diff --git a/Backgrounds/PissSeaSurfaceBGStyle.cs b/Backgrounds/PissSeaSurfaceBGStyle.cs new file mode 100644 index 0000000000..ec2ad42250 --- /dev/null +++ b/Backgrounds/PissSeaSurfaceBGStyle.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Backgrounds +{ + public class PissSeaSurfaceBGStyle : ModSurfaceBackgroundStyle + { + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) + { + b -= 250f; + return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/PissSeaSurfaceClose"); + } + + public override void ModifyFarFades(float[] fades, float transitionSpeed) + { + //This just fades in the background and fades out other backgrounds. + for (int i = 0; i < fades.Length; i++) + { + if (i == Slot) + { + fades[i] += transitionSpeed; + if (fades[i] > 1f) + { + fades[i] = 1f; + } + } + else + { + fades[i] -= transitionSpeed; + if (fades[i] < 0f) + { + fades[i] = 0f; + } + } + } + } + } +} diff --git a/Backgrounds/PissSeaSurfaceClose.png b/Backgrounds/PissSeaSurfaceClose.png new file mode 100644 index 0000000000..d06cf6b3a8 Binary files /dev/null and b/Backgrounds/PissSeaSurfaceClose.png differ diff --git a/Backgrounds/SulphurSeaSurfaceBGStyle.cs b/Backgrounds/SulphurSeaSurfaceBGStyle.cs index ee96629fed..f2f57539d6 100644 --- a/Backgrounds/SulphurSeaSurfaceBGStyle.cs +++ b/Backgrounds/SulphurSeaSurfaceBGStyle.cs @@ -6,8 +6,8 @@ namespace CalamityMod.Backgrounds { public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { - b -= 250f; - return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SulphurSeaSurfaceClose"); + b -= 100f; + return BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); } public override void ModifyFarFades(float[] fades, float transitionSpeed) diff --git a/Backgrounds/SunkenSeaBG0.png b/Backgrounds/SunkenSeaBG0.png new file mode 100644 index 0000000000..da6865c742 Binary files /dev/null and b/Backgrounds/SunkenSeaBG0.png differ diff --git a/Backgrounds/SunkenSeaBG1.png b/Backgrounds/SunkenSeaBG1.png new file mode 100644 index 0000000000..a25e598113 Binary files /dev/null and b/Backgrounds/SunkenSeaBG1.png differ diff --git a/Backgrounds/SunkenSeaBG2.png b/Backgrounds/SunkenSeaBG2.png new file mode 100644 index 0000000000..a3cd31f4ab Binary files /dev/null and b/Backgrounds/SunkenSeaBG2.png differ diff --git a/Backgrounds/SunkenSeaBG3.png b/Backgrounds/SunkenSeaBG3.png new file mode 100644 index 0000000000..a25e598113 Binary files /dev/null and b/Backgrounds/SunkenSeaBG3.png differ diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs new file mode 100644 index 0000000000..7079491989 --- /dev/null +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -0,0 +1,13 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Backgrounds +{ + public class SunkenSeaBGStyle : ModUndergroundBackgroundStyle + { + public override void FillTextureArray(int[] textureSlots) + { + for (int i = 0; i <= 3; i++) + textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString()); + } + } +} \ No newline at end of file diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index a84756aafb..1bdf53e5bd 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -19,6 +19,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using CalamityMod.NPCs.ProfanedGuardians; namespace CalamityMod.Balancing { @@ -207,12 +208,13 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.2f, ProjectileType()))); #endregion - #region Ceaseless Void / Dark Energies + #region Ceaseless Void / Dark Energies / Profaned Rocks // 50% resist to true melee. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new TrueMeleeResistBalancingRule(0.5f))); + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new TrueMeleeResistBalancingRule(0.5f))); - #endregion Ceaseless Void / Dark Energies + #endregion Ceaseless Void / Dark Energies / Profaned Rocks #region Storm Weaver @@ -274,6 +276,9 @@ namespace CalamityMod.Balancing // 15% resist to Enforcer projectiles. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + //55% resist to Dynamic Pursuer + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType(), ProjectileType(), ProjectileType())))); + #endregion Ares #region Artemis and Apollo @@ -290,8 +295,8 @@ namespace CalamityMod.Balancing #region Thanatos - // 85% resist to Dynamic Pursuer (the whole thing lol). - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.15f, ProjectileType(), ProjectileType(), ProjectileType())))); + // 50% resist to Dynamic Pursuer (the whole thing lol). + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType())))); // 65% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new TrueMeleeResistBalancingRule(0.35f)))); @@ -314,8 +319,8 @@ namespace CalamityMod.Balancing // 40% resist to Rancor. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 40% resist to Wrathwing stealth strike. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 50% resist to Wrathwing stealth strike. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 40% resist to Yharim's Crystal. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); diff --git a/BiomeManagers/AbovegroundAstralBiome.cs b/BiomeManagers/AbovegroundAstralBiome.cs index d3ce06a025..42c06dc732 100644 --- a/BiomeManagers/AbovegroundAstralBiome.cs +++ b/BiomeManagers/AbovegroundAstralBiome.cs @@ -9,12 +9,13 @@ namespace CalamityMod.BiomeManagers { public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralSurfaceBGStyle"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/AstralUndergroundBGStyle"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbovegroundAstralBiomeIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space; public override void SetStaticDefaults() { @@ -30,6 +31,5 @@ namespace CalamityMod.BiomeManagers { player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); } - } } diff --git a/BiomeManagers/AbovegroundAstralDesertBiome.cs b/BiomeManagers/AbovegroundAstralDesertBiome.cs index eaf59dfac0..ac0c11a09f 100644 --- a/BiomeManagers/AbovegroundAstralDesertBiome.cs +++ b/BiomeManagers/AbovegroundAstralDesertBiome.cs @@ -14,7 +14,7 @@ namespace CalamityMod.BiomeManagers // Could use its own unique background public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space; public override void SetStaticDefaults() { diff --git a/BiomeManagers/AbovegroundAstralSnowBiome.cs b/BiomeManagers/AbovegroundAstralSnowBiome.cs index 7fc5fbb12c..c357c6812a 100644 --- a/BiomeManagers/AbovegroundAstralSnowBiome.cs +++ b/BiomeManagers/AbovegroundAstralSnowBiome.cs @@ -12,7 +12,7 @@ namespace CalamityMod.BiomeManagers public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Astral") ?? MusicID.Space; + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfection") ?? MusicID.Space; public override void SetStaticDefaults() { @@ -21,7 +21,7 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && !player.ZoneDesert && player.ZoneSnow; + return !player.ZoneDungeon && BiomeTileCounterSystem.AstralTiles > 950 && player.ZoneSnow; } public override void SpecialVisuals(Player player, bool isActive) diff --git a/BiomeManagers/AbyssIcon.png b/BiomeManagers/AbyssIcon.png deleted file mode 100644 index 0fab848b86..0000000000 Binary files a/BiomeManagers/AbyssIcon.png and /dev/null differ diff --git a/BiomeManagers/AbyssLayer1Biome.cs b/BiomeManagers/AbyssLayer1Biome.cs index 80842c3696..5a9ec4a048 100644 --- a/BiomeManagers/AbyssLayer1Biome.cs +++ b/BiomeManagers/AbyssLayer1Biome.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.World; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,25 +10,24 @@ namespace CalamityMod.BiomeManagers { public class AbyssLayer1Biome : ModBiome { + //keep this here even though layer one now uses a tile check, cannot be bothered to move it for now public static bool MeetsBaseAbyssRequirement(Player player, out int playerYTileCoords) { Point point = player.Center.ToTileCoordinates(); int x = Main.maxTilesX; int y = Main.maxTilesY; int genLimit = x / 2; - int abyssChasmY = y - 250; - int abyssChasmX = Abyss.AtLeftSideOfWorld ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135); + int abyssChasmX = Abyss.AtLeftSideOfWorld ? genLimit - (genLimit - 135) + 35 : genLimit + (genLimit - 135) - 35; bool abyssPosX = false; - bool abyssPosY = point.Y <= abyssChasmY; if (Abyss.AtLeftSideOfWorld) { - if (point.X < abyssChasmX + 80) + if (point.X < abyssChasmX + 140) abyssPosX = true; } else { - if (point.X > abyssChasmX - 80) + if (point.X > abyssChasmX - 140) abyssPosX = true; } @@ -36,16 +36,15 @@ namespace CalamityMod.BiomeManagers if (WeakReferenceSupport.InAnySubworld()) return false; - return point.Y > SulphurousSea.YStart + SulphurousSea.BlockDepth - 78 && - !player.lavaWet && - !player.honeyWet && - abyssPosY && - abyssPosX; + int abyssStartHeight = (SulphurousSea.YStart + (int)Main.worldSurface) / 2 + 90; + + return !player.lavaWet && !player.honeyWet && abyssPosX && playerYTileCoords >= abyssStartHeight && playerYTileCoords <= Main.maxTilesY - 200; } - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AbyssWater"); + //temporarily use sulphur for now + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SulphuricDepthsWater"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssIcon"; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer1Icon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1"; @@ -55,19 +54,25 @@ namespace CalamityMod.BiomeManagers { if (CalamityPlayer.areThereAnyDamnBosses) return Main.curMusic; - return CalamityMod.Instance.GetMusicFromMusicMod("Abyss1") ?? MusicID.Hell; + return !Main.dayTime + ? CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaNight") ?? MusicID.Desert // Nighttime + : CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaDay") ?? MusicID.Desert; // Daytime } } public override void SetStaticDefaults() { - DisplayName.SetDefault("Abyss: First Layer"); + DisplayName.SetDefault("Sulphuric Depths"); } public override bool IsBiomeActive(Player player) { - return MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && - playerYTileCoords <= (Main.rockLayer + Main.maxTilesY * 0.03); + Point point = player.Center.ToTileCoordinates(); + + int abyssStartHeight = (SulphurousSea.YStart + (int)Main.worldSurface) / 2 + 90; + + return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && point.Y >= abyssStartHeight && + BiomeTileCounterSystem.Layer1Tiles >= 200 && !player.Calamity().ZoneAbyssLayer2 && !player.Calamity().ZoneAbyssLayer3 && !player.Calamity().ZoneAbyssLayer4; } } } diff --git a/BiomeManagers/AbyssLayer1Icon.png b/BiomeManagers/AbyssLayer1Icon.png new file mode 100644 index 0000000000..5d7fc7648e Binary files /dev/null and b/BiomeManagers/AbyssLayer1Icon.png differ diff --git a/BiomeManagers/AbyssLayer2Biome.cs b/BiomeManagers/AbyssLayer2Biome.cs index 2b9ca90238..87c599324b 100644 --- a/BiomeManagers/AbyssLayer2Biome.cs +++ b/BiomeManagers/AbyssLayer2Biome.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Systems; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,26 +14,25 @@ namespace CalamityMod.BiomeManagers { if (CalamityPlayer.areThereAnyDamnBosses) return Main.curMusic; - return CalamityMod.Instance.GetMusicFromMusicMod("Abyss1") ?? MusicID.Hell; + return CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer2") ?? MusicID.Hell; } } - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AbyssWater"); + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/UpperAbyssWater"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssIcon"; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer2Icon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Abyss: Second Layer"); + DisplayName.SetDefault("Murky Waters"); } public override bool IsBiomeActive(Player player) { - return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && - playerYTileCoords > (Main.rockLayer + Main.maxTilesY * 0.03) && - playerYTileCoords <= (Main.rockLayer + Main.maxTilesY * 0.14); + return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer2Tiles >= 200 && + playerYTileCoords > Main.rockLayer - 10 && playerYTileCoords <= Main.rockLayer + Main.maxTilesY * 0.143; } } } diff --git a/BiomeManagers/AbyssLayer2Icon.png b/BiomeManagers/AbyssLayer2Icon.png new file mode 100644 index 0000000000..dda3a08249 Binary files /dev/null and b/BiomeManagers/AbyssLayer2Icon.png differ diff --git a/BiomeManagers/AbyssLayer3Biome.cs b/BiomeManagers/AbyssLayer3Biome.cs index cbd29d5c81..59b2011304 100644 --- a/BiomeManagers/AbyssLayer3Biome.cs +++ b/BiomeManagers/AbyssLayer3Biome.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Systems; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,26 +14,25 @@ namespace CalamityMod.BiomeManagers { if (CalamityPlayer.areThereAnyDamnBosses) return Main.curMusic; - return CalamityMod.Instance.GetMusicFromMusicMod("Abyss2") ?? MusicID.Hell; + return CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer3") ?? MusicID.Hell; } } - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AbyssWater"); + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/MiddleAbyssWater"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssIcon"; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer3Icon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer23"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Abyss: Third Layer"); + DisplayName.SetDefault("Thermal Vents"); } public override bool IsBiomeActive(Player player) { - return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && - playerYTileCoords > (Main.rockLayer + Main.maxTilesY * 0.14) && - playerYTileCoords <= (Main.rockLayer + Main.maxTilesY * 0.26); + return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer3Tiles >= 200 && + playerYTileCoords > Main.rockLayer + Main.maxTilesY * 0.143 && playerYTileCoords <= Main.rockLayer + Main.maxTilesY * 0.268; } } } diff --git a/BiomeManagers/AbyssLayer3Icon.png b/BiomeManagers/AbyssLayer3Icon.png new file mode 100644 index 0000000000..8986721ad5 Binary files /dev/null and b/BiomeManagers/AbyssLayer3Icon.png differ diff --git a/BiomeManagers/AbyssLayer4Biome.cs b/BiomeManagers/AbyssLayer4Biome.cs index 9368527844..ea2ba5a6e6 100644 --- a/BiomeManagers/AbyssLayer4Biome.cs +++ b/BiomeManagers/AbyssLayer4Biome.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Systems; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,25 +14,25 @@ namespace CalamityMod.BiomeManagers { if (CalamityPlayer.areThereAnyDamnBosses) return Main.curMusic; - return CalamityMod.Instance.GetMusicFromMusicMod("Abyss3") ?? MusicID.Hell; + return CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer4") ?? MusicID.Hell; } } - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AbyssWater"); + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/VoidWater"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; - public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssIcon"; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbyssLayer4Icon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer4"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer4"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Abyss: Fourth Layer"); + DisplayName.SetDefault("The Void"); } public override bool IsBiomeActive(Player player) { - return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && - playerYTileCoords > Main.rockLayer + Main.maxTilesY * 0.26; + return AbyssLayer1Biome.MeetsBaseAbyssRequirement(player, out int playerYTileCoords) && BiomeTileCounterSystem.Layer4Tiles >= 200 && + playerYTileCoords > Main.rockLayer + Main.maxTilesY * 0.268; } } } diff --git a/BiomeManagers/AbyssLayer4Icon.png b/BiomeManagers/AbyssLayer4Icon.png new file mode 100644 index 0000000000..fddcad850a Binary files /dev/null and b/BiomeManagers/AbyssLayer4Icon.png differ diff --git a/BiomeManagers/BrimstoneCragsBiome.cs b/BiomeManagers/BrimstoneCragsBiome.cs index 69a189028b..d94d78962e 100644 --- a/BiomeManagers/BrimstoneCragsBiome.cs +++ b/BiomeManagers/BrimstoneCragsBiome.cs @@ -7,7 +7,7 @@ namespace CalamityMod.BiomeManagers { public class BrimstoneCragsBiome : ModBiome { - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("Crag") ?? MusicID.Eerie; + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("BrimstoneCrags") ?? MusicID.Eerie; public override SceneEffectPriority Priority => SceneEffectPriority.Environment; public override string BestiaryIcon => "CalamityMod/BiomeManagers/BrimstoneCragsIcon"; @@ -20,7 +20,7 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - return BiomeTileCounterSystem.BrimstoneCragTiles > 100; + return BiomeTileCounterSystem.BrimstoneCragTiles > 100 && player.ZoneUnderworldHeight; } } } diff --git a/BiomeManagers/SulphurousSeaBiome.cs b/BiomeManagers/SulphurousSeaBiome.cs index 92203cccf9..ad63c36d7c 100644 --- a/BiomeManagers/SulphurousSeaBiome.cs +++ b/BiomeManagers/SulphurousSeaBiome.cs @@ -1,9 +1,11 @@ -using CalamityMod.CalPlayer; +using System.Security.Policy; +using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Systems; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +13,8 @@ namespace CalamityMod.BiomeManagers { public class SulphurousSeaBiome : ModBiome { - public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SulphuricWater"); - public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/SulphurSeaSurfaceBGStyle"); + public override ModWaterStyle WaterStyle => CalamityWorld.getFixedBoi ? ModContent.Find("CalamityMod/PissWater") : ModContent.Find("CalamityMod/SulphuricWater"); + public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => CalamityWorld.getFixedBoi ?ModContent.Find("CalamityMod/PissSeaSurfaceBGStyle") : ModContent.Find("CalamityMod/SulphurSeaSurfaceBGStyle"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/SulphurousSeaIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/SulphurBG"; @@ -31,14 +33,17 @@ namespace CalamityMod.BiomeManagers if (acidRain) { music = DownedBossSystem.downedPolterghast - ? CalamityMod.Instance.GetMusicFromMusicMod("AcidRain2") ?? MusicID.Monsoon // Acid Rain Tier 3 - : CalamityMod.Instance.GetMusicFromMusicMod("AcidRain1") ?? MusicID.OldOnesArmy; // Acid Rain Tier 1 + 2 + ? CalamityMod.Instance.GetMusicFromMusicMod("AcidRainTier3") ?? MusicID.Monsoon // Acid Rain Tier 3 + : CalamityMod.Instance.GetMusicFromMusicMod("AcidRainTier1") ?? MusicID.OldOnesArmy; // Acid Rain Tier 1 + 2 } - // Regular Sulphur Sea theme, when Acid Rain is not occurring + // Regular Sulphur Sea themes, when Acid Rain is not occurring else - music = CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSea") ?? MusicID.Desert; + music = !Main.dayTime + ? CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaNight") ?? MusicID.Desert // Nighttime + : CalamityMod.Instance.GetMusicFromMusicMod("SulphurousSeaDay") ?? MusicID.Desert; // Daytime } + return music; } } @@ -52,17 +57,39 @@ namespace CalamityMod.BiomeManagers { Point point = player.Center.ToTileCoordinates(); bool sulphurPosX = false; + if (Abyss.AtLeftSideOfWorld) { - if (point.X < 380) + if (point.X < 435) + { sulphurPosX = true; + } } else { - if (point.X > Main.maxTilesX - 380) + if (point.X > Main.maxTilesX - 435) + { sulphurPosX = true; + } + } + + return (BiomeTileCounterSystem.SulphurTiles >= 300 || (point.Y < (Main.rockLayer - Main.maxTilesY / 13) && sulphurPosX)) && !player.Calamity().ZoneAbyss; + } + + public override void SpecialVisuals(Player player, bool isActive) + { + string biomeName = "CalamityMod:SulphurSea"; + if (SkyManager.Instance[biomeName] != null && isActive != SkyManager.Instance[biomeName].IsActive()) + { + if (isActive) + { + SkyManager.Instance.Activate(biomeName); + } + else + { + SkyManager.Instance.Deactivate(biomeName); + } } - return (BiomeTileCounterSystem.SulphurTiles >= 300 || (player.ZoneOverworldHeight && sulphurPosX)) && !player.Calamity().ZoneAbyss; } } } diff --git a/BiomeManagers/SulphurousSeaIcon.png b/BiomeManagers/SulphurousSeaIcon.png index 1c2d2afb05..c2bbafa753 100644 Binary files a/BiomeManagers/SulphurousSeaIcon.png and b/BiomeManagers/SulphurousSeaIcon.png differ diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index 86dfd70fce..e787148e6c 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -8,7 +8,8 @@ namespace CalamityMod.BiomeManagers public class SunkenSeaBiome : ModBiome { public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaWater"); - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.Temple; + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; // Placeholder until we get a dedicated Sunken Sea background diff --git a/BiomeManagers/UndergroundAstralBiome.cs b/BiomeManagers/UndergroundAstralBiome.cs index c4165903d9..103f08642f 100644 --- a/BiomeManagers/UndergroundAstralBiome.cs +++ b/BiomeManagers/UndergroundAstralBiome.cs @@ -15,7 +15,7 @@ namespace CalamityMod.BiomeManagers public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralUnderground") ?? MusicID.Space; + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("AstralInfectionUnderground") ?? MusicID.Space; public override void SetStaticDefaults() { diff --git a/Buffs/Alcohol/BloodyMaryBuff.cs b/Buffs/Alcohol/BloodyMaryBuff.cs index 1e3ef36857..337af644c7 100644 --- a/Buffs/Alcohol/BloodyMaryBuff.cs +++ b/Buffs/Alcohol/BloodyMaryBuff.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Alcohol public override void SetStaticDefaults() { DisplayName.SetDefault("Bloody Mary"); - Description.SetDefault("Damage, critical strike chance, movement speed, and melee speed boosted during a Blood Moon, life regen and defense reduced"); + Description.SetDefault("Damage and movement speed boosted during a Blood Moon, life regen and defense reduced"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; @@ -19,8 +19,6 @@ namespace CalamityMod.Buffs.Alcohol public override void Update(Player player, ref int buffIndex) { player.Calamity().bloodyMary = true; - if (Main.bloodMoon) - player.GetAttackSpeed() += 0.15f; } } } diff --git a/Buffs/Alcohol/GrapeBeerBuff.cs b/Buffs/Alcohol/GrapeBeerBuff.cs index 08e54ba390..a742447705 100644 --- a/Buffs/Alcohol/GrapeBeerBuff.cs +++ b/Buffs/Alcohol/GrapeBeerBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Alcohol public override void SetStaticDefaults() { DisplayName.SetDefault("Grape Beer"); - Description.SetDefault("Defense and movement speed reduced"); + Description.SetDefault("Defense reduced"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/Alcohol/TequilaBuff.cs b/Buffs/Alcohol/TequilaBuff.cs index 3269624146..9b0cfbee4c 100644 --- a/Buffs/Alcohol/TequilaBuff.cs +++ b/Buffs/Alcohol/TequilaBuff.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Alcohol public override void SetStaticDefaults() { DisplayName.SetDefault("Tequila"); - Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); + Description.SetDefault("Critical strike chance, defense, and knockback boosted during daytime, life regen reduced"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/Alcohol/TequilaSunriseBuff.cs b/Buffs/Alcohol/TequilaSunriseBuff.cs index e2defbe958..9a0d6d3321 100644 --- a/Buffs/Alcohol/TequilaSunriseBuff.cs +++ b/Buffs/Alcohol/TequilaSunriseBuff.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Alcohol public override void SetStaticDefaults() { DisplayName.SetDefault("Tequila Sunrise"); - Description.SetDefault("Damage, critical strike chance, damage reduction, defense, and knockback boosted during daytime, life regen reduced"); + Description.SetDefault("Critical strike chance, defense, and knockback boosted during daytime, life regen reduced"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 591a1f8241..5da2670d35 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Buffs { player.arrowDamage *= 0.875f; } - else if (type == BuffID.Endurance) + else if (type == BuffID.Ironskin) { - player.endurance -= 0.05f; + player.statDefense += CalamityUtils.GetScalingDefense(-1) - 8; } else if (type == BuffID.MagicPower) { @@ -103,8 +103,8 @@ namespace CalamityMod.Buffs // Vanilla buffs switch (type) { - case BuffID.Endurance: - tip = "5% reduced damage"; + case BuffID.Ironskin: + tip = "Increase defense by " + CalamityUtils.GetScalingDefense(-1); break; case BuffID.MagicPower: @@ -123,6 +123,10 @@ namespace CalamityMod.Buffs tip = "10% increased movement speed and 20% increased mining speed"; break; + case BuffID.LeafCrystal: + tip = "Emits powerful life pulses at nearby enemies"; + break; + case BuffID.NebulaUpDmg1: tip = "7.5% increased damage"; break; @@ -185,10 +189,6 @@ namespace CalamityMod.Buffs tip += ". Grants immunity to Chilled, Frozen and Glacial State"; break; - case BuffID.Daybreak: - tip = "Incinerated by solar rays"; - break; - case BuffID.WellFed: tip = "Minor improvements to all stats"; break; diff --git a/Buffs/DamageOverTime/BrimstoneFlames.png b/Buffs/DamageOverTime/BrimstoneFlames.png index e2be863c4b..fa625138d1 100644 Binary files a/Buffs/DamageOverTime/BrimstoneFlames.png and b/Buffs/DamageOverTime/BrimstoneFlames.png differ diff --git a/Buffs/DamageOverTime/BurningBlood.cs b/Buffs/DamageOverTime/BurningBlood.cs index 0561fd5a87..10c33cba33 100644 --- a/Buffs/DamageOverTime/BurningBlood.cs +++ b/Buffs/DamageOverTime/BurningBlood.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(Player player, ref int buffIndex) { player.Calamity().bBlood = true; - player.GetAttackSpeed() += 0.025f; } public override void Update(NPC npc, ref int buffIndex) diff --git a/Buffs/DamageOverTime/DemonFlames.cs b/Buffs/DamageOverTime/DemonFlames.cs deleted file mode 100644 index 35ff5d4655..0000000000 --- a/Buffs/DamageOverTime/DemonFlames.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.DamageOverTime -{ - public class DemonFlames : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Demon Flames"); - Description.SetDefault("Another burning debuff"); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - if (npc.Calamity().dFlames < npc.buffTime[buffIndex]) - npc.Calamity().dFlames = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; - } - } -} diff --git a/Buffs/DamageOverTime/DemonFlames.png b/Buffs/DamageOverTime/DemonFlames.png deleted file mode 100644 index e76a537765..0000000000 Binary files a/Buffs/DamageOverTime/DemonFlames.png and /dev/null differ diff --git a/Buffs/DamageOverTime/MiracleBlight.cs b/Buffs/DamageOverTime/MiracleBlight.cs new file mode 100644 index 0000000000..ae881fbbf3 --- /dev/null +++ b/Buffs/DamageOverTime/MiracleBlight.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class MiracleBlight : ModBuff + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Miracle Blight"); + Description.SetDefault("Exotic resonance shreds your corporeal form"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().miracleBlight = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().miracleBlight < npc.buffTime[buffIndex]) + npc.Calamity().miracleBlight = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + } +} diff --git a/Buffs/DamageOverTime/MiracleBlight.png b/Buffs/DamageOverTime/MiracleBlight.png new file mode 100644 index 0000000000..aec924f6c9 Binary files /dev/null and b/Buffs/DamageOverTime/MiracleBlight.png differ diff --git a/Buffs/Mounts/BrimroseMount.cs b/Buffs/Mounts/BrimroseMount.cs index d6ff4597d8..e2f2354c1d 100644 --- a/Buffs/Mounts/BrimroseMount.cs +++ b/Buffs/Mounts/BrimroseMount.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Mounts public override void SetStaticDefaults() { DisplayName.SetDefault("Brimrose Mount"); - Description.SetDefault("The seat is toasty. That is all"); + Description.SetDefault("The seat is toasty. That is all"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; } diff --git a/Buffs/Pets/EidolonSnailBuff.cs b/Buffs/Pets/EidolonSnailBuff.cs new file mode 100644 index 0000000000..aab4d4d0d8 --- /dev/null +++ b/Buffs/Pets/EidolonSnailBuff.cs @@ -0,0 +1,30 @@ +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class EidolonSnailBuff : ModBuff + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Escargidolon Snail"); + Description.SetDefault("What a silly little prehistoric snail"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().eidolonSnailPet = 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); + } + } + } +} diff --git a/Buffs/Pets/EidolonSnailBuff.png b/Buffs/Pets/EidolonSnailBuff.png new file mode 100644 index 0000000000..6cc347ab66 Binary files /dev/null and b/Buffs/Pets/EidolonSnailBuff.png differ diff --git a/Buffs/Pets/GoldieBuff.cs b/Buffs/Pets/GoldieBuff.cs new file mode 100644 index 0000000000..df6234255e --- /dev/null +++ b/Buffs/Pets/GoldieBuff.cs @@ -0,0 +1,27 @@ +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class GoldieBuff : ModBuff + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Goldie"); + Description.SetDefault("All that glitters is gold"); + Main.buffNoTimeDisplay[Type] = true; + Main.lightPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.Calamity().thiefsDime = 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, 50f, 0f); + } + } +} diff --git a/Buffs/Pets/GoldieBuff.png b/Buffs/Pets/GoldieBuff.png new file mode 100644 index 0000000000..588b4378f9 Binary files /dev/null and b/Buffs/Pets/GoldieBuff.png differ diff --git a/Buffs/Placeables/CorruptionEffigyBuff.png b/Buffs/Placeables/CorruptionEffigyBuff.png index c4e47d8cc1..557440806c 100644 Binary files a/Buffs/Placeables/CorruptionEffigyBuff.png and b/Buffs/Placeables/CorruptionEffigyBuff.png differ diff --git a/Buffs/Potions/BoundingBuff.png b/Buffs/Potions/BoundingBuff.png index f94704f48d..48547e7482 100644 Binary files a/Buffs/Potions/BoundingBuff.png and b/Buffs/Potions/BoundingBuff.png differ diff --git a/Buffs/Potions/CadancesGrace.cs b/Buffs/Potions/CadancesGrace.cs deleted file mode 100644 index 582e7040dc..0000000000 --- a/Buffs/Potions/CadancesGrace.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class CadancesGrace : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cadance's Grace"); - Description.SetDefault("Your heart is pure"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().cadence = true; - } - } -} diff --git a/Buffs/Potions/CadancesGrace.png b/Buffs/Potions/CadancesGrace.png deleted file mode 100644 index 2cf41f1a0f..0000000000 Binary files a/Buffs/Potions/CadancesGrace.png and /dev/null differ diff --git a/Buffs/Potions/DraconicSurgeBuff.cs b/Buffs/Potions/DraconicSurgeBuff.cs deleted file mode 100644 index c596202025..0000000000 --- a/Buffs/Potions/DraconicSurgeBuff.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class DraconicSurgeBuff : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Draconic Surge"); - Description.SetDefault("The power of a dragon courses through your veins"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().draconicSurge = true; - } - } -} diff --git a/Buffs/Potions/DraconicSurgeBuff.png b/Buffs/Potions/DraconicSurgeBuff.png deleted file mode 100644 index d68041563b..0000000000 Binary files a/Buffs/Potions/DraconicSurgeBuff.png and /dev/null differ diff --git a/Buffs/Potions/HolyWrathBuff.cs b/Buffs/Potions/HolyWrathBuff.cs deleted file mode 100644 index 37577e28c0..0000000000 --- a/Buffs/Potions/HolyWrathBuff.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class HolyWrathBuff : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Wrath"); - Description.SetDefault("Increased damage and all attacks inflict holy fire"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().holyWrath = true; - } - } -} diff --git a/Buffs/Potions/PenumbraBuff.cs b/Buffs/Potions/PenumbraBuff.cs deleted file mode 100644 index 2ffcf2e778..0000000000 --- a/Buffs/Potions/PenumbraBuff.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class PenumbraBuff : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Penumbra"); - Description.SetDefault("Stealth regenerates 10% faster while moving and 15% faster while standing still"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().penumbra = true; - } - } -} diff --git a/Buffs/Potions/PenumbraBuff.png b/Buffs/Potions/PenumbraBuff.png deleted file mode 100644 index fea7856dc9..0000000000 Binary files a/Buffs/Potions/PenumbraBuff.png and /dev/null differ diff --git a/Buffs/Potions/ProfanedRageBuff.cs b/Buffs/Potions/ProfanedRageBuff.cs deleted file mode 100644 index 227ada9472..0000000000 --- a/Buffs/Potions/ProfanedRageBuff.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class ProfanedRageBuff : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Rage"); - Description.SetDefault("Increased critical strike chance"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().profanedRage = true; - } - } -} diff --git a/Buffs/Potions/ProfanedRageBuff.png b/Buffs/Potions/ProfanedRageBuff.png deleted file mode 100644 index dd7e3fcd35..0000000000 Binary files a/Buffs/Potions/ProfanedRageBuff.png and /dev/null differ diff --git a/Buffs/Potions/TitanScale.cs b/Buffs/Potions/TitanScale.cs deleted file mode 100644 index 3db9f74a48..0000000000 --- a/Buffs/Potions/TitanScale.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class TitanScale : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Titan Scale"); - Description.SetDefault("You feel tanky"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tScale = true; - } - } -} diff --git a/Buffs/Potions/TitanScale.png b/Buffs/Potions/TitanScale.png deleted file mode 100644 index 1e4b1c637b..0000000000 Binary files a/Buffs/Potions/TitanScale.png and /dev/null differ diff --git a/Buffs/Potions/TriumphBuff.cs b/Buffs/Potions/TriumphBuff.cs deleted file mode 100644 index ab5e720394..0000000000 --- a/Buffs/Potions/TriumphBuff.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class TriumphBuff : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triumph"); - Description.SetDefault("Enemy contact damage is reduced, the lower their health the greater the reduction"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().triumph = true; - } - } -} diff --git a/Buffs/Potions/TriumphBuff.png b/Buffs/Potions/TriumphBuff.png deleted file mode 100644 index 0919b9b5df..0000000000 Binary files a/Buffs/Potions/TriumphBuff.png and /dev/null differ diff --git a/Buffs/Potions/AbyssalWeapon.cs b/Buffs/Potions/WeaponImbueBrimstone.cs similarity index 89% rename from Buffs/Potions/AbyssalWeapon.cs rename to Buffs/Potions/WeaponImbueBrimstone.cs index da741f376d..ab45512c1a 100644 --- a/Buffs/Potions/AbyssalWeapon.cs +++ b/Buffs/Potions/WeaponImbueBrimstone.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions { - public class AbyssalWeapon : ModBuff + public class WeaponImbueBrimstone : ModBuff { public override void SetStaticDefaults() { @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.Potions public override void Update(Player player, ref int buffIndex) { - player.Calamity().aWeapon = true; + player.Calamity().flaskBrimstone = true; // A very large number to indicate it's a modded Flask player.meleeEnchant = CalamityGlobalBuff.ModdedFlaskEnchant; } diff --git a/Buffs/Potions/AbyssalWeapon.png b/Buffs/Potions/WeaponImbueBrimstone.png similarity index 100% rename from Buffs/Potions/AbyssalWeapon.png rename to Buffs/Potions/WeaponImbueBrimstone.png diff --git a/Buffs/Potions/ArmorCrumbling.cs b/Buffs/Potions/WeaponImbueCrumbling.cs similarity index 89% rename from Buffs/Potions/ArmorCrumbling.cs rename to Buffs/Potions/WeaponImbueCrumbling.cs index 192d7d3f29..9be0ccb65c 100644 --- a/Buffs/Potions/ArmorCrumbling.cs +++ b/Buffs/Potions/WeaponImbueCrumbling.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions { - public class ArmorCrumbling : ModBuff + public class WeaponImbueCrumbling : ModBuff { public override void SetStaticDefaults() { @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.Potions public override void Update(Player player, ref int buffIndex) { - player.Calamity().armorCrumbling = true; + player.Calamity().flaskCrumbling = true; // A very large number to indicate it's a modded Flask player.meleeEnchant = CalamityGlobalBuff.ModdedFlaskEnchant; } diff --git a/Buffs/Potions/ArmorCrumbling.png b/Buffs/Potions/WeaponImbueCrumbling.png similarity index 100% rename from Buffs/Potions/ArmorCrumbling.png rename to Buffs/Potions/WeaponImbueCrumbling.png diff --git a/Buffs/Potions/WeaponImbueHolyFlames.cs b/Buffs/Potions/WeaponImbueHolyFlames.cs new file mode 100644 index 0000000000..c860bd8251 --- /dev/null +++ b/Buffs/Potions/WeaponImbueHolyFlames.cs @@ -0,0 +1,28 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Potions +{ + public class WeaponImbueHolyFlames : ModBuff + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Weapon Imbue: Holy Flames"); + Description.SetDefault("Melee, Whip, and Rogue attacks ignite enemies with holy flames"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + Main.meleeBuff[Type] = true; + Main.persistentBuff[Type] = true; + BuffID.Sets.IsAFlaskBuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().flaskHoly = true; + // A very large number to indicate it's a modded Flask + player.meleeEnchant = CalamityGlobalBuff.ModdedFlaskEnchant; + } + } +} diff --git a/Buffs/Potions/HolyWrathBuff.png b/Buffs/Potions/WeaponImbueHolyFlames.png similarity index 100% rename from Buffs/Potions/HolyWrathBuff.png rename to Buffs/Potions/WeaponImbueHolyFlames.png diff --git a/Buffs/Potions/YharimPower.cs b/Buffs/Potions/YharimPower.cs deleted file mode 100644 index 2b8ff8b58e..0000000000 --- a/Buffs/Potions/YharimPower.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class YharimPower : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Yharim's Power"); - Description.SetDefault("You feel like you can break the world in two... with your bare hands!"); - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().yPower = true; - player.GetAttackSpeed() += 0.075f; - } - } -} diff --git a/Buffs/Potions/YharimPower.png b/Buffs/Potions/YharimPower.png deleted file mode 100644 index 5bc24a71f1..0000000000 Binary files a/Buffs/Potions/YharimPower.png and /dev/null differ diff --git a/Buffs/StatBuffs/Afflicted.cs b/Buffs/StatBuffs/Afflicted.cs index a9933469c3..6f8f30ae81 100644 --- a/Buffs/StatBuffs/Afflicted.cs +++ b/Buffs/StatBuffs/Afflicted.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs @@ -13,7 +13,6 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatBuffs/Afflicted.png b/Buffs/StatBuffs/Afflicted.png index cbabb0498f..213ca70dac 100644 Binary files a/Buffs/StatBuffs/Afflicted.png and b/Buffs/StatBuffs/Afflicted.png differ diff --git a/Buffs/StatBuffs/ChiBuff.cs b/Buffs/StatBuffs/ChiBuff.cs index 2fe1aadb81..7e65cdb5f5 100644 --- a/Buffs/StatBuffs/ChiBuff.cs +++ b/Buffs/StatBuffs/ChiBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetStaticDefaults() { DisplayName.SetDefault("Chi"); - Description.SetDefault("Your next attack is boosted and you are more resilient"); + Description.SetDefault("You are more resilient"); Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = false; Main.pvpBuff[Type] = true; diff --git a/Buffs/StatBuffs/ChiRegenBuff.cs b/Buffs/StatBuffs/ChiRegenBuff.cs new file mode 100644 index 0000000000..a4d53a7dd0 --- /dev/null +++ b/Buffs/StatBuffs/ChiRegenBuff.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class ChiRegenBuff : ModBuff + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chi"); + Description.SetDefault("Life regen increased"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().chiRegen = true; + } + } +} diff --git a/Buffs/StatBuffs/ChiRegenBuff.png b/Buffs/StatBuffs/ChiRegenBuff.png new file mode 100644 index 0000000000..b74e1690af Binary files /dev/null and b/Buffs/StatBuffs/ChiRegenBuff.png differ diff --git a/Buffs/StatBuffs/Encased.cs b/Buffs/StatBuffs/Encased.cs index 164d1317d8..7933b7d939 100644 --- a/Buffs/StatBuffs/Encased.cs +++ b/Buffs/StatBuffs/Encased.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +21,7 @@ namespace CalamityMod.Buffs.StatBuffs player.Calamity().encased = true; if (player.buffTime[buffIndex] == 2) { - SoundEngine.PlaySound(SoundID.Item27, player.position); + SoundEngine.PlaySound(SoundID.Item27, player.Center); player.GiveIFrames(90, true); } } diff --git a/Buffs/StatBuffs/Mushy.cs b/Buffs/StatBuffs/Mushy.cs index f5a67216a3..d26497c8b3 100644 --- a/Buffs/StatBuffs/Mushy.cs +++ b/Buffs/StatBuffs/Mushy.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Buffs.StatBuffs { DisplayName.SetDefault("Mushy"); Description.SetDefault("Increased defense and life regen"); - Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/StatBuffs/PhantomicEmpowerment.cs b/Buffs/StatBuffs/PhantomicEmpowerment.cs index 62b1c82f0c..1ddc3ee1e9 100644 --- a/Buffs/StatBuffs/PhantomicEmpowerment.cs +++ b/Buffs/StatBuffs/PhantomicEmpowerment.cs @@ -3,7 +3,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - class PhantomicEmpowerment : ModBuff + public class PhantomicEmpowerment : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/StatBuffs/PhantomicRegen.cs b/Buffs/StatBuffs/PhantomicRegen.cs index bc8e5e26de..1375f8ca40 100644 --- a/Buffs/StatBuffs/PhantomicRegen.cs +++ b/Buffs/StatBuffs/PhantomicRegen.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - class PhantomicRegen : ModBuff + public class PhantomicRegen : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/StatBuffs/PhantomicShield.cs b/Buffs/StatBuffs/PhantomicShield.cs index 1063c3a84a..4f380ff537 100644 --- a/Buffs/StatBuffs/PhantomicShield.cs +++ b/Buffs/StatBuffs/PhantomicShield.cs @@ -3,7 +3,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - class PhantomicShield : ModBuff + public class PhantomicShield : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/StatBuffs/PolarisBuff.cs b/Buffs/StatBuffs/PolarisBuff.cs index f6502284da..c57c10cecd 100644 --- a/Buffs/StatBuffs/PolarisBuff.cs +++ b/Buffs/StatBuffs/PolarisBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetStaticDefaults() { DisplayName.SetDefault("Polaris Boost"); - Description.SetDefault("The Northern Star empowers your weapon"); + Description.SetDefault("The Northern Star empowers your life regeneration"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.cs b/Buffs/StatBuffs/ProfanedCrystalBuff.cs index 9ea2fe5b81..0202dfc2a5 100644 --- a/Buffs/StatBuffs/ProfanedCrystalBuff.cs +++ b/Buffs/StatBuffs/ProfanedCrystalBuff.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Buffs.StatBuffs (enrage ? "\nYour weakened life force fuels your desperate attacks" : ""); } } - else if (DownedBossSystem.downedSCal && DownedBossSystem.downedExoMechs) + else if (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs) { tip = "Your profaned soul is constrained by your insufficient summoning powers"; } diff --git a/Buffs/StatDebuffs/TeslaFreeze.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs similarity index 91% rename from Buffs/StatDebuffs/TeslaFreeze.cs rename to Buffs/StatDebuffs/GalvanicCorrosion.cs index 350468176d..f832ca10f2 100644 --- a/Buffs/StatDebuffs/TeslaFreeze.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs { - public class TeslaFreeze : ModBuff + public class GalvanicCorrosion : ModBuff { public override void SetStaticDefaults() { @@ -29,7 +29,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().teslaFreeze = true; + player.Calamity().galvanicCorrosion = true; } } } diff --git a/Buffs/StatDebuffs/TeslaFreeze.png b/Buffs/StatDebuffs/GalvanicCorrosion.png similarity index 100% rename from Buffs/StatDebuffs/TeslaFreeze.png rename to Buffs/StatDebuffs/GalvanicCorrosion.png diff --git a/Buffs/StatDebuffs/GlacialState.png b/Buffs/StatDebuffs/GlacialState.png index f3b591dff6..9513cc9d37 100644 Binary files a/Buffs/StatDebuffs/GlacialState.png and b/Buffs/StatDebuffs/GlacialState.png differ diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index db9a2aca4d..426c1d5851 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void SetStaticDefaults() { DisplayName.SetDefault("Whispering Death"); - Description.SetDefault("Death approaches; movement speed, attack power and life regen reduced"); + Description.SetDefault("Death approaches; attack power and life regen reduced"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/Summon/AquaticStar.cs b/Buffs/Summon/AquaticStar.cs index 3a49d3813b..07195e63d4 100644 --- a/Buffs/Summon/AquaticStar.cs +++ b/Buffs/Summon/AquaticStar.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; @@ -20,18 +20,14 @@ namespace CalamityMod.Buffs.Summon { CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.aStar = true; - } - if (!modPlayer.aStar) + modPlayer.aquaticStar = true; + if (!modPlayer.aquaticStar) { player.DelBuff(buffIndex); buffIndex--; } else - { player.buffTime[buffIndex] = 18000; - } } } } diff --git a/Buffs/Summon/AstralProbeBuff.cs b/Buffs/Summon/AstralProbeBuff.cs index 0993508787..6078b1b63b 100644 --- a/Buffs/Summon/AstralProbeBuff.cs +++ b/Buffs/Summon/AstralProbeBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; @@ -20,18 +20,14 @@ namespace CalamityMod.Buffs.Summon { CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.aProbe = true; - } - if (!modPlayer.aProbe) + modPlayer.astralProbe = true; + if (!modPlayer.astralProbe) { player.DelBuff(buffIndex); buffIndex--; } else - { player.buffTime[buffIndex] = 18000; - } } } } diff --git a/Buffs/Summon/BrittleStar.cs b/Buffs/Summon/BrittleStar.cs index 09dd1af953..f7f960b9ed 100644 --- a/Buffs/Summon/BrittleStar.cs +++ b/Buffs/Summon/BrittleStar.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; @@ -21,9 +21,9 @@ namespace CalamityMod.Buffs.Summon CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { - modPlayer.bStar = true; + modPlayer.brittleStar = true; } - if (!modPlayer.bStar) + if (!modPlayer.brittleStar) { player.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/Summon/GladiatorSwords.cs b/Buffs/Summon/GladiatorSwords.cs deleted file mode 100644 index a43cc61c03..0000000000 --- a/Buffs/Summon/GladiatorSwords.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Summon -{ - public class GladiatorSwords : ModBuff - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gladiator Swords"); - Description.SetDefault("The gladiator swords will protect you"); - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.glSword = true; - } - if (!modPlayer.glSword) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} diff --git a/Buffs/Summon/GladiatorSwords.png b/Buffs/Summon/GladiatorSwords.png deleted file mode 100644 index 2df6ad7858..0000000000 Binary files a/Buffs/Summon/GladiatorSwords.png and /dev/null differ diff --git a/Buffs/Summon/MagicHatBuff.cs b/Buffs/Summon/MagicHatBuff.cs index 5541ad15c0..5a9c631c6d 100644 --- a/Buffs/Summon/MagicHatBuff.cs +++ b/Buffs/Summon/MagicHatBuff.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon.Umbrella; using Terraria; using Terraria.ModLoader; diff --git a/Buffs/Summon/ProfanedBabs.cs b/Buffs/Summon/ProfanedBabs.cs index 71e92fe041..34625ee473 100644 --- a/Buffs/Summon/ProfanedBabs.cs +++ b/Buffs/Summon/ProfanedBabs.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Buffs.Summon Player player = Main.player[Main.myPlayer]; bool offense = player.Calamity().gOffense; bool defense = player.Calamity().gDefense; - if (player.Calamity().profanedCrystal && (!player.Calamity().profanedCrystalBuffs && (!DownedBossSystem.downedSCal || !DownedBossSystem.downedExoMechs))) + if (player.Calamity().profanedCrystal && (!player.Calamity().profanedCrystalBuffs && (!DownedBossSystem.downedCalamitas || !DownedBossSystem.downedExoMechs))) { tip = "The Profaned Babs will accompany you!"; } diff --git a/Buffs/Summon/SarosPossessionBuff.cs b/Buffs/Summon/SarosPossessionBuff.cs index f5fe50ec80..432e037367 100644 --- a/Buffs/Summon/SarosPossessionBuff.cs +++ b/Buffs/Summon/SarosPossessionBuff.cs @@ -19,18 +19,14 @@ namespace CalamityMod.Buffs.Summon { CalamityPlayer modPlayer = player.Calamity(); if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.radiantResolution = true; - } - if (!modPlayer.radiantResolution) + modPlayer.saros = true; + if (!modPlayer.saros) { player.DelBuff(buffIndex); buffIndex--; } else - { player.buffTime[buffIndex] = 18000; - } } } } diff --git a/Buffs/Summon/VoidConcentrationBuff.cs b/Buffs/Summon/VoidConcentrationBuff.cs index 7c09cf4623..0a5bcdff52 100644 --- a/Buffs/Summon/VoidConcentrationBuff.cs +++ b/Buffs/Summon/VoidConcentrationBuff.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - class VoidConcentrationBuff : ModBuff + public class VoidConcentrationBuff : ModBuff { public override void SetStaticDefaults() { diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 3a34fd047c..cbd3774a58 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -49,7 +49,6 @@ using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Environment; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; @@ -58,10 +57,12 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.Chat; using Terraria.DataStructures; +using Terraria.GameContent.Events; using Terraria.GameInput; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -189,8 +190,7 @@ namespace CalamityMod.CalPlayer #region Timer and Counter public int gaelSwipes = 0; public int gaelRageAttackCooldown = 0; - public int bossRushImmunityFrameCurseTimer = 0; - public int aBulwarkRareMeleeBoostTimer = 0; + public int hideOfDeusMeleeBoostTimer = 0; public int nebulaManaNerfCounter = 0; public int alcoholPoisonLevel = 0; public int modStealthTimer; @@ -221,12 +221,13 @@ namespace CalamityMod.CalPlayer public int auralisAuroraCounter = 0; public int auralisAuroraCooldown = 0; public int auralisAurora = 0; - public int fungalSymbioteTimer = 0; - public int aBulwarkRareTimer = 0; + public int hideOfDeusTimer = 0; public int spiritOriginBullseyeShootCountdown = 0; public int spiritOriginConvertedCrit = 0; public int RustyMedallionCooldown = 0; public float SulphWaterPoisoningLevel; + public NPC unstableSelectedTarget; + public int zapActivity = 0; private const int DashDisableCooldown = 12; @@ -251,6 +252,7 @@ namespace CalamityMod.CalPlayer public static readonly SoundStyle AdrenalineFilledSound = new("CalamityMod/Sounds/Custom/AbilitySounds/FullAdrenaline"); public static readonly SoundStyle AdrenalineActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/AdrenalineActivate"); public static readonly SoundStyle AdrenalineHurtSound = new("CalamityMod/Sounds/Custom/AdrenalineMajorLoss"); + public static readonly SoundStyle NanomachinesActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/NanomachinesActivate"); public static readonly SoundStyle RogueStealthSound = new("CalamityMod/Sounds/Custom/RogueStealth"); public static readonly SoundStyle DefenseDamageSound = new("CalamityMod/Sounds/Custom/DefenseDamage"); @@ -324,6 +326,7 @@ namespace CalamityMod.CalPlayer public bool bendyPet = false; public bool littleLightPet = false; public bool pineapplePet = false; + public bool eidolonSnailPet = false; #endregion #region Rage @@ -412,6 +415,7 @@ namespace CalamityMod.CalPlayer public bool rBrain = false; public bool bloodyWormTooth = false; public bool afflicted = false; + public bool chiRegen = false; public bool affliction = false; public bool stressPills = false; public bool laudanum = false; @@ -423,12 +427,10 @@ namespace CalamityMod.CalPlayer public bool evasionScarf = false; public bool badgeOfBravery = false; public bool warbannerOfTheSun = false; - public float warBannerBonus = 0f; public bool cryogenSoul = false; public bool yInsignia = false; public bool eGauntlet = false; public bool eTalisman = false; - public bool statisBeltOfCurses = false; public int statisTimer = 0; public bool nucleogenesis = false; public bool nuclearRod = false; @@ -441,8 +443,8 @@ namespace CalamityMod.CalPlayer public bool aquaticHeartWaterBuff = false; public bool aquaticHeartIce = false; public bool aSpark = false; - public bool aSparkRare = false; - public bool aBulwarkRare = false; + public bool transformer = false; + public bool hideOfDeus = false; public bool dAmulet = false; public bool fCarapace = false; public bool gShell = false; @@ -469,13 +471,14 @@ namespace CalamityMod.CalPlayer public bool frostFlare = false; public bool beeResist = false; public bool uberBees = false; - public bool projRefRare = false; - public int projRefRareLifeRegenCounter = 0; + public bool evolution = false; + public int evolutionLifeRegenCounter = 0; public bool nanotech = false; public bool deadshotBrooch = false; public bool shadowMinions = false; public bool holyMinions = false; public bool alchFlask = false; + public bool toxicHeart = false; public bool abaddon = false; public bool aeroStone = false; public bool community = false; @@ -510,7 +513,7 @@ namespace CalamityMod.CalPlayer public bool voidOfExtinction = false; public bool eArtifact = false; public bool dArtifact = false; - public bool gArtifact = false; + public bool auricSArtifact = false; public bool pArtifact = false; public bool giantPearl = false; public bool normalityRelocator = false; @@ -530,11 +533,17 @@ namespace CalamityMod.CalPlayer public float jellyDmg; public bool oldDukeScales = false; public bool sandWaifu = false; + public bool sandWaifuVanity = false; public bool sandBoobWaifu = false; + public bool sandBoobWaifuVanity = false; public bool cloudWaifu = false; + public bool cloudWaifuVanity = false; public bool brimstoneWaifu = false; + public bool brimstoneWaifuVanity = false; public bool sirenWaifu = false; + public bool sirenWaifuVanity = false; public bool fungalClump = false; + public bool fungalClumpVanity = false; public bool howlsHeart = false; public bool howlsHeartVanity = false; public bool darkGodSheath = false; @@ -563,6 +572,7 @@ namespace CalamityMod.CalPlayer public bool camper = false; public bool corrosiveSpine = false; public bool miniOldDuke = false; + public bool miniOldDukeVanity = false; public bool starbusterCore = false; public bool starTaintedGenerator = false; public bool hallowedRune = false; @@ -574,10 +584,6 @@ namespace CalamityMod.CalPlayer public int icicleCooldown = 0; public bool RustyMedallionDroplets = false; public bool noStupidNaturalARSpawns = false; - public bool roverDrive = false; - public int roverDriveTimer = 0; - public int roverFrameCounter = 0; - public int roverFrame = 0; public int voidFrameCounter = 0; public int voidFrame = 0; public bool rottenDogTooth = false; @@ -586,7 +592,9 @@ namespace CalamityMod.CalPlayer public bool BloomStoneRegen = false; public bool ChaosStone = false; public bool CryoStone = false; + public bool CryoStoneVanity = false; public bool voidField = false; + public bool copyrightInfringementShield = false; #endregion #region Armor Set @@ -748,6 +756,7 @@ namespace CalamityMod.CalPlayer public bool shadowflame = false; public bool wDeath = false; public bool dragonFire = false; + public bool miracleBlight = false; public bool aCrunch = false; public bool irradiated = false; public bool bFlames = false; @@ -795,15 +804,11 @@ namespace CalamityMod.CalPlayer public bool graxDefense = false; public bool encased = false; public bool tFury = false; - public bool cadence = false; public bool omniscience = false; public bool zerg = false; public bool zen = false; public bool isNearbyBoss = false; - public bool yPower = false; - public bool aWeapon = false; - public bool tScale = false; - public int titanBoost = 0; + public bool flaskBrimstone = false; public bool fabsolVodka = false; public bool mushy = false; public bool molten = false; @@ -813,22 +818,18 @@ namespace CalamityMod.CalPlayer public bool anechoicCoating = false; public bool enraged = false; public bool permafrostsConcoction = false; - public bool armorCrumbling = false; + public bool flaskCrumbling = false; public bool ceaselessHunger = false; public bool calcium = false; public bool soaring = false; public bool bounding = false; - public bool triumph = false; - public bool penumbra = false; public bool shadow = false; public bool photosynthesis = false; public bool astralInjection = false; public bool gravityNormalizer = false; - public bool holyWrath = false; - public bool profanedRage = false; - public bool draconicSurge = false; + public bool flaskHoly = false; public bool tesla = false; - public bool teslaFreeze = false; + public bool galvanicCorrosion = false; public bool sulphurskin = false; public bool baguette = false; public bool vodka = false; @@ -874,7 +875,6 @@ namespace CalamityMod.CalPlayer #region Minion public bool wDroid = false; public bool resButterfly = false; - public bool glSword = false; public bool mWorm = false; public bool iClasper = false; public bool magicHat = false; @@ -886,8 +886,8 @@ namespace CalamityMod.CalPlayer public bool cSlime = false; public bool cSlime2 = false; public bool aSlime = false; - public bool bStar = false; - public bool aStar = false; + public bool brittleStar = false; + public bool aquaticStar = false; public bool SP = false; public bool dCreeper = false; public bool bClot = false; @@ -900,7 +900,7 @@ namespace CalamityMod.CalPlayer public bool pGuy = false; public bool sandnado = false; public bool plantera = false; - public bool aProbe = false; + public bool astralProbe = false; public bool gDefense = false; public bool gOffense = false; public bool gHealer = false; @@ -908,8 +908,8 @@ namespace CalamityMod.CalPlayer public int healCounter = 300; public bool shellfish = false; public bool hCrab = false; - public bool tDime = false; public bool allWaifus = false; + public bool allWaifusVanity = false; public bool sCrystal = false; public bool sWaifu = false; public bool dWaifu = false; @@ -932,7 +932,7 @@ namespace CalamityMod.CalPlayer public bool powerfulRaven = false; public bool dragonFamily = false; public bool providenceStabber = false; - public bool radiantResolution = false; + public bool saros = false; public bool plaguebringerMK2 = false; public bool igneousExaltation = false; public bool coldDivinity = false; @@ -1090,6 +1090,8 @@ namespace CalamityMod.CalPlayer public FluidField ProfanedMoonlightAuroraDrawer; + public ArmorShaderData CalamityFireDyeShader = null; + public Vector2 FireDrawerPosition; public int monolithAccursedShader = 0; @@ -1097,6 +1099,8 @@ namespace CalamityMod.CalPlayer #region Draedon Summoning public bool AbleToSelectExoMech = false; + public bool HasTalkedAtCodebreaker = false; + public List SeenDraedonDialogs = new(); #endregion Draedon Summoning #region Mouse Controls Syncing @@ -1229,6 +1233,7 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("newBanditInventory", newBanditInventory); boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); boost.AddWithCondition("GivenBrimstoneLocus", GivenBrimstoneLocus); + boost.AddWithCondition("HasTalkedAtCodebreaker", HasTalkedAtCodebreaker); // Calculate the new total time of all sessions at the instant of this player save. TimeSpan newSessionTotal = previousSessionTotal.Add(CalamityMod.SpeedrunTimer.Elapsed); @@ -1265,6 +1270,7 @@ namespace CalamityMod.CalPlayer tag["lastSplitType"] = lastSplitType; tag["lastSplitTicks"] = lastSplit.Ticks; tag["cooldowns"] = cooldownsTag; + tag["SeenDraedonDialogs"] = SeenDraedonDialogs; } public override void LoadData(TagCompound tag) @@ -1317,6 +1323,7 @@ namespace CalamityMod.CalPlayer newBanditInventory = boost.Contains("newBanditInventory"); newCalamitasInventory = boost.Contains("newCalamitasInventory"); GivenBrimstoneLocus = boost.Contains("GivenBrimstoneLocus"); + HasTalkedAtCodebreaker = boost.Contains("HasTalkedAtCodebreaker"); // Load rage if it's there, which it will be for any players saved with 1.5. // Older players have "stress" instead, which will be ignored. This is intentional. @@ -1359,6 +1366,7 @@ namespace CalamityMod.CalPlayer lastSplitType = tag.GetInt("lastSplitType"); ticks = tag.GetLong("lastSplitTicks"); lastSplit = new TimeSpan(ticks); + SeenDraedonDialogs = tag.GetList("SeenDraedonDialogs").ToList(); // Clear the player's cooldowns in preparation for loading. cooldowns.Clear(); @@ -1402,8 +1410,6 @@ namespace CalamityMod.CalPlayer percentMaxLifeIncrease += 100; if (affliction || afflicted) percentMaxLifeIncrease += 10; - if (cadence) - percentMaxLifeIncrease += 25; if (community) { @@ -1423,8 +1429,6 @@ namespace CalamityMod.CalPlayer // Max health reductions if (crimEffigy) Player.statLifeMax2 = (int)(Player.statLifeMax2 * 0.9); - if (regenator) - Player.statLifeMax2 = (int)(Player.statLifeMax2 * 0.5); ResetRogueStealth(); @@ -1469,6 +1473,7 @@ namespace CalamityMod.CalPlayer bendyPet = false; littleLightPet = false; pineapplePet = false; + eidolonSnailPet = false; onyxExcavator = false; rimehound = false; @@ -1476,6 +1481,7 @@ namespace CalamityMod.CalPlayer crysthamyr = false; ExoChair = false; miniOldDuke = false; + miniOldDukeVanity = false; abyssalDivingSuitPlates = false; @@ -1485,6 +1491,7 @@ namespace CalamityMod.CalPlayer draedonsHeart = false; afflicted = false; + chiRegen = false; affliction = false; dodgeScarf = false; @@ -1559,8 +1566,8 @@ namespace CalamityMod.CalPlayer badgeOfBravery = false; warbannerOfTheSun = false; aSpark = false; - aSparkRare = false; - aBulwarkRare = false; + transformer = false; + hideOfDeus = false; dAmulet = false; fCarapace = false; gShell = false; @@ -1574,20 +1581,20 @@ namespace CalamityMod.CalPlayer frostFlare = false; beeResist = false; uberBees = false; - projRefRare = false; + evolution = false; nanotech = false; deadshotBrooch = false; cryogenSoul = false; yInsignia = false; eGauntlet = false; eTalisman = false; - statisBeltOfCurses = false; nucleogenesis = false; nuclearRod = false; heartOfDarkness = false; shadowMinions = false; holyMinions = false; alchFlask = false; + toxicHeart = false; abaddon = false; aeroStone = false; community = false; @@ -1611,7 +1618,7 @@ namespace CalamityMod.CalPlayer voidOfExtinction = false; eArtifact = false; dArtifact = false; - gArtifact = false; + auricSArtifact = false; pArtifact = false; giantPearl = false; normalityRelocator = false; @@ -1649,13 +1656,14 @@ namespace CalamityMod.CalPlayer corrosiveSpine = false; RustyMedallionDroplets = false; noStupidNaturalARSpawns = false; - roverDrive = false; rottenDogTooth = false; angelicAlliance = false; BloomStoneRegen = false; ChaosStone = false; CryoStone = false; + CryoStoneVanity = false; voidField = false; + copyrightInfringementShield = false; daedalusReflect = false; daedalusSplit = false; @@ -1779,6 +1787,7 @@ namespace CalamityMod.CalPlayer shadowflame = false; wDeath = false; dragonFire = false; + miracleBlight = false; aCrunch = false; irradiated = false; bFlames = false; @@ -1821,35 +1830,28 @@ namespace CalamityMod.CalPlayer graxDefense = false; encased = false; tFury = false; - cadence = false; omniscience = false; zerg = false; zen = false; isNearbyBoss = false; permafrostsConcoction = false; - armorCrumbling = false; + flaskCrumbling = false; ceaselessHunger = false; calcium = false; soaring = false; bounding = false; - triumph = false; - penumbra = false; shadow = false; photosynthesis = false; astralInjection = false; gravityNormalizer = false; - holyWrath = false; - profanedRage = false; - draconicSurge = false; + flaskHoly = false; tesla = false; - teslaFreeze = false; + galvanicCorrosion = false; sulphurskin = false; baguette = false; trippy = false; amidiasBlessing = false; - yPower = false; - aWeapon = false; - tScale = false; + flaskBrimstone = false; fabsolVodka = false; shine = false; anechoicCoating = false; @@ -1896,7 +1898,6 @@ namespace CalamityMod.CalPlayer wDroid = false; resButterfly = false; - glSword = false; mWorm = false; iClasper = false; magicHat = false; @@ -1908,8 +1909,8 @@ namespace CalamityMod.CalPlayer cSlime = false; cSlime2 = false; aSlime = false; - bStar = false; - aStar = false; + brittleStar = false; + aquaticStar = false; SP = false; dCreeper = false; bClot = false; @@ -1940,19 +1941,26 @@ namespace CalamityMod.CalPlayer sGod = false; sandnado = false; plantera = false; - aProbe = false; + astralProbe = false; victideSnail = false; cSpirit = false; rOrb = false; dCrystal = false; youngDuke = false; sandWaifu = false; + sandWaifuVanity = false; sandBoobWaifu = false; + sandBoobWaifuVanity = false; cloudWaifu = false; + cloudWaifuVanity = false; brimstoneWaifu = false; + brimstoneWaifuVanity = false; sirenWaifu = false; + sirenWaifuVanity = false; allWaifus = false; + allWaifusVanity = false; fungalClump = false; + fungalClumpVanity = false; howlsHeart = false; howlsHeartVanity = false; redDevil = false; @@ -1962,7 +1970,6 @@ namespace CalamityMod.CalPlayer daedalusCrystal = false; shellfish = false; hCrab = false; - tDime = false; endoHydra = false; powerfulRaven = false; dragonFamily = false; @@ -1973,7 +1980,7 @@ namespace CalamityMod.CalPlayer voidAura = false; voidAuraDamage = false; voidConcentrationAura = false; - radiantResolution = false; + saros = false; virili = false; frostBlossom = false; cinderBlossom = false; @@ -2121,8 +2128,7 @@ namespace CalamityMod.CalPlayer auralisAuroraCounter = 0; auralisAuroraCooldown = 0; auralisAurora = 0; - fungalSymbioteTimer = 0; - aBulwarkRareTimer = 0; + hideOfDeusTimer = 0; RustyMedallionCooldown = 0; SulphWaterPoisoningLevel = 0f; spiritOriginConvertedCrit = 0; @@ -2137,8 +2143,7 @@ namespace CalamityMod.CalPlayer bloodflareMageCooldown = 0; tarraRangedCooldown = 0; tarraMageHealCooldown = 0; - bossRushImmunityFrameCurseTimer = 0; - aBulwarkRareMeleeBoostTimer = 0; + hideOfDeusMeleeBoostTimer = 0; acidRoundMultiplier = 1D; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; @@ -2159,7 +2164,6 @@ namespace CalamityMod.CalPlayer sulphurBubbleCooldown = 0; ladHearts = 0; prismaticLasers = 0; - roverDriveTimer = 0; angelicActivate = -1; resetHeightandWidth = false; noLifeRegen = false; @@ -2167,6 +2171,7 @@ namespace CalamityMod.CalPlayer shadowflame = false; wDeath = false; dragonFire = false; + miracleBlight = false; aCrunch = false; irradiated = false; bFlames = false; @@ -2244,35 +2249,27 @@ namespace CalamityMod.CalPlayer graxDefense = false; encased = false; tFury = false; - cadence = false; omniscience = false; zerg = false; zen = false; isNearbyBoss = false; permafrostsConcoction = false; - armorCrumbling = false; + flaskCrumbling = false; ceaselessHunger = false; calcium = false; soaring = false; bounding = false; - triumph = false; - penumbra = false; shadow = false; nanomachinesLockoutTimer = 0; photosynthesis = false; astralInjection = false; gravityNormalizer = false; - holyWrath = false; - profanedRage = false; + flaskHoly = false; tesla = false; - teslaFreeze = false; + galvanicCorrosion = false; sulphurskin = false; baguette = false; - draconicSurge = false; - yPower = false; - aWeapon = false; - tScale = false; - titanBoost = 0; + flaskBrimstone = false; fabsolVodka = false; shine = false; anechoicCoating = false; @@ -2531,7 +2528,7 @@ namespace CalamityMod.CalPlayer Player.Teleport(teleportLocation, 4, 0); NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)Player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - int duration = chaosStateDuration_NR; + int duration = areThereAnyDamnBosses ? chaosStateDuration_NR : 360; Player.AddBuff(BuffID.ChaosState, duration, true); // Add a cooldown here so it can have the custom NR icon Player.AddCooldown(ChaosState.ID, duration, true, "normalityrelocator"); @@ -2577,7 +2574,7 @@ namespace CalamityMod.CalPlayer rogueStealth -= rogueStealthMax * 0.1f; int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, Player.whoAmI); Main.projectile[veil].Center = Player.Center; - SoundEngine.PlaySound(SoundID.Item45, Player.position); + SoundEngine.PlaySound(SoundID.Item45, Player.Center); } if (CalamityKeybinds.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0) @@ -2620,7 +2617,7 @@ namespace CalamityMod.CalPlayer Main.dust[dustIndex].noLight = true; } - spectralVeilImmunity = 60; + spectralVeilImmunity = 45; } } } @@ -2829,7 +2826,7 @@ namespace CalamityMod.CalPlayer if (Main.netMode == NetmodeID.SinglePlayer) { Player.TeleportationPotion(); - SoundEngine.PlaySound(SoundID.Item6, Player.position); + SoundEngine.PlaySound(SoundID.Item6, Player.Center); } else if (Main.netMode == NetmodeID.MultiplayerClient && Player.whoAmI == Main.myPlayer) { @@ -2934,9 +2931,11 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(ModContent.BuffType(), AdrenalineDuration); + SoundStyle ActivationSound = draedonsHeart ? NanomachinesActivationSound : AdrenalineActivationSound; + // Play Adrenaline Activation sound if (Player.whoAmI == Main.myPlayer) - SoundEngine.PlaySound(AdrenalineActivationSound); + SoundEngine.PlaySound(ActivationSound); // TODO -- Adrenaline should provide bright green vibrating afterimages on the player for the duration. int dustPerSegment = 96; @@ -3008,7 +3007,7 @@ namespace CalamityMod.CalPlayer int offset = Player.height; if (Player.gravDir == -1f) offset = 0; - SoundEngine.PlaySound(SoundID.DoubleJump, Player.position); + SoundEngine.PlaySound(SoundID.DoubleJump, Player.Center); Player.velocity.Y = -Player.jumpSpeed * Player.gravDir; Player.jump = (int)(Player.jumpHeight * 1.25); for (int d = 0; d < 30; ++d) @@ -3030,7 +3029,7 @@ namespace CalamityMod.CalPlayer int offset = Player.height; if (Player.gravDir == -1f) offset = 0; - SoundEngine.PlaySound(SoundID.DoubleJump, Player.position); + SoundEngine.PlaySound(SoundID.DoubleJump, Player.Center); Player.velocity.Y = -Player.jumpSpeed * Player.gravDir; Player.jump = (int)(Player.jumpHeight * 1.5); for (int d = 0; d < 30; ++d) @@ -3189,12 +3188,11 @@ namespace CalamityMod.CalPlayer // TODO -- why is boss health bar code in Player.UpdateEquips and not a ModSystem CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; + // If the config is enabled, vastly increase the player's base tile and wall placement speeds + // This stacks with the Brick Layer and Portable Cement Mixer if (CalamityConfig.Instance.FasterTilePlacement) { - // Increase tile placement speed to speed up early game a bit and make building more fun Player.tileSpeed += 0.5f; - - // Increase wall placement speed to speed up early game a bit and make building more fun Player.wallSpeed += 0.5f; } @@ -3273,6 +3271,9 @@ namespace CalamityMod.CalPlayer #region PreUpdate public override void PreUpdate() { + // Reset the Calamity shader. + CalamityFireDyeShader = null; + if (HasCustomDash && UsedDash.IsOmnidirectional) Player.maxFallSpeed = 50f; @@ -3287,14 +3288,6 @@ namespace CalamityMod.CalPlayer tailFrameUp = 0; } - int frameAmt = 11; - if (roverFrameCounter >= 7) - { - roverFrameCounter = -1; - roverFrame = roverFrame == frameAmt - 1 ? 0 : roverFrame + 1; - } - roverFrameCounter++; - int frames = 4; if (voidFrameCounter >= 6) { @@ -3411,6 +3404,18 @@ namespace CalamityMod.CalPlayer } } + // Add a cooldown display for the vanilla lifesteal cooldown, which is active when negative + if (Player.whoAmI == Main.myPlayer && Player.lifeSteal < 0f) + { + float duration = Player.lifeSteal; + float baseCooldown = Main.expertMode ? 0.5f : 0.6f; + float lifeStealNerf = BossRushEvent.BossRushActive ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; + duration /= baseCooldown - lifeStealNerf; + duration *= -1f; + if (!Player.HasCooldown(LifeSteal.ID) || (cooldowns[LifeSteal.ID].duration < (int)duration)) + Player.AddCooldown(LifeSteal.ID, (int)duration); + } + ForceVariousEffects(); } #endregion @@ -3434,7 +3439,7 @@ namespace CalamityMod.CalPlayer public override bool CanSellItem(NPC vendor, Item[] shopInventory, Item item) { if (item.type == ModContent.ItemType()) - return DownedBossSystem.downedSCal; //no easy moneycoins for post doggo/yhar + return DownedBossSystem.downedCalamitas; //no easy moneycoins for post doggo/yhar return base.CanSellItem(vendor, shopInventory, item); } @@ -3575,7 +3580,7 @@ namespace CalamityMod.CalPlayer private void GodSlayerDodge() { Player.GiveIFrames(Player.longInvince ? 100 : 60, true); - SoundEngine.PlaySound(SoundID.Item67, Player.position); + SoundEngine.PlaySound(SoundID.Item67, Player.Center); for (int j = 0; j < 30; j++) { @@ -3775,7 +3780,7 @@ namespace CalamityMod.CalPlayer if (nCore && !Player.HasCooldown(Cooldowns.NebulousCore.ID)) { - SoundEngine.PlaySound(SoundID.Item67, Player.position); + SoundEngine.PlaySound(SoundID.Item67, Player.Center); for (int j = 0; j < 50; j++) { @@ -3812,36 +3817,11 @@ namespace CalamityMod.CalPlayer { if (silvaCountdown == silvaReviveDuration && !hasSilvaEffect) { - SoundEngine.PlaySound(SilvaHeadSummon.ActivationSound, Player.position); + SoundEngine.PlaySound(SilvaHeadSummon.ActivationSound, Player.Center); Player.AddBuff(ModContent.BuffType(), silvaReviveDuration); - if (draconicSurge && !Player.HasCooldown(DraconicElixir.ID)) - { - Player.statLife += Player.statLifeMax2 / 2; - Player.HealEffect(Player.statLifeMax2 / 2); - - if (Player.statLife > Player.statLifeMax2) - Player.statLife = Player.statLifeMax2; - - if (Player.FindBuffIndex(ModContent.BuffType()) > -1) - { - Player.ClearBuff(ModContent.BuffType()); - Player.AddCooldown(DraconicElixir.ID, CalamityUtils.SecondsToFrames(60)); - - // Additional potion sickness time - int additionalTime = 0; - for (int i = 0; i < Player.MaxBuffs; i++) - { - if (Player.buffType[i] == BuffID.PotionSickness) - additionalTime = Player.buffTime[i]; - } - - float potionSicknessTime = 30f + (float)Math.Ceiling(additionalTime / 60D); - Player.AddBuff(BuffID.PotionSickness, CalamityUtils.SecondsToFrames(potionSicknessTime)); - } - } - else if (silvaWings) + if (silvaWings) { Player.statLife += Player.statLifeMax2 / 2; Player.HealEffect(Player.statLifeMax2 / 2); @@ -3866,7 +3846,7 @@ namespace CalamityMod.CalPlayer Player.statLife = Player.statLifeMax2 * 3 / 10; - SoundEngine.PlaySound(SoundID.Item92, Player.position); + SoundEngine.PlaySound(SoundID.Item92, Player.Center); for (int i = 0; i < 60; i++) { @@ -3912,6 +3892,10 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(Player.name + "'s ashes scatter in the wind."); } + if (miracleBlight) + { + damageSource = PlayerDeathReason.ByCustomReason(Player.name + (Main.rand.NextBool() ? " was blown away by miraculous technological advancements." : " disintegrated from the overpowering exotic resonance.")); + } if (hInferno) { damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was turned to ashes by the Profaned Goddess."); @@ -4046,7 +4030,10 @@ namespace CalamityMod.CalPlayer public override void ModifyWeaponDamage(Item item, ref StatModifier damage) { if (flamethrowerBoost && item.CountsAsClass() && (item.useAmmo == AmmoID.Gel || CalamityLists.flamethrowerList.Contains(item.type))) - damage += (hoverboardBoost ? 0.35f : 0.25f); + damage += hoverboardBoost ? 0.35f : 0.25f; + + if (fungalSymbiote && CalamityLists.MushroomWeaponIDs.Contains(item.type)) + damage += 0.1f; if (item.CountsAsClass()) acidRoundMultiplier = item.useTime / 20D; @@ -4079,9 +4066,6 @@ namespace CalamityMod.CalPlayer if (moscowMule) knockback += item.knockBack * 0.5f; - if (yPower) - knockback += item.knockBack * 0.25f; - if (titanHeartMask && rogue) knockback += item.knockBack * 0.05f; @@ -4141,7 +4125,7 @@ namespace CalamityMod.CalPlayer if (item.CountsAsClass()) { var source = Player.GetSource_ItemUse(item); - if (fungalSymbiote && Player.whoAmI == Main.myPlayer && fungalSymbioteTimer == 0) + if (fungalSymbiote && CalamityLists.MushroomWeaponIDs.Contains(item.type) && Player.whoAmI == Main.myPlayer) { if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.1) || Player.itemAnimation == (int)(Player.itemAnimationMax * 0.3) || @@ -4149,7 +4133,6 @@ namespace CalamityMod.CalPlayer Player.itemAnimation == (int)(Player.itemAnimationMax * 0.7) || Player.itemAnimation == (int)(Player.itemAnimationMax * 0.9)) { - fungalSymbioteTimer = 3; float yVel = 0f; float xVel = 0f; float yOffset = 0f; @@ -4205,18 +4188,24 @@ namespace CalamityMod.CalPlayer xVel *= 1.5f; xOffset *= (float)Player.direction; yOffset *= Player.gravDir; - int damage = (int)Player.GetTotalDamage().ApplyTo(item.damage * 0.15f); - Projectile.NewProjectile(source, (float)(hitbox.X + hitbox.Width / 2) + xOffset, (float)(hitbox.Y + hitbox.Height / 2) + yOffset, (float)Player.direction * xVel, yVel * Player.gravDir, ProjectileID.Mushroom, damage, 0f, Player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, (float)(hitbox.X + hitbox.Width / 2) + xOffset, (float)(hitbox.Y + hitbox.Height / 2) + yOffset, (float)Player.direction * xVel, yVel * Player.gravDir, ProjectileID.Mushroom, 0, 0f, Player.whoAmI); } } - if (aWeapon) + if (flaskHoly) + { + if (Main.rand.NextBool(3)) + { + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (int)CalamityDusts.ProfanedFire, Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 1f); + } + } + if (flaskBrimstone) { if (Main.rand.NextBool(3)) { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, ModContent.DustType(), Player.velocity.X * 0.2f + Player.direction * 3f, Player.velocity.Y * 0.2f, 100, default, 1f); } } - if (armorCrumbling) + if (flaskCrumbling) { if (Main.rand.NextBool(3)) { @@ -4356,7 +4345,7 @@ namespace CalamityMod.CalPlayer int knockbackAdd = (int)(damage * 0.15 * (1f - target.knockBackResist)); damage += knockbackAdd; } - if (proj.type == ModContent.ProjectileType()) + if (proj.type == ModContent.ProjectileType()) { int defenseAdd = (int)(target.defense * 0.05 * (proj.damage / 50D) * acidRoundMultiplier); //100 defense * 0.05 = 5 damage += defenseAdd; @@ -4386,12 +4375,13 @@ namespace CalamityMod.CalPlayer // Fearmonger armor reduces the summoner cross-class nerf // Forbidden armor reduces said nerf when holding the respective helmet's preferred weapon type // Profaned Soul Crystal encourages use of other weapons, nerfing the damage would not make sense. + // Having the Old One's Army event active also disables this during the duration of the event - bool forbidden = Player.head == ArmorIDs.Head.AncientBattleArmor && Player.body == ArmorIDs.Body.AncientBattleArmor && Player.legs == ArmorIDs.Legs.AncientBattleArmor; - bool reducedNerf = fearmongerSet || (forbidden && heldItem.CountsAsClass()) || (GemTechSet && GemTechState.IsBlueGemActive); + bool forbidden = Player.armor[0].type == ItemID.AncientBattleArmorHat && Player.armor[1].type == ItemID.AncientBattleArmorShirt && Player.armor[2].type == ItemID.AncientBattleArmorPants; + bool penaltyNegation = fearmongerSet || (forbidden && heldItem.CountsAsClass()) || (GemTechSet && GemTechState.IsBlueGemActive); - double summonNerfMult = reducedNerf ? 0.75 : 0.5; - if (isSummon && heldItem.type > ItemID.None && !profanedCrystalBuffs) + double summonNerfMult = 0.75; + if (isSummon && heldItem.type > ItemID.None && !profanedCrystalBuffs && !penaltyNegation && !DD2Event.Ongoing) { bool classCheck = !heldItem.CountsAsClass() && (heldItem.CountsAsClass() || heldItem.CountsAsClass() || heldItem.CountsAsClass() || @@ -4408,6 +4398,9 @@ namespace CalamityMod.CalPlayer { switch (proj.type) { + case ProjectileID.MoonlordArrowTrail: + damage = (int)(damage * 0.5); + break; case ProjectileID.CrystalShard: damage = (int)(damage * 0.6); break; @@ -4548,10 +4541,7 @@ namespace CalamityMod.CalPlayer } } - if (triumph) - contactDamageReduction += 0.15 * (1D - (npc.life / (double)npc.lifeMax)); - - if (aSparkRare) + if (transformer) { if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || npc.type == NPCID.FungoFish || npc.type == NPCID.BloodJelly || npc.type == NPCID.AngryNimbus || npc.type == NPCID.GigaZapper || @@ -4593,7 +4583,7 @@ namespace CalamityMod.CalPlayer } if (trinketOfChiBuff) - contactDamageReduction += 0.15; + contactDamageReduction += 0.1; // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. // To prevent abuse, this effect does not work if there are any bosses alive. @@ -4670,7 +4660,7 @@ namespace CalamityMod.CalPlayer { bool reduceChaosBallDamage = npc.type == NPCID.ChaosBall && !NPC.AnyNPCs(NPCID.GoblinSummoner); - if (reduceChaosBallDamage || npc.type == NPCID.BurningSphere || npc.type == NPCID.WaterSphere) + if (reduceChaosBallDamage || npc.type == NPCID.ChaosBallTim || npc.type == NPCID.BurningSphere || npc.type == NPCID.WaterSphere) { damage = (int)(damage * 0.6); @@ -4679,11 +4669,11 @@ namespace CalamityMod.CalPlayer } } - if (aBulwarkRare) + if (hideOfDeus) { - aBulwarkRareMeleeBoostTimer += 3 * damage; - if (aBulwarkRareMeleeBoostTimer > 900) - aBulwarkRareMeleeBoostTimer = 900; + hideOfDeusMeleeBoostTimer += 3 * damage; + if (hideOfDeusMeleeBoostTimer > 900) + hideOfDeusMeleeBoostTimer = 900; } } #endregion @@ -4697,7 +4687,7 @@ namespace CalamityMod.CalPlayer if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID)) { // The Evolution - if (projRefRare) + if (evolution) { proj.hostile = false; proj.friendly = true; @@ -4707,7 +4697,7 @@ namespace CalamityMod.CalPlayer Player.GiveIFrames(20, false); damage = 0; - projRefRareLifeRegenCounter = 300; + evolutionLifeRegenCounter = 300; projTypeJustHitBy = proj.type; Player.AddCooldown(GlobalDodge.ID, BalancingConstants.EvolutionReflectCooldown); @@ -4729,6 +4719,7 @@ namespace CalamityMod.CalPlayer damage -= 100; if (damage < 1) damage = 1; + auralisAuroraCounter = 0; auralisAuroraCooldown = CalamityUtils.SecondsToFrames(30f); } @@ -4840,26 +4831,26 @@ namespace CalamityMod.CalPlayer // The amount of damage that will be dealt is yet to be determined. // - if (projRefRare) + if (evolution) { if (proj.type == projTypeJustHitBy) projectileDamageReduction += 0.15; } - if (aSparkRare) + if (transformer) { if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || proj.type == ProjectileID.VortexLightning || proj.type == ModContent.ProjectileType() || proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) projectileDamageReduction += 0.5; } + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && damage > 0) { // Daedalus Reflect counts as a reflect but doesn't actually stop you from taking damage - if (daedalusReflect && !disableAllDodges && !projRefRare && !Player.HasCooldown(GlobalDodge.ID)) + if (daedalusReflect && !disableAllDodges && !evolution && !Player.HasCooldown(GlobalDodge.ID)) projectileDamageReduction += 0.5; } - if (beeResist) { if (CalamityLists.beeProjectileList.Contains(proj.type)) @@ -4867,7 +4858,7 @@ namespace CalamityMod.CalPlayer } if (trinketOfChiBuff) - projectileDamageReduction += 0.15; + projectileDamageReduction += 0.1; // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. // To prevent abuse, this effect does not work if there are any bosses alive. @@ -4904,6 +4895,24 @@ namespace CalamityMod.CalPlayer if (Player.mount.Active && (Player.mount.Type == ModContent.MountType() || Player.mount.Type == ModContent.MountType()) && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed / 2f) projectileDamageReduction += 0.1; + // Damage reduction from Shield of the High Ruler if facing the projectile that just hit. + // If the projectile is in the exact center of the player on the X axis YOU GET NOTHING, GOOD DAY, SIR! + if (copyrightInfringementShield) + { + bool projectileRight = (Player.Center.X - proj.Center.X) < 0f; + bool projectileLeft = (Player.Center.X - proj.Center.X) > 0f; + if (Player.direction == 1) + { + if (projectileRight) + projectileDamageReduction += 0.15; + } + else + { + if (projectileLeft) + projectileDamageReduction += 0.15; + } + } + if (vHex) projectileDamageReduction -= 0.1; @@ -4966,7 +4975,8 @@ namespace CalamityMod.CalPlayer if (proj.type == ProjectileID.TorchGod) { int fireDebuffTypes = CalamityWorld.death ? 9 : CalamityWorld.revenge ? 7 : Main.expertMode ? 5 : 3; - switch (Main.rand.Next(fireDebuffTypes)) + int choice = CalamityWorld.getFixedBoi ? 9 : Main.rand.Next(fireDebuffTypes); + switch (choice) { case 0: Player.AddBuff(BuffID.OnFire, 600); @@ -5003,6 +5013,10 @@ namespace CalamityMod.CalPlayer case 8: Player.AddBuff(ModContent.BuffType(), 300); break; + + case 9: + Player.AddBuff(ModContent.BuffType(), 300); + break; } } else if (proj.type == ProjectileID.Explosives) @@ -5084,7 +5098,7 @@ namespace CalamityMod.CalPlayer if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && damage > 0) { // The Transformer can reflect bullets - if (aSparkRare) + if (transformer) { if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) { @@ -5100,7 +5114,7 @@ namespace CalamityMod.CalPlayer // Reflects count as dodges. They share the timer and can be disabled by global dodge disabling effects. if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID)) { - if (daedalusReflect && !projRefRare) + if (daedalusReflect && !evolution) { proj.hostile = false; proj.friendly = true; @@ -5167,7 +5181,7 @@ namespace CalamityMod.CalPlayer num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - int p = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.065), knockBack * 0.5f, Player.whoAmI); + int p = Projectile.NewProjectile(source, vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.075), knockBack * 0.5f, Player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].DamageType = DamageClass.Generic; //in case melee/rogue variants bug out @@ -5180,8 +5194,8 @@ namespace CalamityMod.CalPlayer if (StealthStrikeAvailable()) { - int knifeCount = 15; - int knifeDamage = (int)Player.GetTotalDamage().ApplyTo(35); + int knifeCount = 16; + int knifeDamage = (int)Player.GetTotalDamage().ApplyTo(60); float angleStep = MathHelper.TwoPi / knifeCount; float speed = 15f; @@ -5359,7 +5373,7 @@ namespace CalamityMod.CalPlayer #region Limitations private void ForceVariousEffects() { - if (blockAllDashes || (CalamityConfig.Instance.BossRushDashCurse && BossRushEvent.BossRushActive)) + if (blockAllDashes) DisableDashes(); if (weakPetrification) WeakPetrification(); @@ -5395,7 +5409,7 @@ namespace CalamityMod.CalPlayer if (totalMoonlightDyes > 0) { // Initialize the aurora drawer. - int size = 425; + int size = 340; FluidFieldManager.AdjustSizeRelativeToGraphicsQuality(ref size); float scale = MathHelper.Max(Main.screenWidth, Main.screenHeight) / size * 0.4f; @@ -5403,7 +5417,7 @@ namespace CalamityMod.CalPlayer ProfanedMoonlightAuroraDrawer = FluidFieldManager.CreateField(size, scale, 0.1f, 50f, 0.992f); int sourceArea = (int)Math.Ceiling(6f / ProfanedMoonlightAuroraDrawer.Scale) + 1; - ProfanedMoonlightAuroraDrawer.ShouldUpdate = Player.miscCounter % 4 == 0; + ProfanedMoonlightAuroraDrawer.ShouldUpdate = Player.miscCounter % 2 == 0; ProfanedMoonlightAuroraDrawer.UpdateAction = () => { // Aurora Count does not scale to save on resources if you have a lot of dyes @@ -5485,12 +5499,9 @@ namespace CalamityMod.CalPlayer return false; } - // If Armageddon is active or the Boss Rush Immunity Curse is triggered, instantly kill the player. - if (CalamityWorld.armageddon || (BossRushEvent.BossRushActive && bossRushImmunityFrameCurseTimer > 0)) - { - if (areThereAnyDamnBosses || (BossRushEvent.BossRushActive && bossRushImmunityFrameCurseTimer > 0)) - KillPlayer(); - } + // If Armageddon is active, instantly kill the player. + if (CalamityWorld.armageddon && areThereAnyDamnBosses) + KillPlayer(); #endregion //Todo - At some point it'd be nice to have a "TransformationPlayer" that has all the transformation sfx and visuals so their priorities can be more easily managed. @@ -5500,43 +5511,43 @@ namespace CalamityMod.CalPlayer if (Player.GetModPlayer().ProtectionMatrixDurability > 0) { playSound = false; - SoundEngine.PlaySound(RoverDrive.ShieldHurtSound, Player.position); + SoundEngine.PlaySound(RoverDrive.ShieldHurtSound, Player.Center); hurtSoundTimer = 20; } else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) { playSound = false; - SoundEngine.PlaySound(Providence.HurtSound, Player.position); + SoundEngine.PlaySound(Providence.HurtSound, Player.Center); hurtSoundTimer = 20; } else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) { playSound = false; - SoundEngine.PlaySound(SoundID.NPCHit4, Player.position); //metal hit noise + SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); //metal hit noise hurtSoundTimer = 10; } else if ((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) { playSound = false; - SoundEngine.PlaySound(SoundID.FemaleHit, Player.position); //female hit noise + SoundEngine.PlaySound(SoundID.FemaleHit, Player.Center); //female hit noise hurtSoundTimer = 10; } else if (titanHeartSet) { playSound = false; - SoundEngine.PlaySound(NPCs.Astral.Atlas.HurtSound, Player.position); + SoundEngine.PlaySound(NPCs.Astral.Atlas.HurtSound, Player.Center); hurtSoundTimer = 10; } else if (Player.GetModPlayer().transformationActive) { playSound = false; - SoundEngine.PlaySound(SoundID.NPCHit4, Player.position); + SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); hurtSoundTimer = 10; } else if (Player.GetModPlayer().wulfrumSet && (Player.name.ToLower() == "wagstaff" || Player.name.ToLower() == "john wulfrum")) { playSound = false; - SoundEngine.PlaySound(SoundID.DSTMaleHurt, Player.position); + SoundEngine.PlaySound(SoundID.DSTMaleHurt, Player.Center); hurtSoundTimer = 10; } } @@ -5693,10 +5704,13 @@ namespace CalamityMod.CalPlayer hellbornBoost = 0; + if (trinketOfChi) + chiBuffTimer = 0; + if (amidiasBlessing && damage > 50) { Player.ClearBuff(ModContent.BuffType()); - SoundEngine.PlaySound(SoundID.Item96, Player.position); + SoundEngine.PlaySound(SoundID.Item96, Player.Center); } if ((gShell || flameLickedShell) && !Player.panic) @@ -5713,7 +5727,7 @@ namespace CalamityMod.CalPlayer if (abyssalDivingSuitPlateHits >= 3) { - SoundEngine.PlaySound(SoundID.NPCDeath14, Player.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, Player.Center); if (plateCDExists) cooldowns.Remove(DivingPlatesBreaking.ID); Player.AddCooldown(DivingPlatesBroken.ID, 10830); @@ -5781,7 +5795,7 @@ namespace CalamityMod.CalPlayer if ((fBarrier || (aquaticHeart && NPC.downedBoss3)) && !areThereAnyDamnBosses) { - SoundEngine.PlaySound(SoundID.Item27, Player.position); + SoundEngine.PlaySound(SoundID.Item27, Player.Center); for (int m = 0; m < Main.maxNPCs; m++) { NPC npc = Main.npc[m]; @@ -5834,8 +5848,9 @@ namespace CalamityMod.CalPlayer npc.AddBuff(BuffID.Confused, (int)duration, false); if (amalgam) { - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); + npc.AddBuff(BuffID.Venom, (int)duration); + npc.AddBuff(ModContent.BuffType(), (int)duration); + npc.AddBuff(ModContent.BuffType(), (int)duration); npc.AddBuff(ModContent.BuffType(), (int)duration); npc.AddBuff(ModContent.BuffType(), (int)duration); } @@ -5967,9 +5982,6 @@ namespace CalamityMod.CalPlayer else Player.immuneTime += iFramesToAdd; - if (BossRushEvent.BossRushActive && CalamityConfig.Instance.BossRushIFrameCurse) - bossRushImmunityFrameCurseTimer = 180 + Player.immuneTime; - if (aeroSet && damage > 25) { var source = new ProjectileSource_AerospecSetFeathers(Player); @@ -5979,10 +5991,10 @@ namespace CalamityMod.CalPlayer CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), featherDamage, 1f, Player.whoAmI); } } - if (aBulwarkRare) + if (hideOfDeus) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - SoundEngine.PlaySound(SoundID.Item74, Player.position); + SoundEngine.PlaySound(SoundID.Item74, Player.Center); int blazeDamage = (int)Player.GetBestClassDamage().ApplyTo(25); int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(320); Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), blazeDamage, 5f, Player.whoAmI, 0f, 1f); @@ -5997,7 +6009,7 @@ namespace CalamityMod.CalPlayer for (int n = 0; n < 3; n++) { int deificStarDamage = (int)Player.GetBestClassDamage().ApplyTo(130); - Projectile star = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.HallowStar, deificStarDamage, 4f, Player.whoAmI); + Projectile star = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.StarVeilStar, deificStarDamage, 4f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) { star.DamageType = DamageClass.Generic; @@ -6011,7 +6023,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); if (damage > 0) { - SoundEngine.PlaySound(SoundID.NPCHit45, Player.position); + SoundEngine.PlaySound(SoundID.NPCHit45, Player.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; @@ -6037,7 +6049,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); if (damage > 0) { - SoundEngine.PlaySound(SoundID.Item93, Player.position); + 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; @@ -6045,7 +6057,7 @@ namespace CalamityMod.CalPlayer // Start with base damage, then apply the best damage class you can int sDamage = 6; - if (aSparkRare) + if (transformer) sDamage += 42; sDamage = (int)Player.GetBestClassDamage().ApplyTo(sDamage); if (Player.whoAmI == Main.myPlayer) @@ -6078,7 +6090,7 @@ namespace CalamityMod.CalPlayer rogueStealth += 0.5f; for (int i = 0; i < 3; i++) { - SoundEngine.PlaySound(SoundID.Item61, Player.position); + SoundEngine.PlaySound(SoundID.Item61, Player.Center); int ink = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, Player.whoAmI); if (ink.WithinBounds(Main.maxProjectiles)) Main.projectile[ink].DamageType = DamageClass.Generic; @@ -6108,7 +6120,7 @@ namespace CalamityMod.CalPlayer var fuckYouBitch = Player.GetSource_Misc("21"); if (damage > 0) { - SoundEngine.PlaySound(SoundID.Item74, Player.position); + SoundEngine.PlaySound(SoundID.Item74, Player.Center); int eDamage = (int)Player.GetBestClassDamage().ApplyTo(100); if (Player.whoAmI == Main.myPlayer) Projectile.NewProjectile(fuckYouBitch, Player.Center, Vector2.Zero, ModContent.ProjectileType(), eDamage, 1f, Player.whoAmI, 0f, 0f); @@ -6119,7 +6131,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Misc("22"); if (damage > 0) { - SoundEngine.PlaySound(SoundID.Item27, Player.position); + SoundEngine.PlaySound(SoundID.Item27, Player.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; @@ -6157,7 +6169,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Misc("24"); if (damage > 80) { - SoundEngine.PlaySound(SoundID.Item73, Player.position); + SoundEngine.PlaySound(SoundID.Item73, Player.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; @@ -6266,7 +6278,7 @@ namespace CalamityMod.CalPlayer Player.KillMeForGood(); } } - SoundEngine.PlaySound(SoundID.PlayerKilled, Player.position); + SoundEngine.PlaySound(SoundID.PlayerKilled, Player.Center); Player.headVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; Player.bodyVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; Player.legVelocity.Y = (float)Main.rand.Next(-40, -10) * 0.1f; @@ -6298,7 +6310,7 @@ namespace CalamityMod.CalPlayer PlayerDeathReason damageSource = PlayerDeathReason.ByOther(Player.Male ? 14 : 15); if (abyssDeath) { - SoundEngine.PlaySound(DrownSound, Player.position); + SoundEngine.PlaySound(DrownSound, Player.Center); if (Main.rand.NextBool(2)) { @@ -6313,10 +6325,6 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(Player.name + " failed the challenge at hand."); } - else if (BossRushEvent.BossRushActive && bossRushImmunityFrameCurseTimer > 0) - { - damageSource = PlayerDeathReason.ByCustomReason(Player.name + " was destroyed by a mysterious force."); - } NetworkText deathText = damageSource.GetDeathText(Player.name); if (Main.netMode == NetmodeID.MultiplayerClient && Player.whoAmI == Main.myPlayer) { @@ -6350,6 +6358,17 @@ namespace CalamityMod.CalPlayer } #endregion + #region Anomaly's Nanogun Kill Sound + public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) + { + if (Player.whoAmI == Main.myPlayer && Player.ActiveItem().type == ModContent.ItemType()) + { + if (Main.rand.NextBool(20)) + SoundEngine.PlaySound(IjiDeathSound, Player.Center); + } + } + #endregion + #region Nurse Modifications public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) { @@ -6395,7 +6414,7 @@ namespace CalamityMod.CalPlayer price += Item.buyPrice(0, 1, 20, 0); else if (NPC.downedGolemBoss) price += Item.buyPrice(0, 0, 90, 0); - else if (NPC.downedPlantBoss || DownedBossSystem.downedCalamitas) + else if (NPC.downedPlantBoss || DownedBossSystem.downedCalamitasClone) price += Item.buyPrice(0, 0, 60, 0); else if (NPC.downedMechBossAny) price += Item.buyPrice(0, 0, 40, 0); @@ -6449,7 +6468,7 @@ namespace CalamityMod.CalPlayer if (playRogueStealthSound && rogueStealth >= rogueStealthMax && Player.whoAmI == Main.myPlayer) { playRogueStealthSound = false; - SoundEngine.PlaySound(RogueStealthSound, Player.position); + SoundEngine.PlaySound(RogueStealthSound, Player.Center); } // If the player isn't at full stealth, reset the sound so it'll play again when they hit full stealth. @@ -6555,12 +6574,6 @@ namespace CalamityMod.CalPlayer if (Player.itemAnimation > 0 || finalDawnProjCount > 0) return 0f; - if (penumbra) - { - stealthGenStandstill += 0.15f; - stealthGenMoving += 0.1f; - } - if (shadow) { stealthGenStandstill += 0.08f; @@ -6569,8 +6582,8 @@ namespace CalamityMod.CalPlayer if (eArtifact) { - stealthGenStandstill += 0.1f; - stealthGenMoving += 0.1f; + stealthGenStandstill += 0.15f; + stealthGenMoving += 0.15f; } //Accessory modifiers can boost these stats @@ -6773,7 +6786,10 @@ namespace CalamityMod.CalPlayer CalamityMod.SpeedrunTimer.Restart(); if (CalamityConfig.Instance.WikiStatusMessage) - Main.NewText($"[i:{ItemID.Book}]" + " [c/EE4939:Be sure to check out the Official Calamity Mod Wiki at ][c/3989FF:calamitymod.wiki.gg][c/EE4939:!] " + $"[i:{ItemID.Book}]"); + { + Main.NewText($"[i:{ItemID.Book}]" + " [c/EE4939:Note: The Fandom wiki is no longer supported by Calamity.] " + $"[i:{ItemID.Book}]"); + Main.NewText($"[i:{ItemID.Book}]" + " [c/EE4939:Check out the Official Calamity Mod Wiki at ][c/3989FF:calamitymod.wiki.gg][c/EE4939:!] " + $"[i:{ItemID.Book}]"); + } } /// @@ -6784,6 +6800,7 @@ namespace CalamityMod.CalPlayer public float GetAbyssAggro(float range) { range *= fishAlert ? 3f : 1f; + range *= eidolonSnailPet ? 0.85f : 1f; range *= anechoicCoating ? 0.5f : 1f; range *= anechoicPlating ? 0.5f : 1f; range *= abyssalMirror ? 0.65f : 1f; @@ -6891,7 +6908,7 @@ namespace CalamityMod.CalPlayer // Play a sound from taking defense damage. if (hurtSoundTimer == 0 && Main.myPlayer == Player.whoAmI) { - SoundEngine.PlaySound(DefenseDamageSound with { Volume = DefenseDamageSound.Volume * 0.75f}, Player.position); + SoundEngine.PlaySound(DefenseDamageSound with { Volume = DefenseDamageSound.Volume * 0.75f}, Player.Center); hurtSoundTimer = 30; } @@ -6902,16 +6919,5 @@ namespace CalamityMod.CalPlayer CombatText.NewText(location, messageColor, Language.GetTextValue(text)); } #endregion - - #region Kill - public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) - { - if (Player.whoAmI == Main.myPlayer && Player.ActiveItem().type == ModContent.ItemType()) - { - if (Main.rand.NextBool(20)) - SoundEngine.PlaySound(IjiDeathSound, Player.Center); - } - } - #endregion } } diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 7339d5b708..c0529a346c 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -116,11 +116,11 @@ namespace CalamityMod.CalPlayer { VerticalGodslayerDashTimer++; if (VerticalGodslayerDashTimer >= 25) - { + { Player.dashDelay = dashDelayToApply; - // Stop the player from going flying - Player.velocity *= 0.2f; - } + // Stop the player from going flying + Player.velocity *= 0.2f; + } } if (HasCustomDash) @@ -206,9 +206,21 @@ namespace CalamityMod.CalPlayer direction = DashDirection.Directionless; bool justDashed = false; - if (Player.controlRight && Player.releaseRight) + // If the manual hotkey is bound, standard Terraria dashes cannot be triggered by double tapping. + bool manualHotkeyBound = CalamityKeybinds.DashHotkey.GetAssignedKeys().Count > 0; + bool pressedManualHotkey = CalamityKeybinds.DashHotkey.JustPressed; + + bool vanillaRightDashInput = Player.controlRight && Player.releaseRight && !manualHotkeyBound; + bool manualRightDashInput = pressedManualHotkey && Player.direction == 1; + bool executeRightDash = vanillaRightDashInput || manualRightDashInput; + + bool vanillaLeftDashInput = Player.controlLeft && Player.releaseLeft && !manualHotkeyBound; + bool manualLeftDashInput = pressedManualHotkey && Player.direction == -1; + bool executeLeftDash = vanillaLeftDashInput || manualLeftDashInput; + + if (executeRightDash) { - if (dashTimeMod > 0) + if (dashTimeMod > 0 || pressedManualHotkey) { direction = DashDirection.Right; justDashed = true; @@ -217,9 +229,9 @@ namespace CalamityMod.CalPlayer else dashTimeMod = 15; } - else if (Player.controlLeft && Player.releaseLeft) + else if (executeLeftDash) { - if (dashTimeMod < 0) + if (dashTimeMod < 0 || pressedManualHotkey) { direction = DashDirection.Left; justDashed = true; diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 24ba6bf188..e6abe872eb 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -11,8 +11,6 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Armor.Wulfrum; namespace CalamityMod.CalPlayer { @@ -396,6 +394,18 @@ namespace CalamityMod.CalPlayer drawInfo.DustCache.Add(dust); } } + if (calamityPlayer.miracleBlight) + { + // Violent dust fountain + for (int i = 0; i < 2; ++i) + { + Vector2 dustCorner = Player.position - 2f * Vector2.One; + Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-15f, -12f)); + int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, (int)CalamityDusts.MiracleBlight, dustVel.X, dustVel.Y); + Main.dust[d].noGravity = true; + drawInfo.DustCache.Add(d); + } + } if (calamityPlayer.pFlames) { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index a7f8dff27b..6592637949 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -271,7 +271,7 @@ namespace CalamityMod.CalPlayer biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneAstral); biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); - biomeCrateList.AddWithCondition(ModContent.ItemType(), canSulphurFish); + biomeCrateList.AddWithCondition(ModContent.ItemType(), canSulphurFish); biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CorruptFishingCrateHard : ItemID.CorruptFishingCrate, Player.ZoneCorrupt); biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CrimsonFishingCrateHard : ItemID.CrimsonFishingCrate, Player.ZoneCrimson); biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.HallowedFishingCrateHard : ItemID.HallowedFishingCrate, Player.ZoneHallow); @@ -319,7 +319,7 @@ namespace CalamityMod.CalPlayer } if (canSulphurFish) { - itemDrop = ModContent.ItemType(); + itemDrop = ModContent.ItemType(); } } return; @@ -438,7 +438,7 @@ namespace CalamityMod.CalPlayer } } - if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedCalamitas && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) + if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedCalamitasClone && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) { itemDrop = ModContent.ItemType(); } @@ -581,7 +581,7 @@ namespace CalamityMod.CalPlayer ModContent.ItemType(), ModContent.ItemType() }; - uncommonCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); + uncommonCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); itemDrop = uncommonCatches[Main.rand.Next(uncommonCatches.Count)]; } else diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 951a3099c9..177c9feb3e 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Cooldowns; using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.Projectiles.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -167,12 +168,26 @@ namespace CalamityMod.CalPlayer if (Vector2.Distance(Player.Center.ToTileCoordinates().ToVector2(), closestSafeZone.ToVector2()) < SulphuricWaterSafeZoneSystem.NearbySafeTiles[closestSafeZone] * 17f) nearSafeZone = true; } - if (ZoneSulphur && Player.IsUnderwater() && !decayEffigy && !abyssalDivingSuit && !Player.lavaWet && !Player.honeyWet && !nearSafeZone) + + float ASPoisonLevel = 0f; + if (CalamityGlobalNPC.aquaticScourge >= 0 && CalamityWorld.getFixedBoi) + { + NPC AS = Main.npc[CalamityGlobalNPC.aquaticScourge]; + //if the player is 50 blocks or more away from the head + if (AS.life < AS.lifeMax) //Only poison when damaged + ASPoisonLevel = Utils.GetLerpValue(800f, 1600f, Vector2.Distance(Player.Center, AS.Center), true); + } + + bool ASPoisoning = ASPoisonLevel > 0f; + if (ASPoisoning || ((ZoneSulphur || Player.Calamity().ZoneAbyssLayer1) && !Player.creativeGodMode && Player.IsUnderwater() && !decayEffigy && !abyssalDivingSuit && !Player.lavaWet && !Player.honeyWet && !nearSafeZone)) { float increment = 1f / SulphSeaWaterSafetyTime; - if (sulphurskin) + //No way to mitigate AS Poisoning + if (ASPoisoning) + increment *= 4f + (8f * ASPoisonLevel); + if (sulphurskin && !ASPoisoning) increment *= 0.5f; - if (sulfurSet) + if (sulfurSet && !ASPoisoning) increment *= 0.5f; SulphWaterPoisoningLevel = MathHelper.Clamp(SulphWaterPoisoningLevel + increment, 0f, 1f); @@ -256,6 +271,15 @@ namespace CalamityMod.CalPlayer lifeRegenLost += 36; } + if (miracleBlight) + { + if (Player.lifeRegen > 0) + Player.lifeRegen = 0; + + Player.lifeRegenTime = 0; + lifeRegenLost += 40; + } + if (cDepth) { if (Player.statDefense > 0) @@ -321,7 +345,7 @@ namespace CalamityMod.CalPlayer if (bloodyMary) { alcoholPoisonLevel++; - lifeRegenLost += 2; + lifeRegenLost += 4; } if (tequila) { @@ -331,7 +355,7 @@ namespace CalamityMod.CalPlayer if (tequilaSunrise) { alcoholPoisonLevel++; - lifeRegenLost += 1; + lifeRegenLost += 2; } if (screwdriver) { @@ -354,12 +378,12 @@ namespace CalamityMod.CalPlayer if (starBeamRye) { alcoholPoisonLevel++; - lifeRegenLost += 1; + lifeRegenLost += 2; } if (moscowMule) { alcoholPoisonLevel++; - lifeRegenLost += 2; + lifeRegenLost += 4; } if (whiteWine) { @@ -376,10 +400,7 @@ namespace CalamityMod.CalPlayer alcoholPoisonLevel++; } - if (cirrusDress) - alcoholPoisonLevel = 0; - - if (alcoholPoisonLevel > 3) + if (alcoholPoisonLevel > (cirrusDress ? 5 : 3)) { Player.nebulaLevelLife = 0; @@ -475,6 +496,18 @@ namespace CalamityMod.CalPlayer } } + // Permafrost's Concoction increases life regen while afflicted with a fire debuff + if (permafrostsConcoction) + { + if (Player.onFire || Player.onFire2 || Player.onFire3 || Player.burned || shadowflame || weakBrimstoneFlames || bFlames || cragsLava || gsInferno || hFlames || banishingFire || dragonFire) + { + if (Player.lifeRegenTime < 1800) + Player.lifeRegenTime = 1800; + + Player.lifeRegen += 6; + } + } + if (celestialJewel || astralArcanum) { bool lesserEffect = false; @@ -608,11 +641,8 @@ namespace CalamityMod.CalPlayer if (aChicken) Player.lifeRegen += 1; - if (cadence) - Player.lifeRegen += 5; - if (mushy) - Player.lifeRegen += 1; + Player.lifeRegen += 2; if (permafrostsConcoction) { @@ -622,9 +652,6 @@ namespace CalamityMod.CalPlayer Player.lifeRegen++; if (Player.statLife < actualMaxLife / 10) Player.lifeRegen += 2; - - if (Player.poisoned || Player.onFire || bFlames) - Player.lifeRegen += 4; } if (tRegen) @@ -639,6 +666,9 @@ namespace CalamityMod.CalPlayer if (affliction || afflicted) Player.lifeRegen += 1; + if (trinketOfChi || chiRegen) + Player.lifeRegen += 2; + if (absorber) { if (Player.StandingStill() && Player.itemAnimation == 0) @@ -680,7 +710,7 @@ namespace CalamityMod.CalPlayer Player.lifeRegenTime += 1; } - if (projRefRareLifeRegenCounter > 0) + if (evolutionLifeRegenCounter > 0) { Player.lifeRegenTime += 2; Player.lifeRegen += 2; @@ -689,7 +719,7 @@ namespace CalamityMod.CalPlayer if (darkSunRing) { if (Main.eclipse || Main.dayTime) - Player.lifeRegen += 3; + Player.lifeRegen += Main.eclipse ? 2 : 4; } if (phantomicHeartRegen <= 720 && phantomicHeartRegen >= 600) @@ -729,7 +759,7 @@ namespace CalamityMod.CalPlayer if (regenator) { - Player.lifeRegenTime += 6; + Player.lifeRegenTime += 3; Player.lifeRegen += 12; } if (handWarmer && eskimoSet) @@ -890,13 +920,16 @@ namespace CalamityMod.CalPlayer } } - // The Camper regen boost activates while moving so it can stack with Shiny Stone like effects - if (camper && Player.statLife < actualMaxLife && !Player.StandingStill()) + // The Camper counteracts the regen loss while moving horizontally + if (camper && (Player.velocity.X != 0 && Player.grappling[0] <= 0)) { - float camperRegenMult = areThereAnyDamnBosses ? 1.25f : 2f; - int camperRegenCount = areThereAnyDamnBosses ? 1 : 4; - Player.lifeRegen = (int)(Player.lifeRegen * camperRegenMult); - Player.lifeRegenCount += camperRegenCount; + // Vanilla base regen rate which gets boosted when resting + // The first 6 boosts increment every 300 frames, up to 6 at 1800 + // Then, the last 3 boosts increment every 600 frames, up to 9 at 3600 which is the cap + int baseRegenRate = Math.Clamp(Player.lifeRegenTime / 300, 0, 6) + Math.Clamp((Player.lifeRegenTime - 1800) / 600, 0, 3); + // Normally 1.25 while resting and 0.5 while not + Player.lifeRegen += (int)(baseRegenRate * 0.75f); + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool(2)) { int regen = Dust.NewDust(Player.position, Player.width, Player.height, 12, 0f, 0f, 200, Color.OrangeRed, 1f); @@ -949,17 +982,6 @@ namespace CalamityMod.CalPlayer } } } - - if (BossRushEvent.BossRushActive && CalamityConfig.Instance.BossRushRegenCurse) - { - if (Player.lifeRegen > 0) - Player.lifeRegen = 0; - - Player.lifeRegenTime = 0; - - if (Player.lifeRegenCount > 0) - Player.lifeRegenCount = 0; - } } #endregion } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3abf67a65f..c9cf726359 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -46,6 +46,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Tiles.Ores; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -62,6 +63,7 @@ using Terraria.ID; using Terraria.ModLoader; using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; using CalamityMod.Items.Armor.Wulfrum; +using CalamityMod.Tiles.Abyss.AbyssAmbient; namespace CalamityMod.CalPlayer { @@ -75,7 +77,7 @@ namespace CalamityMod.CalPlayer // Give the player a 24% jump speed boost while wings are equipped, otherwise grant 4% more jump speed so that players can jump 7 tiles high if (Player.wingsLogic > 0) Player.jumpSpeedBoost += 1.2f; - else if (CalamityConfig.Instance.HigherJumpHeight) + else if (CalamityConfig.Instance.FasterJumpSpeed) Player.jumpSpeedBoost += 0.2f; // Decrease the counter on Fearmonger set turbo regeneration @@ -91,6 +93,9 @@ namespace CalamityMod.CalPlayer } OldPositions[0] = Player.position; + // Tile effects for touching tiles + HandleTileEffects(); + // Hurt the nearest NPC to the mouse if using the burning mouse. if (blazingCursorDamage || blazingCursorVisuals) HandleBlazingMouseEffects(); @@ -404,7 +409,6 @@ namespace CalamityMod.CalPlayer #region Adrenaline // This is how much Adrenaline will be changed by this frame. float adrenalineDiff = 0; - bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType()); bool wofAndNotHell = Main.wofNPCIndex >= 0 && Player.position.Y < (float)((Main.maxTilesY - 200) * 16); // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. @@ -452,10 +456,6 @@ namespace CalamityMod.CalPlayer // Stress Pills make Adrenaline charge 20% faster (meaning it takes 83.333% standard time to charge it). if (stressPills) adrenalineDiff *= 1.2f; - - // In the SCal fight, adrenaline charges 33% slower (meaning it takes 50% longer to fully charge it). - if (SCalAlive) - adrenalineDiff *= 0.67f; } @@ -489,6 +489,61 @@ namespace CalamityMod.CalPlayer #endregion #region Misc Effects + private void HandleTileEffects() + { + int astralOreID = ModContent.TileType(); + int auricOreID = ModContent.TileType(); + int scoriaOreID = ModContent.TileType(); + int abyssKelpID = ModContent.TileType(); + + int auricRejectionDamage = 300; + float auricRejectionKB = Player.noKnockback ? 20f : 40f; + + foreach (Point touchedTile in Collision.GetEntityEdgeTiles(Player)) + { + Tile tile = Main.tile[touchedTile]; + if (!tile.HasTile || !tile.HasUnactuatedTile) + continue; + + if (tile.TileType == abyssKelpID) + { + if (Player.velocity.Length() == 0) + { return; } + + Dust dust; + dust = Main.dust[Dust.NewDust(Player.Center, 16, 16, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + + // Ores below here + // Astral Ore inflicts Astral Infection briefly on contact + if (tile.TileType == astralOreID) + Player.AddBuff(ModContent.BuffType(), 2); + + // You will need to set each resistant item here for burning as it gets bypassed for somereason + if (tile.TileType == scoriaOreID && !Player.fireWalk) + Player.AddBuff(BuffID.Burning, 2); + + // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor + // Auric Rejection causes an electrical explosion that yeets the player a considerable distance + else if (tile.TileType == auricOreID && !auricSet) + { + // Cut grappling hooks so the player is surely thrown + Player.RemoveAllGrapplingHooks(); + + // Force Auric Ore to animate with its crackling electricity + AuricOre.Animate = true; + + var yeetVec = Vector2.Normalize(Player.Center - touchedTile.ToWorldCoordinates()); + Player.velocity += yeetVec * auricRejectionKB; + Player.Hurt(PlayerDeathReason.ByCustomReason(Player.name + " was not worthy"), auricRejectionDamage, 0); + Player.AddBuff(BuffID.Electrified, 300); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1")); + } + } + } private void HandleBlazingMouseEffects() { // The sigil's brightness slowly fades away every frame if not incinerating anything. @@ -521,7 +576,10 @@ namespace CalamityMod.CalPlayer // Create a direct strike to hit this specific NPC. var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sigilDamage, 0f, Player.whoAmI, i); + Projectile sigilStrike = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sigilDamage, 0f, Player.whoAmI, i); + + // Enable crits by setting the sigil's damage class to be whatever the player's strongest damage class is. + sigilStrike.DamageType = Player.GetBestClass(); // Incinerate the target with Vulnerability Hex. target.AddBuff(ModContent.BuffType(), VulnerabilityHex.CalamityDuration); @@ -725,7 +783,7 @@ namespace CalamityMod.CalPlayer if (providenceBurnIntensity > 0.45f) ProvidenceBurnEffectDrawer.ParticleSpawnRate = 1; - // Otherwise, if the intensity is too weak, but still presernt, cause the player to release holy cinders. + // Otherwise, if the intensity is too weak, but still present, cause the player to release holy cinders. else if (providenceBurnIntensity > 0f) { int cinderCount = (int)MathHelper.Lerp(1f, 4f, Utils.GetLerpValue(0f, 0.45f, providenceBurnIntensity, true)); @@ -745,7 +803,7 @@ namespace CalamityMod.CalPlayer ProvidenceBurnEffectDrawer.Update(); // Transformer immunity to Electrified - if (aSparkRare) + if (transformer) Player.buffImmune[BuffID.Electrified] = true; // Reduce breath meter while in icy water instead of chilling @@ -939,7 +997,7 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() += critUp; } - bool canProvideBuffs = profanedCrystalBuffs || (!profanedCrystal && pArtifact) || (profanedCrystal && DownedBossSystem.downedSCal && DownedBossSystem.downedExoMechs); + bool canProvideBuffs = profanedCrystalBuffs || (!profanedCrystal && pArtifact) || (profanedCrystal && DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs); bool attack = Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; // Guardian bonuses if not burnt out @@ -979,6 +1037,36 @@ namespace CalamityMod.CalPlayer } } + if (unstableGraniteCore) + { + zapActivity += 1; + if (zapActivity <= 300 && zapActivity % 30 == 0) + { + for (int arcProjCount = 0; arcProjCount < 3; arcProjCount++) + { + float maxDistance = 300f; + int target = -1; + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + float targetDist = Vector2.Distance(npc.Center, Player.Center); + if (targetDist < maxDistance && npc.Calamity().arcZapCooldown == 0 && npc.CanBeChasedBy()) + { + maxDistance = targetDist; + target = npcIndex; + } + } + if (target > 0) + { + unstableSelectedTarget = Main.npc[target]; + unstableSelectedTarget.Calamity().arcZapCooldown = 18; + Projectile.NewProjectile(Player.GetSource_FromThis(), new Vector2(Player.Center.X, Player.Center.Y - 20f), new Vector2(0f, -2f), ModContent.ProjectileType(), 18, 0f, Player.whoAmI, target, 3f); + target = -1; + } + } + } + else if (zapActivity > 600) { zapActivity = 0; } + } // You always get the max minions, even during the effect of the burnout debuff if (attack && canProvideBuffs) Player.maxMinions++; @@ -1106,14 +1194,12 @@ namespace CalamityMod.CalPlayer xerocDmg -= 2f; if (xerocDmg < 0f) xerocDmg = 0f; - if (aBulwarkRareMeleeBoostTimer > 0) - aBulwarkRareMeleeBoostTimer--; - if (bossRushImmunityFrameCurseTimer > 0) - bossRushImmunityFrameCurseTimer--; + if (hideOfDeusMeleeBoostTimer > 0) + hideOfDeusMeleeBoostTimer--; if (gaelRageAttackCooldown > 0) gaelRageAttackCooldown--; - if (projRefRareLifeRegenCounter > 0) - projRefRareLifeRegenCounter--; + if (evolutionLifeRegenCounter > 0) + evolutionLifeRegenCounter--; if (hurtSoundTimer > 0) hurtSoundTimer--; if (icicleCooldown > 0) @@ -1130,18 +1216,14 @@ namespace CalamityMod.CalPlayer tornadoCooldown--; if (ladHearts > 0) ladHearts--; - if (titanBoost > 0) - titanBoost--; if (prismaticLasers > 0) prismaticLasers--; if (dogTextCooldown > 0) dogTextCooldown--; if (titanCooldown > 0) titanCooldown--; - if (fungalSymbioteTimer > 0) - fungalSymbioteTimer--; - if (aBulwarkRareTimer > 0) - aBulwarkRareTimer--; + if (hideOfDeusTimer > 0) + hideOfDeusTimer--; if (hellbornBoost > 0) hellbornBoost--; if (persecutedEnchantSummonTimer < 1800) @@ -1176,15 +1258,6 @@ namespace CalamityMod.CalPlayer reaverRegenCooldown++; else reaverRegenCooldown = 0; - if (roverDrive) - { - if (roverDriveTimer < CalamityUtils.SecondsToFrames(30f)) - roverDriveTimer++; - if (roverDriveTimer >= CalamityUtils.SecondsToFrames(30f)) - roverDriveTimer = 0; - } - else - roverDriveTimer = 616; // Doesn't reset to zero to prevent exploits if (auralisAurora > 0) auralisAurora--; if (auralisAuroraCooldown > 0) @@ -1388,13 +1461,6 @@ namespace CalamityMod.CalPlayer if (avertorBonus) Player.GetDamage() += 0.1f; - if (roverDriveTimer < 616) - { - Player.statDefense += 15; - if (roverDriveTimer > 606) - Player.statDefense -= roverDriveTimer - 606; //so it scales down when the shield dies - } - // Fairy Boots bonus if (fairyBoots) { @@ -2006,8 +2072,6 @@ namespace CalamityMod.CalPlayer // New textures if (Main.netMode != NetmodeID.Server && Player.whoAmI == Main.myPlayer) { - Asset sulphSeaRain = ModContent.Request("CalamityMod/ExtraTextures/VanillaReplacements/RainSulphSea"); - Asset rainOriginal = ModContent.Request("CalamityMod/ExtraTextures/VanillaReplacements/RainOriginal"); Asset cometShard = ModContent.Request("CalamityMod/UI/HealthManaTextures/ManaCometShard"); Asset etherealCore = ModContent.Request("CalamityMod/UI/HealthManaTextures/ManaEtherealCore"); Asset phantomHeart = ModContent.Request("CalamityMod/UI/HealthManaTextures/ManaPhantomHeart"); @@ -2035,13 +2099,6 @@ namespace CalamityMod.CalPlayer break; } - if (Main.bloodMoon) - TextureAssets.Rain = rainOriginal; - else if (Main.raining && ZoneSulphur) - TextureAssets.Rain = sulphSeaRain; - else - TextureAssets.Rain = rainOriginal; - if (auricSet) TextureAssets.FlyingCarpet = carpetAuric; else @@ -2056,29 +2113,6 @@ namespace CalamityMod.CalPlayer // Rogue Stealth UpdateRogueStealth(); - // Trinket of Chi bonus - if (trinketOfChi) - { - if (trinketOfChiBuff) - { - Player.GetDamage() += 0.5f; - if (Player.itemAnimation > 0) - chiBuffTimer = 0; - } - - if (Player.StandingStill(0.1f) && !Player.mount.Active) - { - if (chiBuffTimer < 60) - chiBuffTimer++; - else - Player.AddBuff(ModContent.BuffType(), 6); - } - else - chiBuffTimer--; - } - else - chiBuffTimer = 0; - // Aquatic Emblem bonus if (aquaticEmblem) { @@ -2311,25 +2345,11 @@ namespace CalamityMod.CalPlayer if (astralInjection) { if (Player.statMana < Player.statManaMax2) - Player.statMana += 3; + Player.statMana += 2; if (Player.statMana > Player.statManaMax2) Player.statMana = Player.statManaMax2; } - if (holyWrath) - { - if (Player.FindBuffIndex(BuffID.Wrath) > -1) - Player.ClearBuff(BuffID.Wrath); - Player.GetDamage() += 0.12f; - } - - if (profanedRage) - { - if (Player.FindBuffIndex(BuffID.Rage) > -1) - Player.ClearBuff(BuffID.Rage); - Player.GetCritChance() += ProfanedRagePotion.CritBoost; - } - if (irradiated) Player.statDefense -= 10; @@ -2358,30 +2378,16 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() += 10; } - if (yPower) + // Trinket of Chi bonus + if (trinketOfChi) { - Player.endurance += 0.04f; - Player.statDefense += 10; - Player.pickSpeed -= 0.1f; - Player.GetDamage() += 0.05f; - Player.GetCritChance() += YharimsStimulants.CritBoost; - Player.GetKnockback() += 1f; - Player.moveSpeed += 0.075f; - } - - if (tScale) - { - Player.endurance += 0.05f; - Player.statDefense += 5; - Player.kbBuff = true; - if (titanBoost > 0) - { - Player.statDefense += 20; - Player.endurance += 0.05f; - } + if (chiBuffTimer < TrinketofChi.ChiBuffTimerMax) + chiBuffTimer++; + else + Player.AddBuff(ModContent.BuffType(), 6); } else - titanBoost = 0; + chiBuffTimer = 0; if (darkSunRing) { @@ -2390,7 +2396,7 @@ namespace CalamityMod.CalPlayer Player.GetKnockback() += 1.2f; Player.pickSpeed -= 0.15f; if (Main.eclipse || !Main.dayTime) - Player.statDefense += 15; + Player.statDefense += Main.eclipse ? 10 : 20; } if (eGauntlet) @@ -2428,9 +2434,6 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() += Vodka.CritBoost; } - if (grapeBeer) - Player.moveSpeed -= 0.05f; - if (moonshine) { Player.statDefense += 10; @@ -2453,8 +2456,7 @@ namespace CalamityMod.CalPlayer { if (Main.bloodMoon) { - Player.GetDamage() += 0.15f; - Player.GetCritChance() += BloodyMary.CritBoost; + Player.GetDamage() += 0.1f; Player.moveSpeed += 0.1f; } } @@ -2464,9 +2466,7 @@ namespace CalamityMod.CalPlayer if (Main.dayTime) { Player.statDefense += 5; - Player.GetDamage() += 0.03f; Player.GetCritChance() += Tequila.CritBoost; - Player.endurance += 0.03f; } } @@ -2475,9 +2475,7 @@ namespace CalamityMod.CalPlayer if (Main.dayTime) { Player.statDefense += 10; - Player.GetDamage() += 0.07f; Player.GetCritChance() += TequilaSunrise.CritBoost; - Player.endurance += 0.03f; } } @@ -2503,7 +2501,7 @@ namespace CalamityMod.CalPlayer } if (whiteWine) - Player.GetDamage() += 0.1f; + Player.GetDamage() += 0.08f; // Adjustment to the Tipsy debuff if (Player.tipsy) @@ -2568,7 +2566,6 @@ namespace CalamityMod.CalPlayer (soaring ? 0.1 : 0D) + (prismaticGreaves ? 0.1 : 0D) + (plagueReaper ? 0.05 : 0D) + - (draconicSurge ? 0.2 : 0D) + (Player.empressBrooch ? 0.25 : 0D); if (harpyRing) @@ -2577,15 +2574,6 @@ namespace CalamityMod.CalPlayer if (blueCandle) Player.moveSpeed += 0.1f; - // If the player has the Draconic Elixir cooldown, prevent Draconic Surge from being set as true by any means. - // This can be caused by other mod interference, e.g. by Luiafk. - if (Player.HasCooldown(Cooldowns.DraconicElixir.ID)) - { - draconicSurge = false; - if (Player.FindBuffIndex(ModContent.BuffType()) > -1) - Player.ClearBuff(ModContent.BuffType()); - } - // TODO -- crit is a float now, and knockback can be boosted for all classes if (community) { @@ -2621,8 +2609,7 @@ namespace CalamityMod.CalPlayer if (vHex) { Player.blind = true; - Player.statDefense -= 10; - Player.moveSpeed -= 0.1f; + Player.statDefense -= 20; if (Player.wingTimeMax < 0) Player.wingTimeMax = 0; @@ -2660,7 +2647,7 @@ namespace CalamityMod.CalPlayer } if (mushy) - Player.statDefense += 5; + Player.statDefense += 6; if (omniscience) { @@ -2682,57 +2669,16 @@ namespace CalamityMod.CalPlayer Player.lifeMagnet = true; } - if (cadence) - { - if (Player.FindBuffIndex(BuffID.Regeneration) > -1) - Player.ClearBuff(BuffID.Regeneration); - if (Player.FindBuffIndex(BuffID.Lifeforce) > -1) - Player.ClearBuff(BuffID.Lifeforce); - Player.lifeMagnet = true; - } - - if (Player.poisoned) - Player.moveSpeed -= 0.1f; - - if (Player.venom) - Player.moveSpeed -= 0.15f; - if (wDeath) - { - Player.GetDamage() -= 0.2f; - Player.moveSpeed -= 0.1f; - } - - if (dragonFire) - Player.moveSpeed -= 0.15f; - - if (hInferno) - Player.moveSpeed -= 0.25f; - - if (gsInferno) - Player.moveSpeed -= 0.15f; + Player.GetDamage() -= 0.25f; if (astralInfection) - { - Player.GetDamage() -= 0.1f; - Player.moveSpeed -= 0.15f; - } + Player.GetDamage() -= 0.15f; if (pFlames) { Player.blind = true; - Player.GetDamage() -= 0.1f; - Player.moveSpeed -= 0.15f; - } - - if (bBlood) - { - Player.blind = true; - Player.statDefense -= 3; - Player.moveSpeed += 0.1f; - Player.GetDamage() += 0.05f; - Player.GetDamage() -= 0.1f; - Player.GetDamage() -= 0.1f; + Player.GetDamage() -= 0.15f; } if (aCrunch && !laudanum) @@ -2765,7 +2711,7 @@ namespace CalamityMod.CalPlayer if (eFreeze || eutrophication) Player.velocity = Vector2.Zero; - if (vaporfied || teslaFreeze) + if (vaporfied || galvanicCorrosion) Player.velocity *= 0.98f; if (molluskSet) @@ -3079,11 +3025,11 @@ namespace CalamityMod.CalPlayer if (eArtifact) { - Player.manaCost *= 0.85f; - Player.maxMinions += 2; + Player.manaCost *= 0.75f; + Player.maxMinions++; } - if (gArtifact && Player.FindBuffIndex(ModContent.BuffType()) != -1) + if (auricSArtifact && Player.FindBuffIndex(ModContent.BuffType()) != -1) Player.maxMinions += Player.ownedProjectileCounts[ModContent.ProjectileType()]; if (pArtifact) @@ -3099,23 +3045,23 @@ namespace CalamityMod.CalPlayer if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -6f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); - gDefense = true; + gDefense = true; - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) - { - int guardian = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -3f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(guardian)) - Main.projectile[guardian].originalDamage = 1; - } + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) + { + int guardian = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -3f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(guardian)) + Main.projectile[guardian].originalDamage = 1; + } - gOffense = true; + gOffense = true; - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) - { - int guardian = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -1f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(guardian)) - Main.projectile[guardian].originalDamage = 1; - } + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) + { + int guardian = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -1f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(guardian)) + Main.projectile[guardian].originalDamage = 1; + } } } @@ -3292,7 +3238,7 @@ namespace CalamityMod.CalPlayer } } - if (CryoStone) + if (CryoStone || CryoStoneVanity) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); int damage = (int)Player.GetBestClassDamage().ApplyTo(70); @@ -3634,8 +3580,8 @@ namespace CalamityMod.CalPlayer ref int lostDef = ref bloodflareCoreLostDefense; if (lostDef > 0) { - // Defense regeneration occurs every four frames while defense is missing - if (Player.miscCounter % 4 == 0) + // Defense regeneration occurs every six frames while defense is missing + if (Player.miscCounter % 6 == 0) { --lostDef; if (bloodflareCore) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 11e94b81b4..dd086cef9d 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -62,12 +62,17 @@ namespace CalamityMod.CalPlayer if (flamingItemEnchant) target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); + + target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet; + target.Calamity().IncreasedColdEffects_CryoStone = CryoStone; + + target.Calamity().IncreasedElectricityEffects_Transformer = transformer; target.Calamity().IncreasedHeatEffects_Fireball = fireball; target.Calamity().IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; target.Calamity().IncreasedHeatEffects_HellfireTreads = hellfireTreads; - target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet; + target.Calamity().IncreasedSicknessEffects_ToxicHeart = toxicHeart; target.Calamity().IncreasedSicknessAndWaterEffects_EvergreenGin = evergreenGin; @@ -122,11 +127,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 120); break; - case ItemID.Excalibur: - case ItemID.TrueExcalibur: - target.AddBuff(BuffType(), 120); - break; - case ItemID.FieryGreatsword: case ItemID.MoltenPickaxe: case ItemID.MoltenHamaxe: @@ -141,7 +141,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Poisoned, 240); break; - case ItemID.LightsBane: case ItemID.NightsEdge: target.AddBuff(BuffID.ShadowFlame, 120); break; @@ -151,10 +150,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.ShadowFlame, 120); break; - case ItemID.BloodButcherer: - target.AddBuff(BuffType(), 60); - break; - case ItemID.IceSickle: case ItemID.Frostbrand: target.AddBuff(BuffID.Frostburn, 300); @@ -211,11 +206,16 @@ namespace CalamityMod.CalPlayer if (witheringWeaponEnchant) witheringDamageDone += (int)(damage * (crit ? 2D : 1D)); + cgn.IncreasedColdEffects_EskimoSet = eskimoSet; + cgn.IncreasedColdEffects_CryoStone = CryoStone; + + cgn.IncreasedElectricityEffects_Transformer = transformer; + cgn.IncreasedHeatEffects_Fireball = fireball; cgn.IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; cgn.IncreasedHeatEffects_HellfireTreads = hellfireTreads; - cgn.IncreasedColdEffects_EskimoSet = eskimoSet; + cgn.IncreasedSicknessEffects_ToxicHeart = toxicHeart; cgn.IncreasedSicknessAndWaterEffects_EvergreenGin = evergreenGin; @@ -254,21 +254,8 @@ namespace CalamityMod.CalPlayer Player.HealEffect(2); break; - case ProjectileID.TheRottedFork: - case ProjectileID.TheMeatball: - case ProjectileID.CrimsonYoyo: - case ProjectileID.BloodCloudRaining: - case ProjectileID.BloodRain: - target.AddBuff(BuffType(), 60); - break; - - case ProjectileID.BallOHurt: - case ProjectileID.CorruptYoyo: - target.AddBuff(BuffID.ShadowFlame, 60); - break; - case ProjectileID.ObsidianSwordfish: - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); break; case ProjectileID.Flamelash: @@ -298,12 +285,7 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 60); break; - case ProjectileID.LightBeam: - case ProjectileID.Gungnir: - case ProjectileID.PaladinsHammerFriendly: - target.AddBuff(BuffType(), 120); - break; - + // TODO -- REMOVE IN 1.4.4 LABOR OF LOVE PORT case ProjectileID.DarkLance: target.AddBuff(BuffID.ShadowFlame, 120); break; @@ -349,7 +331,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Frostburn, 120); break; - case ProjectileID.SnowBallFriendly: case ProjectileID.IceBolt: case ProjectileID.FrostDaggerfish: case ProjectileID.FrostburnArrow: @@ -437,11 +418,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 120); break; - case ItemID.Excalibur: - case ItemID.TrueExcalibur: - target.AddBuff(BuffType(), 120); - break; - case ItemID.FieryGreatsword: case ItemID.MoltenPickaxe: case ItemID.MoltenHamaxe: @@ -456,7 +432,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Poisoned, 240); break; - case ItemID.LightsBane: case ItemID.NightsEdge: target.AddBuff(BuffType(), 120); break; @@ -466,10 +441,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 120); break; - case ItemID.BloodButcherer: - target.AddBuff(BuffType(), 60); - break; - case ItemID.IceSickle: case ItemID.Frostbrand: target.AddBuff(BuffID.Frostburn, 300); @@ -508,12 +479,8 @@ namespace CalamityMod.CalPlayer Player.HealEffect(2); break; - case ProjectileID.TheRottedFork: - target.AddBuff(BuffType(), 60); - break; - case ProjectileID.ObsidianSwordfish: - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); break; case ProjectileID.Flamelash: @@ -543,12 +510,7 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 60); break; - case ProjectileID.LightBeam: - case ProjectileID.Gungnir: - case ProjectileID.PaladinsHammerFriendly: - target.AddBuff(BuffType(), 120); - break; - + // TODO -- REMOVE IN 1.4.4 LABOR OF LOVE PORT case ProjectileID.DarkLance: target.AddBuff(BuffType(), 120); break; @@ -594,7 +556,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Frostburn, 120); break; - case ProjectileID.SnowBallFriendly: case ProjectileID.IceBoomerang: case ProjectileID.IceBolt: case ProjectileID.FrostDaggerfish: @@ -632,22 +593,13 @@ namespace CalamityMod.CalPlayer if (npcCheck) { - if (item.CountsAsClass() && aBulwarkRare && aBulwarkRareTimer == 0) + if (item.CountsAsClass() && hideOfDeus && hideOfDeusTimer == 0) { - aBulwarkRareTimer = 10; + hideOfDeusTimer = 10; int bulwarkStarDamage = (int)Player.GetTotalDamage().ApplyTo(320); for (int n = 0; n < 3; n++) CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), bulwarkStarDamage, 5f, Player.whoAmI); } - if (unstableGraniteCore && crit && Player.ownedProjectileCounts[ProjectileType()] < 5) - { - for (int s = 0; s < 3; s++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int graniteSparkDamage = (int)Player.GetBestClassDamage().ApplyTo(15); - Projectile.NewProjectile(source, position, velocity, ProjectileType(), graniteSparkDamage, 0f, Player.whoAmI); - } - } if (astralStarRain && crit && astralStarRainCooldown <= 0) { astralStarRainCooldown = 60; @@ -656,7 +608,8 @@ namespace CalamityMod.CalPlayer int projectileType = Utils.SelectRandom(Main.rand, new int[] { ProjectileType(), - ProjectileID.HallowStar, + ProjectileID.BeeCloakStar, + ProjectileID.StarCloakStar, ProjectileType() }); int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120); @@ -669,7 +622,6 @@ namespace CalamityMod.CalPlayer if (item.CountsAsClass()) { - titanBoost = 600; if (npcCheck) { if (ataxiaGeyser && Player.ownedProjectileCounts[ProjectileType()] < 3) @@ -726,17 +678,6 @@ namespace CalamityMod.CalPlayer if (npcCheck) { - if (unstableGraniteCore && crit && Player.ownedProjectileCounts[ProjectileType()] < 5 && proj.type != ProjectileType()) - { - for (int s = 0; s < 3; s++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int graniteSparkDamage = (int)Player.GetBestClassDamage().ApplyTo(15); - Projectile.NewProjectile(source, position, velocity, ProjectileType(), graniteSparkDamage, 0f, Player.whoAmI); - Player.ownedProjectileCounts[ProjectileType()]++; - } - } - if (astralStarRain && crit && astralStarRainCooldown <= 0) { astralStarRainCooldown = 60; @@ -745,7 +686,8 @@ namespace CalamityMod.CalPlayer int projectileType = Utils.SelectRandom(Main.rand, new int[] { ProjectileType(), - ProjectileID.HallowStar, + ProjectileID.BeeCloakStar, + ProjectileID.StarCloakStar, ProjectileType() }); int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120); @@ -776,7 +718,6 @@ namespace CalamityMod.CalPlayer if (proj.IsTrueMelee()) { - titanBoost = 600; if (soaring) { double useTimeMultiplier = 0.85 + (heldItem.useTime * heldItem.useAnimation / 3600D); //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 + 1 = 21.7% boost @@ -791,9 +732,9 @@ namespace CalamityMod.CalPlayer if (Player.wingTime > Player.wingTimeMax) Player.wingTime = Player.wingTimeMax; } - if (aBulwarkRare && aBulwarkRareTimer == 0) + if (hideOfDeus && hideOfDeusTimer == 0) { - aBulwarkRareTimer = 10; + hideOfDeusTimer = 10; int bulwarkStarDamage = (int)Player.GetTotalDamage().ApplyTo(320); for (int n = 0; n < 3; n++) CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), bulwarkStarDamage, 5f, Player.whoAmI); @@ -890,7 +831,7 @@ namespace CalamityMod.CalPlayer if (silvaMage && silvaMageCooldown <= 0 && (proj.penetrate == 1 || proj.timeLeft <= 5)) { silvaMageCooldown = 300; - SoundEngine.PlaySound(SoundID.Zombie103 , proj.position); //So scuffed, just because zombie sounds werent ported normally + SoundEngine.PlaySound(SoundID.Zombie103 , proj.Center); //So scuffed, just because zombie sounds werent ported normally // Silva Mage Blasts: 800 + 60%, softcap on the whole combined thing starts at 1400 int silvaBurstDamage = CalamityUtils.DamageSoftCap(800.0 + 0.6 * proj.damage, 1400); Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), silvaBurstDamage, 8f, Player.whoAmI); @@ -1070,13 +1011,14 @@ namespace CalamityMod.CalPlayer break; } } - int damage = (int)Player.GetTotalDamage().ApplyTo(300); + int damage = (int)Player.GetTotalDamage().ApplyTo(180); int projectileIndex = Projectile.NewProjectile(spawnSource, projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), damage, 15f, Main.myPlayer, 16f, 16f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].DamageType = DamageClass.Generic; Main.projectile[projectileIndex].netUpdate = true; - Main.projectile[projectileIndex].localNPCHitCooldown = 10; + Main.projectile[projectileIndex].usesIDStaticNPCImmunity = true; + Main.projectile[projectileIndex].idStaticNPCHitCooldown = 30; } } @@ -1226,7 +1168,7 @@ namespace CalamityMod.CalPlayer if (type != -1) { - int damage = (int)Player.GetTotalDamage().ApplyTo(30); + int damage = (int)Player.GetTotalDamage().ApplyTo(24); float speed = Main.rand.NextFloat(5f, 11f); int cloud = Projectile.NewProjectile(spawnSource, position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, damage, proj.knockBack, Player.whoAmI); if (cloud.WithinBounds(Main.maxProjectiles)) @@ -1270,8 +1212,8 @@ namespace CalamityMod.CalPlayer for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int damage = (int)Player.GetTotalDamage().ApplyTo(10); - int spark = Projectile.NewProjectile(spawnSource, position, velocity, ProjectileType(), damage, 0f, Player.whoAmI); + int damage = (int)Player.GetTotalDamage().ApplyTo(9); + int spark = Projectile.NewProjectile(spawnSource, position, velocity, ProjectileType(), damage, 0f, Player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) { Main.projectile[spark].DamageType = DamageClass.Generic; @@ -1288,16 +1230,13 @@ namespace CalamityMod.CalPlayer #region Debuffs public void NPCDebuffs(NPC target, bool melee, bool ranged, bool magic, bool summon, bool rogue, bool whip, bool proj) { - if (melee) //prevents Deep Sea Dumbell from snagging true melee debuff memes + if (melee) // Prevents Deep Sea Dumbell from snagging true melee debuff memes { if (eGauntlet) { - int duration = 300; - target.AddBuff(BuffID.OnFire, duration, false); - target.AddBuff(BuffID.Frostburn, duration, false); - target.AddBuff(BuffType(), duration, false); + CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire3); } - if (cryogenSoul || frostFlare) + if (cryogenSoul) { CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn); } @@ -1312,13 +1251,17 @@ namespace CalamityMod.CalPlayer } if (melee || rogue || whip) { - if (armorCrumbling) + if (flaskCrumbling) { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } - if (aWeapon) + if (flaskBrimstone) { - CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + CalamityUtils.Inflict246DebuffsNPC(target, BuffType(), 4f); + } + if (flaskHoly) + { + target.AddBuff(BuffType(), 180, false); } } if (rogue) @@ -1397,6 +1340,10 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 180); } } + if (voidOfExtinction) + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + if (frostFlare) + CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn2); if (omegaBlueChestplate) target.AddBuff(BuffType(), 180); if (sulfurSet) @@ -1405,25 +1352,16 @@ namespace CalamityMod.CalPlayer { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } - if (dsSetBonus) - { - CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); - } if (alchFlask) { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } - if (holyWrath) - { - target.AddBuff(BuffType(), 180, false); - } if (vexation) { if ((Player.armor[0].type == ItemType() || Player.armor[0].type == ItemType() || Player.armor[0].type == ItemType()) && Player.armor[1].type == ItemType() && Player.armor[2].type == ItemType()) { - target.AddBuff(BuffID.CursedInferno, 90, false); target.AddBuff(BuffID.Venom, 120, false); } } @@ -1434,36 +1372,30 @@ namespace CalamityMod.CalPlayer if (melee) { if (eGauntlet) - { - int duration = 300; - target.AddBuff(BuffID.OnFire, duration, false); - target.AddBuff(BuffID.Frostburn, duration, false); - target.AddBuff(BuffType(), duration, false); - } - if (cryogenSoul || frostFlare) - { + CalamityUtils.Inflict246DebuffsPvp(target, BuffID.OnFire3); + + if (cryogenSoul) CalamityUtils.Inflict246DebuffsPvp(target, BuffID.Frostburn); - } + if (yInsignia) - { CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); - } + if (ataxiaFire) - { CalamityUtils.Inflict246DebuffsPvp(target, BuffID.OnFire, 4f); - } } + if (melee || rogue || whip) { - if (armorCrumbling) - { + if (flaskCrumbling) CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); - } - if (aWeapon) - { - CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); - } + + if (flaskBrimstone) + CalamityUtils.Inflict246DebuffsPvp(target, BuffType(), 4f); + + if (flaskHoly) + target.AddBuff(BuffType(), 180, false); } + if (rogue) { switch (Player.meleeEnchant) @@ -1487,44 +1419,34 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); break; } + if (titanHeartMask) - { target.AddBuff(BuffType(), 120); - } + if (corrosiveSpine) - { - target.AddBuff(BuffID.Poisoned, 240); - } + target.AddBuff(BuffID.Venom, 240); } + if (summon) { if (pArtifact && !profanedCrystal) - { target.AddBuff(BuffType(), 300); - } + if (profanedCrystalBuffs) - { target.AddBuff(Main.dayTime ? BuffType() : BuffType(), 600); - } if (holyMinions) - { target.AddBuff(BuffType(), 180); - } if (shadowMinions) - { target.AddBuff(BuffID.ShadowFlame, 180); - } if (voltaicJelly) { - //100% chance for Star Tainted Generator or Nucleogenesis - //20% chance for Voltaic Jelly + // 100% chance for Star Tainted Generator or Nucleogenesis + // 20% chance for Voltaic Jelly if (Main.rand.NextBool(starTaintedGenerator ? 1 : 5)) - { target.AddBuff(BuffID.Electrified, 60); - } } if (starTaintedGenerator) @@ -1533,29 +1455,31 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 180); } } + + if (voidOfExtinction) + CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); + + if (frostFlare) + CalamityUtils.Inflict246DebuffsPvp(target, BuffID.Frostburn2); + if (omegaBlueChestplate) target.AddBuff(BuffType(), 180); + if (sulfurSet) target.AddBuff(BuffID.Poisoned, 120); + if (alchFlask) - { CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); - } + if (abyssalAmulet) - { CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); - } - if (holyWrath) - { - target.AddBuff(BuffType(), 180, false); - } + if (vexation) { if ((Player.armor[0].type == ItemType() || Player.armor[0].type == ItemType() || Player.armor[0].type == ItemType()) && Player.armor[1].type == ItemType() && Player.armor[2].type == ItemType()) { - target.AddBuff(BuffID.CursedInferno, 90, false); target.AddBuff(BuffID.Venom, 120, false); } } @@ -1604,10 +1528,16 @@ namespace CalamityMod.CalPlayer } } + if (gladiatorSword && !target.SpawnedFromStatue && target.life <= 0 && !target.CountsAsACritter && !target.dontCountMe && target.aiStyle != 9 && target.Calamity().gladiatorOnKill) + { + target.Calamity().gladiatorOnKill = false; + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); + } + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !Player.moonLeech) { // Increases the degree to which Spectre Healing set contributes to the lifesteal cap - if (Player.ghostHeal) + if (Player.ghostHeal && proj.CountsAsClass()) { float cooldownMult = 0.2f; cooldownMult -= proj.numHits * 0.05f; @@ -1628,17 +1558,23 @@ namespace CalamityMod.CalPlayer Main.player[Main.myPlayer].lifeSteal -= cooldown; } - if (vampiricTalisman && proj.CountsAsClass() && crit) + if (vampiricTalisman && proj.CountsAsClass() && crit) { float heal = MathHelper.Clamp(damage * 0.011f, 0f, 5f); if ((int)heal > 0) + { CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, 1200f, 3f); + float cooldown = heal * 2f; + Main.player[Main.myPlayer].lifeSteal -= cooldown; + } } if (bloodyGlove && proj.CountsAsClass() && modProj.stealthStrike) { + float cooldown = 20; Player.statLife += 2; Player.HealEffect(2); + Main.player[Main.myPlayer].lifeSteal -= cooldown; } if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue) @@ -1838,6 +1774,12 @@ namespace CalamityMod.CalPlayer } } + if (gladiatorSword && !target.SpawnedFromStatue && target.life <= 0 && !target.CountsAsACritter && !target.dontCountMe && target.aiStyle != 9 && target.Calamity().gladiatorOnKill) + { + target.Calamity().gladiatorOnKill = false; + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); + } + if (reaverDefense) { if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !Player.moonLeech) diff --git a/CalPlayer/Dashes/AsgardianAegisDash.cs b/CalPlayer/Dashes/AsgardianAegisDash.cs index aa0d0234ea..5a6cfded4b 100644 --- a/CalPlayer/Dashes/AsgardianAegisDash.cs +++ b/CalPlayer/Dashes/AsgardianAegisDash.cs @@ -82,9 +82,7 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.Damage = (int)player.GetTotalDamage().ApplyTo(300f); int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(135); - int holyEruptionDamage = (int)player.GetBestClassDamage().ApplyTo(90); Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), supremeExplosionDamage, 20f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), holyEruptionDamage, 5f, Main.myPlayer, 0f, 0f); npc.AddBuff(ModContent.BuffType(), 300); } } diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index baaec7b39e..c45a18b728 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Projectiles.Typeless; @@ -72,6 +73,7 @@ namespace CalamityMod.CalPlayer.Dashes int holyExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(60); Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), holyExplosionDamage, 15f, Main.myPlayer, 0f, 0f); + npc.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/CalPlayer/Dashes/ElysianAegisDash.cs b/CalPlayer/Dashes/ElysianAegisDash.cs index 27b300aa10..97fab65f06 100644 --- a/CalPlayer/Dashes/ElysianAegisDash.cs +++ b/CalPlayer/Dashes/ElysianAegisDash.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Projectiles.Typeless; @@ -74,9 +75,8 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.Damage = (int)player.GetTotalDamage().ApplyTo(250f); int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(120); - int holyEruptionDamage = (int)player.GetBestClassDamage().ApplyTo(80); Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), supremeExplosionDamage, 15f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), holyEruptionDamage, 5f, Main.myPlayer, 0f, 0f); + npc.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index 930f5f106c..322ed4d9cd 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -71,7 +71,7 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { - SoundEngine.PlaySound(SoundID.Item67, player.position); + SoundEngine.PlaySound(SoundID.Item67, player.Center); for (int j = 0; j < 30; j++) { diff --git a/CalPlayer/DrawLayers/RoverDriveShield.png b/CalPlayer/DrawLayers/RoverDriveShield.png deleted file mode 100644 index 9250879d99..0000000000 Binary files a/CalPlayer/DrawLayers/RoverDriveShield.png and /dev/null differ diff --git a/CalPlayer/DrawLayers/RoverDriveShieldLayer.cs b/CalPlayer/DrawLayers/RoverDriveShieldLayer.cs deleted file mode 100644 index e1c036b7d6..0000000000 --- a/CalPlayer/DrawLayers/RoverDriveShieldLayer.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.CalPlayer.DrawLayers -{ - public class RoverDriveShieldLayer : PlayerDrawLayer - { - public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.Skin); - - public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - return drawInfo.shadow == 0f && !drawPlayer.dead && modPlayer.roverDriveTimer < 616 && modPlayer.roverDrive; - } - - protected override void Draw(ref PlayerDrawSet drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - Texture2D texture = ModContent.Request("CalamityMod/CalPlayer/DrawLayers/RoverDriveShield").Value; - Vector2 drawPos = drawPlayer.Center - Main.screenPosition + new Vector2(0f, drawPlayer.gfxOffY); - Rectangle frame = texture.Frame(1, 11, 0, drawPlayer.Calamity().roverFrame); - Color color = Color.White * 0.625f; - Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f / 11f); - float scale = 1f + (float)Math.Cos(Main.GlobalTimeWrappedHourly) * 0.1f; - SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - - drawInfo.DrawDataCache.Add(new DrawData(texture, drawPos, frame, color, 0f, origin, scale, spriteEffects, 0)); - } - } -} diff --git a/CalamityConfig.cs b/CalamityConfig.cs index a5dfabdaa3..47ffa1cdb0 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -18,6 +18,7 @@ using CalamityMod.Items.PermanentBoosters; using CalamityMod.UI.Rippers; using CalamityMod.UI.DraedonsArsenal; using CalamityMod.UI.SulphurousWaterMeter; +using CalamityMod.Items.Tools.ClimateChange; namespace CalamityMod { @@ -57,6 +58,12 @@ namespace CalamityMod [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.ParticleLimit")] public int ParticleLimit { get; set; } + [Label("$Mods.CalamityMod.Config.EntryTitle.BossesStopWeather")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossesStopWeather")] + public bool BossesStopWeather { get; set; } + [Label("$Mods.CalamityMod.Config.EntryTitle.Screenshake")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -205,6 +212,12 @@ namespace CalamityMod #region General Gameplay Changes [Header("$Mods.CalamityMod.Config.SectionTitle.Gameplay")] + [Label("$Mods.CalamityMod.Config.EntryTitle.FasterFallHotkey")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.FasterFallHotkey")] + public bool FasterFallHotkey { get; set; } + [Label("$Mods.CalamityMod.Config.EntryTitle.RemoveReforgeRNG")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -223,6 +236,12 @@ namespace CalamityMod [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossZen")] public bool BossZen { get; set; } + [Label("$Mods.CalamityMod.Config.EntryTitle.PotionSelling")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.PotionSelling")] + public bool PotionSelling { get; set; } + [Label("$Mods.CalamityMod.Config.EntryTitle.TownNPCsSpawnAtNight")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(false)] @@ -276,13 +295,6 @@ namespace CalamityMod [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.FasterJumpSpeed")] public bool FasterJumpSpeed { get; set; } - - [Label("$Mods.CalamityMod.Config.EntryTitle.FasterFallHotkey")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.FasterFallHotkey")] - public bool FasterFallHotkey { get; set; } - [Label("$Mods.CalamityMod.Config.EntryTitle.FasterTilePlacement")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -361,28 +373,6 @@ namespace CalamityMod public float AdrenalineMeterPosY { get; set; } #endregion - #region Boss Rush Curses - [Header("$Mods.CalamityMod.Config.SectionTitle.BossRushCurses")] - - [Label("$Mods.CalamityMod.Config.EntryTitle.BossRushRegenCurse")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossRushRegenCurse")] - public bool BossRushRegenCurse { get; set; } - - [Label("$Mods.CalamityMod.Config.EntryTitle.BossRushDashCurse")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossRushDashCurse")] - public bool BossRushDashCurse { get; set; } - - [Label("$Mods.CalamityMod.Config.EntryTitle.BossRushIFrameCurse")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - [Tooltip("$Mods.CalamityMod.Config.EntryTooltip.BossRushIFrameCurse")] - public bool BossRushIFrameCurse { get; set; } - #endregion - #region Dynamic Localization (Item Icon Injection) // Because it is impossible to know the item IDs of Calamity items until runtime, @@ -395,8 +385,9 @@ namespace CalamityMod var configLabelItemEmbeds = new KeyValuePair[] { new("Afterimages", ItemID.SteampunkGoggles), - new("Screenshake", ModContent.ItemType()), new("ParticleLimit", ItemID.FragmentStardust), + new("BossesStopWeather", ModContent.ItemType()), + new("Screenshake", ModContent.ItemType()), new("StealthInvisibility", ModContent.ItemType()), new("ShopNewAlert", ItemID.GoldChest), new("WikiStatusMessage", ItemID.Book), @@ -422,9 +413,11 @@ namespace CalamityMod new("SpeedrunTimerPosX", ItemID.LaserRuler), new("SpeedrunTimerPosY", ItemID.LaserRuler), + new("FasterFallHotkey", ModContent.ItemType()), new("RemoveReforgeRNG", ItemID.TinHammer), new("EarlyHardmodeProgressionRework", ItemID.Pwnhammer), new("BossZen", ModContent.ItemType()), + new("PotionSelling", ItemID.SpelunkerPotion), new("TownNPCsSpawnAtNight", ItemID.ClothierVoodooDoll), new("TownNPCSpawnRateMultiplier", ItemID.GuideVoodooDoll), new("BossHealthBoost", ItemID.LifeCrystal), @@ -432,7 +425,6 @@ namespace CalamityMod new("FasterBaseSpeed", ItemID.HermesBoots), new("HigherJumpHeight", ItemID.ShinyRedBalloon), new("FasterJumpSpeed", ItemID.FrogLeg), - new("FasterFallHotkey", ModContent.ItemType()), new("FasterTilePlacement", ItemID.ArchitectGizmoPack), new("NerfExpertDebuffs", ItemID.AnkhCharm), diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index 5f7fd17506..62f801ac11 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -1,7 +1,6 @@ using Terraria.ModLoader; namespace CalamityMod - { public class CalamityKeybinds : ModSystem { @@ -18,6 +17,7 @@ namespace CalamityMod public static ModKeybind AngelicAllianceHotKey { get; private set; } public static ModKeybind GodSlayerDashHotKey { get; private set; } public static ModKeybind ExoChairSlowdownHotkey { get; private set; } + public static ModKeybind DashHotkey { get; private set; } public override void Load() { @@ -35,6 +35,7 @@ namespace CalamityMod AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "Angelic Alliance Blessing", "G"); GodSlayerDashHotKey = KeybindLoader.RegisterKeybind(Mod, "God Slayer Dash", "H"); ExoChairSlowdownHotkey = KeybindLoader.RegisterKeybind(Mod, "Exo Chair Slow Down", "RightShift"); + DashHotkey = KeybindLoader.RegisterKeybind(Mod, "Dash Double Tap Override", "F"); } public override void Unload() @@ -52,6 +53,7 @@ namespace CalamityMod AngelicAllianceHotKey = null; GodSlayerDashHotKey = null; ExoChairSlowdownHotkey = null; + DashHotkey = null; } } } diff --git a/CalamityLists.cs b/CalamityLists.cs index 4d9a20c91e..47238d602b 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -3,8 +3,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Accessories.Wings; -using CalamityMod.Items.Ammo.FiniteUse; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Fishing.BrimstoneCragCatches; @@ -14,7 +12,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; -using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -22,14 +19,13 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.AdultEidolonWyrm; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Crags; @@ -117,6 +113,8 @@ namespace CalamityMod public static List livingFireBlockList; public static List amalgamBuffList; public static List persistentBuffList; + public static List MushroomWeaponIDs; + public static List MushroomProjectileIDs; public static List zombieList; public static List demonEyeList; @@ -462,7 +460,6 @@ namespace CalamityMod "Shiny", "Whale", "The Infinity", - "Toasty", "MrCreamen", "TemperedAether", "LucasTwocas", @@ -529,6 +526,7 @@ namespace CalamityMod ProjectileID.ChargedBlasterCannon, ProjectileID.MedusaHead, + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -588,6 +586,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), @@ -976,7 +975,8 @@ namespace CalamityMod BuffType(), BuffType(), BuffType(), - BuffType() + BuffType(), + BuffType() }; alcoholList = new List() @@ -1366,19 +1366,16 @@ namespace CalamityMod ItemType(), ItemType(), ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), - ItemType(), - ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, @@ -1426,30 +1423,23 @@ namespace CalamityMod amalgamBuffList = new List() { - 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(), @@ -1530,8 +1520,9 @@ namespace CalamityMod persistentBuffList = new List() { - BuffType(), - BuffType(), + BuffType(), + BuffType(), + BuffType(), BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, @@ -1542,6 +1533,34 @@ namespace CalamityMod BuffID.WeaponImbuePoison }; + MushroomWeaponIDs = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemID.Hammush, + ItemID.MushroomSpear, + ItemID.Shroomerang + }; + + MushroomProjectileIDs = new List() + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileID.TruffleSpore, + ProjectileID.MushroomSpear, + ProjectileID.Shroomerang + }; + zombieList = new List() { NPCID.Zombie, @@ -1731,6 +1750,7 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), @@ -1764,6 +1784,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -1800,7 +1821,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), }; @@ -2214,14 +2235,14 @@ namespace CalamityMod { NPCID.Deerclops, 315000 }, // 30 seconds - { NPCID.SkeletronHead, 160000 }, // 30 seconds + { NPCID.SkeletronHead, 150000 }, // 30 seconds { NPCID.SkeletronHand, 60000 }, { NPCID.WallofFlesh, 450000 }, // 30 seconds { NPCID.WallofFleshEye, 450000 }, // Tier 2 - { NPCID.QueenSlimeBoss, 100000 }, // 30 seconds + { NPCID.QueenSlimeBoss, 150000 }, // 30 seconds { NPCID.QueenSlimeMinionBlue, 6000 }, { NPCID.QueenSlimeMinionPink, 6000 }, { NPCID.QueenSlimeMinionPurple, 5000 }, @@ -2234,7 +2255,7 @@ namespace CalamityMod { NPCID.TheDestroyerTail, 250000 }, { NPCID.Probe, 10000 }, - { NPCID.SkeletronPrime, 150000 }, // 30 seconds + { NPCID.SkeletronPrime, 160000 }, // 30 seconds { NPCID.PrimeVice, 54000 }, { NPCID.PrimeCannon, 45000 }, { NPCID.PrimeSaw, 45000 }, @@ -2250,7 +2271,7 @@ namespace CalamityMod { NPCID.GolemFistLeft, 25000 }, { NPCID.GolemFistRight, 25000 }, - { NPCID.HallowBoss, 180000 }, // 30 seconds + { NPCID.HallowBoss, 200000 }, // 30 seconds { NPCID.DukeFishron, 290000 }, // 30 seconds @@ -2344,10 +2365,9 @@ namespace CalamityMod { NPCType(), 41 }, { NPCType(), 41 }, { NPCType(), 41 }, - { NPCType(), 42 }, - { NPCID.QueenSlimeBoss, 43 }, - { NPCID.HallowBoss, 44 }, - { NPCID.Deerclops, 45 } + { NPCID.QueenSlimeBoss, 42 }, + { NPCID.HallowBoss, 43 }, + { NPCID.Deerclops, 44 } }; bossMinionList = new List() @@ -2444,6 +2464,7 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), @@ -2553,6 +2574,8 @@ namespace CalamityMod livingFireBlockList = null; amalgamBuffList = null; persistentBuffList = null; + MushroomWeaponIDs = null; + MushroomProjectileIDs = null; zombieList = null; demonEyeList = null; diff --git a/CalamityMod.cs b/CalamityMod.cs index 6584fc9039..739c1dd199 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -4,6 +4,8 @@ using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; +using System.Linq; +using CalamityMod.Systems; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; @@ -17,20 +19,15 @@ using CalamityMod.FluidSimulation; using CalamityMod.ILEditing; using CalamityMod.Items; using CalamityMod.Items.Dyes.HairDye; -using CalamityMod.Items.PermanentBoosters; -using CalamityMod.Items.Pets; using CalamityMod.Items.VanillaArmorChanges; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Localization; using CalamityMod.NPCs.AdultEidolonWyrm; using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; @@ -52,7 +49,6 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Particles; @@ -78,6 +74,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Config; +using Terraria.DataStructures; [assembly: InternalsVisibleTo("CalTestHelpers")] [assembly: InternalsVisibleTo("InfernumMode")] @@ -100,6 +97,9 @@ namespace CalamityMod public static Asset manaOriginal; public static Asset carpetOriginal; public static Texture2D AstralSky; + public static Texture2D SulphurSeaSky; + public static Texture2D SulphurSeaSkyFront; + public static Texture2D SulphurSeaSurface; // DR data structure public static SortedDictionary DRValues; @@ -150,6 +150,9 @@ namespace CalamityMod internal Mod varia = null; internal Mod wikithis = null; + //hell background + //private List loadCache; + #region Load public override void Load() { @@ -245,11 +248,37 @@ namespace CalamityMod BalancingChangesManager.Load(); BaseIdleHoldoutProjectile.LoadAll(); PlayerDashManager.Load(); + + /* + //keep this disabled for now, hell bg system isnt used and there is a better way to load it + //hell background loading + HellBGManager.Load(); + + //load stuff for hell background + loadCache = new List(); + + foreach (Type type in Code.GetTypes()) + { + if (!type.IsAbstract && type.GetInterfaces().Contains(typeof(HellBGLoad))) + { + var instance = Activator.CreateInstance(type); + loadCache.Add(instance as HellBGLoad); + } + } + + for (int k = 0; k < loadCache.Count; k++) + { + loadCache[k].Load(); + } + */ } private void LoadClient() { AstralSky = ModContent.Request("CalamityMod/Skies/AstralSky", AssetRequestMode.ImmediateLoad).Value; + SulphurSeaSky = ModContent.Request("CalamityMod/Skies/SulphurSeaSky", AssetRequestMode.ImmediateLoad).Value; + SulphurSeaSkyFront = ModContent.Request("CalamityMod/Skies/SulphurSeaSkyFront", AssetRequestMode.ImmediateLoad).Value; + SulphurSeaSurface = ModContent.Request("CalamityMod/Skies/SulphurSeaSurface", AssetRequestMode.ImmediateLoad).Value; // TODO -- Sky shaders should probably be loaded in a ModSystem Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); @@ -273,9 +302,6 @@ namespace CalamityMod Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); - Filters.Scene["CalamityMod:AdultEidolonWyrm"] = new Filter(new AEWScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.25f).UseOpacity(0.35f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:AdultEidolonWyrm"] = new AEWSky(); - Filters.Scene["CalamityMod:Signus"] = new Filter(new SignusScreenShaderData("FilterMiniTower").UseColor(0.35f, 0.1f, 0.55f).UseOpacity(0.35f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:Signus"] = new SignusSky(); @@ -288,7 +314,15 @@ namespace CalamityMod Filters.Scene["CalamityMod:MonolithAccursed"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:MonolithAccursed"] = new MonolithSky(); + //Normal intensity is 4f + Texture2D DistortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/BlobbyNoise", AssetRequestMode.ImmediateLoad).Value; + Filters.Scene["CalamityMod:DrunkCrabulon"] = new Filter(new DrunkCrabScreenShaderData("FilterHeatDistortion").UseImage(DistortionTexture, 0, null).UseIntensity(20f), EffectPriority.VeryHigh); + + Filters.Scene["CalamityMod:BrimstoneCrag"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0f).UseOpacity(0f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:BrimstoneCrag"] = new BrimstoneCragSky(); + SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); + SkyManager.Instance["CalamityMod:SulphurSea"] = new SulphurSeaSky(); SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky(); SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky(); @@ -311,6 +345,7 @@ namespace CalamityMod // Centralizing head texture registration like this seems absurdly stiff Apollo.LoadHeadIcons(); Artemis.LoadHeadIcons(); + Cryogen.LoadHeadIcons(); DevourerofGodsHead.LoadHeadIcons(); DevourerofGodsBody.LoadHeadIcons(); DevourerofGodsTail.LoadHeadIcons(); @@ -433,6 +468,21 @@ namespace CalamityMod manaOriginal = null; carpetOriginal = null; + /* + //unload hell background stuff + HellBGManager.Unload(); + + if (loadCache != null) + { + foreach (var loadable in loadCache) + { + loadable.Unload(); + } + } + + loadCache = null; + */ + ILChanges.Unload(); Instance = null; base.Unload(); @@ -767,6 +817,7 @@ namespace CalamityMod { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, { ModContent.NPCType(), velocityScaleMin }, diff --git a/Cooldowns/DraconicElixir.cs b/Cooldowns/DraconicElixir.cs deleted file mode 100644 index 79a1a5448e..0000000000 --- a/Cooldowns/DraconicElixir.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; - -namespace CalamityMod.Cooldowns -{ - public class DraconicElixir : CooldownHandler - { - public static new string ID => "DraconicElixir"; - public override bool ShouldDisplay => true; - public override string DisplayName => "Draconic Surge Cooldown"; - public override string Texture => "CalamityMod/Cooldowns/DraconicElixir"; - public override Color OutlineColor => Color.Lerp(new Color(141, 199, 90), new Color(221, 187, 106), (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.5f + 0.5f); - public override Color CooldownStartColor => new Color(165, 22, 46); - public override Color CooldownEndColor => new Color(216, 103, 43); - } -} diff --git a/Cooldowns/DraconicElixir.png b/Cooldowns/DraconicElixir.png deleted file mode 100644 index 15fe8a8f7a..0000000000 Binary files a/Cooldowns/DraconicElixir.png and /dev/null differ diff --git a/Cooldowns/DraconicElixirOutline.png b/Cooldowns/DraconicElixirOutline.png deleted file mode 100644 index 74b72fab5a..0000000000 Binary files a/Cooldowns/DraconicElixirOutline.png and /dev/null differ diff --git a/Cooldowns/DraconicElixirOverlay.png b/Cooldowns/DraconicElixirOverlay.png deleted file mode 100644 index 7657d20bd2..0000000000 Binary files a/Cooldowns/DraconicElixirOverlay.png and /dev/null differ diff --git a/Cooldowns/EclipseEvade.png b/Cooldowns/EclipseEvade.png index 04f9364317..b1f01fa4da 100644 Binary files a/Cooldowns/EclipseEvade.png and b/Cooldowns/EclipseEvade.png differ diff --git a/Cooldowns/EclipseEvadeOutline.png b/Cooldowns/EclipseEvadeOutline.png index c607d42282..60befb3fd7 100644 Binary files a/Cooldowns/EclipseEvadeOutline.png and b/Cooldowns/EclipseEvadeOutline.png differ diff --git a/Cooldowns/EclipseEvadeOverlay.png b/Cooldowns/EclipseEvadeOverlay.png index 2f0ea83ee4..c674189e3c 100644 Binary files a/Cooldowns/EclipseEvadeOverlay.png and b/Cooldowns/EclipseEvadeOverlay.png differ diff --git a/Cooldowns/LifeSteal.cs b/Cooldowns/LifeSteal.cs new file mode 100644 index 0000000000..0cb11b571e --- /dev/null +++ b/Cooldowns/LifeSteal.cs @@ -0,0 +1,15 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Cooldowns +{ + public class LifeSteal : CooldownHandler + { + public static new string ID => "LifeSteal"; + public override bool ShouldDisplay => instance.player.lifeSteal < 0f; + public override string DisplayName => "Life Steal Cooldown"; + public override string Texture => "CalamityMod/Cooldowns/LifeSteal"; + public override Color OutlineColor => new Color(255, 142, 165); + public override Color CooldownStartColor => Color.Lerp(new Color(255, 216, 216), new Color(255, 117, 117), instance.Completion); + public override Color CooldownEndColor => Color.Lerp(new Color(255, 216, 216), new Color(255, 117, 117), instance.Completion); + } +} diff --git a/Cooldowns/LifeSteal.png b/Cooldowns/LifeSteal.png new file mode 100644 index 0000000000..ff204d7181 Binary files /dev/null and b/Cooldowns/LifeSteal.png differ diff --git a/Cooldowns/LifeStealOutline.png b/Cooldowns/LifeStealOutline.png new file mode 100644 index 0000000000..86633b605a Binary files /dev/null and b/Cooldowns/LifeStealOutline.png differ diff --git a/Cooldowns/LifeStealOverlay.png b/Cooldowns/LifeStealOverlay.png new file mode 100644 index 0000000000..3abb76845e Binary files /dev/null and b/Cooldowns/LifeStealOverlay.png differ diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 5560f28a94..4488f4a01a 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -683,8 +683,8 @@ namespace CalamityMod.DataStructures { id = AttunementID.Phoenix; name = "Phoenix's Pride"; - function_description = "Hold the attack button to swing Galaxia around you, accelerating over time. The swirling nebula constantly emits homing cosmic bolts"; - function_description_extra = "Releasing the attack button hurls the sword towards your cursor alongside a burst of 6 gigantic cosmic bolts. The sword then quickly returns to your hand"; + function_description = "Hold left click to swing Galaxia around you, accelerating over time\nThe swirling nebula constantly emits homing cosmic bolts"; + function_description_extra = "Release left click to hurl Galaxia toward the cursor alongside 6 gigantic cosmic bolts"; tooltipColor = new Color(255, 87, 0); tooltipColor2 = new Color(255, 143, 0); @@ -723,7 +723,7 @@ namespace CalamityMod.DataStructures { id = AttunementID.Aries; name = "Aries' Wrath"; - function_description = "Throw Galaxia to your cursor, holding it in place with constellations. Galaxia follows your cursor, rapidly spinning to shred enemies"; + function_description = "Throw Galaxia to your cursor, holding it in place with constellations\nGalaxia follows your cursor, rapidly spinning to shred enemies"; function_description_extra = "Striking enemies causes nebulous explosions which spawn homing cosmic bolts"; tooltipColor = new Color(196, 89, 201); tooltipColor2 = new Color(255, 0, 0); @@ -762,8 +762,8 @@ namespace CalamityMod.DataStructures { id = AttunementID.Polaris; name = "Polaris' Gaze"; //It carries the mark of the Northern Star - function_description = "Hold the attack button to channel the Northern Star's power into a tight vortex of galactic energies, bound by concentric rings of stars.\nThe vortex powers up over time and when hitting enemies"; - function_description_extra = "Release the attack button to fire off the charged star. Attacking again immediately thereafter dashes to the star, emitting a nova of cosmic bolts"; + function_description = "Hold left click to channel Galaxia's power into a tight vortex of galactic energies\nThe vortex powers up over time and when hitting enemies"; + function_description_extra = "Release left click to fire off the charged star in straight line\nPress left click again immediately to dash towards the star and release cosmic bolts"; tooltipColor = new Color(128, 189, 255); tooltipColor2 = new Color(255, 128, 140); @@ -800,9 +800,9 @@ namespace CalamityMod.DataStructures public AndromedaAttunement() { id = AttunementID.Andromeda; - name = "Andromeda's Stride"; //EHEEHEHEHE GOD ERASING BECAUSE THE ANDROMEDA BOSS WAS SCRAPPED (ALSO KNOWN AS A "GOD" BEING "ERASED") EHEHEHE - function_description = "Hold the attack button to charge a god-erasing lunge, release to unleash the devastating blow. Galaxia emits cosmic bolts while charging"; - function_description_extra = "Striking the earth with the lunge will cause a massive impact which summons an apocalyptic storm of cosmic energies"; + name = "Andromeda's Stride"; + function_description = "Hold left click to charge a god-erasing lunge, release to unleash the devastating blow\nGalaxia emits cosmic bolts while charging"; + function_description_extra = "Lunging into the ground will cause a shockwave which summons a storm of cosmic energies"; tooltipColor = new Color(132, 128, 255); tooltipColor2 = new Color(194, 166, 255); diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 017db119a3..7dda451120 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -4,7 +4,7 @@ using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; @@ -319,7 +319,7 @@ namespace CalamityMod { NPCID.EaterofWorldsHead, new int[] { 25, 55, 77, 88, 132 } }, { NPCID.EaterofWorldsBody, new int[] { 15, 24, 32, 40, 60 } }, { NPCID.EaterofWorldsTail, new int[] { 10, 16, 24, 32, 42 } }, - { NPCID.VileSpit, new int[] { -1, 64, 64, 64, 96 } }, + { NPCID.VileSpitEaterOfWorlds, new int[] { -1, 64, 64, 64, 96 } }, { NPCID.BrainofCthulhu, new int[] { 30, 54, 81, 99, 135 } }, { NPCID.Creeper, new int[] { 20, 36, 54, 72, 90 } }, @@ -445,7 +445,7 @@ namespace CalamityMod { ModContent.NPCType(), new int[] { 70, 140, 160, 170, 210 } }, { ModContent.NPCType(), new int[] { 100, 220, 242, 253, 330 } }, - { ModContent.NPCType(), new int[] { 75, 150, 172, 184, 240 } }, + { ModContent.NPCType(), new int[] { 66, 112, 128, 138, 180 } }, { NPCID.Golem, new int[] { 90, 144, 176, 192, 240 } }, { NPCID.GolemHead, new int[] { 80, 128, 144, 160, 192 } }, @@ -494,6 +494,7 @@ namespace CalamityMod { ModContent.NPCType(), new int[] { 120, 240, 264, 278, 336 } }, { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, { ModContent.NPCType(), new int[] { 150, 300, 330, 348, 450 } }, { ModContent.NPCType(), new int[] { 130, 260, 288, 304, 390 } }, @@ -566,11 +567,14 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 48, 66 } }, { new Tuple(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 72, 96 } }, // 66 damage in non-rev master mode { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 68, 84, 92, 126 } }, // 102 damage in non-rev master mode - { new Tuple(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 40, 60, 76, 84, 114 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 92, 126 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, @@ -578,6 +582,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 34, 52, 68, 74, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 24, 48, 60, 68, 90 } }, { new Tuple(NPCID.WallofFleshEye, ProjectileID.EyeLaser), new int[] { @@ -689,6 +694,7 @@ namespace CalamityMod { new Tuple(NPCID.DukeFishron, ProjectileID.Sharknado), new int[] { 80, 100, 184, 200, 270 } }, // 150 in non-rev master mode { new Tuple(NPCID.DukeFishron, ProjectileID.Cthulunado), new int[] { 160, 200, 232, 248, 348 } }, // 300 in non-rev master mode + // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 188, 258 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 188, 258 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, @@ -715,8 +721,18 @@ namespace CalamityMod { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalDeathray), new int[] { 100, 200, 260, 284, 390 } }, // 300 in non-rev master mode { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 320, 352, 370, 528 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 198, 284 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 356, 498 } }, @@ -761,7 +777,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 400, 440, 464, 660 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 364, 492 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 340, 462 } }, @@ -777,6 +793,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 444, 600 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 476, 484, 500, 726 } }, diff --git a/Dusts/CalamityDusts.cs b/Dusts/CalamityDusts.cs index 8a296ee119..f894ef9f72 100644 --- a/Dusts/CalamityDusts.cs +++ b/Dusts/CalamityDusts.cs @@ -1,4 +1,4 @@ -namespace CalamityMod.Dusts +namespace CalamityMod.Dusts { public enum CalamityDusts : int { @@ -16,5 +16,6 @@ namespace CalamityMod.Dusts PurpleCosmilite = 173, // This is what God Slayer Slugs use, at least. I'm not sure about other Cosmilite stuff, didn't bother to check. BlueCosmilite = 180, + MiracleBlight = 163, } } diff --git a/Dusts/CinderBlossomDust.cs b/Dusts/CinderBlossomDust.cs new file mode 100644 index 0000000000..2b23116d6d --- /dev/null +++ b/Dusts/CinderBlossomDust.cs @@ -0,0 +1,46 @@ +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Dusts +{ + public class CinderBlossomDust : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.05f; + dust.velocity.Y *= 0.5f; + dust.noGravity = true; + dust.noLight = true; + dust.alpha = 0; + dust.fadeIn = 12f; + dust.scale *= Main.rand.NextFloat(0.75f, 1f); + } + + public override bool Update(Dust dust) + { + float strength = dust.scale * 1.4f; + Lighting.AddLight(dust.position, 0.025f * strength, 0.1f * strength, 0.1f * strength); + + if (Main.rand.Next(20) == 0) + { + dust.alpha += 5; + } + + if (Main.rand.Next(12) == 0) + { + dust.velocity.X += Main.rand.NextFloat(-0.1f, 0.1f); + dust.velocity.Y += Main.rand.NextFloat(0.02f, 0.08f); + } + + dust.position -= dust.velocity; + + if (dust.alpha > 255) + { + dust.active = false; + } + + return false; + } + } +} \ No newline at end of file diff --git a/Dusts/CinderBlossomDust.png b/Dusts/CinderBlossomDust.png new file mode 100644 index 0000000000..abfbb39119 Binary files /dev/null and b/Dusts/CinderBlossomDust.png differ diff --git a/Effects/ArtAttackTrail.xnb b/Effects/ArtAttackTrail.xnb index 231853e120..8c6d6b95d4 100644 Binary files a/Effects/ArtAttackTrail.xnb and b/Effects/ArtAttackTrail.xnb differ diff --git a/Effects/ArtemisLaserShader.xnb b/Effects/ArtemisLaserShader.xnb index cf0ac79d93..5440f33bfb 100644 Binary files a/Effects/ArtemisLaserShader.xnb and b/Effects/ArtemisLaserShader.xnb differ diff --git a/Effects/CustomShader.xnb b/Effects/AstralFogShader.xnb similarity index 100% rename from Effects/CustomShader.xnb rename to Effects/AstralFogShader.xnb diff --git a/Effects/BasicPrimitiveShader.xnb b/Effects/BasicPrimitiveShader.xnb index 82e6f14567..9a1ba5ab5f 100644 Binary files a/Effects/BasicPrimitiveShader.xnb and b/Effects/BasicPrimitiveShader.xnb differ diff --git a/Effects/BasicTint.xnb b/Effects/BasicTint.xnb index 7d2ca5de7b..4b02bc2bdc 100644 Binary files a/Effects/BasicTint.xnb and b/Effects/BasicTint.xnb differ diff --git a/Effects/BlueStaticShader.fx b/Effects/BlueStaticShader.fx new file mode 100644 index 0000000000..51c42aaac8 --- /dev/null +++ b/Effects/BlueStaticShader.fx @@ -0,0 +1,49 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float4 uShaderSpecificData; +float coordinateZoomFactor; +bool useStaticLine; +bool useTrueNoise; + +float Random(float2 coords) +{ + return abs(frac(sin(dot(coords, float2(17.8342, 74.8819))) * 53648)); +} + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + // Calculate a noise value that very, very rapidly descends downward. + // So fast that it gives the appearance of TV static. This as an overall effect on the entire texture. + float noise = Random(coords * coordinateZoomFactor * 0.3 + float2(0, frac(uTime * -97.3))); + + // Calculate a base noise value that makes a bright line scroll down the screen. This is achieved by using a strongly squished sinusoid that scrolls downward and + // taking its resulting value as a 0-1 interpolant. + float brightLineInterpolant = useStaticLine ? pow(sin(uTime * 3.1 - coords.y * 5.4) * 0.5 + 0.5, 4.96) : 0; + + // After the initial bright line value is calculated, incorporate the X axis to weaker extent. This allows the line to have bends and look less unnaturally simple. + brightLineInterpolant += pow(sin(uTime * 1.9 - coords.x * 2.4) * 0.5 + 0.5, 2.51) * 0.55; + + // Lastly, apply the noise from above, and clamp the entire interpolant between 0-1 before passing it in as a color multiplier. + brightLineInterpolant += noise * (useStaticLine ? 0.16 : 0.91); + + return float4(uColor, 1) * lerp(1, 6, saturate(brightLineInterpolant)) * sampleColor * tex2D(uImage0, coords).a * 0.2; +} +technique Technique1 +{ + pass GlitchPass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/BlueStaticShader.xnb b/Effects/BlueStaticShader.xnb new file mode 100644 index 0000000000..edaedf5ae1 Binary files /dev/null and b/Effects/BlueStaticShader.xnb differ diff --git a/Effects/BordernadoFire.xnb b/Effects/BordernadoFire.xnb index 28f7b524a8..121eeed7fe 100644 Binary files a/Effects/BordernadoFire.xnb and b/Effects/BordernadoFire.xnb differ diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 40ec339aae..ef3559e599 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -10,162 +10,361 @@ namespace CalamityMod.Effects // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public class CalamityShaders { - public static Effect AstralFogShader; - public static Effect LightShader; - public static Effect SCalMouseShader; - public static Effect TentacleShader; - public static Effect TeleportDisplacementShader; - public static Effect LightDistortionShader; - public static Effect PhaseslayerRipShader; - public static Effect FadedUVMapStreakShader; - public static Effect FlameStreakShader; - public static Effect FadingSolidTrailShader; - public static Effect ScarletDevilShader; - public static Effect BordernadoFireShader; - public static Effect PrismCrystalShader; - public static Effect ImpFlameTrailShader; - public static Effect SCalShieldShader; - public static Effect RancorMagicCircleShader; - public static Effect BasicTintShader; - public static Effect CircularBarShader; - public static Effect CircularBarSpriteShader; - public static Effect DoGDisintegrationShader; - public static Effect ArtAttackTrailShader; - public static Effect CircularAoETelegraph; - public static Effect IntersectionClipShader; - public static Effect LocalLinearTransformationShader; - public static Effect BasicPrimitiveShader; - public static Effect ArtemisLaserShader; - public static Effect ExobladeSlashShader; - public static Effect ExobladePierceShader; - public static Effect ExoVortexShader; - public static Effect SideStreakTrailShader; - public static Effect HeavenlyGaleTrailShader; - public static Effect HeavenlyGaleLightningShader; - public static Effect PrimTextureOverlayShader; + private const string ShaderPath = "Effects/"; + internal const string CalamityShaderPrefix = "CalamityMod:"; - public static Effect BaseFusableParticleEdgeShader; - public static Effect AdditiveFusableParticleEdgeShader; + // made by boffin. Source code not available. Creates fog in the astral infection + internal static Effect AstralFogShader; - public static Effect DoGPortalShader; + // + // All below shaders created by Dominic Karma + // + #region Dominic's Shaders - public static Effect FluidShaders; + // The Dance of Light's Blinding Light + internal static Effect DanceOfLightBlindingShader; + + // Calamity accessory + internal static Effect CalamityAccessoryMouseShader; + + // Subsuming Vortex tentacles + internal static Effect SubsumingVortexTentacleShader; + + // Draedon teleporting shader + internal static Effect DraedonTeleportShader; + + // UNKNOWN -- PROBABLY UNUSED + internal static Effect LightDistortionShader; + + // Phaseslayer red energy trail + internal static Effect PhaseslayerRipShader; + + // Generic UV-fade streak trail shader. Used by many things? + internal static Effect FadedUVMapStreakShader; + + // Generic flaming streak trail shader. Used by many things? + internal static Effect FlameStreakShader; + + // Generic solid trail shader. Used by many things? + internal static Effect FadingSolidTrailShader; + + // Scarlet Devil main spear glowing trail. BEWARE: Is reused by many other items! + internal static Effect ScarletDevilShader; + + // Yharon border suns (or flame pillars?) unsure. it's one or the other. maybe both + internal static Effect BordernadoFireShader; + + // Photon Ripper hardlight teeth trail shader + internal static Effect PrismCrystalShader; + + // Generic flame trail. BEWARE: Reused by Apollo, Artemis, Cosmilamp, Gem Tech broken gems, and Persecuted enchant portal demons + internal static Effect ImpFlameTrailShader; + + // Supreme Witch, Calamitas' force field (which is her visual hitbox) + internal static Effect SCalShieldShader; + + // Rancor's alchemical / satanic circle which floats near the player. The laser is emitted from here + internal static Effect RancorMagicCircleShader; + + // Generic colored glow shader. BEWARE: Used by about a billion things, including Ares telegraphs, the Biome Blade line, etc. + internal static Effect BasicTintShader; + + // Generic "pie chart" shader that renders only certain arc sectors of things. Used for the Cooldown Rack and various other visuals. + internal static Effect CircularBarShader; + + // Cooldown Rack shader used to draw the cooldown's icon appropriately. + internal static Effect CircularBarSpriteShader; + + // Devourer of Gods' death animation where he disintegrates into purple energy stuff. + internal static Effect DoGDisintegrationShader; + + // Art Attack's main projectile trail shader (Visually designed to match Paper Mario) + internal static Effect ArtAttackTrailShader; + + // Generic AoE telegraph. Used for Ares' nukes to denote their area of effect. + internal static Effect CircularAoETelegraph; + + // Clips a sprite along a fixed plane. Used by Stream Gouge to have half-spears come out of portals. + internal static Effect IntersectionClipShader; + + // Used by Dom's Bladecrest Oathsword. Appears to govern the swing animation. + internal static Effect LocalLinearTransformationShader; + + // UNUSED -- Probably leftover from Dominic's experiments with applying shaders to primitives (arbitrary GPU-rendered triangles) + internal static Effect BasicPrimitiveShader; + + // Artemis Ohio Beam. Also used by get fixed boi Nuclear Terror's "G-FUEL BEAM" + internal static Effect ArtemisLaserShader; + + // Exoblade's melee slash trails. Also used by Terratomere + internal static Effect ExobladeSlashShader; + + // Exoblade's projectile on-hit "aniume slash marks". Also used by Terratomere + internal static Effect ExobladePierceShader; + + // Used by Subsuming Vortex's various vortices. Draws the main vortices + internal static Effect ExoVortexShader; + + // Used by Subsuming Vortex's side vortices. Draws the swirling energy tendrils. + internal static Effect SideStreakTrailShader; + + // Used by Heavenly Gale's hardlight arrows. + internal static Effect HeavenlyGaleTrailShader; + + // Used by Heavenly Gale's exo lightning strikes. Also used by Stormfront Razor lightning. + internal static Effect HeavenlyGaleLightningShader; + + // Used in the Codebreaker on Draedon's sprite while communicating with him. + internal static Effect BlueStaticShader; + + // Used by Acid Eels, presumably to have their snaking movements look more smooth. + internal static Effect PrimTextureOverlayShader; + + // Used by Devourer of Gods. Renders the portal that he escapes through at the end of phase 1. + internal static Effect DoGPortalShader; + + // Fusable particles. See the FusableParticleManager for comments on how this system works. + // These shaders are leveraged to render the results of the fusable particle simulation to the screen. + // The "Base" shader draws the particles themselves. + // The "Additive" shader actually FUSES the particles into their blobby mess. + // + // Backing textures vary. The primary use of this system is Gruesome Eminence. + internal static Effect BaseFusableParticleEdgeShader; + internal static Effect AdditiveFusableParticleEdgeShader; + + // Used to render the results of Navier-Stokes fluid simulations. + internal static Effect FluidShaders; + #endregion + + // + // All below shaders were added to Calamity by IbanPlay + // Authorship between IbanPlay and other SLR devs unknown + // + #region Iban's Shaders + + // Used by Coral Spout and Titanium Railgun while charging to indicate current projectile spread. + internal static Effect SpreadTelegraph; + + // Used by Wulfrum Screwdriver and Titanium Railgun. Renders a pixelly "laser sight". + internal static Effect PixelatedSightLine; + + // Used by the Wulfrum Treasure Pinger to highlight tiles in range + internal static Effect WulfrumTilePing; + + // Used by the Wulfrum Scaffold Kit to highlight locations where Scaffold tiles will be placed + internal static Effect WulfrumScaffoldSelection; + + // Used to render the Rover Drive's force field around the player + internal static Effect RoverDriveShield; + + // UNUSED -- Probably leftover from Iban's work on the Biome Blade and Ark lines. + internal static Effect RotateSprite; + + // Used on Exoblade to draw the sword swinging dramatically. This was the edit Iban made to Dom's Exoblade. + internal static Effect SwingSprite; + #endregion + + // + // All below shaders created by Ozzatron + // + #region Ozz's Shaders + + // Used on players and NPCs when they have the Miracle Blight debuff. + internal static Effect MiracleBlight; + #endregion + + // Shorthand to register a loaded shader in Terraria's graphics engine + // All shaders registered this way are accessible under GameShaders.Misc + // They will use the prefix described above + private static void RegisterMiscShader(Effect shader, string passName, string registrationName) + { + Ref shaderPointer = new(shader); + MiscShaderData passParamRegistration = new(shaderPointer, passName); + GameShaders.Misc[$"{CalamityShaderPrefix}{registrationName}"] = passParamRegistration; + } + + private static void RegisterSceneFilter(ScreenShaderData passReg, string registrationName, EffectPriority priority = EffectPriority.High) + { + string prefixedRegistrationName = $"{CalamityShaderPrefix}{registrationName}"; + Filters.Scene[prefixedRegistrationName] = new Filter(passReg, priority); + Filters.Scene[prefixedRegistrationName].Load(); + } + + // Shorthand to register a loaded shader in Terraria's graphics engine + // All shaders registered this way are accessible under Filters.Scene + // They will use the prefix described above + private static void RegisterScreenShader(Effect shader, string passName, string registrationName, EffectPriority priority = EffectPriority.High) + { + Ref shaderPointer = new(shader); + ScreenShaderData passParamRegistration = new(shaderPointer, passName); + RegisterSceneFilter(passParamRegistration, registrationName, priority); + } public static void LoadShaders() { if (Main.dedServ) return; - AstralFogShader = CalamityMod.Instance.Assets.Request("Effects/CustomShader", AssetRequestMode.ImmediateLoad).Value; - LightShader = CalamityMod.Instance.Assets.Request("Effects/LightBurstShader", AssetRequestMode.ImmediateLoad).Value; - TentacleShader = CalamityMod.Instance.Assets.Request("Effects/TentacleShader", AssetRequestMode.ImmediateLoad).Value; - TeleportDisplacementShader = CalamityMod.Instance.Assets.Request("Effects/TeleportDisplacementShader", AssetRequestMode.ImmediateLoad).Value; - SCalMouseShader = CalamityMod.Instance.Assets.Request("Effects/SCalMouseShader", AssetRequestMode.ImmediateLoad).Value; - LightDistortionShader = CalamityMod.Instance.Assets.Request("Effects/DistortionShader", AssetRequestMode.ImmediateLoad).Value; - PhaseslayerRipShader = CalamityMod.Instance.Assets.Request("Effects/PhaseslayerRipShader", AssetRequestMode.ImmediateLoad).Value; - ScarletDevilShader = CalamityMod.Instance.Assets.Request("Effects/ScarletDevilStreak", AssetRequestMode.ImmediateLoad).Value; - BordernadoFireShader = CalamityMod.Instance.Assets.Request("Effects/BordernadoFire", AssetRequestMode.ImmediateLoad).Value; - PrismCrystalShader = CalamityMod.Instance.Assets.Request("Effects/PrismCrystalStreak", AssetRequestMode.ImmediateLoad).Value; - FadedUVMapStreakShader = CalamityMod.Instance.Assets.Request("Effects/FadedUVMapStreak", AssetRequestMode.ImmediateLoad).Value; - FlameStreakShader = CalamityMod.Instance.Assets.Request("Effects/Flame", AssetRequestMode.ImmediateLoad).Value; - FadingSolidTrailShader = CalamityMod.Instance.Assets.Request("Effects/FadingSolidTrail", AssetRequestMode.ImmediateLoad).Value; - ImpFlameTrailShader = CalamityMod.Instance.Assets.Request("Effects/ImpFlameTrail", AssetRequestMode.ImmediateLoad).Value; - SCalShieldShader = CalamityMod.Instance.Assets.Request("Effects/SupremeShieldShader", AssetRequestMode.ImmediateLoad).Value; - RancorMagicCircleShader = CalamityMod.Instance.Assets.Request("Effects/RancorMagicCircle", AssetRequestMode.ImmediateLoad).Value; - BasicTintShader = CalamityMod.Instance.Assets.Request("Effects/BasicTint", AssetRequestMode.ImmediateLoad).Value; - CircularBarShader = CalamityMod.Instance.Assets.Request("Effects/CircularBarShader", AssetRequestMode.ImmediateLoad).Value; - CircularBarSpriteShader = CalamityMod.Instance.Assets.Request("Effects/CircularBarSpriteShader", AssetRequestMode.ImmediateLoad).Value; - DoGDisintegrationShader = CalamityMod.Instance.Assets.Request("Effects/DoGDisintegration", AssetRequestMode.ImmediateLoad).Value; - ArtAttackTrailShader = CalamityMod.Instance.Assets.Request("Effects/ArtAttackTrail", AssetRequestMode.ImmediateLoad).Value; - CircularAoETelegraph = CalamityMod.Instance.Assets.Request("Effects/CircularAoETelegraph", AssetRequestMode.ImmediateLoad).Value; - IntersectionClipShader = CalamityMod.Instance.Assets.Request("Effects/IntersectionClipShader", AssetRequestMode.ImmediateLoad).Value; - LocalLinearTransformationShader = CalamityMod.Instance.Assets.Request("Effects/LocalLinearTransformationShader", AssetRequestMode.ImmediateLoad).Value; - BasicPrimitiveShader = CalamityMod.Instance.Assets.Request("Effects/BasicPrimitiveShader", AssetRequestMode.ImmediateLoad).Value; - ArtemisLaserShader = CalamityMod.Instance.Assets.Request("Effects/ArtemisLaserShader", AssetRequestMode.ImmediateLoad).Value; - ExobladeSlashShader = CalamityMod.Instance.Assets.Request("Effects/ExobladeSlashShader", AssetRequestMode.ImmediateLoad).Value; - ExobladePierceShader = CalamityMod.Instance.Assets.Request("Effects/ExobladePierceShader", AssetRequestMode.ImmediateLoad).Value; - ExoVortexShader = CalamityMod.Instance.Assets.Request("Effects/ExoVortexShader", AssetRequestMode.ImmediateLoad).Value; - SideStreakTrailShader = CalamityMod.Instance.Assets.Request("Effects/SideStreakTrail", AssetRequestMode.ImmediateLoad).Value; - HeavenlyGaleTrailShader = CalamityMod.Instance.Assets.Request("Effects/HeavenlyGaleTrailShader", AssetRequestMode.ImmediateLoad).Value; - HeavenlyGaleLightningShader = CalamityMod.Instance.Assets.Request("Effects/HeavenlyGaleLightningShader", AssetRequestMode.ImmediateLoad).Value; - PrimTextureOverlayShader = CalamityMod.Instance.Assets.Request("Effects/PrimTextureOverlayShader", AssetRequestMode.ImmediateLoad).Value; + AssetRepository calAss = CalamityMod.Instance.Assets; - BaseFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/BaseFusableParticleEdgeShader", AssetRequestMode.ImmediateLoad).Value; - AdditiveFusableParticleEdgeShader = CalamityMod.Instance.Assets.Request("Effects/ParticleFusion/AdditiveFusableParticleEdgeShader", AssetRequestMode.ImmediateLoad).Value; + // Shorthand to load shaders immediately. + // Strings provided to LoadShader are the .xnb file paths. + Effect LoadShader(string path) => calAss.Request($"{ShaderPath}{path}", AssetRequestMode.ImmediateLoad).Value; - DoGPortalShader = CalamityMod.Instance.Assets.Request("Effects/ScreenShaders/DoGPortalShader", AssetRequestMode.ImmediateLoad).Value; + // + // Loading and registering each individual compiled shader for use. + // - FluidShaders = CalamityMod.Instance.Assets.Request("Effects/FluidShaders", AssetRequestMode.ImmediateLoad).Value; + AstralFogShader = LoadShader("AstralFogShader"); + var astralPassReg = new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f); + RegisterSceneFilter(astralPassReg, "Astral", EffectPriority.VeryHigh); - Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); + #region Loading Dominic's Shaders - Filters.Scene["CalamityMod:LightBurst"] = new Filter(new ScreenShaderData(new Ref(LightShader), "BurstPass"), EffectPriority.VeryHigh); - Filters.Scene["CalamityMod:LightBurst"].Load(); + DanceOfLightBlindingShader = LoadShader("LightBurstShader"); + RegisterScreenShader(DanceOfLightBlindingShader, "BurstPass", "LightBurst"); - GameShaders.Misc["CalamityMod:FireMouse"] = new MiscShaderData(new Ref(SCalMouseShader), "DyePass"); - GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); - GameShaders.Misc["CalamityMod:TeleportDisplacement"] = new MiscShaderData(new Ref(TeleportDisplacementShader), "GlitchPass"); - GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"] = new MiscShaderData(new Ref(PhaseslayerRipShader), "TrailPass"); - GameShaders.Misc["CalamityMod:TrailStreak"] = new MiscShaderData(new Ref(FadedUVMapStreakShader), "TrailPass"); - GameShaders.Misc["CalamityMod:Flame"] = new MiscShaderData(new Ref(FlameStreakShader), "TrailPass"); - GameShaders.Misc["CalamityMod:FadingSolidTrail"] = new MiscShaderData(new Ref(FadingSolidTrailShader), "TrailPass"); - GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"] = new MiscShaderData(new Ref(ScarletDevilShader), "TrailPass"); - GameShaders.Misc["CalamityMod:Bordernado"] = new MiscShaderData(new Ref(BordernadoFireShader), "TrailPass"); - GameShaders.Misc["CalamityMod:PrismaticStreak"] = new MiscShaderData(new Ref(PrismCrystalShader), "TrailPass"); - GameShaders.Misc["CalamityMod:ImpFlameTrail"] = new MiscShaderData(new Ref(ImpFlameTrailShader), "TrailPass"); - GameShaders.Misc["CalamityMod:SupremeShield"] = new MiscShaderData(new Ref(SCalShieldShader), "ShieldPass"); - GameShaders.Misc["CalamityMod:RancorMagicCircle"] = new MiscShaderData(new Ref(RancorMagicCircleShader), "ShieldPass"); - GameShaders.Misc["CalamityMod:BasicTint"] = new MiscShaderData(new Ref(BasicTintShader), "TintPass"); - GameShaders.Misc["CalamityMod:CircularBarShader"] = new MiscShaderData(new Ref(CircularBarShader), "Pass0"); - GameShaders.Misc["CalamityMod:CircularBarSpriteShader"] = new MiscShaderData(new Ref(CircularBarSpriteShader), "Pass0"); - GameShaders.Misc["CalamityMod:DoGDisintegration"] = new MiscShaderData(new Ref(DoGDisintegrationShader), "DisintegrationPass"); - GameShaders.Misc["CalamityMod:ArtAttack"] = new MiscShaderData(new Ref(ArtAttackTrailShader), "TrailPass"); - GameShaders.Misc["CalamityMod:CircularAoETelegraph"] = new MiscShaderData(new Ref(CircularAoETelegraph), "TelegraphPass"); - GameShaders.Misc["CalamityMod:IntersectionClip"] = new MiscShaderData(new Ref(IntersectionClipShader), "ClipPass"); - GameShaders.Misc["CalamityMod:LinearTransformation"] = new MiscShaderData(new Ref(LocalLinearTransformationShader), "TransformationPass"); - GameShaders.Misc["CalamityMod:PrimitiveDrawer"] = new MiscShaderData(new Ref(BasicPrimitiveShader), "TrailPass"); - GameShaders.Misc["CalamityMod:ArtemisLaser"] = new MiscShaderData(new Ref(ArtemisLaserShader), "TrailPass"); - GameShaders.Misc["CalamityMod:ExobladeSlash"] = new MiscShaderData(new Ref(ExobladeSlashShader), "TrailPass"); - GameShaders.Misc["CalamityMod:ExobladePierce"] = new MiscShaderData(new Ref(ExobladePierceShader), "PiercePass"); - GameShaders.Misc["CalamityMod:ExoVortex"] = new MiscShaderData(new Ref(ExoVortexShader), "VortexPass"); - GameShaders.Misc["CalamityMod:SideStreakTrail"] = new MiscShaderData(new Ref(SideStreakTrailShader), "TrailPass"); - GameShaders.Misc["CalamityMod:HeavenlyGaleTrail"] = new MiscShaderData(new Ref(HeavenlyGaleTrailShader), "PiercePass"); - GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"] = new MiscShaderData(new Ref(HeavenlyGaleLightningShader), "TrailPass"); - GameShaders.Misc["CalamityMod:PrimitiveTexture"] = new MiscShaderData(new Ref(PrimTextureOverlayShader), "TrailPass"); + SubsumingVortexTentacleShader = LoadShader("TentacleShader"); + RegisterMiscShader(SubsumingVortexTentacleShader, "BurstPass", "SubsumingTentacle"); - GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"] = new MiscShaderData(new Ref(BaseFusableParticleEdgeShader), "ParticlePass"); - GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"] = new MiscShaderData(new Ref(AdditiveFusableParticleEdgeShader), "ParticlePass"); + DraedonTeleportShader = LoadShader("TeleportDisplacementShader"); + RegisterMiscShader(DraedonTeleportShader, "GlitchPass", "TeleportDisplacement"); - GameShaders.Misc["CalamityMod:DoGPortal"] = new MiscShaderData(new Ref(DoGPortalShader), "ScreenPass"); + CalamityAccessoryMouseShader = LoadShader("SCalMouseShader"); + RegisterMiscShader(CalamityAccessoryMouseShader, "DyePass", "FireMouse"); - //A little experimenting courtesy of looking at how slr does it. - var screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/SpreadTelegraph", AssetRequestMode.ImmediateLoad).Value); - Filters.Scene["SpreadTelegraph"] = new Filter(new ScreenShaderData(screenRef, "TelegraphPass"), EffectPriority.High); - Filters.Scene["SpreadTelegraph"].Load(); + // THIS SHADER IS UNUSED. + LightDistortionShader = LoadShader("DistortionShader"); - screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/PixelatedSightLine", AssetRequestMode.ImmediateLoad).Value); - Filters.Scene["PixelatedSightLine"] = new Filter(new ScreenShaderData(screenRef, "SightLinePass"), EffectPriority.High); - Filters.Scene["PixelatedSightLine"].Load(); + PhaseslayerRipShader = LoadShader("PhaseslayerRipShader"); + RegisterMiscShader(PhaseslayerRipShader, "TrailPass", "PhaseslayerRipEffect"); - screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/WulfrumTilePing", AssetRequestMode.ImmediateLoad).Value); - Filters.Scene["WulfrumTilePing"] = new Filter(new ScreenShaderData(screenRef, "TilePingPass"), EffectPriority.High); - Filters.Scene["WulfrumTilePing"].Load(); + FadedUVMapStreakShader = LoadShader("FadedUVMapStreak"); + RegisterMiscShader(FadedUVMapStreakShader, "TrailPass", "TrailStreak"); - screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/WulfrumScaffoldSelection", AssetRequestMode.ImmediateLoad).Value); - Filters.Scene["WulfrumScaffoldSelection"] = new Filter(new ScreenShaderData(screenRef, "TilePingPass"), EffectPriority.High); - Filters.Scene["WulfrumScaffoldSelection"].Load(); + FlameStreakShader = LoadShader("Flame"); + RegisterMiscShader(FlameStreakShader, "TrailPass", "Flame"); - screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/RoverDriveShield", AssetRequestMode.ImmediateLoad).Value); - Filters.Scene["RoverDriveShield"] = new Filter(new ScreenShaderData(screenRef, "ShieldPass"), EffectPriority.High); - Filters.Scene["RoverDriveShield"].Load(); + FadingSolidTrailShader = LoadShader("FadingSolidTrail"); + RegisterMiscShader(FadingSolidTrailShader, "TrailPass", "FadingSolidTrail"); - screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/RotateSprite", AssetRequestMode.ImmediateLoad).Value); - Filters.Scene["RotateSprite"] = new Filter(new ScreenShaderData(screenRef, "RotationPass"), EffectPriority.High); - Filters.Scene["RotateSprite"].Load(); + ScarletDevilShader = LoadShader("ScarletDevilStreak"); + RegisterMiscShader(ScarletDevilShader, "TrailPass", "OverpoweredTouhouSpearShader"); - screenRef = new Ref(CalamityMod.Instance.Assets.Request("Effects/SwingSprite", AssetRequestMode.ImmediateLoad).Value); - Filters.Scene["SwingSprite"] = new Filter(new ScreenShaderData(screenRef, "SwingPass"), EffectPriority.High); - Filters.Scene["SwingSprite"].Load(); + BordernadoFireShader = LoadShader("BordernadoFire"); + RegisterMiscShader(BordernadoFireShader, "TrailPass", "Bordernado"); + + PrismCrystalShader = LoadShader("PrismCrystalStreak"); + RegisterMiscShader(PrismCrystalShader, "TrailPass", "PrismaticStreak"); + + ImpFlameTrailShader = LoadShader("ImpFlameTrail"); + RegisterMiscShader(ImpFlameTrailShader, "TrailPass", "ImpFlameTrail"); + + SCalShieldShader = LoadShader("SupremeShieldShader"); + RegisterMiscShader(SCalShieldShader, "ShieldPass", "SupremeShield"); + + RancorMagicCircleShader = LoadShader("RancorMagicCircle"); + RegisterMiscShader(RancorMagicCircleShader, "ShieldPass", "RancorMagicCircle"); + + BasicTintShader = LoadShader("BasicTint"); + RegisterMiscShader(BasicTintShader, "TintPass", "BasicTint"); + + CircularBarShader = LoadShader("CircularBarShader"); + RegisterMiscShader(CircularBarShader, "Pass0", "CircularBarShader"); + + CircularBarSpriteShader = LoadShader("CircularBarSpriteShader"); + RegisterMiscShader(CircularBarSpriteShader, "Pass0", "CircularBarSpriteShader"); + + DoGDisintegrationShader = LoadShader("DoGDisintegration"); + RegisterMiscShader(DoGDisintegrationShader, "DisintegrationPass", "DoGDisintegration"); + + ArtAttackTrailShader = LoadShader("ArtAttackTrail"); + RegisterMiscShader(ArtAttackTrailShader, "TrailPass", "ArtAttack"); + + CircularAoETelegraph = LoadShader("CircularAoETelegraph"); + RegisterMiscShader(CircularAoETelegraph, "TelegraphPass", "CircularAoETelegraph"); + + IntersectionClipShader = LoadShader("IntersectionClipShader"); + RegisterMiscShader(IntersectionClipShader, "ClipPass", "IntersectionClip"); + + LocalLinearTransformationShader = LoadShader("LocalLinearTransformationShader"); + RegisterMiscShader(LocalLinearTransformationShader, "TransformationPass", "LinearTransformation"); + + // NOTE: despite being registered, this shader is UNUSED + BasicPrimitiveShader = LoadShader("BasicPrimitiveShader"); + RegisterMiscShader(BasicPrimitiveShader, "TrailPass", "PrimitiveDrawer"); + + ArtemisLaserShader = LoadShader("ArtemisLaserShader"); + RegisterMiscShader(ArtemisLaserShader, "TrailPass", "ArtemisLaser"); + + ExobladeSlashShader = LoadShader("ExobladeSlashShader"); + RegisterMiscShader(ExobladeSlashShader, "TrailPass", "ExobladeSlash"); + + ExobladePierceShader = LoadShader("ExobladePierceShader"); + RegisterMiscShader(ExobladePierceShader, "PiercePass", "ExobladePierce"); + + ExoVortexShader = LoadShader("ExoVortexShader"); + RegisterMiscShader(ExoVortexShader, "VortexPass", "ExoVortex"); + + SideStreakTrailShader = LoadShader("SideStreakTrail"); + RegisterMiscShader(SideStreakTrailShader, "TrailPass", "SideStreakTrail"); + + HeavenlyGaleTrailShader = LoadShader("HeavenlyGaleTrailShader"); + RegisterMiscShader(HeavenlyGaleTrailShader, "PiercePass", "HeavenlyGaleTrail"); + + HeavenlyGaleLightningShader = LoadShader("HeavenlyGaleLightningShader"); + RegisterMiscShader(HeavenlyGaleLightningShader, "TrailPass", "HeavenlyGaleLightningArc"); + + BlueStaticShader = LoadShader("BlueStaticShader"); + RegisterMiscShader(BlueStaticShader, "GlitchPass", "BlueStatic"); + + PrimTextureOverlayShader = LoadShader("PrimTextureOverlayShader"); + RegisterMiscShader(PrimTextureOverlayShader, "TrailPass", "PrimitiveTexture"); + + DoGPortalShader = LoadShader("ScreenShaders/DoGPortalShader"); + RegisterMiscShader(DoGPortalShader, "ScreenPass", "DoGPortal"); + + // These two shaders are often (but not always) used together. + BaseFusableParticleEdgeShader = LoadShader("ParticleFusion/BaseFusableParticleEdgeShader"); + RegisterMiscShader(BaseFusableParticleEdgeShader, "ParticlePass", "BaseFusableParticleEdge"); + + AdditiveFusableParticleEdgeShader = LoadShader("ParticleFusion/AdditiveFusableParticleEdgeShader"); + RegisterMiscShader(AdditiveFusableParticleEdgeShader, "ParticlePass", "AdditiveFusableParticleEdge"); + + // This shader is not registered with the game but is invoked directly to render the results of fluid simulation. + FluidShaders = LoadShader("FluidShaders"); + #endregion + + #region Loading Iban's Shaders + + SpreadTelegraph = LoadShader("SpreadTelegraph"); + RegisterScreenShader(SpreadTelegraph, "TelegraphPass", "SpreadTelegraph"); + + PixelatedSightLine = LoadShader("PixelatedSightLine"); + RegisterScreenShader(PixelatedSightLine, "SightLinePass", "PixelatedSightLine"); + + WulfrumTilePing = LoadShader("WulfrumTilePing"); + RegisterScreenShader(WulfrumTilePing, "TilePingPass", "WulfrumTilePing"); + + WulfrumScaffoldSelection = LoadShader("WulfrumScaffoldSelection"); + RegisterScreenShader(WulfrumScaffoldSelection, "TilePingPass", "WulfrumScaffoldSelection"); + + RoverDriveShield = LoadShader("RoverDriveShield"); + RegisterScreenShader(RoverDriveShield, "ShieldPass", "RoverDriveShield"); + + // THIS SHADER IS UNUSED. + RotateSprite = LoadShader("RotateSprite"); + RegisterScreenShader(RotateSprite, "RotationPass", "RotateSprite"); + + SwingSprite = LoadShader("SwingSprite"); + RegisterScreenShader(SwingSprite, "SwingPass", "SwingSprite"); + #endregion + + #region Loading Ozz's Shaders + + MiracleBlight = LoadShader("MiracleBlight"); + RegisterMiscShader(MiracleBlight, "BlightPass", "MiracleBlight"); + #endregion } } } diff --git a/Effects/CircularAoETelegraph.xnb b/Effects/CircularAoETelegraph.xnb index ba4a7077de..5dac18b1ff 100644 Binary files a/Effects/CircularAoETelegraph.xnb and b/Effects/CircularAoETelegraph.xnb differ diff --git a/Effects/CircularBarShader.xnb b/Effects/CircularBarShader.xnb index bfd24d480b..80fe279aab 100644 Binary files a/Effects/CircularBarShader.xnb and b/Effects/CircularBarShader.xnb differ diff --git a/Effects/CircularBarSpriteShader.xnb b/Effects/CircularBarSpriteShader.xnb index 75068092d9..9c110332bb 100644 Binary files a/Effects/CircularBarSpriteShader.xnb and b/Effects/CircularBarSpriteShader.xnb differ diff --git a/Effects/DoGDisintegration.xnb b/Effects/DoGDisintegration.xnb index 5e7e84b439..bbc4f237f3 100644 Binary files a/Effects/DoGDisintegration.xnb and b/Effects/DoGDisintegration.xnb differ diff --git a/Effects/ExoVortexShader.xnb b/Effects/ExoVortexShader.xnb index 2a3c3b1e0e..9c2cdf2d16 100644 Binary files a/Effects/ExoVortexShader.xnb and b/Effects/ExoVortexShader.xnb differ diff --git a/Effects/ExobladePierceShader.xnb b/Effects/ExobladePierceShader.xnb index 8a491cee1d..5fa9893e5a 100644 Binary files a/Effects/ExobladePierceShader.xnb and b/Effects/ExobladePierceShader.xnb differ diff --git a/Effects/ExobladeSlashShader.fx b/Effects/ExobladeSlashShader.fx index 906e61476b..5d340a58b2 100644 --- a/Effects/ExobladeSlashShader.fx +++ b/Effects/ExobladeSlashShader.fx @@ -57,27 +57,46 @@ float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 if (flipped) coords.y = 1 - coords.y; - float2 noiseCoords = coords * float2(0.5, 3) - float2(uTime * 0.45, 0); + // Calculate the base noise sampling coordinates. They are firstly squished, with the X coordinate factor acting as a metric of the "sameness" of the trail patterns. + // The lower the X coordinate factor is, the more detailed the trail is, while the inverse is true for the Y coordinate. After this, a time pass is incorporated to create the effect + // that the slash is moving against the starting point, as one might expect a slash to do. + float2 noiseDetail = float2(2, 2); + float2 noiseCoords = coords * float2(1.0 / noiseDetail.x, noiseDetail.y) - float2(uTime * 0.45, 0); + + // To prevent weird, sudden cutoffs unless the texture repeats, the X coordinate (which is in terms of the completion ratio of the trail) in transformed with a 0-1 sine instead of a + // X Mod 1 cuttoff, which would essentially "cut off" the texture and return the start, turning a value of 1.1 to 0.1, 1.32 to 0.32, etc. noiseCoords.x = sin(noiseCoords.x * 5.4) * 0.5 + 0.5; + + // Sample noise colors based on the original base noise coordinates. These all vary somewhat to create more varied detail. float noise = tex2D(uImage1, noiseCoords).r; float noise2 = pow(tex2D(uImage1, noiseCoords * 2.2).r, 1.6); float noise3 = pow(tex2D(uImage1, noiseCoords * 1.1).r, 1.3); + + // Combine all the noise values together. The base noise serves as a universal multiplier while the others are fed into a squishing function. + // Importantly, the squishing function ensures that its inputs range from 0-1, such that power doesn't result in values beyond 1. + // This is also where the "white hot edge" and trail fade effect comes from, due to the incorporation of the X and Y coordinate. In this context, the X coordinate exists to + // create lower opacities (which then are squished to make the trail look like it's vanishing) the further along the trail the point is. The Y coordinate, meanwhile, is multiplied + // with the noise and subtracted such that values close to 1 (the bottom of the trail) are given less weight and recieve less brightness. The inverse is true, with values closer to 0 + // recieving more brightness. float opacity = noise * pow(saturate((1 - coords.x) - noise * coords.y * 0.54), 3); - // Fade to the second primary color. + // Fade to the second primary color based on one of the noise values. color = lerp(color, float4(uColor, 1), noise2); - // Create dark colors. + // Create dark colors. Points that are further along the trail are incentized to fade to the dark color more strongly. This also holds true to points that are closer to the bottom of + // the trail. To create some variance on top of this, the primary noise value is added as well. float darkColorWeight = saturate(coords.y * 1.8 + coords.x * 0.45 + noise * 0.1); color = lerp(color, float4(uSecondaryColor, 1), darkColorWeight); - // Create a fire streak. + // Create a fire streak. This only applies to points in the top 30% of the trail, and the effect is stronger the closer a point is to the top. After this, a multiplier is incorporated + // to make the effect dissipate the further along the trail a point is. float fireColorWeight = InverseLerp(0.3, 0, coords.y) * pow(1 - coords.x, 1.56); color = lerp(color, float4(fireColor, 1), fireColorWeight); + // Calculate the final color. float4 noiseColor = color * opacity * (noise3 * 2.4 + 2.4); noiseColor.a = lerp(noiseColor.a, 0, 1 - fireColorWeight); - return noiseColor; + return noiseColor * input.Color.a; } technique Technique1 diff --git a/Effects/ExobladeSlashShader.xnb b/Effects/ExobladeSlashShader.xnb index 81e2e5191b..5a61b1bcb9 100644 Binary files a/Effects/ExobladeSlashShader.xnb and b/Effects/ExobladeSlashShader.xnb differ diff --git a/Effects/FadedUVMapStreak.xnb b/Effects/FadedUVMapStreak.xnb index cba3a873a1..8c734f97ee 100644 Binary files a/Effects/FadedUVMapStreak.xnb and b/Effects/FadedUVMapStreak.xnb differ diff --git a/Effects/FadingSolidTrail.xnb b/Effects/FadingSolidTrail.xnb index f97fe09680..c57e61edc4 100644 Binary files a/Effects/FadingSolidTrail.xnb and b/Effects/FadingSolidTrail.xnb differ diff --git a/Effects/Flame.xnb b/Effects/Flame.xnb index 744ad3487e..6c73b5e2b0 100644 Binary files a/Effects/Flame.xnb and b/Effects/Flame.xnb differ diff --git a/Effects/FluidShaders.xnb b/Effects/FluidShaders.xnb index be7126e59a..a9321a426e 100644 Binary files a/Effects/FluidShaders.xnb and b/Effects/FluidShaders.xnb differ diff --git a/Effects/HeavenlyGaleLightningShader.xnb b/Effects/HeavenlyGaleLightningShader.xnb index fce4bd53d8..6d5783ec44 100644 Binary files a/Effects/HeavenlyGaleLightningShader.xnb and b/Effects/HeavenlyGaleLightningShader.xnb differ diff --git a/Effects/HeavenlyGaleTrailShader.xnb b/Effects/HeavenlyGaleTrailShader.xnb index 5f3eb77dcd..fcf28f8d71 100644 Binary files a/Effects/HeavenlyGaleTrailShader.xnb and b/Effects/HeavenlyGaleTrailShader.xnb differ diff --git a/Effects/ImpFlameTrail.xnb b/Effects/ImpFlameTrail.xnb index fc33169629..9eb4fe0468 100644 Binary files a/Effects/ImpFlameTrail.xnb and b/Effects/ImpFlameTrail.xnb differ diff --git a/Effects/IntersectionClipShader.xnb b/Effects/IntersectionClipShader.xnb index 8fc86f0147..f201a6bb61 100644 Binary files a/Effects/IntersectionClipShader.xnb and b/Effects/IntersectionClipShader.xnb differ diff --git a/Effects/LocalLinearTransformationShader.xnb b/Effects/LocalLinearTransformationShader.xnb index 9704f12e44..184f41f1f3 100644 Binary files a/Effects/LocalLinearTransformationShader.xnb and b/Effects/LocalLinearTransformationShader.xnb differ diff --git a/Effects/MiracleBlight.fx b/Effects/MiracleBlight.fx new file mode 100644 index 0000000000..a17b9f84e8 --- /dev/null +++ b/Effects/MiracleBlight.fx @@ -0,0 +1,79 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity : register(C0); +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float4 uShaderSpecificData; + +// Cosine does not work in shaders in Terraria 1.4. It returns incredibly corrupted values and nobody is sure why. +// This reimplements cosine using trigonometric identities. +// +// Discovery of malfunctioning cosine attributed to ScalarVector from SLR: +// https://discord.com/channels/103110554649894912/445276626352209920/979928448300634175 +float realCos(float value) +{ + return sin(value + 1.57079); +} + +// +// Based on Devourer of Gods' death animation (by Dominic) +// in turn, that was based on ExampleMod's cool death animation +// + + +float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + if (!any(color)) + return color; + + // Framed coordinates -- a UV of the NPC's current framed sprite, instead of the whole sheet + float2 framedCoords = (coords * uImageSize0 - uSourceRect.xy) / uSourceRect.zw; + + // Temporal drift to make the sprite slide through the noise texture + float2 drift = float2(5 * sin(8.33 * uTime), 220 * uTime); + + float2 noiseMapTexCoords = framedCoords * uSourceRect.zw + drift; + float4 noiseColor = tex2D(uImage1, noiseMapTexCoords / uImageSize1); + + // Define thresholds for total pixel erasure and glowing lines. + // + // Rapidly flickering sinewave produced by Desmos, loosely based on the Weierstrass function + // (infinitely sharp vague sinewave, periodic, continuous everywhere but differentiable nowhere) + // https://en.wikipedia.org/wiki/Weierstrass_function + float flickerOne = 0.05 * realCos(7 * uTime); + float flickerTwo = 0.06 * realCos(31 * uTime); + float flickerThree = 0.04 * sin(167 * uTime); + float fullErasureThreshold = uOpacity + flickerOne + flickerTwo + flickerThree; + float glowThreshold = fullErasureThreshold - 0.1; + + // If the noise over the erasure threshold, completely erase this pixel. + if (noiseColor.r > fullErasureThreshold) + { + color.rgba = 0; + } + // Otherwise, if it's over the slightly lower threshold, replace it with a bright color. + else if (noiseColor.r > glowThreshold) + { + color = float4(0.4902, 1, 0, 1); + } + + return color; +} + +technique Technique1 +{ + pass BlightPass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/MiracleBlight.xnb b/Effects/MiracleBlight.xnb new file mode 100644 index 0000000000..a37ac5c837 Binary files /dev/null and b/Effects/MiracleBlight.xnb differ diff --git a/Effects/PhaseslayerRipShader.xnb b/Effects/PhaseslayerRipShader.xnb index 037098c6a9..44fa03af03 100644 Binary files a/Effects/PhaseslayerRipShader.xnb and b/Effects/PhaseslayerRipShader.xnb differ diff --git a/Effects/PixelatedSightLine.xnb b/Effects/PixelatedSightLine.xnb index b36c07cba6..de93208781 100644 Binary files a/Effects/PixelatedSightLine.xnb and b/Effects/PixelatedSightLine.xnb differ diff --git a/Effects/PrimTextureOverlayShader.xnb b/Effects/PrimTextureOverlayShader.xnb index f139435fc6..7f4004da66 100644 Binary files a/Effects/PrimTextureOverlayShader.xnb and b/Effects/PrimTextureOverlayShader.xnb differ diff --git a/Effects/PrismCrystalStreak.xnb b/Effects/PrismCrystalStreak.xnb index dac8824f97..10e8411c26 100644 Binary files a/Effects/PrismCrystalStreak.xnb and b/Effects/PrismCrystalStreak.xnb differ diff --git a/Effects/RancorMagicCircle.xnb b/Effects/RancorMagicCircle.xnb index 6f89e648c3..565184684a 100644 Binary files a/Effects/RancorMagicCircle.xnb and b/Effects/RancorMagicCircle.xnb differ diff --git a/Effects/RotateSprite.xnb b/Effects/RotateSprite.xnb index a4475a6c47..fd51404d21 100644 Binary files a/Effects/RotateSprite.xnb and b/Effects/RotateSprite.xnb differ diff --git a/Effects/RoverDriveShield.xnb b/Effects/RoverDriveShield.xnb index f26b005c5d..ad0acba4f7 100644 Binary files a/Effects/RoverDriveShield.xnb and b/Effects/RoverDriveShield.xnb differ diff --git a/Effects/SCalMouseShader.xnb b/Effects/SCalMouseShader.xnb index c487fa5b59..026df479da 100644 Binary files a/Effects/SCalMouseShader.xnb and b/Effects/SCalMouseShader.xnb differ diff --git a/Effects/ScarletDevilStreak.xnb b/Effects/ScarletDevilStreak.xnb index 001a8926bd..e360f61523 100644 Binary files a/Effects/ScarletDevilStreak.xnb and b/Effects/ScarletDevilStreak.xnb differ diff --git a/Effects/SideStreakTrail.xnb b/Effects/SideStreakTrail.xnb index a9983c063f..4720c1c32b 100644 Binary files a/Effects/SideStreakTrail.xnb and b/Effects/SideStreakTrail.xnb differ diff --git a/Effects/SpreadTelegraph.xnb b/Effects/SpreadTelegraph.xnb index e752b000ce..77a06cba8c 100644 Binary files a/Effects/SpreadTelegraph.xnb and b/Effects/SpreadTelegraph.xnb differ diff --git a/Effects/SupremeShieldShader.xnb b/Effects/SupremeShieldShader.xnb index 848fa21dcd..9a60c6f376 100644 Binary files a/Effects/SupremeShieldShader.xnb and b/Effects/SupremeShieldShader.xnb differ diff --git a/Effects/SwingSprite.xnb b/Effects/SwingSprite.xnb index f3b222ac54..3fc80cb765 100644 Binary files a/Effects/SwingSprite.xnb and b/Effects/SwingSprite.xnb differ diff --git a/Effects/TeleportDisplacementShader.xnb b/Effects/TeleportDisplacementShader.xnb index 2e53b4830b..666d95c5ab 100644 Binary files a/Effects/TeleportDisplacementShader.xnb and b/Effects/TeleportDisplacementShader.xnb differ diff --git a/Effects/TentacleShader.xnb b/Effects/TentacleShader.xnb index e9d34c45ad..5ebc09bdfe 100644 Binary files a/Effects/TentacleShader.xnb and b/Effects/TentacleShader.xnb differ diff --git a/Effects/WulfrumScaffoldSelection.xnb b/Effects/WulfrumScaffoldSelection.xnb index 61ac0a7311..ebf94fcb96 100644 Binary files a/Effects/WulfrumScaffoldSelection.xnb and b/Effects/WulfrumScaffoldSelection.xnb differ diff --git a/Effects/WulfrumTilePing.xnb b/Effects/WulfrumTilePing.xnb index 62b423ebaf..2dd6d79468 100644 Binary files a/Effects/WulfrumTilePing.xnb and b/Effects/WulfrumTilePing.xnb differ diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index a8ae4cf92f..60463ba23c 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -265,13 +265,6 @@ namespace CalamityMod.Events } } - // Stop the rain if the Old Duke is present for visibility during the fight. - if (Main.raining && NPC.AnyNPCs(ModContent.NPCType())) - { - Main.raining = false; - CalamityNetcode.SyncWorld(); - } - // If the rain stops for whatever reason, end the invasion. // This is primarily done for compatibility, so that if another mod wants to manipulate the weather, // they can without having to deal with endless rain. diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index 5a1c2dc8ed..7c693f1ba8 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -8,7 +8,7 @@ using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; @@ -156,7 +156,7 @@ namespace CalamityMod.Events new Boss(NPCID.EyeofCthulhu, TimeChangeContext.Night, permittedNPCs: NPCID.ServantofCthulhu), - new Boss(ModContent.NPCType(), spawnContext: type => + new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => { Player player = Main.player[ClosestPlayerToWorldCenter]; int thePefectOne = NPC.NewNPC(Source, (int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), type, 1); @@ -164,7 +164,7 @@ namespace CalamityMod.Events CalamityUtils.BossAwakenMessage(thePefectOne); }, permittedNPCs: ModContent.NPCType()), - new Boss(NPCID.EaterofWorldsHead, permittedNPCs: new int[] { NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.VileSpit }), + new Boss(NPCID.EaterofWorldsHead, permittedNPCs: new int[] { NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.VileSpitEaterOfWorlds }), new Boss(NPCID.BrainofCthulhu, permittedNPCs: NPCID.Creeper), @@ -174,7 +174,7 @@ namespace CalamityMod.Events ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() ,ModContent.NPCType() }), - new Boss(NPCID.QueenBee), + new Boss(NPCID.QueenBee, permittedNPCs: new int[] { NPCID.Bee, NPCID.BeeSmall }), new Boss(NPCID.Deerclops), @@ -186,7 +186,7 @@ namespace CalamityMod.Events CalamityUtils.BossAwakenMessage(sans); }, permittedNPCs: NPCID.SkeletronHand), - new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), new Boss(NPCID.WallofFlesh, spawnContext: type => @@ -205,20 +205,20 @@ namespace CalamityMod.Events NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Retinazer); }, permittedNPCs: NPCID.Retinazer), - new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), new Boss(NPCID.TheDestroyer, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.TheDestroyerBody, NPCID.TheDestroyerTail, NPCID.Probe }), - new Boss(ModContent.NPCType(), permittedNPCs: ModContent.NPCType()), + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: ModContent.NPCType()), new Boss(NPCID.SkeletronPrime, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser, NPCID.Probe }), new Boss(ModContent.NPCType(), TimeChangeContext.Night, dimnessFactor: 0.6f, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), - new Boss(NPCID.Plantera, permittedNPCs: new int[] { NPCID.PlanterasTentacle, NPCID.PlanterasHook, NPCID.Spore }), + new Boss(NPCID.Plantera, TimeChangeContext.Day, permittedNPCs: new int[] { NPCID.PlanterasTentacle, NPCID.PlanterasHook, NPCID.Spore }), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, specialSpawnCountdown: 120, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), + new Boss(ModContent.NPCType(), specialSpawnCountdown: 120, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), NPCID.DetonatingBubble}), new Boss(ModContent.NPCType(), TimeChangeContext.Night, permittedNPCs: ModContent.NPCType()), @@ -240,7 +240,7 @@ namespace CalamityMod.Events new Boss(NPCID.HallowBoss, TimeChangeContext.Night), - new Boss(NPCID.DukeFishron, TimeChangeContext.Day, spawnContext: type => + new Boss(NPCID.DukeFishron, TimeChangeContext.Day, type => { Player player = Main.player[ClosestPlayerToWorldCenter]; int dukeFishron = NPC.NewNPC(Source, (int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), type, 1); @@ -252,12 +252,12 @@ namespace CalamityMod.Events { Player player = Main.player[ClosestPlayerToWorldCenter]; - SoundEngine.PlaySound(SoundID.ScaryScream, player.position); + SoundEngine.PlaySound(SoundID.ScaryScream, player.Center); int ravager = NPC.NewNPC(Source, (int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 600f), type, 1); Main.npc[ravager].timeLeft *= 20; CalamityUtils.BossAwakenMessage(ravager); }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType(), ModContent.NPCType() }), + ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), new Boss(NPCID.CultistBoss, spawnContext: type => { @@ -293,13 +293,13 @@ namespace CalamityMod.Events NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, permittedNPCs: new int[] { NPCID.MoonLordLeechBlob, NPCID.MoonLordHand, NPCID.MoonLordHead, NPCID.MoonLordFreeEye }), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, spawnContext: type => + new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierThreeEndText2", XerocTextColor); NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); - }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), + }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType() }), + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType() }), new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => { @@ -329,7 +329,7 @@ namespace CalamityMod.Events NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, usesSpecialSound: true, permittedNPCs: ModContent.NPCType()), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => + new Boss(ModContent.NPCType(), spawnContext: type => { Player player = Main.player[ClosestPlayerToWorldCenter]; @@ -345,9 +345,8 @@ namespace CalamityMod.Events NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => + new Boss(ModContent.NPCType(), spawnContext: type => { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFourEndText2", XerocTextColor); Player player = Main.player[ClosestPlayerToWorldCenter]; SoundEngine.PlaySound(Polterghast.SpawnSound, player.Center); @@ -363,7 +362,7 @@ namespace CalamityMod.Events CalamityUtils.BossAwakenMessage(boomerDuke); }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => + new Boss(ModContent.NPCType(), spawnContext: type => { Player player = Main.player[ClosestPlayerToWorldCenter]; @@ -371,25 +370,26 @@ namespace CalamityMod.Events NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => + new Boss(ModContent.NPCType(), spawnContext: type => { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFourEndText2", XerocTextColor); Player player = Main.player[ClosestPlayerToWorldCenter]; SoundEngine.PlaySound(Yharon.FireSound, player.Center); NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, usesSpecialSound: true), - new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => + new Boss(ModContent.NPCType(), spawnContext: type => { - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - Player player = Main.player[ClosestPlayerToWorldCenter]; + if (!NPC.AnyNPCs(ModContent.NPCType())) + { + Player player = Main.player[ClosestPlayerToWorldCenter]; - SoundEngine.PlaySound(CodebreakerUI.SummonSound, player.Center); - Vector2 spawnPos = player.Center + new Vector2(-8f, -100f); - int draedon = NPC.NewNPC(Source, (int)spawnPos.X, (int)spawnPos.Y, ModContent.NPCType()); - Main.npc[draedon].timeLeft *= 20; - } + SoundEngine.PlaySound(CodebreakerUI.SummonSound, player.Center); + Vector2 spawnPos = player.Center + new Vector2(-8f, -100f); + int draedon = NPC.NewNPC(Source, (int)spawnPos.X, (int)spawnPos.Y, ModContent.NPCType()); + Main.npc[draedon].timeLeft *= 20; + } }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), new Boss(ModContent.NPCType(), spawnContext: type => @@ -398,8 +398,6 @@ namespace CalamityMod.Events CalamityUtils.SpawnBossBetter(Main.player[ClosestPlayerToWorldCenter].Top - new Vector2(42f, 84f), type); }, specialSpawnCountdown: 840, dimnessFactor: 0.6f, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), - - // new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), }; BossDeathEffects = new Dictionary>() @@ -409,21 +407,21 @@ namespace CalamityMod.Events CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierOneEndText", XerocTextColor); CreateTierAnimation(2); - // Teleport players to where they came from - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - Player p = Main.player[playerIndex]; - if (p is not null && p.active) - { - if (p.Calamity().BossRushReturnPosition.HasValue) - { - CalamityPlayer.ModTeleport(p, p.Calamity().BossRushReturnPosition.Value, false, TeleportationStyleID.TeleportationPotion); - p.Calamity().BossRushReturnPosition = null; - } - p.Calamity().BossRushReturnPosition = null; + // Teleport players to where they came from + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + if (p.Calamity().BossRushReturnPosition.HasValue) + { + CalamityPlayer.ModTeleport(p, p.Calamity().BossRushReturnPosition.Value, false, TeleportationStyleID.TeleportationPotion); + p.Calamity().BossRushReturnPosition = null; + } + p.Calamity().BossRushReturnPosition = null; SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center); - } - } + } + } }, [NPCID.Plantera] = npc => { @@ -445,6 +443,10 @@ namespace CalamityMod.Events CalamityUtils.KillAllHostileProjectiles(); HostileProjectileKillCounter = 3; + // Mark Boss Rush as complete + DownedBossSystem.downedBossRush = true; + CalamityNetcode.SyncWorld(); + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(Source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } @@ -480,14 +482,14 @@ namespace CalamityMod.Events { get { - int tier = CurrentTier; + int tier = CurrentTier; if (CalamityMod.Instance.musicMod != null) - { - // Boss Rush music for tiers 4 and 5 don't exist - if (tier > 3) - tier = 3; + { + // Boss Rush music for tiers 4 and 5 don't exist + if (tier > 3) + tier = 3; return CalamityMod.Instance.GetMusicFromMusicMod($"BossRushTier{tier}") ?? 0; - } + } switch (CurrentTier) { @@ -588,7 +590,7 @@ namespace CalamityMod.Events // Play a special boss roar sound by default. if (!Bosses[BossRushStage].UsesSpecialSound) - SoundEngine.PlaySound(BossSummonSound, Main.player[ClosestPlayerToWorldCenter].position); + SoundEngine.PlaySound(BossSummonSound, Main.player[ClosestPlayerToWorldCenter].Center); // And spawn the boss. Bosses[BossRushStage].SpawnContext.Invoke(CurrentlyFoughtBoss); @@ -610,26 +612,26 @@ namespace CalamityMod.Events public static void End() { - // Reset BossRushReturnPosition - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - Player p = Main.player[playerIndex]; - if (p is not null && p.active) - { - p.Calamity().BossRushReturnPosition = null; - } - } + // Reset BossRushReturnPosition + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + p.Calamity().BossRushReturnPosition = null; + } + } if (Main.netMode == NetmodeID.SinglePlayer) { EndEffects(); } else - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.EndBossRush); - netMessage.Send(); - } + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.EndBossRush); + netMessage.Send(); + } } internal static void EndEffects() @@ -718,19 +720,19 @@ namespace CalamityMod.Events CalamityUtils.KillAllHostileProjectiles(); HostileProjectileKillCounter = 3; - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - Player p = Main.player[playerIndex]; - if (p is not null && p.active) - { - p.Calamity().BossRushReturnPosition = p.Center; - Vector2? underworld = CalamityPlayer.GetUnderworldPosition(p); - if (!underworld.HasValue) - break; - CalamityPlayer.ModTeleport(p, underworld.Value, false, TeleportationStyleID.TeleportationPotion); + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player p = Main.player[playerIndex]; + if (p is not null && p.active) + { + p.Calamity().BossRushReturnPosition = p.Center; + Vector2? underworld = CalamityPlayer.GetUnderworldPosition(p); + if (!underworld.HasValue) + break; + CalamityPlayer.ModTeleport(p, underworld.Value, false, TeleportationStyleID.TeleportationPotion); SoundEngine.PlaySound(TeleportSound with { Volume = 1.6f }, p.Center); - } - } + } + } } // This is the generic form of "Are there any remaining NPCs on the boss list for this boss rush stage?" check. diff --git a/ExtraTextures/GreyscaleGradients/Cracks.png b/ExtraTextures/GreyscaleGradients/Cracks.png new file mode 100644 index 0000000000..ece39867ba Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Cracks.png differ diff --git a/ExtraTextures/GreyscaleGradients/FrozenCrust.png b/ExtraTextures/GreyscaleGradients/FrozenCrust.png new file mode 100644 index 0000000000..69792113d3 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/FrozenCrust.png differ diff --git a/ExtraTextures/GreyscaleGradients/Neurons.png b/ExtraTextures/GreyscaleGradients/Neurons.png new file mode 100644 index 0000000000..b2e8ec7a6c Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Neurons.png differ diff --git a/ExtraTextures/GreyscaleGradients/Neurons2.png b/ExtraTextures/GreyscaleGradients/Neurons2.png new file mode 100644 index 0000000000..41d5fd5d44 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Neurons2.png differ diff --git a/ExtraTextures/GreyscaleGradients/Smudges.png b/ExtraTextures/GreyscaleGradients/Smudges.png new file mode 100644 index 0000000000..73848e7639 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/Smudges.png differ diff --git a/ExtraTextures/GreyscaleGradients/VoidGashes.png b/ExtraTextures/GreyscaleGradients/VoidGashes.png new file mode 100644 index 0000000000..7f0e5bdb52 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/VoidGashes.png differ diff --git a/ExtraTextures/GreyscaleGradients/VoronoiShapes2.png b/ExtraTextures/GreyscaleGradients/VoronoiShapes2.png new file mode 100644 index 0000000000..7217087449 Binary files /dev/null and b/ExtraTextures/GreyscaleGradients/VoronoiShapes2.png differ diff --git a/ExtraTextures/GreyscaleOpenCircle.png b/ExtraTextures/GreyscaleOpenCircle.png new file mode 100644 index 0000000000..0871b3ebcc Binary files /dev/null and b/ExtraTextures/GreyscaleOpenCircle.png differ diff --git a/ExtraTextures/Lasers/LaserBegin.png b/ExtraTextures/Lasers/EndoLaserBegin.png similarity index 100% rename from ExtraTextures/Lasers/LaserBegin.png rename to ExtraTextures/Lasers/EndoLaserBegin.png diff --git a/ExtraTextures/Lasers/LaserEnd.png b/ExtraTextures/Lasers/EndoLaserEnd.png similarity index 100% rename from ExtraTextures/Lasers/LaserEnd.png rename to ExtraTextures/Lasers/EndoLaserEnd.png diff --git a/ExtraTextures/Lasers/LaserMid.png b/ExtraTextures/Lasers/EndoLaserMid.png similarity index 100% rename from ExtraTextures/Lasers/LaserMid.png rename to ExtraTextures/Lasers/EndoLaserMid.png diff --git a/ExtraTextures/Lasers/SparklingLaserBegin.png b/ExtraTextures/Lasers/SparklingLaserBegin.png new file mode 100644 index 0000000000..f27b8f2151 Binary files /dev/null and b/ExtraTextures/Lasers/SparklingLaserBegin.png differ diff --git a/ExtraTextures/Lasers/SparklingLaserEnd.png b/ExtraTextures/Lasers/SparklingLaserEnd.png new file mode 100644 index 0000000000..54b0738fa7 Binary files /dev/null and b/ExtraTextures/Lasers/SparklingLaserEnd.png differ diff --git a/ExtraTextures/Lasers/SparklingLaserMid.png b/ExtraTextures/Lasers/SparklingLaserMid.png new file mode 100644 index 0000000000..925381c74c Binary files /dev/null and b/ExtraTextures/Lasers/SparklingLaserMid.png differ diff --git a/ExtraTextures/VanillaReplacements/RainAstral.png b/ExtraTextures/VanillaReplacements/RainAstral.png new file mode 100644 index 0000000000..e178d0380e Binary files /dev/null and b/ExtraTextures/VanillaReplacements/RainAstral.png differ diff --git a/ExtraTextures/VanillaReplacements/RainOriginal.png b/ExtraTextures/VanillaReplacements/RainOriginal.png deleted file mode 100644 index fcf8f439da..0000000000 Binary files a/ExtraTextures/VanillaReplacements/RainOriginal.png and /dev/null differ diff --git a/FluidSimulation/FluidField.cs b/FluidSimulation/FluidField.cs index 1b686932b8..7274eb6da2 100644 --- a/FluidSimulation/FluidField.cs +++ b/FluidSimulation/FluidField.cs @@ -24,6 +24,8 @@ namespace CalamityMod.FluidSimulation internal FluidFieldState ColorField; + internal RenderTarget2D OutputTarget; + public float Viscosity; public float DiffusionFactor; @@ -85,6 +87,8 @@ namespace CalamityMod.FluidSimulation DivergenceField = new(Main.instance.GraphicsDevice, Size, Size, true, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); DivergencePoissonField = new(Main.instance.GraphicsDevice, Size, Size, true, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); + + OutputTarget = new(Main.instance.GraphicsDevice, Size, Size, true, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); } internal void ApplyThingToTarget(RenderTarget2D currentField, Action shaderPreparationsAction) @@ -239,6 +243,7 @@ namespace CalamityMod.FluidSimulation UpdateVelocityFields(); UpdateDensityFields(); + UpdateOutputTarget(); ShouldSkipDivergenceClearingStep = false; } @@ -265,6 +270,20 @@ namespace CalamityMod.FluidSimulation CalculateAdvection(ColorField.PreviousState, ColorField.NextState, VelocityField.NextState, true); } + public void UpdateOutputTarget() + { + Main.instance.GraphicsDevice.SetRenderTarget(OutputTarget); + Main.instance.GraphicsDevice.Clear(Color.Transparent); + + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + Main.instance.GraphicsDevice.Textures[5] = ColorField.NextState; + CalamityShaders.FluidShaders.CurrentTechnique.Passes["DrawFluidPass"].Apply(); + Main.spriteBatch.Draw(DensityField.NextState, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, 0, 0f); + Main.spriteBatch.End(); + + Main.instance.GraphicsDevice.SetRenderTarget(null); + } + public void Dispose() { // Prevent disposing twice. @@ -280,6 +299,7 @@ namespace CalamityMod.FluidSimulation VelocityField?.Dispose(); ColorField?.Dispose(); DensityField?.Dispose(); + OutputTarget?.Dispose(); } public void CreateSource(int x, int y, float density, Color color, Vector2 velocity) @@ -291,19 +311,21 @@ namespace CalamityMod.FluidSimulation ColorField.PendingChanges.Enqueue(new PixelQueueValue(pos, color)); - VelocityField.PendingChanges.Enqueue(new(pos, new Vector4(velocity.X, velocity.Y, 0f, 0f))); + if (velocity != Vector2.Zero) + VelocityField.PendingChanges.Enqueue(new(pos, new Vector4(velocity.X, velocity.Y, 0f, 0f))); DensityField.PendingChanges.Enqueue(new PixelQueueValue(pos, new Color(density, 0f, 0f))); } - public void Draw(Vector2 drawPosition, bool needsToCallEnd, Matrix drawPerspective, Matrix previousPerspective) + public void Draw(Vector2 drawPosition, bool needsToCallEnd, Matrix drawPerspective, Matrix previousPerspective, Action shaderPreparations = null) { if (needsToCallEnd) Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, drawPerspective); - Main.instance.GraphicsDevice.Textures[5] = ColorField.NextState; - CalamityShaders.FluidShaders.CurrentTechnique.Passes["DrawFluidPass"].Apply(); - Main.spriteBatch.Draw(DensityField.NextState, drawPosition, null, Color.White, 0f, DensityField.NextState.Size() * 0.5f, Scale, 0, 0f); + + shaderPreparations?.Invoke(OutputTarget); + + Main.spriteBatch.Draw(OutputTarget, drawPosition, null, Color.White, 0f, OutputTarget.Size() * 0.5f, Scale, 0, 0f); Main.spriteBatch.End(); if (needsToCallEnd) diff --git a/FluidSimulation/FluidFieldManager.cs b/FluidSimulation/FluidFieldManager.cs index 0316fc29d0..89782ee017 100644 --- a/FluidSimulation/FluidFieldManager.cs +++ b/FluidSimulation/FluidFieldManager.cs @@ -2,10 +2,11 @@ using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ModLoader; namespace CalamityMod.FluidSimulation { - public static class FluidFieldManager + public class FluidFieldManager : ModSystem { internal static List Fields = new(); @@ -44,5 +45,15 @@ namespace CalamityMod.FluidSimulation field.Update(); Main.GameViewMatrix.Zoom = old; } + + public override void OnModUnload() + { + Main.QueueMainThreadAction(() => + { + // The dispose method automatically pops fields from the list. + while (Fields.Count > 0) + Fields[0].Dispose(); + }); + } } } diff --git a/Fonts/CodebreakerDialog.xnb b/Fonts/CodebreakerDialog.xnb new file mode 100644 index 0000000000..f488541ef9 Binary files /dev/null and b/Fonts/CodebreakerDialog.xnb differ diff --git a/Gores/AcidRain/BabyFlakCrabGore.png b/Gores/AcidRain/BabyFlakCrabGore.png new file mode 100644 index 0000000000..892685d38f Binary files /dev/null and b/Gores/AcidRain/BabyFlakCrabGore.png differ diff --git a/Gores/AngryDog/AngryDog.png b/Gores/AngryDog/AngryDog.png new file mode 100644 index 0000000000..46feec27ff Binary files /dev/null and b/Gores/AngryDog/AngryDog.png differ diff --git a/Gores/AngryDog/AngryDog2.png b/Gores/AngryDog/AngryDog2.png new file mode 100644 index 0000000000..870191ca8d Binary files /dev/null and b/Gores/AngryDog/AngryDog2.png differ diff --git a/Gores/AngryDog/AngryDog3.png b/Gores/AngryDog/AngryDog3.png new file mode 100644 index 0000000000..4624401a88 Binary files /dev/null and b/Gores/AngryDog/AngryDog3.png differ diff --git a/Gores/AngryDog/AngryDog4.png b/Gores/AngryDog/AngryDog4.png new file mode 100644 index 0000000000..7f94e64011 Binary files /dev/null and b/Gores/AngryDog/AngryDog4.png differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerBody.png b/Gores/ArmoredDigger/ArmoredDiggerBody.png new file mode 100644 index 0000000000..082eb57526 Binary files /dev/null and b/Gores/ArmoredDigger/ArmoredDiggerBody.png differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerBody2.png b/Gores/ArmoredDigger/ArmoredDiggerBody2.png new file mode 100644 index 0000000000..a7a22f0697 Binary files /dev/null and b/Gores/ArmoredDigger/ArmoredDiggerBody2.png differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerHead.png b/Gores/ArmoredDigger/ArmoredDiggerHead.png new file mode 100644 index 0000000000..7debb48e29 Binary files /dev/null and b/Gores/ArmoredDigger/ArmoredDiggerHead.png differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerHead2.png b/Gores/ArmoredDigger/ArmoredDiggerHead2.png new file mode 100644 index 0000000000..c1fe479da5 Binary files /dev/null and b/Gores/ArmoredDigger/ArmoredDiggerHead2.png differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerTail.png b/Gores/ArmoredDigger/ArmoredDiggerTail.png new file mode 100644 index 0000000000..6a30219a5b Binary files /dev/null and b/Gores/ArmoredDigger/ArmoredDiggerTail.png differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerTail2.png b/Gores/ArmoredDigger/ArmoredDiggerTail2.png new file mode 100644 index 0000000000..616e848530 Binary files /dev/null and b/Gores/ArmoredDigger/ArmoredDiggerTail2.png differ diff --git a/Gores/Bloatfish/Bloatfish.png b/Gores/Bloatfish/Bloatfish.png new file mode 100644 index 0000000000..0ac9d6cf4e Binary files /dev/null and b/Gores/Bloatfish/Bloatfish.png differ diff --git a/Gores/Bloatfish/Bloatfish2.png b/Gores/Bloatfish/Bloatfish2.png new file mode 100644 index 0000000000..4cbb6541d2 Binary files /dev/null and b/Gores/Bloatfish/Bloatfish2.png differ diff --git a/Gores/Bloatfish/Bloatfish3.png b/Gores/Bloatfish/Bloatfish3.png new file mode 100644 index 0000000000..821a92fa37 Binary files /dev/null and b/Gores/Bloatfish/Bloatfish3.png differ diff --git a/Gores/Bohldohr/Bohldohr.png b/Gores/Bohldohr/Bohldohr.png new file mode 100644 index 0000000000..924ce1bbac Binary files /dev/null and b/Gores/Bohldohr/Bohldohr.png differ diff --git a/Gores/Bohldohr/Bohldohr2.png b/Gores/Bohldohr/Bohldohr2.png new file mode 100644 index 0000000000..148db3d79e Binary files /dev/null and b/Gores/Bohldohr/Bohldohr2.png differ diff --git a/Gores/Bohldohr/Bohldohr3.png b/Gores/Bohldohr/Bohldohr3.png new file mode 100644 index 0000000000..62ca6d4adb Binary files /dev/null and b/Gores/Bohldohr/Bohldohr3.png differ diff --git a/Gores/CalamityEye/CalamityEye.png b/Gores/CalamityEye/CalamityEye.png new file mode 100644 index 0000000000..29f8ba31f3 Binary files /dev/null and b/Gores/CalamityEye/CalamityEye.png differ diff --git a/Gores/CalamityEye/CalamityEye2.png b/Gores/CalamityEye/CalamityEye2.png new file mode 100644 index 0000000000..06b4bb0396 Binary files /dev/null and b/Gores/CalamityEye/CalamityEye2.png differ diff --git a/Gores/Cuttlefish/Cuttlefish.png b/Gores/Cuttlefish/Cuttlefish.png new file mode 100644 index 0000000000..e65f763902 Binary files /dev/null and b/Gores/Cuttlefish/Cuttlefish.png differ diff --git a/Gores/Cuttlefish/Cuttlefish2.png b/Gores/Cuttlefish/Cuttlefish2.png new file mode 100644 index 0000000000..5031fba894 Binary files /dev/null and b/Gores/Cuttlefish/Cuttlefish2.png differ diff --git a/Gores/DevilFish/Devilfish.png b/Gores/DevilFish/Devilfish.png new file mode 100644 index 0000000000..f5b58ea384 Binary files /dev/null and b/Gores/DevilFish/Devilfish.png differ diff --git a/Gores/DevilFish/Devilfish2.png b/Gores/DevilFish/Devilfish2.png new file mode 100644 index 0000000000..7f8fc4afb0 Binary files /dev/null and b/Gores/DevilFish/Devilfish2.png differ diff --git a/Gores/DevilFish/Devilfish3.png b/Gores/DevilFish/Devilfish3.png new file mode 100644 index 0000000000..4ddfd3bd6b Binary files /dev/null and b/Gores/DevilFish/Devilfish3.png differ diff --git a/Gores/DevilFish/DevilfishAlt.png b/Gores/DevilFish/DevilfishAlt.png new file mode 100644 index 0000000000..f5b58ea384 Binary files /dev/null and b/Gores/DevilFish/DevilfishAlt.png differ diff --git a/Gores/DevilFish/DevilfishAlt2.png b/Gores/DevilFish/DevilfishAlt2.png new file mode 100644 index 0000000000..7f8fc4afb0 Binary files /dev/null and b/Gores/DevilFish/DevilfishAlt2.png differ diff --git a/Gores/DevilFish/DevilfishAlt3.png b/Gores/DevilFish/DevilfishAlt3.png new file mode 100644 index 0000000000..4ddfd3bd6b Binary files /dev/null and b/Gores/DevilFish/DevilfishAlt3.png differ diff --git a/Gores/FrogFish/Frogfish.png b/Gores/FrogFish/Frogfish.png new file mode 100644 index 0000000000..4fbda47043 Binary files /dev/null and b/Gores/FrogFish/Frogfish.png differ diff --git a/Gores/FrogFish/Frogfish2.png b/Gores/FrogFish/Frogfish2.png new file mode 100644 index 0000000000..5f35576153 Binary files /dev/null and b/Gores/FrogFish/Frogfish2.png differ diff --git a/Gores/GemCrawler Gems/CrawlerAmber.png b/Gores/GemCrawler Gems/CrawlerAmber.png new file mode 100644 index 0000000000..8fddabc6e1 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerAmber.png differ diff --git a/Gores/GemCrawler Gems/CrawlerAmber2.png b/Gores/GemCrawler Gems/CrawlerAmber2.png new file mode 100644 index 0000000000..ca096cf80c Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerAmber2.png differ diff --git a/Gores/GemCrawler Gems/CrawlerAmethyst.png b/Gores/GemCrawler Gems/CrawlerAmethyst.png new file mode 100644 index 0000000000..bd279e1fae Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerAmethyst.png differ diff --git a/Gores/GemCrawler Gems/CrawlerAmethyst2.png b/Gores/GemCrawler Gems/CrawlerAmethyst2.png new file mode 100644 index 0000000000..d248460d7b Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerAmethyst2.png differ diff --git a/Gores/GemCrawler Gems/CrawlerCrystal.png b/Gores/GemCrawler Gems/CrawlerCrystal.png new file mode 100644 index 0000000000..94990257e1 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerCrystal.png differ diff --git a/Gores/GemCrawler Gems/CrawlerCrystal2.png b/Gores/GemCrawler Gems/CrawlerCrystal2.png new file mode 100644 index 0000000000..3731c14a43 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerCrystal2.png differ diff --git a/Gores/GemCrawler Gems/CrawlerDiamond.png b/Gores/GemCrawler Gems/CrawlerDiamond.png new file mode 100644 index 0000000000..055fc7fa7d Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerDiamond.png differ diff --git a/Gores/GemCrawler Gems/CrawlerDiamond2.png b/Gores/GemCrawler Gems/CrawlerDiamond2.png new file mode 100644 index 0000000000..3b5b277598 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerDiamond2.png differ diff --git a/Gores/GemCrawler Gems/CrawlerEmerald.png b/Gores/GemCrawler Gems/CrawlerEmerald.png new file mode 100644 index 0000000000..e54a86372a Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerEmerald.png differ diff --git a/Gores/GemCrawler Gems/CrawlerEmerald2.png b/Gores/GemCrawler Gems/CrawlerEmerald2.png new file mode 100644 index 0000000000..c22a1b2f55 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerEmerald2.png differ diff --git a/Gores/GemCrawler Gems/CrawlerRuby.png b/Gores/GemCrawler Gems/CrawlerRuby.png new file mode 100644 index 0000000000..a3273cca23 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerRuby.png differ diff --git a/Gores/GemCrawler Gems/CrawlerRuby2.png b/Gores/GemCrawler Gems/CrawlerRuby2.png new file mode 100644 index 0000000000..c36110c354 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerRuby2.png differ diff --git a/Gores/GemCrawler Gems/CrawlerSapphire.png b/Gores/GemCrawler Gems/CrawlerSapphire.png new file mode 100644 index 0000000000..b39f101da1 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerSapphire.png differ diff --git a/Gores/GemCrawler Gems/CrawlerSapphire2.png b/Gores/GemCrawler Gems/CrawlerSapphire2.png new file mode 100644 index 0000000000..1ac542b658 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerSapphire2.png differ diff --git a/Gores/GemCrawler Gems/CrawlerTopaz.png b/Gores/GemCrawler Gems/CrawlerTopaz.png new file mode 100644 index 0000000000..ba7a621725 Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerTopaz.png differ diff --git a/Gores/GemCrawler Gems/CrawlerTopaz2.png b/Gores/GemCrawler Gems/CrawlerTopaz2.png new file mode 100644 index 0000000000..c17b7e305b Binary files /dev/null and b/Gores/GemCrawler Gems/CrawlerTopaz2.png differ diff --git a/Gores/GemCrawler Universal/Crawler.png b/Gores/GemCrawler Universal/Crawler.png new file mode 100644 index 0000000000..0eb8d19fb7 Binary files /dev/null and b/Gores/GemCrawler Universal/Crawler.png differ diff --git a/Gores/GemCrawler Universal/Crawler2.png b/Gores/GemCrawler Universal/Crawler2.png new file mode 100644 index 0000000000..6e16f92455 Binary files /dev/null and b/Gores/GemCrawler Universal/Crawler2.png differ diff --git a/Gores/IceClasper/IceClasper.png b/Gores/IceClasper/IceClasper.png new file mode 100644 index 0000000000..e5e3930e27 Binary files /dev/null and b/Gores/IceClasper/IceClasper.png differ diff --git a/Gores/IceClasper/IceClasper2.png b/Gores/IceClasper/IceClasper2.png new file mode 100644 index 0000000000..fc5985858c Binary files /dev/null and b/Gores/IceClasper/IceClasper2.png differ diff --git a/Gores/IceClasper/IceClasper3.png b/Gores/IceClasper/IceClasper3.png new file mode 100644 index 0000000000..bc516c2e9d Binary files /dev/null and b/Gores/IceClasper/IceClasper3.png differ diff --git a/Gores/ImpiousImmolator/ImpiousImmolator.png b/Gores/ImpiousImmolator/ImpiousImmolator.png new file mode 100644 index 0000000000..69ec8765c3 Binary files /dev/null and b/Gores/ImpiousImmolator/ImpiousImmolator.png differ diff --git a/Gores/ImpiousImmolator/ImpiousImmolator2.png b/Gores/ImpiousImmolator/ImpiousImmolator2.png new file mode 100644 index 0000000000..ca773be7a1 Binary files /dev/null and b/Gores/ImpiousImmolator/ImpiousImmolator2.png differ diff --git a/Gores/ImpiousImmolator/ImpiousImmolator3.png b/Gores/ImpiousImmolator/ImpiousImmolator3.png new file mode 100644 index 0000000000..8f1e1a7d8b Binary files /dev/null and b/Gores/ImpiousImmolator/ImpiousImmolator3.png differ diff --git a/Gores/LuminousCorvina/LuminousCorvina.png b/Gores/LuminousCorvina/LuminousCorvina.png new file mode 100644 index 0000000000..e65da49586 Binary files /dev/null and b/Gores/LuminousCorvina/LuminousCorvina.png differ diff --git a/Gores/LuminousCorvina/LuminousCorvina2.png b/Gores/LuminousCorvina/LuminousCorvina2.png new file mode 100644 index 0000000000..72afa6a54d Binary files /dev/null and b/Gores/LuminousCorvina/LuminousCorvina2.png differ diff --git a/Gores/LuminousCorvina/LuminousCorvina3.png b/Gores/LuminousCorvina/LuminousCorvina3.png new file mode 100644 index 0000000000..8bb28adcc1 Binary files /dev/null and b/Gores/LuminousCorvina/LuminousCorvina3.png differ diff --git a/Gores/MantisShrimp/MantisShrimp.png b/Gores/MantisShrimp/MantisShrimp.png new file mode 100644 index 0000000000..ec026b5b2c Binary files /dev/null and b/Gores/MantisShrimp/MantisShrimp.png differ diff --git a/Gores/MantisShrimp/MantisShrimp2.png b/Gores/MantisShrimp/MantisShrimp2.png new file mode 100644 index 0000000000..a4342e23ab Binary files /dev/null and b/Gores/MantisShrimp/MantisShrimp2.png differ diff --git a/Gores/MantisShrimp/MantisShrimp3.png b/Gores/MantisShrimp/MantisShrimp3.png new file mode 100644 index 0000000000..e221daf830 Binary files /dev/null and b/Gores/MantisShrimp/MantisShrimp3.png differ diff --git a/Gores/Melter/Melter.png b/Gores/Melter/Melter.png new file mode 100644 index 0000000000..ee97b31043 Binary files /dev/null and b/Gores/Melter/Melter.png differ diff --git a/Gores/Melter/Melter2.png b/Gores/Melter/Melter2.png new file mode 100644 index 0000000000..2f1f1c9ab8 Binary files /dev/null and b/Gores/Melter/Melter2.png differ diff --git a/Gores/Melter/Melter3.png b/Gores/Melter/Melter3.png new file mode 100644 index 0000000000..a24a71dd66 Binary files /dev/null and b/Gores/Melter/Melter3.png differ diff --git a/Gores/MorayEel/MorayEel.png b/Gores/MorayEel/MorayEel.png new file mode 100644 index 0000000000..a934215ae9 Binary files /dev/null and b/Gores/MorayEel/MorayEel.png differ diff --git a/Gores/MorayEel/MorayEel2.png b/Gores/MorayEel/MorayEel2.png new file mode 100644 index 0000000000..22b442ac98 Binary files /dev/null and b/Gores/MorayEel/MorayEel2.png differ diff --git a/Gores/MorayEel/MorayEel3.png b/Gores/MorayEel/MorayEel3.png new file mode 100644 index 0000000000..548d458f34 Binary files /dev/null and b/Gores/MorayEel/MorayEel3.png differ diff --git a/Gores/Oarfish/OarfishBody.png b/Gores/Oarfish/OarfishBody.png new file mode 100644 index 0000000000..50ea356a3d Binary files /dev/null and b/Gores/Oarfish/OarfishBody.png differ diff --git a/Gores/Oarfish/OarfishHead.png b/Gores/Oarfish/OarfishHead.png new file mode 100644 index 0000000000..14f397c7eb Binary files /dev/null and b/Gores/Oarfish/OarfishHead.png differ diff --git a/Gores/Oarfish/OarfishTail.png b/Gores/Oarfish/OarfishTail.png new file mode 100644 index 0000000000..cd7acee3bf Binary files /dev/null and b/Gores/Oarfish/OarfishTail.png differ diff --git a/Gores/OldDuke/OldDukeToothBallGore.png b/Gores/OldDuke/OldDukeToothBallGore.png new file mode 100644 index 0000000000..3eea41f8a3 Binary files /dev/null and b/Gores/OldDuke/OldDukeToothBallGore.png differ diff --git a/Gores/OldDuke/OldDukeToothBallGore2.png b/Gores/OldDuke/OldDukeToothBallGore2.png new file mode 100644 index 0000000000..4ab294eb25 Binary files /dev/null and b/Gores/OldDuke/OldDukeToothBallGore2.png differ diff --git a/Gores/OldDuke/SulphurousSharkronGore.png b/Gores/OldDuke/SulphurousSharkronGore.png new file mode 100644 index 0000000000..47affdc9e2 Binary files /dev/null and b/Gores/OldDuke/SulphurousSharkronGore.png differ diff --git a/Gores/OldDuke/SulphurousSharkronGore2.png b/Gores/OldDuke/SulphurousSharkronGore2.png new file mode 100644 index 0000000000..d99a8b88bf Binary files /dev/null and b/Gores/OldDuke/SulphurousSharkronGore2.png differ diff --git a/Gores/PlagueCharger/PlagueCharger.png b/Gores/PlagueCharger/PlagueCharger.png new file mode 100644 index 0000000000..e6a256a27d Binary files /dev/null and b/Gores/PlagueCharger/PlagueCharger.png differ diff --git a/Gores/PlagueCharger/PlagueCharger2.png b/Gores/PlagueCharger/PlagueCharger2.png new file mode 100644 index 0000000000..bc3c2b213f Binary files /dev/null and b/Gores/PlagueCharger/PlagueCharger2.png differ diff --git a/Gores/PlagueCharger/PlagueCharger3.png b/Gores/PlagueCharger/PlagueCharger3.png new file mode 100644 index 0000000000..1d1132d94d Binary files /dev/null and b/Gores/PlagueCharger/PlagueCharger3.png differ diff --git a/Gores/PlagueCharger/PlagueCharger4.png b/Gores/PlagueCharger/PlagueCharger4.png new file mode 100644 index 0000000000..2b4137eb30 Binary files /dev/null and b/Gores/PlagueCharger/PlagueCharger4.png differ diff --git a/Gores/Plagueshell/Plagueshell.png b/Gores/Plagueshell/Plagueshell.png new file mode 100644 index 0000000000..11f0c27c74 Binary files /dev/null and b/Gores/Plagueshell/Plagueshell.png differ diff --git a/Gores/Plagueshell/Plagueshell2.png b/Gores/Plagueshell/Plagueshell2.png new file mode 100644 index 0000000000..e9622dab07 Binary files /dev/null and b/Gores/Plagueshell/Plagueshell2.png differ diff --git a/Gores/Plagueshell/Plagueshell3.png b/Gores/Plagueshell/Plagueshell3.png new file mode 100644 index 0000000000..4f388357ab Binary files /dev/null and b/Gores/Plagueshell/Plagueshell3.png differ diff --git a/Gores/ProfanedEnergy/ProfanedEnergyBody.png b/Gores/ProfanedEnergy/ProfanedEnergyBody.png new file mode 100644 index 0000000000..6b7d1300e6 Binary files /dev/null and b/Gores/ProfanedEnergy/ProfanedEnergyBody.png differ diff --git a/Gores/ProfanedEnergy/ProfanedEnergyBody2.png b/Gores/ProfanedEnergy/ProfanedEnergyBody2.png new file mode 100644 index 0000000000..1fd732a43e Binary files /dev/null and b/Gores/ProfanedEnergy/ProfanedEnergyBody2.png differ diff --git a/Gores/ProfanedEnergy/ProfanedEnergyBody3.png b/Gores/ProfanedEnergy/ProfanedEnergyBody3.png new file mode 100644 index 0000000000..0d89e3a526 Binary files /dev/null and b/Gores/ProfanedEnergy/ProfanedEnergyBody3.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA.png index 378884b497..d068883547 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2.png index cf6fea2514..339344beb0 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA2.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3.png index 127eb77b75..b142b129dc 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA3.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4.png index baea77123d..daa097eef6 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossA4.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH.png index 181189a78e..77124bb1c6 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2.png index e6df4d36ae..aa736b46e7 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH2.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3.png index 1f436492ca..eac92d66c8 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH3.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4.png index f454bed3d3..daa097eef6 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH4.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5.png deleted file mode 100644 index 6cc0ba0e18..0000000000 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossH5.png and /dev/null differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT.png index 94647c29d3..57403d465e 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2.png index d23ea13f76..50f71dfbb2 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT2.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3.png index dae6ae4789..c788b0ad84 100644 Binary files a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3.png and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT3.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT4.png b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT4.png new file mode 100644 index 0000000000..daa097eef6 Binary files /dev/null and b/Gores/ProfanedGuardianBossGores/ProfanedGuardianBossT4.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedRocksGore1.png b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore1.png new file mode 100644 index 0000000000..b04bbdf7c9 Binary files /dev/null and b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore1.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedRocksGore2.png b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore2.png new file mode 100644 index 0000000000..89c21f7f9c Binary files /dev/null and b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore2.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedRocksGore3.png b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore3.png new file mode 100644 index 0000000000..bad23fe72d Binary files /dev/null and b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore3.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedRocksGore4.png b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore4.png new file mode 100644 index 0000000000..44421a5bc9 Binary files /dev/null and b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore4.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedRocksGore5.png b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore5.png new file mode 100644 index 0000000000..528073d491 Binary files /dev/null and b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore5.png differ diff --git a/Gores/ProfanedGuardianBossGores/ProfanedRocksGore6.png b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore6.png new file mode 100644 index 0000000000..a4fe8a2329 Binary files /dev/null and b/Gores/ProfanedGuardianBossGores/ProfanedRocksGore6.png differ diff --git a/Gores/ShockstormShuttle/ShockstormShuttle.png b/Gores/ShockstormShuttle/ShockstormShuttle.png new file mode 100644 index 0000000000..31345943bc Binary files /dev/null and b/Gores/ShockstormShuttle/ShockstormShuttle.png differ diff --git a/Gores/ShockstormShuttle/ShockstormShuttle2.png b/Gores/ShockstormShuttle/ShockstormShuttle2.png new file mode 100644 index 0000000000..43495c6aad Binary files /dev/null and b/Gores/ShockstormShuttle/ShockstormShuttle2.png differ diff --git a/Gores/ShockstormShuttle/ShockstormShuttle3.png b/Gores/ShockstormShuttle/ShockstormShuttle3.png new file mode 100644 index 0000000000..6620165e69 Binary files /dev/null and b/Gores/ShockstormShuttle/ShockstormShuttle3.png differ diff --git a/Gores/Sulflounder/Sulflounder.png b/Gores/Sulflounder/Sulflounder.png new file mode 100644 index 0000000000..3b60679d69 Binary files /dev/null and b/Gores/Sulflounder/Sulflounder.png differ diff --git a/Gores/Sulflounder/Sulflounder2.png b/Gores/Sulflounder/Sulflounder2.png new file mode 100644 index 0000000000..f28c944259 Binary files /dev/null and b/Gores/Sulflounder/Sulflounder2.png differ diff --git a/Gores/Toxicatfish/Toxicatfish.png b/Gores/Toxicatfish/Toxicatfish.png new file mode 100644 index 0000000000..8e7e9d1fde Binary files /dev/null and b/Gores/Toxicatfish/Toxicatfish.png differ diff --git a/Gores/Toxicatfish/Toxicatfish2.png b/Gores/Toxicatfish/Toxicatfish2.png new file mode 100644 index 0000000000..f53edbf909 Binary files /dev/null and b/Gores/Toxicatfish/Toxicatfish2.png differ diff --git a/Gores/Trees/SpineBottom.png b/Gores/Trees/SpineBottom.png new file mode 100644 index 0000000000..670969b718 Binary files /dev/null and b/Gores/Trees/SpineBottom.png differ diff --git a/Gores/Trees/SpineBottom2.png b/Gores/Trees/SpineBottom2.png new file mode 100644 index 0000000000..b2ff701bb9 Binary files /dev/null and b/Gores/Trees/SpineBottom2.png differ diff --git a/Gores/Trees/SpineRib1.png b/Gores/Trees/SpineRib1.png new file mode 100644 index 0000000000..31294a21d8 Binary files /dev/null and b/Gores/Trees/SpineRib1.png differ diff --git a/Gores/Trees/SpineRib1_2.png b/Gores/Trees/SpineRib1_2.png new file mode 100644 index 0000000000..3f8c7a743e Binary files /dev/null and b/Gores/Trees/SpineRib1_2.png differ diff --git a/Gores/Trees/SpineRib2.png b/Gores/Trees/SpineRib2.png new file mode 100644 index 0000000000..6bdc2591de Binary files /dev/null and b/Gores/Trees/SpineRib2.png differ diff --git a/Gores/Trees/SpineRib2_2.png b/Gores/Trees/SpineRib2_2.png new file mode 100644 index 0000000000..3940f89fd5 Binary files /dev/null and b/Gores/Trees/SpineRib2_2.png differ diff --git a/Gores/Trees/SpineRib3.png b/Gores/Trees/SpineRib3.png new file mode 100644 index 0000000000..0e000a1f81 Binary files /dev/null and b/Gores/Trees/SpineRib3.png differ diff --git a/Gores/Trees/SpineRib3_2.png b/Gores/Trees/SpineRib3_2.png new file mode 100644 index 0000000000..18a7c2ac02 Binary files /dev/null and b/Gores/Trees/SpineRib3_2.png differ diff --git a/Gores/Trees/SpineRib3_3.png b/Gores/Trees/SpineRib3_3.png new file mode 100644 index 0000000000..27d5773bc9 Binary files /dev/null and b/Gores/Trees/SpineRib3_3.png differ diff --git a/Gores/Trees/SpineSegment.png b/Gores/Trees/SpineSegment.png new file mode 100644 index 0000000000..d2603444a1 Binary files /dev/null and b/Gores/Trees/SpineSegment.png differ diff --git a/Gores/Trees/SpineSegment2.png b/Gores/Trees/SpineSegment2.png new file mode 100644 index 0000000000..bfe346ac27 Binary files /dev/null and b/Gores/Trees/SpineSegment2.png differ diff --git a/Gores/Trees/SpineSegment3.png b/Gores/Trees/SpineSegment3.png new file mode 100644 index 0000000000..fde649aa7d Binary files /dev/null and b/Gores/Trees/SpineSegment3.png differ diff --git a/Gores/Trees/Umbrella/TreeAstralBottom.png b/Gores/Trees/Umbrella/TreeAstralBottom.png new file mode 100644 index 0000000000..e4d136f2f1 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeAstralBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeAstralTop.png b/Gores/Trees/Umbrella/TreeAstralTop.png new file mode 100644 index 0000000000..574f8d6843 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeAstralTop.png differ diff --git a/Gores/Trees/Umbrella/TreeCorruptionBottom.png b/Gores/Trees/Umbrella/TreeCorruptionBottom.png new file mode 100644 index 0000000000..d40b2c7a3c Binary files /dev/null and b/Gores/Trees/Umbrella/TreeCorruptionBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeCorruptionTop.png b/Gores/Trees/Umbrella/TreeCorruptionTop.png new file mode 100644 index 0000000000..046a914292 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeCorruptionTop.png differ diff --git a/Gores/Trees/Umbrella/TreeCrimsonBottom.png b/Gores/Trees/Umbrella/TreeCrimsonBottom.png new file mode 100644 index 0000000000..790c4ad6bc Binary files /dev/null and b/Gores/Trees/Umbrella/TreeCrimsonBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeCrimsonTop.png b/Gores/Trees/Umbrella/TreeCrimsonTop.png new file mode 100644 index 0000000000..58cc58e297 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeCrimsonTop.png differ diff --git a/Gores/Trees/Umbrella/TreeForestBottom.png b/Gores/Trees/Umbrella/TreeForestBottom.png new file mode 100644 index 0000000000..f01196fb5e Binary files /dev/null and b/Gores/Trees/Umbrella/TreeForestBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeForestTop.png b/Gores/Trees/Umbrella/TreeForestTop.png new file mode 100644 index 0000000000..e61546be89 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeForestTop.png differ diff --git a/Gores/Trees/Umbrella/TreeHallowBottom.png b/Gores/Trees/Umbrella/TreeHallowBottom.png new file mode 100644 index 0000000000..7dc2fddc74 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeHallowBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeHallowTop.png b/Gores/Trees/Umbrella/TreeHallowTop.png new file mode 100644 index 0000000000..4a62340760 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeHallowTop.png differ diff --git a/Gores/Trees/Umbrella/TreeJungleBottom.png b/Gores/Trees/Umbrella/TreeJungleBottom.png new file mode 100644 index 0000000000..861c1c90be Binary files /dev/null and b/Gores/Trees/Umbrella/TreeJungleBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeJungleTop.png b/Gores/Trees/Umbrella/TreeJungleTop.png new file mode 100644 index 0000000000..acad6c7e68 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeJungleTop.png differ diff --git a/Gores/Trees/Umbrella/TreeOceanBottom.png b/Gores/Trees/Umbrella/TreeOceanBottom.png new file mode 100644 index 0000000000..cfb75ee273 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeOceanBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeOceanTop.png b/Gores/Trees/Umbrella/TreeOceanTop.png new file mode 100644 index 0000000000..872f27e99f Binary files /dev/null and b/Gores/Trees/Umbrella/TreeOceanTop.png differ diff --git a/Gores/Trees/Umbrella/TreeSnowBottom.png b/Gores/Trees/Umbrella/TreeSnowBottom.png new file mode 100644 index 0000000000..964e4e0491 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeSnowBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeSnowTop.png b/Gores/Trees/Umbrella/TreeSnowTop.png new file mode 100644 index 0000000000..92f8b90654 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeSnowTop.png differ diff --git a/Gores/Trees/Umbrella/TreeSulphurousSeaBottom.png b/Gores/Trees/Umbrella/TreeSulphurousSeaBottom.png new file mode 100644 index 0000000000..58e0503c21 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeSulphurousSeaBottom.png differ diff --git a/Gores/Trees/Umbrella/TreeSulphurousSeaTop.png b/Gores/Trees/Umbrella/TreeSulphurousSeaTop.png new file mode 100644 index 0000000000..aa17a9c426 Binary files /dev/null and b/Gores/Trees/Umbrella/TreeSulphurousSeaTop.png differ diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 917b73755b..ed6e96b26a 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -166,7 +166,7 @@ namespace CalamityMod.ILEditing cursor.Remove(); // Increase by 10% if the higher jump speed is enabled. - cursor.EmitDelegate>(() => CalamityConfig.Instance.FasterJumpSpeed ? BalancingConstants.ConfigBoostedBaseJumpHeight : VanillaBaseJumpHeight); + cursor.EmitDelegate>(() => CalamityConfig.Instance.HigherJumpHeight ? BalancingConstants.ConfigBoostedBaseJumpHeight : VanillaBaseJumpHeight); } #endregion diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 1543319339..374f4eef54 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -59,6 +59,7 @@ namespace CalamityMod.ILEditing On.Terraria.NPC.ApplyTileCollision += AllowTriggeredFallthrough; IL.Terraria.Player.Hurt += RemoveRNGFromDodges; IL.Terraria.Player.DashMovement += FixAllDashMechanics; + On.Terraria.Player.DoCommonDashHandle += ApplyDashKeybind; IL.Terraria.Player.GiveImmuneTimeForCollisionAttack += MakeShieldSlamIFramesConsistent; IL.Terraria.Player.Update_NPCCollision += NerfShieldOfCthulhuBonkSafety; On.Terraria.WorldGen.OpenDoor += OpenDoor_LabDoorOverride; @@ -68,6 +69,7 @@ namespace CalamityMod.ILEditing // TODO -- This should be unnecessary. There is now a TML hook for platform collision for ModNPCs. On.Terraria.NPC.Collision_DecideFallThroughPlatforms += EnableCalamityBossPlatformCollision; IL.Terraria.Wiring.HitWireSingle += AddTwinklersToStatue; + On.Terraria.Player.UpdateItemDye += FindCalamityItemDyeShader; // Mana Burn IL.Terraria.Player.QuickHeal += ConditionallyReplaceManaSickness; @@ -128,6 +130,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife; IL.Terraria.WorldGen.AttemptFossilShattering += PreventFossilShattering; On.Terraria.Player.GetPickaxeDamage += RemoveHellforgePickaxeRequirement; + On.Terraria.Player.GetAnglerReward += ImproveAnglerRewards; // Fix vanilla bugs exposed by Calamity mechanics IL.Terraria.NPC.NPCLoot += FixSplittingWormBannerDrops; @@ -177,12 +180,16 @@ namespace CalamityMod.ILEditing On.Terraria.NPC.ApplyTileCollision -= AllowTriggeredFallthrough; IL.Terraria.Player.Hurt -= RemoveRNGFromDodges; IL.Terraria.Player.DashMovement -= FixAllDashMechanics; + On.Terraria.Player.DoCommonDashHandle -= ApplyDashKeybind; IL.Terraria.Player.GiveImmuneTimeForCollisionAttack -= MakeShieldSlamIFramesConsistent; IL.Terraria.Player.Update_NPCCollision -= NerfShieldOfCthulhuBonkSafety; On.Terraria.WorldGen.OpenDoor -= OpenDoor_LabDoorOverride; On.Terraria.WorldGen.CloseDoor -= CloseDoor_LabDoorOverride; On.Terraria.Item.AffixName -= IncorporateEnchantmentInAffix; On.Terraria.Projectile.NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float -= IncorporateMinionExplodingCountdown; + On.Terraria.NPC.Collision_DecideFallThroughPlatforms -= EnableCalamityBossPlatformCollision; + IL.Terraria.Wiring.HitWireSingle -= AddTwinklersToStatue; + On.Terraria.Player.UpdateItemDye -= FindCalamityItemDyeShader; // Mana Burn IL.Terraria.Player.QuickHeal -= ConditionallyReplaceManaSickness; @@ -242,6 +249,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Main.UpdateTime_StartNight -= BloodMoonsRequire200MaxLife; IL.Terraria.WorldGen.AttemptFossilShattering -= PreventFossilShattering; On.Terraria.Player.GetPickaxeDamage -= RemoveHellforgePickaxeRequirement; + On.Terraria.Player.GetAnglerReward -= ImproveAnglerRewards; // Fix vanilla bugs exposed by Calamity mechanics IL.Terraria.NPC.NPCLoot -= FixSplittingWormBannerDrops; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index da0092b722..df3665145b 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -44,6 +44,7 @@ using CalamityMod.Particles.Metaballs; using Terraria.GameContent.Drawing; using CalamityMod.Tiles.Abyss; using System.Collections.Generic; +using CalamityMod.BiomeManagers; namespace CalamityMod.ILEditing { @@ -62,6 +63,8 @@ namespace CalamityMod.ILEditing private static readonly MethodInfo textureGetValueMethod = typeof(Asset).GetMethod("get_Value", BindingFlags.Public | BindingFlags.Instance); + public static event Func ExtraColorChangeConditions; + #region Dash Fixes and Improvements private static void MakeShieldSlamIFramesConsistent(ILContext il) { @@ -240,6 +243,39 @@ namespace CalamityMod.ILEditing cursor.Remove(); cursor.Emit(OpCodes.Ldc_I4, 10 - BalancingConstants.ShieldOfCthulhuBonkNoCollideFrames); } + + private static void ApplyDashKeybind(On.Terraria.Player.orig_DoCommonDashHandle orig, Player self, out int dir, out bool dashing, Player.DashStartAction dashStartAction) + { + if (CalamityKeybinds.DashHotkey.JustPressed) + { + dir = self.direction; + dashing = true; + if (self.dashTime > 0) + self.dashTime--; + if (self.dashTime < 0) + self.dashTime++; + + if ((self.dashTime <= 0 && self.direction == -1) || (self.dashTime >= 0 && self.direction == 1)) + { + self.dashTime = 15; + return; + } + + dashing = true; + self.dashTime = 0; + self.timeSinceLastDashStarted = 0; + dashStartAction?.Invoke(dir); + return; + } + + if (CalamityKeybinds.DashHotkey.GetAssignedKeys().Count == 0) + orig(self, out dir, out dashing, dashStartAction); + else + { + dir = 1; + dashing = false; + } + } #endregion Dash Fixes and Improvements #region Allow Empress to Enrage in Boss Rush @@ -552,7 +588,7 @@ namespace CalamityMod.ILEditing // If the blazing mouse is actually going to do damage, draw an indicator aura. if (!Main.mapFullscreen) { - int size = 450; + int size = 370; FluidFieldManager.AdjustSizeRelativeToGraphicsQuality(ref size); float scale = MathHelper.Max(Main.screenWidth, Main.screenHeight) / size; @@ -566,10 +602,10 @@ namespace CalamityMod.ILEditing int x = (int)((drawPosition.X - firePosition.X) / calamityFireDrawer.Scale); int y = (int)((drawPosition.Y - firePosition.Y) / calamityFireDrawer.Scale); - int horizontalArea = (int)Math.Ceiling(5f / calamityFireDrawer.Scale); - int verticalArea = (int)Math.Ceiling(5f / calamityFireDrawer.Scale); + int horizontalArea = (int)Math.Ceiling(8f / calamityFireDrawer.Scale); + int verticalArea = (int)Math.Ceiling(8f / calamityFireDrawer.Scale); - calamityFireDrawer.ShouldUpdate = player.miscCounter % 4 == 0; + calamityFireDrawer.ShouldUpdate = player.miscCounter % 2 == 0; calamityFireDrawer.UpdateAction = () => { Color color = Color.Lerp(Color.Red, Color.Orange, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f) * 0.5f + 0.5f); @@ -578,6 +614,10 @@ namespace CalamityMod.ILEditing if (player.hasRainbowCursor) color = Color.Lerp(color, Main.hslToRgb(Main.GlobalTimeWrappedHourly * 0.97f % 1f, 1f, 0.6f), 0.75f); + // Make the flame more greyscale if a dye is being applied, so that it doesn't conflict with the specific oranges and reds to create gross colors. + if (player.Calamity().CalamityFireDyeShader is not null) + color = Color.Lerp(color, Color.White, 0.75f); + for (int i = -horizontalArea; i <= horizontalArea; i++) { float offsetAngle = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6.7f) * 0.99f; @@ -590,7 +630,7 @@ namespace CalamityMod.ILEditing } UIManagementSystem.PreviousMouseWorld = Main.MouseWorld; - velocity = velocity.SafeNormalize(-Vector2.UnitY).RotatedBy(offsetAngle) * 0.2f; + velocity = velocity.SafeNormalize(-Vector2.UnitY).RotatedBy(offsetAngle) * 3f; // Add a tiny bit of randomness to the velocity. // Chaos in the advection calculations should result in different flames being made over time, instead of a @@ -598,11 +638,18 @@ namespace CalamityMod.ILEditing velocity *= Main.rand.NextFloat(0.9f, 1.1f); for (int j = -verticalArea; j <= verticalArea; j++) - player.Calamity().CalamityFireDrawer.CreateSource(x + size / 2 + i, y + size / 2 + j, 1f, color, velocity); + player.Calamity().CalamityFireDrawer.CreateSource(x + size / 2 + i, y + size / 2 + j, 1f, color, i == 0 && j == 0 ? velocity : Vector2.Zero); } }; - calamityFireDrawer.Draw(firePosition, true, Main.UIScaleMatrix, Main.UIScaleMatrix); + calamityFireDrawer.Draw(firePosition, true, Main.UIScaleMatrix, Main.UIScaleMatrix, output => + { + var armorShader = player.Calamity().CalamityFireDyeShader; + if (armorShader is null) + return; + + armorShader.Apply(null, new(output, Vector2.Zero, Color.White)); + }); } Main.spriteBatch.Draw(TextureAssets.Cursors[cursorIndex].Value, drawPosition, null, desaturatedCursorColor, 0f, Vector2.Zero, Main.cursorScale, SpriteEffects.None, 0f); @@ -788,8 +835,19 @@ namespace CalamityMod.ILEditing initialColor.TopRightColor = SelectLavaColor(initialTexture, initialColor.TopRightColor, liquidType == 1); initialColor.BottomLeftColor = SelectLavaColor(initialTexture, initialColor.BottomLeftColor, liquidType == 1); initialColor.BottomRightColor = SelectLavaColor(initialTexture, initialColor.BottomRightColor, liquidType == 1); - if (liquidType == ModContent.Find("CalamityMod/SulphuricWater").Slot) + + if (liquidType == ModContent.Find("CalamityMod/SunkenSeaWater").Slot || + liquidType == ModContent.Find("CalamityMod/SulphuricWater").Slot || + liquidType == ModContent.Find("CalamityMod/SulphuricDepthsWater").Slot || + liquidType == ModContent.Find("CalamityMod/UpperAbyssWater").Slot || + liquidType == ModContent.Find("CalamityMod/MiddleAbyssWater").Slot || + liquidType == ModContent.Find("CalamityMod/VoidWater").Slot) + { SelectSulphuricWaterColor(x, y, ref initialColor); + } + + // Apply any extra color conditions. + initialColor = ExtraColorChangeConditions?.Invoke(initialColor, liquidType, new(x, y)) ?? initialColor; return initialColor; }); @@ -799,7 +857,9 @@ namespace CalamityMod.ILEditing { ILCursor cursor = new ILCursor(il); - // Locate the local index for the liquid color. + // Locate the local index for the liquid color and tile coordinates. + int xCoordLocalIndex = 0; + int yCoordLocalIndex = 0; int liquidColorLocalIndex = 0; MethodInfo lightingGetColorMethod = typeof(Lighting).GetMethod("GetColor", new Type[] { typeof(int), typeof(int) }); if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchCallOrCallvirt(lightingGetColorMethod))) @@ -807,6 +867,16 @@ namespace CalamityMod.ILEditing LogFailure("Custom Lava Drawing", "Could not lighting GetColor call."); return; } + if (!cursor.TryGotoPrev(c => c.MatchLdloc(out xCoordLocalIndex))) + { + LogFailure("Custom Lava Drawing", "Could not X coordinate local variable index."); + return; + } + if (!cursor.TryGotoPrev(c => c.MatchLdloc(out yCoordLocalIndex))) + { + LogFailure("Custom Lava Drawing", "Could not Y coordinate local variable index."); + return; + } if (!cursor.TryGotoNext(c => c.MatchStloc(out liquidColorLocalIndex))) { LogFailure("Custom Lava Drawing", "Could not lighting GetColor local variable index."); @@ -839,7 +909,17 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldloc, liquidTypeLocalIndex); cursor.Emit(OpCodes.Ldelem_Ref); cursor.Emit(OpCodes.Call, textureGetValueMethod); - cursor.EmitDelegate>((initialColor, initialTexture) => SelectLavaColor(initialTexture, initialColor)); + cursor.Emit(OpCodes.Ldloc, xCoordLocalIndex); + cursor.Emit(OpCodes.Ldloc, yCoordLocalIndex); + cursor.EmitDelegate>((initialColor, initialTexture, x, y) => + { + Color c = SelectLavaColor(initialTexture, initialColor); + + if (ExtraColorChangeConditions is not null) + c = ExtraColorChangeConditions(new(c), Main.waterStyle, new(x, y)).TopLeftColor; + + return c; + }); cursor.Emit(OpCodes.Stloc, liquidColorLocalIndex); // Go back to the start and change textures as necessary. @@ -849,7 +929,7 @@ namespace CalamityMod.ILEditing { // Move to the end of the get_Value() call and then use the resulting texture to check if a new one should replace it. // Adding to the index directly would seem like a simple, direct way of achieving this since the operation is incredibly light, but - // it also unsafe due to the potential for NOP operations to appear. + // it is unsafe due to the potential for NOP operations to appear. if (!cursor.TryGotoNext(MoveType.After, c => c.MatchCallvirt(textureGetValueMethod))) { LogFailure("Custom Lava Drawing", "Could not locate the liquid texture Value call."); @@ -884,26 +964,114 @@ namespace CalamityMod.ILEditing } #endregion Custom Lava Visuals - #region Sulph Sea Water Visuals + #region Water Visuals private static void MakeSulphSeaWaterBetter(On.Terraria.Graphics.Light.TileLightScanner.orig_GetTileLight orig, TileLightScanner self, int x, int y, out Vector3 outputColor) { orig(self, x, y, out outputColor); + if (outputColor == Vector3.One || outputColor == new Vector3(0.25f, 0.25f, 0.25f) || outputColor == new Vector3(0.5f, 0.5f, 0.5f)) + return; Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.LiquidAmount <= 0 || tile.HasTile || Main.waterStyle != ModContent.Find("CalamityMod/SulphuricWater").Slot) + if (tile.LiquidAmount <= 0 || tile.HasTile || (Main.waterStyle != SulphuricWater.Type && + Main.waterStyle != SulphuricDepthsWater.Type && Main.waterStyle != SunkenSeaWater.Type)) return; Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1); - if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9)) + if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9) && + Main.waterStyle == SulphuricWater.Type) { MediumMistParticle acidFoam = new(new(x * 16f + Main.rand.NextFloat(16f), y * 16f + 8f), -Vector2.UnitY.RotatedByRandom(0.67f) * Main.rand.NextFloat(1f, 2.4f), Color.LightSeaGreen, Color.White, 0.16f, 128f, 0.02f); GeneralParticleHandler.SpawnParticle(acidFoam); } if (tile.TileType != (ushort)ModContent.TileType()) - outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f); + { + if (Main.waterStyle == SulphuricWater.Type && Main.dayTime == true && !Main.raining) + { + float brightness = MathHelper.Clamp(0.2f - (y / 680), 0.0f, 0.2f); + if (y > 580) + brightness *= 1f - (y - 580) / 100f; + + float waveScale1 = Main.GameUpdateCount * 0.014f; + float waveScale2 = Main.GameUpdateCount * 0.1f; + int scalar = x + (-y / 2); + float wave1 = waveScale1 * -50 + scalar * 15; + float wave2 = waveScale2 * -10 + scalar * 14; + float wave3 = waveScale1 * -100 + scalar * 13; + float wave4 = waveScale2 * 10 + scalar * 25; + float wave5 = waveScale1 * -70 + scalar * 5; + float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); + outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle); + outputColor *= brightness; + } + + if (Main.waterStyle == SulphuricWater.Type && Main.dayTime == false && !Main.raining) + { + float brightness = MathHelper.Clamp(0.17f - (y / 680), 0.0f, 0.17f); + if (y > 580) + brightness *= 1f - (y - 580) / 100f; + + float waveScale1 = Main.GameUpdateCount * 0.014f; + float waveScale2 = Main.GameUpdateCount * 0.1f; + int scalar = x + (-y / 2); + float wave1 = waveScale1 * -50 + scalar * 15; + float wave2 = waveScale2 * -10 + scalar * 14; + float wave3 = waveScale1 * -100 + scalar * 13; + float wave4 = waveScale2 * 10 + scalar * 25; + float wave5 = waveScale1 * -70 + scalar * 5; + float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); + outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle); + outputColor *= brightness; + } + + if (Main.waterStyle == SulphuricWater.Type && Main.raining) + { + float brightness = MathHelper.Clamp(1f - (y / 680), 0.0f, 1f); + if (y > 580) + brightness *= 1f - (y - 580) / 100f; + + outputColor = Vector3.Lerp(outputColor, Color.LightSeaGreen.ToVector3(), 0.41f); + outputColor *= brightness; + } + + if (Main.waterStyle == SulphuricDepthsWater.Type) + outputColor = Vector3.Lerp(outputColor, Color.MediumSeaGreen.ToVector3(), 0.18f); + + if (Main.waterStyle == SunkenSeaWater.Type) + { + float brightness = MathHelper.Clamp(0.07f, 0f, 0.07f); + float waveScale1 = Main.GameUpdateCount * 0.028f; + float waveScale2 = Main.GameUpdateCount * 0.1f; + int yScale = -y / 2; + int xScale = x / 15; + float wave1 = Main.GameUpdateCount * 0.024f * -50 + ((-x / 30) + (y / 30)) * 25; + float wave2 = waveScale2 * -10 + ((-xScale) + yScale) * 45; + float wave3 = waveScale1 * -100 + ((x / 7) + (y / 50)) * 25; + float wave4 = Main.GameUpdateCount * 0.15f * 10 + ((x / 3) + yScale) * 45; + float wave5 = waveScale1 * -70 + ((-x / 25) + (-y / 25)) * 20; + float wave6 = waveScale2 * -10 + (xScale + yScale) * 45; + float bigwave = Main.GameUpdateCount * 0.01f * -70 + ((-x / 2) + (-y / 40)) * 5; + float wave1angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5)); + float wave6angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave6)); + float bigwaveangle = 0.55f + 0.80f * (float)Math.Sin(MathHelper.ToRadians(bigwave)); + outputColor = Vector3.Lerp(outputColor, Color.DeepSkyBlue.ToVector3(), 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle); + outputColor *= brightness; + } + } } - #endregion Sulph Sea Water Visuals + #endregion Water Visuals #region Statue Additions /// @@ -1012,6 +1180,7 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Call, "get_TaxesToCollectLimit"); } #endregion Make Tax Collector Worth it + #region Foreground tiles drawing private static void DrawForegroundStuff(On.Terraria.Main.orig_DrawGore orig, Main self) { @@ -1130,5 +1299,15 @@ namespace CalamityMod.ILEditing mp.hookCache = -1; } #endregion + + #region Find Calamity Item Dye Shader + + internal static void FindCalamityItemDyeShader(On.Terraria.Player.orig_UpdateItemDye orig, Player self, bool isNotInVanitySlot, bool isSetToHidden, Item armorItem, Item dyeItem) + { + orig(self, isNotInVanitySlot, isSetToHidden, armorItem, dyeItem); + if (armorItem.type == ModContent.ItemType()) + self.Calamity().CalamityFireDyeShader = GameShaders.Armor.GetShaderFromItemId(dyeItem.type); + } + #endregion Find Calamity Item Dye Shader } } diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 1d346b60f8..2cd9b6c862 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -6,8 +6,10 @@ using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; using System; +using System.Collections.Generic; using System.Reflection; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -420,5 +422,237 @@ namespace CalamityMod.ILEditing NetMessage.SendData(MessageID.ItemTweaker, -1, -1, null, itemID, 1f); } #endregion Color Blighted Gel + + #region Improve Angler Quest Rewards + private static void ImproveAnglerRewards(On.Terraria.Player.orig_GetAnglerReward orig, Player self, NPC angler) + { + orig(self, angler); + + EntitySource_Gift source = new EntitySource_Gift(angler); + int questsDone = self.anglerQuestsFinished + Main.rand.Next(101); + float rarityReduction = 1f; + rarityReduction = (questsDone <= 50) ? (rarityReduction - questsDone * 0.01f) : ((questsDone <= 100) ? (0.5f - (questsDone - 50) * 0.005f) : ((questsDone > 150) ? 0.15f : (0.25f - (questsDone - 100) * 0.002f))); + rarityReduction *= 0.9f; + rarityReduction *= (float)(self.currentShoppingSettings.PriceAdjustment + 1.0) / 2f; + + List rewardItems = new List(); + + GetItemSettings anglerRewardSettings = GetItemSettings.NPCEntityToPlayerInventorySettings; + + Item item = new Item(); + item.SetDefaults(ItemID.MasterBait); + item.stack += 5; + if (item.stack > 0) + rewardItems.Add(item); + + Item item2 = self.GetItem(self.whoAmI, item, GetItemSettings.NPCEntityToPlayerInventorySettings); + if (item2.stack > 0) + rewardItems.Add(item2); + + item = new Item(); + item.SetDefaults(ItemID.GoldCoin); + item.stack = 10; + + item.position = self.Center; + item2 = self.GetItem(self.whoAmI, item, anglerRewardSettings); + if (item2.stack > 0) + rewardItems.Add(item2); + + // Golden Fishing Rod + if (Main.rand.NextBool((int)(500f * rarityReduction))) + { + item = new Item(); + item.SetDefaults(ItemID.GoldenFishingRod); + rewardItems.Add(item); + } + + // Hotline Fishing Hook + if (Main.rand.NextBool((int)(200f * rarityReduction)) || self.anglerQuestsFinished == 22) + { + item = new Item(); + item.SetDefaults(ItemID.HotlineFishingHook); + rewardItems.Add(item); + } + + // Angler Set + if (Main.rand.NextBool((int)(150f * rarityReduction))) + { + item = new Item(); + item.SetDefaults(ItemID.AnglerHat); + rewardItems.Add(item); + item = new Item(); + item.SetDefaults(ItemID.AnglerVest); + rewardItems.Add(item); + item = new Item(); + item.SetDefaults(ItemID.AnglerPants); + rewardItems.Add(item); + } + + // Mermaid Set + if (Main.rand.NextBool((int)(150f * rarityReduction)) || self.anglerQuestsFinished == 11) + { + item = new Item(); + item.SetDefaults(ItemID.SeashellHairpin); + rewardItems.Add(item); + item = new Item(); + item.SetDefaults(ItemID.MermaidAdornment); + rewardItems.Add(item); + item = new Item(); + item.SetDefaults(ItemID.MermaidTail); + rewardItems.Add(item); + } + + // Fish Set + if (Main.rand.NextBool((int)(150f * rarityReduction)) || self.anglerQuestsFinished == 8) + { + item = new Item(); + item.SetDefaults(ItemID.FishCostumeMask); + rewardItems.Add(item); + item = new Item(); + item.SetDefaults(ItemID.FishCostumeShirt); + rewardItems.Add(item); + item = new Item(); + item.SetDefaults(ItemID.FishCostumeFinskirt); + rewardItems.Add(item); + } + + // Fin Wings + if (Main.rand.NextBool((int)(140f * rarityReduction)) && Main.hardMode) + { + item = new Item(); + item.SetDefaults(ItemID.FinWings); + rewardItems.Add(item); + } + + // Bottomless Water Bucket + if (Main.rand.NextBool((int)(140f * rarityReduction))) + { + item = new Item(); + item.SetDefaults(ItemID.BottomlessBucket); + rewardItems.Add(item); + } + + // Bottomless Honey Bucket + /*if (Main.rand.NextBool((int)(140f * rarityReduction)) || self.anglerQuestsFinished == 29) + { + item = new Item(); + item.SetDefaults(ItemID.BottomlessHoneyBucket); + rewardItems.Add(item); + }*/ + + // Super Absorbant Sponge + if (Main.rand.NextBool((int)(140f * rarityReduction)) || self.anglerQuestsFinished == 17) + { + item = new Item(); + item.SetDefaults(ItemID.SuperAbsorbantSponge); + rewardItems.Add(item); + } + + // Honey Absorbant Sponge + /*if (Main.rand.NextBool((int)(140f * rarityReduction)) || self.anglerQuestsFinished == 19) + { + item = new Item(); + item.SetDefaults(ItemID.SuperAbsorbantSponge); + rewardItems.Add(item); + }*/ + + // Golden Bug Net + if (Main.rand.NextBool((int)(140f * rarityReduction)) || self.anglerQuestsFinished == 27) + { + item = new Item(); + item.SetDefaults(ItemID.GoldenBugNet); + rewardItems.Add(item); + } + + // Fish Hook + if (Main.rand.NextBool((int)(120f * rarityReduction)) || self.anglerQuestsFinished == 4) + { + item = new Item(); + item.SetDefaults(ItemID.FishHook); + rewardItems.Add(item); + } + + // Minecarp + if (Main.rand.NextBool((int)(120f * rarityReduction)) || self.anglerQuestsFinished == 9) + { + item = new Item(); + item.SetDefaults(ItemID.FishMinecart); + rewardItems.Add(item); + } + + // High Test Fishing Line + if (Main.rand.NextBool((int)(80f * rarityReduction)) || self.anglerQuestsFinished == 2) + { + item = new Item(); + item.SetDefaults(ItemID.HighTestFishingLine); + rewardItems.Add(item); + } + + // Angler Earring + if (Main.rand.NextBool((int)(80f * rarityReduction)) || self.anglerQuestsFinished == 7) + { + item = new Item(); + item.SetDefaults(ItemID.AnglerEarring); + rewardItems.Add(item); + } + + // Tackle Box + if (Main.rand.NextBool((int)(80f * rarityReduction)) || self.anglerQuestsFinished == 12) + { + item = new Item(); + item.SetDefaults(ItemID.TackleBox); + rewardItems.Add(item); + } + + // Fisherman's Pocket Guide + if (Main.rand.NextBool((int)(60f * rarityReduction)) || self.anglerQuestsFinished == 1) + { + item = new Item(); + item.SetDefaults(ItemID.FishermansGuide); + rewardItems.Add(item); + } + + // Weather Radio + if (Main.rand.NextBool((int)(60f * rarityReduction)) || self.anglerQuestsFinished == 3) + { + item = new Item(); + item.SetDefaults(ItemID.WeatherRadio); + rewardItems.Add(item); + } + + // Sextant + if (Main.rand.NextBool((int)(60f * rarityReduction)) || self.anglerQuestsFinished == 6) + { + item = new Item(); + item.SetDefaults(ItemID.Sextant); + rewardItems.Add(item); + } + + // Fishing Bobber + /*if (Main.rand.NextBool((int)(50f * rarityReduction)) || self.anglerQuestsFinished == 13) + { + item = new Item(); + item.SetDefaults(ItemID.FishingBobber); + rewardItems.Add(item); + }*/ + + PlayerLoader.AnglerQuestReward(self, rarityReduction, rewardItems); + + foreach (Item rewardItem in rewardItems) + { + rewardItem.position = self.Center; + + Item getItem = self.GetItem(self.whoAmI, rewardItem, GetItemSettings.NPCEntityToPlayerInventorySettings); + + if (getItem.stack > 0) + { + int number = Item.NewItem(source, (int)self.position.X, (int)self.position.Y, self.width, self.height, getItem.type, getItem.stack, noBroadcast: false, 0, noGrabDelay: true); + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, number, 1f); + } + } + } + #endregion } } diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index f14059a7a0..a6d9991ee8 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddRecipeGroup("AnyGoldCrown"). AddIngredient(5). - AddIngredient(10). + AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 79a305fa5c..50f02fa8d2 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -82,11 +82,8 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(15). - AddIngredient(40). - AddIngredient(40). - AddIngredient(15). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(15). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index c0db5f2781..c98256fc8c 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -44,8 +44,6 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(ItemID.SpectreBar, 8). - AddIngredient(10). AddIngredient(5). AddIngredient(5). AddTile(TileID.MythrilAnvil). diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index ce18b696d4..bc3fb39026 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Ancient Fossil"); - Tooltip.SetDefault("Increases pick speed by 15% while underground"); + Tooltip.SetDefault("Increases mining speed by 15%"); } public override void SetDefaults() @@ -24,10 +24,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) - { - player.pickSpeed -= 0.15f; - } + player.pickSpeed -= 0.15f; } public override void AddRecipes() diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index 00cb5e505d..ef35b32d57 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -56,9 +56,9 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.TerrasparkBoots). AddIngredient(). AddIngredient(5). + AddIngredient(ItemID.SoulofFright). AddIngredient(ItemID.SoulofMight). AddIngredient(ItemID.SoulofSight). - AddIngredient(ItemID.SoulofFright). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 377d51eb84..19f5b43274 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Archaic Powder"); - Tooltip.SetDefault("20% increased mining speed, 5% damage reduction and +10 defense while underground or in the underworld"); + Tooltip.SetDefault("Increased mining speed by 20%\n" + + "5% increased damage reduction and +10 defense while underground or in the underworld"); } public override void SetDefaults() @@ -25,11 +26,11 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { + player.pickSpeed -= 0.2f; if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight) { player.statDefense += 10; player.endurance += 0.05f; - player.pickSpeed -= 0.2f; } } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index b6dccbe1cc..f08f266f18 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Grants immunity to knockback\n" + "Immune to most debuffs\n" + "+40 max life and increased life regeneration\n" + - "Grants a supreme holy flame dash\n" + + "Grants a supreme god slayer flame dash\n" + "Can be used to ram enemies\n" + "TOOLTIP LINE HERE\n" + "Activating this buff will reduce your movement speed and increase enemy aggro\n" + diff --git a/Items/Accessories/BloodstainedGlove.cs b/Items/Accessories/BloodstainedGlove.cs index 1e3eb2edf6..d4df01cbd1 100644 --- a/Items/Accessories/BloodstainedGlove.cs +++ b/Items/Accessories/BloodstainedGlove.cs @@ -34,9 +34,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.CrimtaneBar, 4). AddIngredient(5). AddIngredient(ItemID.Vertebrae, 4). - AddIngredient(ItemID.CrimtaneBar, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index f2cd522540..84490cef64 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories // This is ONLY the direct DPS of having the cursor over the enemy, not the damage from the flames debuff. // The debuff is VulnerabilityHex, check that file for its DPS. - public const int BaseDamage = 266; + public const int BaseDamage = 320; public const int HitsPerSecond = 12; public override void SetStaticDefaults() diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 53089018fe..18bee7c6f6 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,9 +32,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnyGoldBar", 4). + AddRecipeGroup("AnyCopperBar", 12). AddRecipeGroup("AnyEvilBar", 8). - AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index 7a224840ea..017e274566 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Corrosive Spine"); Tooltip.SetDefault("5% increased movement speed\n" + - "All rogue weapons inflict poisoned and spawn clouds on enemy hits\n" + + "All rogue weapons inflict poison and spawn irradiated clouds on enemy hits\n" + "You release a ton of clouds everywhere on hit"); } @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Accessories ModContent.ProjectileType() }); float speed = Main.rand.NextFloat(3f, 11f); - int damage = (int)player.GetTotalDamage().ApplyTo(100); + int damage = (int)player.GetTotalDamage().ApplyTo(80); Projectile.NewProjectile(source, player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, damage, 0f, player.whoAmI); } diff --git a/Items/Accessories/CryoStone.cs b/Items/Accessories/CryoStone.cs index 8d92cd49f6..5ae61c8983 100644 --- a/Items/Accessories/CryoStone.cs +++ b/Items/Accessories/CryoStone.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Cryo Stone"); Tooltip.SetDefault("One of the ancient relics\n" + + "Multiplies all cold-based debuff damage by 1.5\n" + "Creates a rotating ice shield around you that damages and slows down enemies on contact"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; @@ -27,5 +28,7 @@ namespace CalamityMod.Items.Accessories } public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().CryoStone = true; + + public override void UpdateVanity(Player player) => player.Calamity().CryoStoneVanity = true; } } diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index 0852a51923..d0213c1ee6 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -98,9 +98,9 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.LunarBar, 10). AddIngredient(15). AddIngredient(15). + AddIngredient(ItemID.LunarBar, 10). AddIngredient(4). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 3ddfefe845..a4b31fbb72 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Dark Sun Ring"); Tooltip.SetDefault("Contains the power of the dark sun\n" + "12% increase to damage and melee speed\n" + - "+1 life regen, 15% increased pick speed and +2 max minions\n" + + "+1 life regen, 15% increased mining speed and +2 max minions\n" + "Increased minion knockback\n" + - "During the day the player has +3 life regen\n" + - "During the night the player has +15 defense\n" + - "Both of these bonuses are granted during an eclipse"); + "During the day the player has +4 life regen\n" + + "During the night the player has +20 defense\n" + + "During an eclipse the player has +2 life regen and +10 defense"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 7)); ItemID.Sets.AnimatesAsSoul[Type] = true; } diff --git a/Items/Accessories/DeadshotBrooch.cs b/Items/Accessories/DeadshotBrooch.cs index 73f041347d..155d7df828 100644 --- a/Items/Accessories/DeadshotBrooch.cs +++ b/Items/Accessories/DeadshotBrooch.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 28; - Item.height = 32; + Item.width = 46; + Item.height = 40; Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.RangerEmblem). - AddIngredient(3). + AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/DeadshotBrooch.png b/Items/Accessories/DeadshotBrooch.png index 233491de85..87af2f68cf 100644 Binary files a/Items/Accessories/DeadshotBrooch.png and b/Items/Accessories/DeadshotBrooch.png differ diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 25cf519fbf..a2fb75f49b 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.CharmofMyths). AddIngredient(ItemID.StarVeil). AddIngredient(10). - AddIngredient(ItemID.MeteoriteBar, 10). AddIngredient(15). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 305af709e8..bd142d499c 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories { public class DragonScales : ModItem { - internal static int ShitBaseDamage = 50; + internal static int ShitBaseDamage = 55; public override void SetStaticDefaults() { diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 587f7bc8c7..59ad439682 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 38; - Item.height = 38; + Item.width = 30; + Item.height = 46; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; diff --git a/Items/Accessories/EclipseMirror.png b/Items/Accessories/EclipseMirror.png index 16a667fcbc..fad1405a90 100644 Binary files a/Items/Accessories/EclipseMirror.png and b/Items/Accessories/EclipseMirror.png differ diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index dfd1e287e0..eabe0f8106 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Eldritch Soul Artifact"); Tooltip.SetDefault("Knowledge\n" + - "Boosts melee speed by 10%, ranged velocity by 25%, rogue stealth regen by 10%, max minions by 2 and reduces mana cost by 15%\n" + + "Boosts melee speed by 10%, ranged velocity by 25%, rogue stealth regen by 15%, max minions by 1 and reduces mana cost by 25%\n" + "Grants immunity to Whispering Death"); } diff --git a/Items/Accessories/ElectriciansGlove.cs b/Items/Accessories/ElectriciansGlove.cs index a184a8b273..5a6f5e1a4c 100644 --- a/Items/Accessories/ElectriciansGlove.cs +++ b/Items/Accessories/ElectriciansGlove.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Electrician's Glove"); Tooltip.SetDefault(@"Stealth strikes summon sparks on enemy hits -Stealth strikes also have +10 armor penetration, deal 8% more damage, and heal for 2 HP"); +Stealth strikes also have +8 armor penetration, deal 8% more damage, and heal for 2 HP"); } public override void SetDefaults() diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 348c32addb..4acd53afeb 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Elemental Gauntlet"); - Tooltip.SetDefault("Melee attacks and projectiles inflict on fire, frostburn and holy flames\n" + + Tooltip.SetDefault("Melee attacks and projectiles inflict Hellfire\n" + "15% increased melee speed, damage, and 5% increased melee critical strike chance\n" + "20% increased true melee damage\n" + "Temporary immunity to lava\n" + diff --git a/Items/Accessories/EnchantedPearl.cs b/Items/Accessories/EnchantedPearl.cs index 063d39bacd..dcb867be43 100644 --- a/Items/Accessories/EnchantedPearl.cs +++ b/Items/Accessories/EnchantedPearl.cs @@ -34,9 +34,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.FishingPotion). - AddIngredient(ItemID.CratePotion, 8). - AddRecipeGroup("Boss2Material", 5). + AddIngredient(ItemID.WhitePearl). AddIngredient(10). AddIngredient(3). AddTile(TileID.Anvils). diff --git a/Items/Accessories/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index 395ea49ed3..87219854f0 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Ethereal Extorter"); Tooltip.SetDefault(@"Rogue projectiles explode into homing souls on death -10% increased rogue damage and +10 maximum stealth"); +8% increased rogue damage and +10 maximum stealth"); } public override void SetDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.etherealExtorter = true; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.08f; modPlayer.rogueStealthMax += 0.1f; } } diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index c99177d730..c8df27741f 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.SoulofNight, 5). AddIngredient(ItemID.SoulofLight, 5). + AddIngredient(ItemID.SoulofNight, 5). AddIngredient(ItemID.Silk, 15). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index a0e078441a..7fa939da49 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -55,5 +55,25 @@ namespace CalamityMod.Items.Accessories } } } + + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.cloudWaifuVanity = 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_Accessory(Item); + int damage = (int)player.GetTotalDamage().ApplyTo(45); + var p = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); + p.originalDamage = 45; + } + } + } } } diff --git a/Items/Accessories/FilthyGlove.cs b/Items/Accessories/FilthyGlove.cs index 32906f9bca..23802f3b2a 100644 --- a/Items/Accessories/FilthyGlove.cs +++ b/Items/Accessories/FilthyGlove.cs @@ -34,9 +34,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.RottenChunk, 4). AddIngredient(ItemID.DemoniteBar, 4). AddIngredient(5). + AddIngredient(ItemID.RottenChunk, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index b5e548b201..db350a36d1 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Frost Flare"); - Tooltip.SetDefault("All melee attacks and projectiles inflict frostburn\n" + + Tooltip.SetDefault("All attacks and projectiles inflict frostbite\n" + "Immunity to frostburn, chilled and frozen\n" + "Being above 75% life grants 10% increased damage\n" + "Being below 25% life grants 20 defense and 15% increased max movement speed and acceleration\n" + diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index 7850c277ae..d07230e8a1 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -48,5 +48,25 @@ namespace CalamityMod.Items.Accessories } } } + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.fungalClumpVanity = 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_Accessory(Item); + int damage = (int)player.GetBestClassDamage().ApplyTo(FungalClumpDamage); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 1f, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = FungalClumpDamage; + } + } + } } } diff --git a/Items/Accessories/FungalSymbiote.cs b/Items/Accessories/FungalSymbiote.cs index 9d311596df..c2440931a4 100644 --- a/Items/Accessories/FungalSymbiote.cs +++ b/Items/Accessories/FungalSymbiote.cs @@ -11,8 +11,9 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Fungal Symbiote"); - Tooltip.SetDefault("Various melee weapons emit mushrooms in true melee range\n" + - "15% increased true melee damage"); + Tooltip.SetDefault("You grow mushrooms on the grass beneath you\n" + + "Consuming mushrooms provides the Mushy buff, increasing defense by 6 and life regen by 2\n" + + "All mushroom-based weapons deal 10% more damage and emit non-damaging mushrooms"); } public override void SetDefaults() @@ -26,9 +27,92 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetDamage() += 0.15f; CalamityPlayer modPlayer = player.Calamity(); modPlayer.fungalSymbiote = true; + + // Mushroom growing effects. + int x = (int)player.Center.X / 16; + int y = (int)(player.Bottom.Y - 1f) / 16; + Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y + 1); + if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) + { + Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (!walkTile.HasTile && walkTile.LiquidAmount == 0 && groundTile != null && WorldGen.SolidTile(groundTile)) + { + walkTile.TileFrameY = 0; + walkTile.Get().Slope = SlopeType.Solid; + walkTile.Get().IsHalfBlock = false; + + // On dirt, grow teal and green mushrooms. + if (groundTile.TileType == TileID.Dirt) + { + if (Main.rand.NextBool(1000)) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.DyePlants; + walkTile.TileFrameX = (short)(Main.rand.NextBool() ? 0 : 34); + } + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + + // On grass, grow mushrooms. + else if (groundTile.TileType == TileID.Grass) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.Plants; + walkTile.TileFrameX = 144; + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + + // On hallowed grass, grow mushrooms. + else if (groundTile.TileType == TileID.HallowedGrass) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.HallowedPlants; + walkTile.TileFrameX = 144; + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + + // On corrupt grass, grow vile mushrooms. + else if (groundTile.TileType == TileID.CorruptGrass) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.CorruptPlants; + walkTile.TileFrameX = 144; + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + + // On crimson grass, grow vicious mushrooms. + else if (groundTile.TileType == TileID.CrimsonGrass) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.CrimsonPlants; + walkTile.TileFrameX = 270; + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + + // On glowing mushroom grass, grow glowing mushrooms. + else if (groundTile.TileType == TileID.MushroomGrass) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.MushroomPlants; + walkTile.TileFrameX = (short)(Main.rand.Next(5) * 18); + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + } + } } } } diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 523455e1d5..3af35ba06f 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Gladiator's Locket"); - Tooltip.SetDefault("Summons two spirit swords to protect you"); + Tooltip.SetDefault("Enemies drop a healing orb on kill\n" + + "Gain an increase to your damage and movement speed the lower your health is, up to 20%"); } public override void SetDefaults() @@ -37,25 +38,11 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.gladiatorSword = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - player.AddBuff(ModContent.BuffType(), 3600, true); - - int baseDamage = 30; - int swordDmg = (int)player.GetTotalDamage().ApplyTo(baseDamage); - var source = player.GetSource_Accessory(Item); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - var sword = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); - sword.originalDamage = baseDamage; - - sword = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); - sword.originalDamage = baseDamage; - } - } + float damageIncrease = 0.2f; + float moveSpeedIncrease = 0.2f; + player.Calamity().gladiatorSword = true; + player.GetDamage() += damageIncrease - (damageIncrease * player.statLife / player.statLifeMax2); + player.moveSpeed += moveSpeedIncrease - (moveSpeedIncrease * player.statLife / player.statLifeMax2); } } } diff --git a/Items/Accessories/GloveOfRecklessness.cs b/Items/Accessories/GloveOfRecklessness.cs index 0bf8509182..15bf6fe3d4 100644 --- a/Items/Accessories/GloveOfRecklessness.cs +++ b/Items/Accessories/GloveOfRecklessness.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Glove of Recklessness"); - Tooltip.SetDefault("Increases rogue attack speed by 15% but decreases damage by 12%\n" + + Tooltip.SetDefault("Increases rogue attack speed by 15% but decreases damage by 13%\n" + "15% increased stealth regeneration\n" + "Adds inaccuracy to rogue weapons"); } @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories modPlayer.gloveOfRecklessness = true; modPlayer.stealthGenStandstill += 0.15f; modPlayer.stealthGenMoving += 0.15f; - player.GetDamage() -= 0.12f; + player.GetDamage() -= 0.13f; player.GetAttackSpeed() += 0.15f; } } diff --git a/Items/Accessories/GloveofPrecision.cs b/Items/Accessories/GloveofPrecision.cs index 7622ff6918..9305765e49 100644 --- a/Items/Accessories/GloveofPrecision.cs +++ b/Items/Accessories/GloveofPrecision.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Glove of Precision"); - Tooltip.SetDefault("Decreases rogue attack speed by 15% but increases damage and crit by 15% and velocity by 25%"); + Tooltip.SetDefault("Decreases rogue attack speed by 15% but increases damage by 13%, crit by 15% and velocity by 25%"); } public override void SetDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.gloveOfPrecision = true; - player.GetDamage() += 0.15f; + player.GetDamage() += 0.13f; player.GetCritChance() += 15; modPlayer.rogueVelocity += 0.25f; player.GetAttackSpeed() -= 0.15f; diff --git a/Items/Accessories/GodlySoulArtifact.cs b/Items/Accessories/GodlySoulArtifact.cs index 869e56d333..eb2c5126aa 100644 --- a/Items/Accessories/GodlySoulArtifact.cs +++ b/Items/Accessories/GodlySoulArtifact.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Godly Soul Artifact"); + DisplayName.SetDefault("Auric Soul Artifact"); Tooltip.SetDefault("Loyalty\n" + "For each Fiery Draconid you have summoned, you gain 1 minion slot"); } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.gArtifact = true; + modPlayer.auricSArtifact = true; } public override void AddRecipes() diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index 4d4e327319..c7e3ae24e8 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -35,8 +35,8 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(2). + AddIngredient(ItemID.SunplateBlock, 2). AddIngredient(ItemID.Feather, 5). - AddIngredient(ItemID.FallenStar). AddTile(TileID.SkyMill). Register(); } diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 9042a5583e..e3498493b6 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -108,6 +108,68 @@ namespace CalamityMod.Items.Accessories } } + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.allWaifusVanity = true; + // modPlayer.elementalHeart = true; + + int brimmy = ProjectileType(); + int siren = ProjectileType(); + int healer = ProjectileType(); + int sandy = ProjectileType(); + int cloudy = ProjectileType(); + + var source = player.GetSource_Accessory(Item); + Vector2 velocity = new Vector2(0f, -1f); + int elementalDmg = (int)player.GetTotalDamage().ApplyTo(90); + float kBack = 2f + player.GetKnockback().Additive; + + if (player.ownedProjectileCounts[brimmy] > 1 || player.ownedProjectileCounts[siren] > 1 || + player.ownedProjectileCounts[healer] > 1 || player.ownedProjectileCounts[sandy] > 1 || + player.ownedProjectileCounts[cloudy] > 1) + { + player.ClearBuff(BuffType()); + } + if (player != null && player.whoAmI == Main.myPlayer && !player.dead) + { + if (player.FindBuffIndex(BuffType()) == -1) + { + player.AddBuff(BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[brimmy] < 1) + { + int p = Projectile.NewProjectile(source, player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; + } + if (player.ownedProjectileCounts[siren] < 1) + { + int p = Projectile.NewProjectile(source, player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; + } + if (player.ownedProjectileCounts[healer] < 1) + { + int p = Projectile.NewProjectile(source, player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; + } + if (player.ownedProjectileCounts[sandy] < 1) + { + int p = Projectile.NewProjectile(source, player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; + } + if (player.ownedProjectileCounts[cloudy] < 1) + { + int p = Projectile.NewProjectile(source, player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; + } + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index 19f7ad2cb2..bc8709dc0b 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); player.buffImmune[ModContent.BuffType()] = true; - modPlayer.aBulwarkRare = true; - if (modPlayer.aBulwarkRareMeleeBoostTimer > 0) + modPlayer.hideOfDeus = true; + if (modPlayer.hideOfDeusMeleeBoostTimer > 0) player.GetDamage() += 0.5f; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 0783661b05..b6f5c89c10 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 20; - Item.height = 20; + Item.width = 34; + Item.height = 24; Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; diff --git a/Items/Accessories/LivingDew.png b/Items/Accessories/LivingDew.png index 8ef949d3b5..d7cfdff8d2 100644 Binary files a/Items/Accessories/LivingDew.png and b/Items/Accessories/LivingDew.png differ diff --git a/Items/Accessories/LumenousAmulet.cs b/Items/Accessories/LumenousAmulet.cs index aa826cfaf4..96574337b3 100644 --- a/Items/Accessories/LumenousAmulet.cs +++ b/Items/Accessories/LumenousAmulet.cs @@ -43,8 +43,6 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(15). - AddIngredient(5). - AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/MutatedTruffle.cs b/Items/Accessories/MutatedTruffle.cs index 12c32f8655..a22276a719 100644 --- a/Items/Accessories/MutatedTruffle.cs +++ b/Items/Accessories/MutatedTruffle.cs @@ -52,5 +52,29 @@ namespace CalamityMod.Items.Accessories } } } + + public override void UpdateVanity(Player player) + { + player.Calamity().miniOldDukeVanity = true; + if (player.whoAmI == Main.myPlayer) + { + var source = player.GetSource_Accessory(Item); + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + const int baseDamage = 1200; + int damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); + var duke = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, + ModContent.ProjectileType(), + damage, + 6.5f, Main.myPlayer, 0f, 0f); + + duke.originalDamage = baseDamage; + } + } + } } } diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index 61e4ddab05..0425b17cb3 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Necklace of Vexation"); Tooltip.SetDefault("Revenge\n" + "20% increased damage when under 50% life\n" + - "All attacks inflict Cursed Inferno and Venom while wearing Reaver armor"); + "All attacks inflict acid venom while wearing Reaver armor"); } public override void SetDefaults() diff --git a/Items/Accessories/PearlofEnthrallment.cs b/Items/Accessories/PearlofEnthrallment.cs index 9ce2827a0e..9350a6996d 100644 --- a/Items/Accessories/PearlofEnthrallment.cs +++ b/Items/Accessories/PearlofEnthrallment.cs @@ -58,5 +58,26 @@ namespace CalamityMod.Items.Accessories } } } + + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.sirenWaifuVanity = true; + if (player.whoAmI == Main.myPlayer) + { + var source = player.GetSource_Accessory(Item); + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + int damage = (int)player.GetTotalDamage().ApplyTo(65); + int anahita = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer); + if (Main.projectile.IndexInRange(anahita)) + Main.projectile[anahita].originalDamage = 65; + } + } + } } } diff --git a/Items/Accessories/PermafrostsConcoction.cs b/Items/Accessories/PermafrostsConcoction.cs index 743efd3483..e666d6ca2e 100644 --- a/Items/Accessories/PermafrostsConcoction.cs +++ b/Items/Accessories/PermafrostsConcoction.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Permafrost's Concoction"); Tooltip.SetDefault(@"Increases maximum mana by 50 and reduces mana cost by 15% Increases life regen as life decreases -Increases life regen when afflicted with Poison, On Fire, or Brimstone Flames +Increases life regen when afflicted with any fire debuff You will survive fatal damage and revive with 30% life on a 3 minute cooldown You are encased in an ice barrier for 3 seconds when revived"); } diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs index 005f83ddec..9814584b8f 100644 --- a/Items/Accessories/PhantomicArtifact.cs +++ b/Items/Accessories/PhantomicArtifact.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; using Terraria; using Terraria.DataStructures; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(5). - AddIngredient(10). + AddIngredient(25). AddIngredient(20). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index c9d59f1916..e909c4b44d 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Plagued Fuel Pack"); - Tooltip.SetDefault("5% increased rogue damage and 15% increased rogue projectile velocity\n" + + Tooltip.SetDefault("8% increased rogue damage and 15% increased rogue projectile velocity\n" + "Stealth generates 10% faster\n" + "TOOLTIP LINE HERE" + "This effect has a 1 second cooldown before it can be used again"); @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().hasJetpack = true; - player.GetDamage() += 0.05f; + player.GetDamage() += 0.08f; player.Calamity().rogueVelocity += 0.15f; player.Calamity().plaguedFuelPack = true; player.Calamity().stealthGenStandstill += 0.1f; diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index d5e22d1623..c8a55657d5 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(25). - AddIngredient(25). + AddIngredient(25). AddIngredient(5). AddTile(TileID.DemonAltar). Register(); diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 15b8d5a9c4..f8cf140994 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List tooltips) { - bool scal = DownedBossSystem.downedSCal; + bool scal = DownedBossSystem.downedCalamitas; bool draedon = DownedBossSystem.downedExoMechs; if (!scal || !draedon) { @@ -163,7 +163,7 @@ namespace CalamityMod.Items.Accessories internal static void DetermineTransformationEligibility(Player player) { - if (DownedBossSystem.downedSCal && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= 10 && !player.Calamity().profanedCrystalForce && player.HasBuff()) + if (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= 10 && !player.Calamity().profanedCrystalForce && player.HasBuff()) { player.Calamity().profanedCrystalBuffs = true; } @@ -355,27 +355,14 @@ namespace CalamityMod.Items.Accessories return false; } - public static void MakeRecipesCheaper(Recipe recipe, int type, ref int numRequired) - { - int shadowSpec = ModContent.ItemType(); - int geode = ModContent.ItemType(); - int essence = ModContent.ItemType(); - bool biomePower = Main.LocalPlayer.ZoneHallow || Main.LocalPlayer.ZoneUnderworldHeight; - numRequired = biomePower && (type == (shadowSpec | geode | essence)) ? numRequired / 2 : numRequired; //cuts the above mats consumed by half if in the biomes instead of arbitrary biome locking - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.ObsidianRose). - AddIngredient(5). - AddIngredient(25). AddIngredient(50). AddIngredient(100). AddIngredient(5). AddTile(). - AddConsumeItemCallback(MakeRecipesCheaper). Register(); } } diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 766cf9c53f..e18db0d035 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -67,7 +67,6 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.FrozenShield). AddIngredient(). - AddIngredient(5). AddIngredient(10). AddIngredient(10). AddIngredient(4). diff --git a/Items/Accessories/ReaperToothNecklace.cs b/Items/Accessories/ReaperToothNecklace.cs index ee4f92850c..16a652c2ad 100644 --- a/Items/Accessories/ReaperToothNecklace.cs +++ b/Items/Accessories/ReaperToothNecklace.cs @@ -36,9 +36,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(6). - AddIngredient(15). AddIngredient(15). - AddIngredient(5). AddTile(TileID.TinkerersWorkbench). Register(); } diff --git a/Items/Accessories/Regenator.cs b/Items/Accessories/Regenator.cs index 00eabedf96..e3a419047b 100644 --- a/Items/Accessories/Regenator.cs +++ b/Items/Accessories/Regenator.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Regenator"); - Tooltip.SetDefault("Reduces max HP by 50% but greatly improves life regeneration"); + Tooltip.SetDefault("Greatly improves life regeneration\n" + + "However, your health cannot exceed 50% of its maximum"); } public override void SetDefaults() @@ -28,6 +29,16 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.regenator = true; + + //Hard-lock the player's health to 50%. + //No lifesteal, no regen, no healing pots + if (player.statLife >= (int)(player.statLifeMax2 * 0.5f)) + { + player.statLife = (int)(player.statLifeMax2 * 0.5f); + player.lifeRegenCount = 0; + player.moonLeech = true; + modPlayer.healingPotBonus = 0; + } } } } diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index a3e79909b7..cf9ff96619 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -56,5 +56,26 @@ namespace CalamityMod.Items.Accessories } } } + + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.brimstoneWaifuVanity = true; + if (player.whoAmI == Main.myPlayer) + { + var source = player.GetSource_Accessory(Item); + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + int damage = (int)player.GetTotalDamage().ApplyTo(60); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 60; + } + } + } } } diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index 61b6be7570..7dfc2dd3be 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/RoverDriveActivate") { Volume = 0.85f }; public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/Custom/RoverDriveBreak") { Volume = 0.75f }; - public static int ProtectionMatrixDurabilityMax = 50; + public static int ProtectionMatrixDurabilityMax = 40; public static int ProtectionMatrixRechargeTime = 60 * 10; public static int ProtectionMatrixDefenseBoost = 10; @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Accessories float shieldStrentgh = forcedVisibility ? 1f : (float)Math.Pow(Main.LocalPlayer.GetModPlayer().ProtectionMatrixDurability / (float)ProtectionMatrixDurabilityMax, 0.5f); float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); - Effect shieldEffect = Filters.Scene["RoverDriveShield"].GetShader().Shader; + Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f); shieldEffect.Parameters["blowUpPower"].SetValue(2.5f); shieldEffect.Parameters["blowUpSize"].SetValue(0.5f); @@ -179,7 +179,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { RoverDrivePlayer modPlayer = player.GetModPlayer(); - //modPlayer.roverDrive = true; modPlayer.RoverDriveOn = true; modPlayer.ShieldVisibility = hideVisual ? false : null; diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs index 822847edf0..bd0b31734e 100644 --- a/Items/Accessories/RuinMedallion.cs +++ b/Items/Accessories/RuinMedallion.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(). AddIngredient(4). - AddIngredient(2). + AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 7123ae2451..dc0ed9882e 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Sand Cloak"); - Tooltip.SetDefault("+2 defense and 5% increased movement speed\n" + + Tooltip.SetDefault("5% increased movement speed\n" + "TOOLTIP LINE HERE\n" + "This effect has a 30 second cooldown before it can be used again"); } @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; + Item.defense = 2; } public override void ModifyTooltips(List list) @@ -37,7 +38,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.statDefense += 2; player.moveSpeed += 0.05f; player.Calamity().sandCloak = true; } diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index 236285c32e..f3319bab7d 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -44,6 +44,9 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Shattered Community"); Tooltip.SetDefault("Ruined by unknowable hatred, it still contains (most of) the power of The Community...\n" + + "Increases damage by 10% and critical strike chance by 5%\n" + + "Increases max health by 10%, damage reduction by 5%, defense by 10 and life regen by 2\n" + + "Increases movement speed by 10% and flight time by 20%\n" + "You generate rage over time and rage does not fade away out of combat\n" + "Taking damage gives rage, this effect is not hindered by your defensive stats\n" + "While Rage Mode is active, taking damage gives only half as much rage\n" + @@ -109,18 +112,18 @@ namespace CalamityMod.Items.Accessories // Stat tooltips are added dynamically. StringBuilder sb = new StringBuilder(256); - // Line 1: If not on Rev+, note that the accessory enables Rage. - TooltipLine rageOverTimeLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); + // Line 5: If not on Rev+, note that the accessory enables Rage. + TooltipLine rageOverTimeLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip4"); if (rageOverTimeLine != null && !CalamityWorld.revenge) rageOverTimeLine.Text = "Adds the Rage meter\n" + rageOverTimeLine.Text; - // Line 6: Current level + // Line 9: Current level sb.Append("Current level: "); sb.Append(level); sb.Append(" (+"); sb.Append(level); sb.Append("% Rage Mode damage)"); - tooltips.Add(new TooltipLine(Mod, "Tooltip6", sb.ToString())); + tooltips.Add(new TooltipLine(Mod, "Tooltip8", sb.ToString())); sb.Clear(); if (level < MaxLevel) @@ -130,18 +133,18 @@ namespace CalamityMod.Items.Accessories double ratio = (double)progressToNextLevel / totalToNextLevel; string percent = (100D * ratio).ToString("0.00"); - // Line 7: Progress to next level + // Line 10: Progress to next level sb.Append("Progress to next level: "); sb.Append(percent); sb.Append('%'); - tooltips.Add(new TooltipLine(Mod, "Tooltip7", sb.ToString())); + tooltips.Add(new TooltipLine(Mod, "Tooltip9", sb.ToString())); sb.Clear(); } - // Line 8: Total damage dealt + // Line 11: Total damage dealt sb.Append("Total Rage Mode damage: "); sb.Append(totalRageDamage); - tooltips.Add(new TooltipLine(Mod, "Tooltip8", sb.ToString())); + tooltips.Add(new TooltipLine(Mod, "Tooltip10", sb.ToString())); } public override void SaveData(TagCompound tag) diff --git a/Items/Accessories/ShieldoftheHighRuler.cs b/Items/Accessories/ShieldoftheHighRuler.cs new file mode 100644 index 0000000000..859b40d141 --- /dev/null +++ b/Items/Accessories/ShieldoftheHighRuler.cs @@ -0,0 +1,99 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + [AutoloadEquip(EquipType.Shield)] + public class ShieldoftheHighRuler : ModItem + { + public const int ShieldSlamIFrames = 12; + public bool dashVelocityBoosted = false; + private const float EoCDashVelocity = 14.5f; + private const float TabiDashVelocity = 18.9f; + + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Shield of the High Ruler"); + Tooltip.SetDefault("For the fate of the kingdom\n" + + "Grants immunity to knockback\n" + + "Immune to most debuffs\n" + + "+10 max life\n" + + "Grants an improved Shield of Cthulhu dash\n" + + "Bonking an enemy reduces the delay before you can dash again by 50%\n" + + "If you are facing a projectile when it hits you it will deal 15% less damage"); + } + + public override void SetDefaults() + { + Item.DamageType = DamageClass.MeleeNoSpeed; + Item.damage = 30; + Item.knockBack = 9f; + Item.width = 36; + Item.height = 38; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.Calamity().donorItem = true; + Item.defense = 12; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + player.dashType = 2; + modPlayer.DashID = string.Empty; + modPlayer.copyrightInfringementShield = true; + player.noKnockback = true; + player.fireWalk = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Chilled] = true; + player.buffImmune[BuffID.Frostburn] = true; + player.buffImmune[BuffID.Weak] = true; + player.buffImmune[BuffID.BrokenArmor] = true; + player.buffImmune[BuffID.Bleeding] = true; + player.buffImmune[BuffID.Poisoned] = true; + player.buffImmune[BuffID.Slow] = true; + player.buffImmune[BuffID.Confused] = true; + player.buffImmune[BuffID.Silenced] = true; + player.buffImmune[BuffID.Cursed] = true; + player.buffImmune[BuffID.Darkness] = true; + player.buffImmune[BuffID.WindPushed] = true; + player.buffImmune[BuffID.Stoned] = true; + player.statLifeMax2 += 10; + + // If the player hasn't hit anything with the shield and a dash is currently happening, increase velocity on the first frame of the dash to be on par with Tabi. + // EoC dash decelerates faster than Tabi, so compensate for it by increasing the Tabi dash velocity value by an approximate amount. + if (player.eocHit == -1 && player.dashDelay == -1) + { + if (!dashVelocityBoosted) + { + dashVelocityBoosted = true; + player.velocity.X *= TabiDashVelocity / EoCDashVelocity; + } + } + else + dashVelocityBoosted = false; + + // Dash delay reduced to 15 frames (half the original 30) if an enemy is bonked. + if (player.eocHit != -1) + { + if (player.dashDelay > 15) + player.dashDelay = 15; + } + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.EoCShield). + AddIngredient(ItemID.CobaltShield). + AddIngredient(4). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Accessories/ShieldoftheHighRuler.png b/Items/Accessories/ShieldoftheHighRuler.png new file mode 100644 index 0000000000..5fee413618 Binary files /dev/null and b/Items/Accessories/ShieldoftheHighRuler.png differ diff --git a/Items/Accessories/ShieldoftheHighRuler_Shield.png b/Items/Accessories/ShieldoftheHighRuler_Shield.png new file mode 100644 index 0000000000..e845dbdad2 Binary files /dev/null and b/Items/Accessories/ShieldoftheHighRuler_Shield.png differ diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 1af18c95e8..bc165b6e3f 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Armor; +using CalamityMod.Items.Armor.Victide; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,7 +32,11 @@ namespace CalamityMod.Items.Accessories { player.statDefense += 5; } - if (player.Calamity().victideSet) + // 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; diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index 0f3b389106..ee200e3842 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -40,10 +40,8 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.CelestialEmblem). - AddRecipeGroup("AnyEvilWater", 10). - AddIngredient(10). - AddIngredient(5). - AddIngredient(2). + AddIngredient(5). + AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/SpiritGlyph.cs b/Items/Accessories/SpiritGlyph.cs index 86ea535d63..465a6dcce2 100644 --- a/Items/Accessories/SpiritGlyph.cs +++ b/Items/Accessories/SpiritGlyph.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(ItemID.Diamond, 5). - AddRecipeGroup("IronBar", 15). + AddIngredient(ItemID.Obsidian, 15). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index f7ea0fea72..6ebb46efe2 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Items.Accessories int abyssDefenseLoss = modPlayer.abyssDefenseLossStat; // The notice about held item mattering is always displayed first. - StringBuilder sb = new StringBuilder("Displays almost all player stats\nOffensive stats displayed vary with held item\n\n", 1024); + StringBuilder sb = new StringBuilder("Displays almost all player stats\nOffensive stats displayed vary with held item", 1024); // Only append rippers stats in Rev+ if (CalamityWorld.revenge) @@ -115,10 +115,9 @@ namespace CalamityMod.Items.Accessories string rageDamageDisplay = TwoPlaces(100f * rageDamage); string adrenalineDamageDisplay = TwoPlaces(100f * adrenalineDamage); string adrenalineDRDisplay = TwoPlaces(100f * adrenalineDR); - sb.Append("Rage Damage Boost: ").Append(rageDamageDisplay).Append("%\n"); + sb.Append("\n\nRage Damage Boost: ").Append(rageDamageDisplay).Append("%\n"); sb.Append("Adrenaline Damage Boost: ").Append(adrenalineDamageDisplay) - .Append("% | Adrenaline DR Boost: ").Append(adrenalineDRDisplay) - .Append("%\n\n"); + .Append("% | Adrenaline DR Boost: ").Append(adrenalineDRDisplay).Append("%"); } // Append item stats only if the held item isn't null, and base it off of the item's damage type. @@ -174,7 +173,7 @@ namespace CalamityMod.Items.Accessories float armorPen = player.GetTotalArmorPenetration(dc); // starts at 0f = +0 armor pen // Attack damage tooltip. The boosts are displayed in exactly the order they are applied - sb.Append(damageClassName).Append(" Damage: "); + sb.Append("\n\n").Append(damageClassName).Append(" Damage: "); // Flat base damage additions are extremely rare and only appear when relevant if (baseFlatDamage != 0f) diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index 2f5063944f..cd0dee78d7 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,17 +41,10 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.AnglerHat). - AddIngredient(ItemID.AnglerVest). - AddIngredient(ItemID.AnglerPants). AddIngredient(ItemID.LavaproofTackleBag). - AddIngredient(ItemID.FishingPotion, 5). - AddIngredient(ItemID.CratePotion, 5). AddIngredient(ItemID.SonarPotion, 5). AddIngredient(ItemID.MasterBait, 5). - AddIngredient(ItemID.SoulofLight, 5). - AddIngredient(ItemID.SoulofNight, 5). - AddIngredient(10). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index a0b0cd5e0d..e4a21f3a94 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -52,23 +52,15 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(). - AddIngredient(15). - AddIngredient(15). - AddIngredient(5). AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(). + AddIngredient(). AddIngredient(). - AddIngredient(). - AddIngredient(15). - AddIngredient(15). - AddIngredient(5). AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 831b8e333a..8e062f4ce7 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories "Grants the ability to dodge attacks\n" + $"The dodge has a {BalancingConstants.AmalgamDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects\n" + "Temporarily increases critical strike chance and summon damage after a dodge\n" + - "Nearby enemies receive a variety of debuffs when you are hit"); + "Nearby enemies receive a variety of sickness-related debuffs when you are hit"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(9, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Accessories Item.height = 34; Item.accessory = true; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index ef8c5798fb..d3b5319773 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -40,9 +40,24 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); CalamityPlayer modPlayer = player.Calamity(); modPlayer.camper = true; - player.AddBuff(BuffID.HeartLamp, 60, true); - player.AddBuff(BuffID.Campfire, 60, true); - player.AddBuff(BuffID.WellFed, 60, true); + player.AddBuff(BuffID.HeartLamp, 60); + Main.SceneMetrics.HasHeartLantern = true; + player.AddBuff(BuffID.Campfire, 60); + Main.SceneMetrics.HasCampfire = true; + + // Only hand out the buff if the player is not already fully fed. This prevents the player from being robbed of food. + if (!player.HasBuff(BuffID.WellFed3)) + player.AddBuff(BuffID.WellFed3, 80); + else + { + // Prevent it from flickering + for (int l = 0; l < Player.MaxBuffs; l++) + { + if (player.buffType[l] == BuffID.WellFed3 && player.buffTime[l] < 80) + player.buffTime[l] = 80; + } + } + Lighting.AddLight(player.Center, 0.825f, 0.66f, 0f); if (Main.myPlayer == player.whoAmI) { @@ -60,11 +75,7 @@ namespace CalamityMod.Items.Accessories if (npc.active && !npc.friendly && npc.damage > -1 && !npc.dontTakeDamage && Vector2.Distance(player.Center, npc.Center) <= range) { int campingFireDamage = (int)player.GetBestClassDamage().ApplyTo(Main.rand.Next(20, 41)); - Projectile p = Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), campingFireDamage, 0f, player.whoAmI, i); - if (!npc.buffImmune[BuffID.OnFire]) - { - npc.AddBuff(BuffID.OnFire, 120); - } + Projectile.NewProjectileDirect(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), campingFireDamage, 0f, player.whoAmI, i); } } } diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index a3ea91fab6..a8d9dc3ec3 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Accessories numBosses += NPC.downedMechBoss2.ToInt(); numBosses += DownedBossSystem.downedBrimstoneElemental.ToInt(); numBosses += NPC.downedMechBoss3.ToInt(); - numBosses += DownedBossSystem.downedCalamitas.ToInt(); + numBosses += DownedBossSystem.downedCalamitasClone.ToInt(); numBosses += NPC.downedPlantBoss.ToInt(); // 20 numBosses += DownedBossSystem.downedLeviathan.ToInt(); numBosses += DownedBossSystem.downedAstrumAureus.ToInt(); @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Accessories numBosses += DownedBossSystem.downedDoG.ToInt(); numBosses += DownedBossSystem.downedYharon.ToInt(); // 40 numBosses += DownedBossSystem.downedExoMechs.ToInt(); - numBosses += DownedBossSystem.downedSCal.ToInt(); + numBosses += DownedBossSystem.downedCalamitas.ToInt(); return numBosses / (float)TotalCountedBosses; } diff --git a/Items/Accessories/TheEvolution.cs b/Items/Accessories/TheEvolution.cs index 7a2a53aae1..cba0cf7bb2 100644 --- a/Items/Accessories/TheEvolution.cs +++ b/Items/Accessories/TheEvolution.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.projRefRare = true; + modPlayer.evolution = true; } } } diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index eaacc4b18f..3c6a01cfbd 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -13,9 +13,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("The First Shadowflame"); - Tooltip.SetDefault("It is said that in the past, Prometheus descended from the heavens to grant man fire\n" + - "If that were true, then it is surely the demons of hell that would have risen from below to do the same\n" + - "Increases max minions by 1 and minions inflict the Shadowflame debuff on enemies\n" + + Tooltip.SetDefault("Increases max minions by 1 and minions inflict the Shadowflame debuff on enemies\n" + "Grants immunity to Shadowflame"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; diff --git a/Items/Accessories/TheFirstShadowflame.png b/Items/Accessories/TheFirstShadowflame.png index c56be57372..564b12632c 100644 Binary files a/Items/Accessories/TheFirstShadowflame.png and b/Items/Accessories/TheFirstShadowflame.png differ diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index a9d18edddf..32ee0b7b66 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("The Transformer"); - Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + + Tooltip.SetDefault("Multiplies all electricity-based debuff damage by 1.5\n" + + "Taking damage releases a blast of sparks\n" + "Immunity to Electrified and you resist all electrical projectile and enemy damage\n" + "Enemy bullets do half damage to you and are reflected back at the enemy for 800% their original damage"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 16)); @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aSparkRare = true; + modPlayer.transformer = true; modPlayer.aSpark = true; } } diff --git a/Items/Accessories/ThiefsDime.cs b/Items/Accessories/ThiefsDime.cs deleted file mode 100644 index 4dcbe6fcfe..0000000000 --- a/Items/Accessories/ThiefsDime.cs +++ /dev/null @@ -1,46 +0,0 @@ -using CalamityMod.Projectiles.Rogue; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Accessories -{ - public class ThiefsDime : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Thief's Dime"); - Tooltip.SetDefault("Those scurvy dogs don’t know the first thing about making bank\n" + - "Summons a coin that revolves around you and steals money from enemies"); - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.value = CalamityGlobalItem.Rarity5BuyPrice; - Item.rare = ItemRarityID.Pink; - Item.accessory = true; - } - - public override bool CanEquipAccessory(Player player, int slot, bool modded) - { - return !player.Calamity().thiefsDime; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.Calamity().thiefsDime = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - var source = player.GetSource_Accessory(Item); - int damage = (int)player.GetTotalDamage().ApplyTo(100); - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, 6f, Main.myPlayer, 0f, 0f); - } - } - } - } -} diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index 56d388a1cb..78667e6afc 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Toxic Heart"); Tooltip.SetDefault("Summons a plague aura around you that damages nearby enemies\n" + - "Makes you immune to the Plague debuff "); + "Makes you immune to the Plague debuff\n"+ + "Multiplies all sickness-based debuff damage by 1.5"); } public override void SetDefaults() @@ -30,6 +31,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + modPlayer.toxicHeart = true; player.buffImmune[ModContent.BuffType()] = true; int plagueCounter = 0; Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0.05f, 1f, 0.1f); @@ -56,7 +58,7 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - Projectile p = Projectile.NewProjectileDirect(source, nPC.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, player.whoAmI, l); + Projectile.NewProjectileDirect(source, nPC.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, player.whoAmI, l); } } } diff --git a/Items/Accessories/TrinketofChi.cs b/Items/Accessories/TrinketofChi.cs index 2e206ce1f0..5118f481da 100644 --- a/Items/Accessories/TrinketofChi.cs +++ b/Items/Accessories/TrinketofChi.cs @@ -2,18 +2,20 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.Buffs.StatBuffs; namespace CalamityMod.Items.Accessories { public class TrinketofChi : ModItem { + internal const int ChiBuffTimerMax = 900; + public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Trinket of Chi"); - Tooltip.SetDefault("After 1 second of standing still and not attacking you gain a buff\n" + - "This buff boosts your damage by 50% and decreases damage taken by 15%\n" + - "The buff deactivates after you move or attack once"); + Tooltip.SetDefault("Provides 10% damage reduction after not being hit for 15 seconds, this is removed when you are hit\n" + + "Provides 2 life regen for you and everyone on your team"); } public override void SetDefaults() @@ -29,6 +31,13 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.trinketOfChi = true; + if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + { + if (Main.LocalPlayer.team == player.team && player.team != 0) + { + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 20, true); + } + } } } } diff --git a/Items/Accessories/UnstableGraniteCore.cs b/Items/Accessories/UnstableGraniteCore.cs index 5dfd4f7a0f..a774bf57a0 100644 --- a/Items/Accessories/UnstableGraniteCore.cs +++ b/Items/Accessories/UnstableGraniteCore.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Unstable Granite Core"); - Tooltip.SetDefault("Three sparks are released on critical hits"); + Tooltip.SetDefault("Periodically gain an unstable energy field that repeatedly zaps nearby enemies with arcing energy\n" + + "The arcing energy ignores a substantial amount of enemy defense"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; } diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs index 733b766136..f97d344853 100644 --- a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs +++ b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories.Vanity { SacrificeTotal = 1; DisplayName.SetDefault("Abandoned Wulfrum Helmet"); - Tooltip.SetDefault("A worn and rusty helmet ressembling older models of wulfrum armor\n" + + Tooltip.SetDefault("A worn and rusty helmet resembling older models of wulfrum armor\n" + "Transforms the holder into a wulfrum robot\n" + "Can also be worn in the helmet slot as a regular helm\n" + "[c/83B87E:This rather flimsy armor was commonly worn by scavengers and looters]\n" + diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index 70a895df70..8a3f2e93a6 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetDamage() += 0.1f; + player.GetDamage() += 0.10f; player.Calamity().veneratedLocket = true; } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index 1bbf033af6..b298901d6d 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Accessories SacrificeTotal = 1; DisplayName.SetDefault("Void of Extinction"); Tooltip.SetDefault("Drops brimstone fireballs from the sky occasionally\n" + - "10% increase to all damage\n" + - "Melee attacks inflict Hellfire\n" + + "12% increase to all damage\n" + + "All attacks inflict Brimstone Flames\n" + "Brimstone fire rains down after getting hit\n" + "Reduces damage from touching lava\n" + "Grants immunity to Burning, On Fire!, Brimstone Flames and Searing Lava"); @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; - Item.defense = 8; + Item.defense = 12; } public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().voidOfCalamity; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); @@ -60,11 +60,10 @@ namespace CalamityMod.Items.Accessories modPlayer.voidOfExtinction = true; modPlayer.abaddon = true; player.buffImmune[ModContent.BuffType()] = true; - player.magmaStone = true; player.buffImmune[BuffID.OnFire] = true; player.fireWalk = true; player.lavaRose = true; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.12f; if (player.immune) { if (player.miscCounter % 10 == 0) @@ -105,7 +104,7 @@ namespace CalamityMod.Items.Accessories spawn.X += i * 30 - (FireProjectiles * 15); Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int damage = (int)player.GetBestClassDamage().ApplyTo(70); + int damage = (int)player.GetBestClassDamage().ApplyTo(100); Projectile.NewProjectile(source, spawn, velocity, ModContent.ProjectileType(), damage, 5f, Main.myPlayer, 0f, 0f); } } diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index 186375dca7..5ebb7a4658 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -52,5 +52,23 @@ namespace CalamityMod.Items.Accessories } } } + + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.sandWaifuVanity = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + int damage = (int)player.GetTotalDamage().ApplyTo(45); + Projectile.NewProjectile(player.GetSource_Accessory(Item), player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); + } + } + } } } diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index 4025a79a14..3d6d9a9ab0 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -56,5 +56,25 @@ namespace CalamityMod.Items.Accessories } } } + + public override void UpdateVanity(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.sandBoobWaifuVanity = 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_Accessory(Item); + int damage = (int)player.GetTotalDamage().ApplyTo(45); + Projectile sandy = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 2f, Main.myPlayer, 0f, 0f); + sandy.originalDamage = damage; + } + } + } } } diff --git a/Items/Accessories/Wings/AureateBooster.cs b/Items/Accessories/Wings/AureateBooster.cs index 2afbee26ce..39c70c18ec 100644 --- a/Items/Accessories/Wings/AureateBooster.cs +++ b/Items/Accessories/Wings/AureateBooster.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories.Wings player.rocketDelay2--; if (player.rocketDelay2 <= 0) { - SoundEngine.PlaySound(SoundID.Item13, player.position); + SoundEngine.PlaySound(SoundID.Item13, player.Center); player.rocketDelay2 = 60; } int num66 = 2; @@ -100,9 +100,8 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(). AddIngredient(ItemID.SoulofFlight, 20). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Wings/ExodusWings.cs b/Items/Accessories/Wings/ExodusWings.cs index a21b825c7d..2c9ef2145c 100644 --- a/Items/Accessories/Wings/ExodusWings.cs +++ b/Items/Accessories/Wings/ExodusWings.cs @@ -74,7 +74,8 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(ItemID.SoulofFlight, 20). + AddIngredient(14). AddIngredient(ItemID.LunarBar, 10). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/Wings/HadalMantle.cs b/Items/Accessories/Wings/HadalMantle.cs index 53a5f4d6cd..b1f8adf252 100644 --- a/Items/Accessories/Wings/HadalMantle.cs +++ b/Items/Accessories/Wings/HadalMantle.cs @@ -76,9 +76,8 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(). AddIngredient(ItemID.SoulofFlight, 20). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 92ff6a11e7..f1b21ed4d0 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories.Wings player.rocketDelay2--; if (player.rocketDelay2 <= 0) { - SoundEngine.PlaySound(SoundID.Item13, player.position); + SoundEngine.PlaySound(SoundID.Item13, player.Center); player.rocketDelay2 = 60; } int dustAmt = 2; @@ -113,11 +113,11 @@ namespace CalamityMod.Items.Accessories.Wings CreateRecipe(). AddIngredient(ItemID.FrogLeg). AddIngredient(ItemID.BundleofBalloons). - AddIngredient(ItemID.LuckyHorseshoe). + //TODO -- Use HorseshoeBundle for 1.4.4. AddIngredient(ItemID.Jetpack). + AddIngredient(ItemID.SoulofFright). AddIngredient(ItemID.SoulofMight). AddIngredient(ItemID.SoulofSight). - AddIngredient(ItemID.SoulofFright). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Wings/SeraphTracers.cs b/Items/Accessories/Wings/SeraphTracers.cs index 8a78abf0c3..5c888cd70a 100644 --- a/Items/Accessories/Wings/SeraphTracers.cs +++ b/Items/Accessories/Wings/SeraphTracers.cs @@ -1,5 +1,4 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -85,8 +84,6 @@ namespace CalamityMod.Items.Accessories.Wings CreateRecipe(). AddIngredient(). AddRecipeGroup("WingsGroup"). - AddIngredient(3). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index c2e285894d..ec9e3272b0 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -76,10 +76,10 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.SoulofFlight, 20). + AddIngredient(3). AddIngredient(15). - AddRecipeGroup("AnyGoldBar", 3). - AddIngredient(3). - AddIngredient(5). + AddIngredient(2). AddTile(). Register(); } diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index e5b37d5f24..ccba4fa990 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -52,9 +52,8 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(5). + AddIngredient(ItemID.SunplateBlock, 5). AddIngredient(ItemID.Feather, 5). - AddIngredient(ItemID.FallenStar, 5). - AddIngredient(ItemID.Bone, 15). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index 686d2e7534..e3d2c20b17 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.Accessories.Wings { SacrificeTotal = 1; DisplayName.SetDefault("Soul of Cryogen"); - Tooltip.SetDefault("The magic of the ancient ice castle is yours\n" + - "Counts as wings\n" + + Tooltip.SetDefault("Counts as wings\n" + "Horizontal speed: 6.25\n" + "Acceleration multiplier: 1.0\n" + "Average vertical speed\n" + diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index 663cd73fb8..f0372578eb 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -76,9 +76,8 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(). AddIngredient(ItemID.SoulofFlight, 20). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 1953b549ca..9fafadf172 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -78,8 +78,8 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.SoulofFlight, 20). AddIngredient(5). - AddIngredient(ItemID.SoulofFlight, 30). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index 96ac181043..3991b4f766 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Wulfrum Acrobatics Pack"); - Tooltip.SetDefault("This mess of cogs and wires in a box retools the winch mechanism of hooks to transform them into a wulfrum slingshot\n" + - "The wulfrum slingshot trades the ability to reel you back in for advanced rope physics, letting you swing around the hook as you please\n" + - "Additionally, the pack automatically attempts to grapple a nearby wall if it detects danger from fall damage\n" + - "This safety feature won't activate if the down key is being held\n" + - "8% increased movement speed"); + Tooltip.SetDefault("Transforms equipped hooks into a wulfrum slingshot\n" + + "The slingshot allows for advanced rope-swinging physics\n" + + "Automatically grapples nearby walls if a lethal fall is detected\n" + + "This safety feature won't activate if DOWN is held\n" + + "8% increased movement speed"); } public override void SetDefaults() diff --git a/Items/Ammo/ArcticArrow.cs b/Items/Ammo/ArcticArrow.cs index 3009245093..0c7f956cec 100644 --- a/Items/Ammo/ArcticArrow.cs +++ b/Items/Ammo/ArcticArrow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 20; + Item.damage = 18; Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 36; diff --git a/Items/Ammo/AcidRound.cs b/Items/Ammo/BubonicRound.cs similarity index 79% rename from Items/Ammo/AcidRound.cs rename to Items/Ammo/BubonicRound.cs index ec1ec8aa3f..261ca9d6cd 100644 --- a/Items/Ammo/AcidRound.cs +++ b/Items/Ammo/BubonicRound.cs @@ -6,14 +6,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Ammo { - [LegacyName("AcidBullet")] - public class AcidRound : ModItem + [LegacyName("AcidBullet", "AcidRound")] + public class BubonicRound : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 99; - DisplayName.SetDefault("Acid Round"); - Tooltip.SetDefault("Explodes into acid that inflicts the plague\n" + + DisplayName.SetDefault("Bubonic Round"); + Tooltip.SetDefault("Bursts into virulent plague on contact\n" + "Does more damage the higher the target's defense"); } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Ammo Item.knockBack = 1.5f; Item.value = Item.sellPrice(copper: 16); Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.ammo = AmmoID.Bullet; } diff --git a/Items/Ammo/AcidRound.png b/Items/Ammo/BubonicRound.png similarity index 100% rename from Items/Ammo/AcidRound.png rename to Items/Ammo/BubonicRound.png diff --git a/Items/Ammo/FiniteUse/ExplosiveShells.cs b/Items/Ammo/FiniteUse/ExplosiveShells.cs deleted file mode 100644 index a929cba0ff..0000000000 --- a/Items/Ammo/FiniteUse/ExplosiveShells.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CalamityMod.Projectiles.Typeless.FiniteUse; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Ammo.FiniteUse -{ - public class ExplosiveShells : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Explosive Shotgun Shell"); - } - - public override void SetDefaults() - { - Item.damage = 30; - Item.width = 18; - Item.height = 18; - Item.maxStack = 6; - Item.consumable = true; - Item.knockBack = 10f; - Item.value = 15000; - Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - Item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? - } - } -} diff --git a/Items/Ammo/FiniteUse/ExplosiveShells.png b/Items/Ammo/FiniteUse/ExplosiveShells.png deleted file mode 100644 index 6aca8240af..0000000000 Binary files a/Items/Ammo/FiniteUse/ExplosiveShells.png and /dev/null differ diff --git a/Items/Ammo/FiniteUse/GrenadeRounds.cs b/Items/Ammo/FiniteUse/GrenadeRounds.cs deleted file mode 100644 index f98d5108a9..0000000000 --- a/Items/Ammo/FiniteUse/GrenadeRounds.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CalamityMod.Projectiles.Typeless.FiniteUse; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Ammo.FiniteUse -{ - public class GrenadeRounds : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Grenade Shell"); - } - - public override void SetDefaults() - { - Item.damage = 200; - Item.width = 18; - Item.height = 18; - Item.maxStack = 9; - Item.consumable = true; - Item.knockBack = 10f; - Item.value = 15000; - Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - Item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? - } - } -} diff --git a/Items/Ammo/FiniteUse/GrenadeRounds.png b/Items/Ammo/FiniteUse/GrenadeRounds.png deleted file mode 100644 index b9172771c8..0000000000 Binary files a/Items/Ammo/FiniteUse/GrenadeRounds.png and /dev/null differ diff --git a/Items/Ammo/FiniteUse/MagnumRounds.cs b/Items/Ammo/FiniteUse/MagnumRounds.cs deleted file mode 100644 index f91f8c76ba..0000000000 --- a/Items/Ammo/FiniteUse/MagnumRounds.cs +++ /dev/null @@ -1,31 +0,0 @@ -using CalamityMod.Projectiles.Typeless.FiniteUse; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Ammo.FiniteUse -{ - public class MagnumRounds : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Magnum Round"); - } - - public override void SetDefaults() - { - Item.damage = 80; - Item.crit += 4; - Item.width = 18; - Item.height = 18; - Item.maxStack = 12; - Item.consumable = true; - Item.knockBack = 8f; - Item.value = 10000; - Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; - Item.ammo = ModContent.ItemType(); // CONSIDER -- Would item.type work here instead of a self reference? - } - } -} diff --git a/Items/Ammo/FiniteUse/MagnumRounds.png b/Items/Ammo/FiniteUse/MagnumRounds.png deleted file mode 100644 index 08a3366f9b..0000000000 Binary files a/Items/Ammo/FiniteUse/MagnumRounds.png and /dev/null differ diff --git a/Items/Ammo/MarksmanRound.cs b/Items/Ammo/MarksmanRound.cs new file mode 100644 index 0000000000..8938576984 --- /dev/null +++ b/Items/Ammo/MarksmanRound.cs @@ -0,0 +1,42 @@ +using CalamityMod.Projectiles.Ranged; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Ammo +{ + public class MarksmanRound : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 99; + DisplayName.SetDefault("Marksman Round"); + Tooltip.SetDefault("A carefully crafted round which can be ricocheted off of midair coins\nAny gun firing this bullet can perform Ricoshots with coins tossed using Midas Prime"); + } + + public override void SetDefaults() + { + Item.damage = 12; + Item.DamageType = DamageClass.Ranged; + Item.width = 12; + Item.height = 26; + Item.maxStack = 999; + Item.consumable = true; + Item.knockBack = 2.25f; + Item.value = Item.sellPrice(copper: 10); + Item.rare = ItemRarityID.LightRed; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; + Item.ammo = AmmoID.Bullet; + } + + public override void AddRecipes() + { + CreateRecipe(999). + AddIngredient(ItemID.GoldenBullet, 999). + AddIngredient(ItemID.GoldCoin). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Ammo/MarksmanRound.png b/Items/Ammo/MarksmanRound.png new file mode 100644 index 0000000000..de0c458f7a Binary files /dev/null and b/Items/Ammo/MarksmanRound.png differ diff --git a/Items/Ammo/NapalmArrow.cs b/Items/Ammo/NapalmArrow.cs index d40b0e1121..0f4def240a 100644 --- a/Items/Ammo/NapalmArrow.cs +++ b/Items/Ammo/NapalmArrow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - Item.damage = 12; + Item.damage = 11; Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 36; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Ammo { CreateRecipe(250). AddIngredient(ItemID.WoodenArrow, 250). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.Torch). AddTile(TileID.Anvils). Register(); diff --git a/Items/AntiTumorOintment.cs b/Items/AntiTumorOintment.cs index cd141cf49d..ce8d47a6ec 100644 --- a/Items/AntiTumorOintment.cs +++ b/Items/AntiTumorOintment.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items public override void SetStaticDefaults() { DisplayName.SetDefault("Anti-Tumor Ointment"); - Tooltip.SetDefault("Favorite this item to prevent hive cysts from spawning near you"); + Tooltip.SetDefault("Favorite this item to prevent hive tumors from spawning near you"); SacrificeTotal = 1; } public override void SetDefaults() diff --git a/Items/Armor/Aerospec/AerospecBreastplate.cs b/Items/Armor/Aerospec/AerospecBreastplate.cs index 862d59bf9d..ad5f38c2c9 100644 --- a/Items/Armor/Aerospec/AerospecBreastplate.cs +++ b/Items/Armor/Aerospec/AerospecBreastplate.cs @@ -30,8 +30,7 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(11). - AddIngredient(ItemID.Cloud, 10). - AddIngredient(ItemID.RainCloud, 5). + AddIngredient(ItemID.SunplateBlock, 8). AddIngredient(ItemID.Feather, 2). AddTile(TileID.SkyMill). Register(); diff --git a/Items/Armor/Aerospec/AerospecHat.cs b/Items/Armor/Aerospec/AerospecHat.cs index d7bd845968..6dd68eceb8 100644 --- a/Items/Armor/Aerospec/AerospecHat.cs +++ b/Items/Armor/Aerospec/AerospecHat.cs @@ -57,8 +57,7 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.Cloud, 3). - AddIngredient(ItemID.RainCloud). + AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). Register(); diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadgear.cs index bac06dd3dc..20615f64c4 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadgear.cs @@ -63,8 +63,7 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.Cloud, 3). - AddIngredient(ItemID.RainCloud). + AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). Register(); diff --git a/Items/Armor/Aerospec/AerospecHelm.cs b/Items/Armor/Aerospec/AerospecHelm.cs index bb931db546..86113f45d8 100644 --- a/Items/Armor/Aerospec/AerospecHelm.cs +++ b/Items/Armor/Aerospec/AerospecHelm.cs @@ -58,8 +58,7 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.Cloud, 3). - AddIngredient(ItemID.RainCloud). + AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). Register(); diff --git a/Items/Armor/Aerospec/AerospecHelmet.cs b/Items/Armor/Aerospec/AerospecHelmet.cs index 3f3cc0d646..9e4a1c7795 100644 --- a/Items/Armor/Aerospec/AerospecHelmet.cs +++ b/Items/Armor/Aerospec/AerospecHelmet.cs @@ -76,8 +76,7 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.Cloud, 3). - AddIngredient(ItemID.RainCloud). + AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). Register(); diff --git a/Items/Armor/Aerospec/AerospecHood.cs b/Items/Armor/Aerospec/AerospecHood.cs index 903ea84e52..fb55c007e0 100644 --- a/Items/Armor/Aerospec/AerospecHood.cs +++ b/Items/Armor/Aerospec/AerospecHood.cs @@ -56,8 +56,7 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.Cloud, 3). - AddIngredient(ItemID.RainCloud). + AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.SkyMill). Register(); diff --git a/Items/Armor/Aerospec/AerospecLeggings.cs b/Items/Armor/Aerospec/AerospecLeggings.cs index 054fcd1760..ee964e6aa8 100644 --- a/Items/Armor/Aerospec/AerospecLeggings.cs +++ b/Items/Armor/Aerospec/AerospecLeggings.cs @@ -33,8 +33,7 @@ namespace CalamityMod.Items.Armor.Aerospec { CreateRecipe(). AddIngredient(7). - AddIngredient(ItemID.Cloud, 6). - AddIngredient(ItemID.RainCloud, 3). + AddIngredient(ItemID.SunplateBlock, 4). AddIngredient(ItemID.Feather, 2). AddTile(TileID.SkyMill). Register(); diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index 6b9027c9ff..8750aa3ec2 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor.Astral { player.setBonus = "5% increased movement speed and +3 max minions\n" + "35% increased damage and 25% increased critical strike chance\n" + - "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + + "Whenever you crit an enemy, a barrage of stars will rain down\n" + "This effect has a 1 second cooldown before it can trigger again"; var modPlayer = player.Calamity(); modPlayer.astralStarRain = true; diff --git a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs index d4814db344..f4f681f6cc 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs @@ -46,7 +46,6 @@ namespace CalamityMod.Items.Armor.Bloodflare player.setBonus = "Greatly increases life regen\n" + "Enemies below 50% life drop a heart when struck\n" + "This effect has a 5 second cooldown\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "Magic weapons fire ghostly bolts every 1.67 seconds\n" + "Magic critical strikes cause flame explosions every 2 seconds"; player.crimsonRegen = true; diff --git a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs index 8de74fdb5d..6f263fd506 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs @@ -47,7 +47,6 @@ namespace CalamityMod.Items.Armor.Bloodflare "Enemies are more likely to target you\n" + "Enemies below 50% life drop a heart when struck\n" + "This effect has a 5 second cooldown\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "True melee strikes will heal you\n" + "After striking an enemy 15 times with true melee you will enter a blood frenzy for 5 seconds\n" + "During this you will gain 25% increased melee damage, critical strike chance, and contact damage is halved\n" + diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index 47b243f925..e6c066fd0a 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Armor.Bloodflare player.setBonus = "Greatly increases life regen\n" + "Enemies below 50% life drop a heart when struck\n" + "This effect has a 5 second cooldown\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "Press " + hotkey + " to unleash the lost souls of polterghast to destroy your enemies\n" + "This effect has a 30 second cooldown\n" + "Ranged weapons fire bloodsplosion orbs every 2.5 seconds"; diff --git a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs index 524feb0257..d706579ad9 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Items.Armor.Bloodflare player.setBonus = "Greatly increases life regen\n" + "Enemies below 50% life drop a heart when struck\n" + "This effect has a 5 second cooldown\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "+120 maximum stealth\n" + "Being over 80% life boosts your defense by 30 and rogue crit by 5%\n" + "Being below 80% life boosts your rogue damage by 10%\n" + diff --git a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs index 34e02c5211..30c8c23940 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Items.Armor.Bloodflare "Greatly increases life regen\n" + "Enemies below 50% life drop a heart when struck\n" + "This effect has a 5 second cooldown\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "Summons polterghast mines to circle you\n" + "At 90% life and above you gain 10% increased minion damage\n" + "At 50% life and below you gain 20 defense and 2 life regen"; diff --git a/Items/Armor/CirrusDress.cs b/Items/Armor/CirrusDress.cs index 3658b179d9..b787ea6ef9 100644 --- a/Items/Armor/CirrusDress.cs +++ b/Items/Armor/CirrusDress.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor { SacrificeTotal = 1; DisplayName.SetDefault("Cirrus' Dress"); - Tooltip.SetDefault("Here, this should help you drink as much alcohol as you want!\n" + + Tooltip.SetDefault("Here, this should help you drink a lot more than usual!\n" + "5% increased magic damage and critical strike chance\n" + "You feel thick..."); diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index 9e0d2b3f0d..6e2637a233 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(15). - AddIngredient(ItemID.CrystalShard, 6). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadMagic.cs b/Items/Armor/Daedalus/DaedalusHeadMagic.cs index 1eaad669f9..8622657539 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMagic.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMagic.cs @@ -59,8 +59,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.CrystalShard, 3). + AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadMelee.cs b/Items/Armor/Daedalus/DaedalusHeadMelee.cs index 72f5854a49..196fe5636d 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMelee.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMelee.cs @@ -61,8 +61,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.CrystalShard, 3). + AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index f29e8c3b2c..fca8c82ea0 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -57,8 +57,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.CrystalShard, 3). + AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadRogue.cs b/Items/Armor/Daedalus/DaedalusHeadRogue.cs index 52aaab8064..5ff264c7e9 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRogue.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRogue.cs @@ -61,8 +61,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.CrystalShard, 3). + AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Daedalus/DaedalusHeadSummon.cs b/Items/Armor/Daedalus/DaedalusHeadSummon.cs index 64e9a0ab48..db1a654ca0 100644 --- a/Items/Armor/Daedalus/DaedalusHeadSummon.cs +++ b/Items/Armor/Daedalus/DaedalusHeadSummon.cs @@ -72,8 +72,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.CrystalShard, 3). + AddIngredient(7). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Daedalus/DaedalusLeggings.cs b/Items/Armor/Daedalus/DaedalusLeggings.cs index 99045d726c..7061f7ee11 100644 --- a/Items/Armor/Daedalus/DaedalusLeggings.cs +++ b/Items/Armor/Daedalus/DaedalusLeggings.cs @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Armor.Daedalus { CreateRecipe(). AddIngredient(10). - AddIngredient(ItemID.CrystalShard, 4). AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index 734bde4a84..65281220b9 100644 --- a/Items/Armor/Demonshade/DemonshadeHelm.cs +++ b/Items/Armor/Demonshade/DemonshadeHelm.cs @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Armor.Demonshade { var hotkey = CalamityKeybinds.SetBonusHotKey.TooltipHotkeyString(); player.setBonus = "100% increased minion damage and +10 max minions\n" + - "All attacks inflict the demon flame debuff\n" + "Shadowbeams and demon scythes will fire down when you are hit\n" + "A friendly red devil follows you around\n" + "Press " + hotkey + " to enrage nearby enemies with a dark magic spell for 10 seconds\n" + diff --git a/Items/Armor/DesertProwler/DesertProwlerSet.cs b/Items/Armor/DesertProwler/DesertProwlerSet.cs index 29b27e16f4..6f33f5b949 100644 --- a/Items/Armor/DesertProwler/DesertProwlerSet.cs +++ b/Items/Armor/DesertProwler/DesertProwlerSet.cs @@ -314,8 +314,7 @@ namespace CalamityMod.Items.Armor.DesertProwler public override void ModifyWeaponDamage(Item item, ref StatModifier damage) { - // Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me - if (desertProwlerSet && (item.CountsAsClass() || item.type == ModContent.ItemType()) && item.ammo == AmmoID.None) + if (desertProwlerSet && item.CountsAsClass() && item.ammo == AmmoID.None) damage.Flat += 1f; } diff --git a/Items/Armor/Empyrean/EmpyreanCloak.cs b/Items/Armor/Empyrean/EmpyreanCloak.cs index 908d4c23fa..49737a71e0 100644 --- a/Items/Armor/Empyrean/EmpyreanCloak.cs +++ b/Items/Armor/Empyrean/EmpyreanCloak.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(22). + AddIngredient(20). AddIngredient(ItemID.LunarBar, 16). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Armor/Empyrean/EmpyreanCuisses.cs b/Items/Armor/Empyrean/EmpyreanCuisses.cs index 1f433933f5..e228edc1be 100644 --- a/Items/Armor/Empyrean/EmpyreanCuisses.cs +++ b/Items/Armor/Empyrean/EmpyreanCuisses.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). + AddIngredient(15). AddIngredient(ItemID.LunarBar, 12). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index fe9be6cbad..b15042202f 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddIngredient(ItemID.LunarBar, 8). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs index fd915b5a80..046ce36ac7 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs @@ -45,10 +45,8 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpiderGreaves). AddIngredient(9). AddIngredient(8). - AddIngredient(15). AddIngredient(4). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs index 0e428bfa3e..b2839d848e 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs @@ -51,10 +51,8 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpiderBreastplate). AddIngredient(12). AddIngredient(10). - AddIngredient(18). AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs index 783703bf07..10d792d278 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs @@ -73,10 +73,8 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpiderMask). AddIngredient(5). AddIngredient(6). - AddIngredient(11). AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 3bddaafe79..6afe01b960 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -49,12 +49,12 @@ namespace CalamityMod.Items.Armor.Fearmonger public override void UpdateArmorSet(Player player) { - player.setBonus = @"20% increased minion damage and +2 max minions - The minion damage nerf while wielding weaponry is reduced - Immunity to all forms of frost and flame - All minion attacks grant colossal life regeneration - 15% increased damage reduction during the Pumpkin and Frost Moons - This extra damage reduction ignores the soft cap"; + player.setBonus = "20% increased minion damage and +2 max minions\n" + + "Minions no longer deal less damage while wielding non-summoner weapons\n" + + "Immunity to all forms of frost and flame\n" + + "All minion attacks grant colossal life regeneration\n" + + "15% increased damage reduction during the Pumpkin and Frost Moons\n" + + "This extra damage reduction ignores the soft cap"; // This bool encompasses cross-class nerf immunity, colossal life regen on minion attack, and the holiday moon DR // TODO -- Fearmonger life regen from minion attacks needs some sort of cool visual effect diff --git a/Items/Armor/GemTech/GemTechBodyArmor.cs b/Items/Armor/GemTech/GemTechBodyArmor.cs index d4b651a79f..9b420edd81 100644 --- a/Items/Armor/GemTech/GemTechBodyArmor.cs +++ b/Items/Armor/GemTech/GemTechBodyArmor.cs @@ -23,9 +23,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 48; Item.height = 32; Item.defense = 31; - - // Exact worth of the armor piece's constituents. - Item.value = Item.sellPrice(platinum: 9, gold: 79, silver: 80); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -36,7 +34,7 @@ namespace CalamityMod.Items.Armor.GemTech CreateRecipe() .AddIngredient(16) .AddIngredient(5) - .AddIngredient(3) + .AddIngredient(2) .AddTile() .Register(); } diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index 7d409e6073..1e282c1ca3 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -65,9 +65,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 40; Item.height = 32; Item.defense = 14; - - // Exact worth of the armor piece's constituents. - Item.value = Item.sellPrice(platinum: 6, gold: 14, silver: 88); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -142,7 +140,7 @@ namespace CalamityMod.Items.Armor.GemTech tooltips.Insert(setBonusIndex, greenGemTooltip); setBonusIndex++; - TooltipLine blueGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus5", "[i:" + ItemID.Sapphire + "]" + $"The blue gem grants {SummonMinionCountBoost} extra maximum minions, increased minion damage, and reduces the penalty for summoner items while holding a non-summoner weapon"); + TooltipLine blueGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus5", "[i:" + ItemID.Sapphire + "]" + $"The blue gem grants {SummonMinionCountBoost} extra maximum minions, increased minion damage, and negates the minion damage penalty while wielding non-summoner weapons"); blueGemTooltip.OverrideColor = new Color(37, 119, 206); tooltips.Insert(setBonusIndex, blueGemTooltip); @@ -173,7 +171,7 @@ namespace CalamityMod.Items.Armor.GemTech CreateRecipe(). AddIngredient(10). AddIngredient(3). - AddIngredient(3). + AddIngredient(2). AddTile(). Register(); } diff --git a/Items/Armor/GemTech/GemTechSchynbaulds.cs b/Items/Armor/GemTech/GemTechSchynbaulds.cs index 8720063370..48e674a64f 100644 --- a/Items/Armor/GemTech/GemTechSchynbaulds.cs +++ b/Items/Armor/GemTech/GemTechSchynbaulds.cs @@ -23,9 +23,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.width = 28; Item.height = 26; Item.defense = 24; - - // Exact worth of the armor piece's constituents. - Item.value = Item.sellPrice(platinum: 7, gold: 35, silver: 84); + Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -37,7 +35,7 @@ namespace CalamityMod.Items.Armor.GemTech CreateRecipe(). AddIngredient(12). AddIngredient(4). - AddIngredient(3). + AddIngredient(2). AddTile(). Register(); } diff --git a/Items/Armor/GodSlayer/GodSlayerChestplate.cs b/Items/Armor/GodSlayer/GodSlayerChestplate.cs index 71be545c19..3267a5fd41 100644 --- a/Items/Armor/GodSlayer/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayer/GodSlayerChestplate.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(23). + AddIngredient(15). AddIngredient(3). AddTile(). Register(); diff --git a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs index 2c8d5f14f9..0eb6229f42 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs @@ -45,14 +45,14 @@ namespace CalamityMod.Items.Armor.GodSlayer modPlayer.godSlayerDamage = true; var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(); player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + - "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + - "Enemies you dash through take massive damage\n" + - "During the dash you are immune to most debuffs\n" + - "The dash has a " + GodslayerArmorDash.GodslayerCooldown + " second cooldown\n" + - "Enemies are more likely to target you\n" + - "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + - "Enemies take a lot of damage when they hit you\n" + - "An attack that would deal 80 damage or less will have its damage reduced to 1"; + "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + + "Enemies you dash through take massive damage\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a " + GodslayerArmorDash.GodslayerCooldown + " second cooldown\n" + + "Enemies are more likely to target you\n" + + "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + + "Enemies take a lot of damage when they hit you\n" + + "An attack that would deal 80 damage or less will have its damage reduced to 1"; player.thorns += 2.5f; player.aggro += 1000; @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(14). + AddIngredient(7). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs index d3dede6140..b9846e5b9b 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(14). + AddIngredient(7). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs index f12d9c2138..1fb223c51b 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(14). + AddIngredient(7). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/GodSlayer/GodSlayerLeggings.cs b/Items/Armor/GodSlayer/GodSlayerLeggings.cs index 0970e02888..4c3fd46bc2 100644 --- a/Items/Armor/GodSlayer/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayer/GodSlayerLeggings.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void AddRecipes() { CreateRecipe(). - AddIngredient(18). + AddIngredient(10). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/Hydrothermic/HydrothermicArmor.cs b/Items/Armor/Hydrothermic/HydrothermicArmor.cs index 0054a0ec3c..ae23c71630 100644 --- a/Items/Armor/Hydrothermic/HydrothermicArmor.cs +++ b/Items/Armor/Hydrothermic/HydrothermicArmor.cs @@ -37,8 +37,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(15). - AddIngredient(ItemID.HellstoneBar, 8). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index 457e65b7a8..511f16eaca 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -64,8 +64,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(ItemID.HellstoneBar, 4). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index 71583f3299..af0cb054c7 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -70,8 +70,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(ItemID.HellstoneBar, 4). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index eb63f62997..850b1a363d 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -63,8 +63,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(ItemID.HellstoneBar, 4). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index 79cbbf1ee8..56eb524c35 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -68,8 +68,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(ItemID.HellstoneBar, 4). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index b7f5fecd5a..af8843c8e4 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -80,8 +80,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(7). - AddIngredient(ItemID.HellstoneBar, 4). - AddIngredient(). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs index 85144b6e88..a8c4aa562d 100644 --- a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs +++ b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs @@ -36,8 +36,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic { CreateRecipe(). AddIngredient(10). - AddIngredient(ItemID.HellstoneBar, 5). - AddIngredient(2). + AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index dc122f328c..44d9174171 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -50,9 +50,8 @@ No positive life regen"); { CreateRecipe(). AddIngredient(12). - AddIngredient(8). - AddIngredient(8). - AddIngredient(4). + AddIngredient(18). + AddIngredient(3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index ada6f5f3c5..ad8e24d11f 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -99,9 +99,8 @@ namespace CalamityMod.Items.Armor.OmegaBlue { CreateRecipe(). AddIngredient(8). - AddIngredient(5). - AddIngredient(5). - AddIngredient(2). + AddIngredient(12). + AddIngredient(1). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index e6cce20158..c7460c8501 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -46,9 +46,8 @@ namespace CalamityMod.Items.Armor.OmegaBlue { CreateRecipe(). AddIngredient(10). - AddIngredient(6). - AddIngredient(6). - AddIngredient(3). + AddIngredient(15). + AddIngredient(2). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Armor/Reaver/ReaverCuisses.cs b/Items/Armor/Reaver/ReaverCuisses.cs index 710ad47677..aec265ea54 100644 --- a/Items/Armor/Reaver/ReaverCuisses.cs +++ b/Items/Armor/Reaver/ReaverCuisses.cs @@ -35,8 +35,7 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(10). - AddIngredient(ItemID.JungleSpores, 8). - AddIngredient(2). + AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index 698bd47417..633a18c3da 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -83,9 +83,8 @@ namespace CalamityMod.Items.Armor.Reaver public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.JungleSpores, 4). - AddIngredient(). + AddIngredient(7). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Reaver/ReaverHeadMobility.cs b/Items/Armor/Reaver/ReaverHeadMobility.cs index 11013739c3..0891daf5b4 100644 --- a/Items/Armor/Reaver/ReaverHeadMobility.cs +++ b/Items/Armor/Reaver/ReaverHeadMobility.cs @@ -62,9 +62,8 @@ namespace CalamityMod.Items.Armor.Reaver public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.JungleSpores, 4). - AddIngredient(). + AddIngredient(7). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 85089d0736..b3e4b38ad3 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -71,9 +71,8 @@ namespace CalamityMod.Items.Armor.Reaver public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.JungleSpores, 4). - AddIngredient(). + AddIngredient(7). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index 1bded1cc05..bd1e242b7a 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -44,8 +44,7 @@ namespace CalamityMod.Items.Armor.Reaver { CreateRecipe(). AddIngredient(15). - AddIngredient(ItemID.JungleSpores, 12). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs deleted file mode 100644 index 799687b645..0000000000 --- a/Items/Armor/ShroomiteVisage.cs +++ /dev/null @@ -1,62 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ShroomiteVisage : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - DisplayName.SetDefault("Shroomite Visage"); - Tooltip.SetDefault("25% increased ranged damage for flamethrowers"); - } - - public override void SetDefaults() - { - Item.width = 24; - Item.height = 20; - // Same price as the other Shroomite helms - Item.value = Item.buyPrice(0, 37, 50, 0); - Item.rare = ItemRarityID.Yellow; - Item.defense = 11; //62 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ItemID.ShroomiteBreastplate && legs.type == ItemID.ShroomiteLeggings; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - player.shroomiteStealth = true; - player.setBonus = "Ranged stealth while standing still"; - } - - public override void UpdateEquip(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.flamethrowerBoost = true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.ShroomiteBar, 12). - AddTile(TileID.MythrilAnvil). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.ChlorophyteHelmet). - AddIngredient(ItemID.GlowingMushroom, 60). - AddTile(TileID.Autohammer). - Register(); - - } - } -} diff --git a/Items/Armor/ShroomiteVisage.png b/Items/Armor/ShroomiteVisage.png deleted file mode 100644 index c1dccf261b..0000000000 Binary files a/Items/Armor/ShroomiteVisage.png and /dev/null differ diff --git a/Items/Armor/ShroomiteVisage_Head.png b/Items/Armor/ShroomiteVisage_Head.png deleted file mode 100644 index 91eafd0590..0000000000 Binary files a/Items/Armor/ShroomiteVisage_Head.png and /dev/null differ diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index b71944d6d5..76045fcdb1 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -38,9 +38,8 @@ namespace CalamityMod.Items.Armor.Silva public override void AddRecipes() { CreateRecipe(). + AddIngredient(12). AddIngredient(10). - AddRecipeGroup("AnyGoldBar", 10). - AddIngredient(12). AddIngredient(3). AddTile(). Register(); diff --git a/Items/Armor/Silva/SilvaHeadMagic.cs b/Items/Armor/Silva/SilvaHeadMagic.cs index f2ae1a7cd4..66806ff2fb 100644 --- a/Items/Armor/Silva/SilvaHeadMagic.cs +++ b/Items/Armor/Silva/SilvaHeadMagic.cs @@ -63,9 +63,8 @@ namespace CalamityMod.Items.Armor.Silva public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddRecipeGroup("AnyGoldBar", 5). - AddIngredient(6). + AddIngredient(6). + AddIngredient(5). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/Silva/SilvaHeadSummon.cs b/Items/Armor/Silva/SilvaHeadSummon.cs index e1acfa5451..fdbecb95a4 100644 --- a/Items/Armor/Silva/SilvaHeadSummon.cs +++ b/Items/Armor/Silva/SilvaHeadSummon.cs @@ -81,9 +81,8 @@ namespace CalamityMod.Items.Armor.Silva public override void AddRecipes() { CreateRecipe(). + AddIngredient(6). AddIngredient(5). - AddRecipeGroup("AnyGoldBar", 5). - AddIngredient(6). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/Silva/SilvaLeggings.cs b/Items/Armor/Silva/SilvaLeggings.cs index 6db9e7b34d..6d1dca8724 100644 --- a/Items/Armor/Silva/SilvaLeggings.cs +++ b/Items/Armor/Silva/SilvaLeggings.cs @@ -38,9 +38,8 @@ namespace CalamityMod.Items.Armor.Silva public override void AddRecipes() { CreateRecipe(). + AddIngredient(9). AddIngredient(7). - AddRecipeGroup("AnyGoldBar", 7). - AddIngredient(9). AddIngredient(2). AddTile(). Register(); diff --git a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs index babf075af0..860197099a 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian Item.height = 18; Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 2; //4 + Item.defense = 4; //9 } public override void UpdateEquip(Player player) @@ -48,9 +48,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnySnowBlock", 30). - AddRecipeGroup("AnyIceBlock", 15). - AddIngredient(ItemID.BorealWood, 45). + AddRecipeGroup("AnySnowBlock", 60). AddIngredient(ItemID.FlinxFur, 2). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs index 92a8ce8358..7540ce5e19 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian Item.height = 18; Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 1; //4 + Item.defense = 3; //9 } public override void UpdateEquip(Player player) @@ -31,9 +31,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnySnowBlock", 20). - AddRecipeGroup("AnyIceBlock", 10). - AddIngredient(ItemID.BorealWood, 30). + AddRecipeGroup("AnySnowBlock", 40). AddIngredient(ItemID.FlinxFur). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/SnowRuffian/SnowRuffianMask.cs b/Items/Armor/SnowRuffian/SnowRuffianMask.cs index 69d2fb259e..84813b660b 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianMask.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian Item.height = 18; Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 1; //4 + Item.defense = 2; //9 } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -76,9 +76,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnySnowBlock", 10). - AddRecipeGroup("AnyIceBlock", 5). - AddIngredient(ItemID.BorealWood, 15). + AddRecipeGroup("AnySnowBlock", 20). AddIngredient(ItemID.FlinxFur). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/Statigel/StatigelArmor.cs b/Items/Armor/Statigel/StatigelArmor.cs index 5cf78847b3..7f481241a1 100644 --- a/Items/Armor/Statigel/StatigelArmor.cs +++ b/Items/Armor/Statigel/StatigelArmor.cs @@ -38,8 +38,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddIngredient(ItemID.HellstoneBar, 13). + AddIngredient(12). + AddIngredient(12). AddTile(). Register(); } diff --git a/Items/Armor/Statigel/StatigelGreaves.cs b/Items/Armor/Statigel/StatigelGreaves.cs index d70779a18f..22471ef1b7 100644 --- a/Items/Armor/Statigel/StatigelGreaves.cs +++ b/Items/Armor/Statigel/StatigelGreaves.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddIngredient(ItemID.HellstoneBar, 11). + AddIngredient(7). + AddIngredient(7). AddTile(). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadMagic.cs b/Items/Armor/Statigel/StatigelHeadMagic.cs index ccaadffd12..e62278f14c 100644 --- a/Items/Armor/Statigel/StatigelHeadMagic.cs +++ b/Items/Armor/Statigel/StatigelHeadMagic.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Armor.Statigel { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.HellstoneBar, 9). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadMelee.cs b/Items/Armor/Statigel/StatigelHeadMelee.cs index e559bda9b5..7bb2fc9342 100644 --- a/Items/Armor/Statigel/StatigelHeadMelee.cs +++ b/Items/Armor/Statigel/StatigelHeadMelee.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Armor.Statigel { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.HellstoneBar, 9). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadRanged.cs b/Items/Armor/Statigel/StatigelHeadRanged.cs index 5f3cf2fcba..b919cc2c1b 100644 --- a/Items/Armor/Statigel/StatigelHeadRanged.cs +++ b/Items/Armor/Statigel/StatigelHeadRanged.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.Statigel { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.HellstoneBar, 9). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadRogue.cs b/Items/Armor/Statigel/StatigelHeadRogue.cs index 1c01e3add3..29d7b1d856 100644 --- a/Items/Armor/Statigel/StatigelHeadRogue.cs +++ b/Items/Armor/Statigel/StatigelHeadRogue.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Armor.Statigel { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.HellstoneBar, 9). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadSummon.cs b/Items/Armor/Statigel/StatigelHeadSummon.cs index a75c6e4c01..d2f35b4454 100644 --- a/Items/Armor/Statigel/StatigelHeadSummon.cs +++ b/Items/Armor/Statigel/StatigelHeadSummon.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Armor.Statigel { CreateRecipe(). AddIngredient(5). - AddIngredient(ItemID.HellstoneBar, 9). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Armor/Sulphurous/SulphurousBreastplate.cs b/Items/Armor/Sulphurous/SulphurousBreastplate.cs index cac25f6ba9..5822bc23cb 100644 --- a/Items/Armor/Sulphurous/SulphurousBreastplate.cs +++ b/Items/Armor/Sulphurous/SulphurousBreastplate.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Items.Weapons.Rogue; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,9 +35,7 @@ namespace CalamityMod.Items.Armor.Sulphurous public override void AddRecipes() { CreateRecipe(). - AddIngredient(50). AddIngredient(20). - AddIngredient(20). AddIngredient(20). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/Sulphurous/SulphurousHelmet.cs b/Items/Armor/Sulphurous/SulphurousHelmet.cs index 7eac2f2c10..7ff654ea1c 100644 --- a/Items/Armor/Sulphurous/SulphurousHelmet.cs +++ b/Items/Armor/Sulphurous/SulphurousHelmet.cs @@ -1,7 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Items.Weapons.Rogue; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -59,9 +58,7 @@ namespace CalamityMod.Items.Armor.Sulphurous public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). AddIngredient(10). - AddIngredient(10). AddIngredient(10). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/Sulphurous/SulphurousLeggings.cs b/Items/Armor/Sulphurous/SulphurousLeggings.cs index 99de8e7313..426b9aa4bf 100644 --- a/Items/Armor/Sulphurous/SulphurousLeggings.cs +++ b/Items/Armor/Sulphurous/SulphurousLeggings.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Items.Weapons.Rogue; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,9 +35,7 @@ namespace CalamityMod.Items.Armor.Sulphurous public override void AddRecipes() { CreateRecipe(). - AddIngredient(30). AddIngredient(15). - AddIngredient(15). AddIngredient(15). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/Vanity/CalamitasMask.cs b/Items/Armor/Vanity/CalamitasCloneMask.cs similarity index 80% rename from Items/Armor/Vanity/CalamitasMask.cs rename to Items/Armor/Vanity/CalamitasCloneMask.cs index 2d29b1022d..9eb874a0f7 100644 --- a/Items/Armor/Vanity/CalamitasMask.cs +++ b/Items/Armor/Vanity/CalamitasCloneMask.cs @@ -5,12 +5,13 @@ using Terraria.ID; namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] - public class CalamitasMask : ModItem + [LegacyName("CalamitasMask")] + public class CalamitasCloneMask : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Calamitas Mask"); + DisplayName.SetDefault("Calamitas Clone Mask"); if (Main.netMode != NetmodeID.Server) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; diff --git a/Items/Armor/Vanity/CalamitasMask.png b/Items/Armor/Vanity/CalamitasCloneMask.png similarity index 100% rename from Items/Armor/Vanity/CalamitasMask.png rename to Items/Armor/Vanity/CalamitasCloneMask.png diff --git a/Items/Armor/Vanity/CalamitasMask_Head.png b/Items/Armor/Vanity/CalamitasCloneMask_Head.png similarity index 100% rename from Items/Armor/Vanity/CalamitasMask_Head.png rename to Items/Armor/Vanity/CalamitasCloneMask_Head.png diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 169663c958..b3f81fbb96 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -214,6 +214,9 @@ namespace CalamityMod.Items.Armor.Wulfrum if (!transformedAlready) { + player.controlUseItem = false; + player.controlUseTile = false; + player.controlThrow = false; for (int i = 0; i < 5; i++) { Particle part = new WulfrumBastionPartsParticle(player, i, BastionBuildTime + 2); diff --git a/Items/BloodBroccoli.png b/Items/BloodBroccoli.png new file mode 100644 index 0000000000..2bc47a0418 Binary files /dev/null and b/Items/BloodBroccoli.png differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index ac2aba6403..c748dcb305 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Potions; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -79,7 +80,6 @@ namespace CalamityMod.Items #endregion // Miscellaneous stuff - public int timesUsed = 0; public bool donorItem = false; public bool devItem = false; public bool canFirePointBlankShots = false; @@ -120,7 +120,6 @@ namespace CalamityMod.Items myClone.DischargeEnchantExhaustion = DischargeEnchantExhaustion; // Miscellaneous - myClone.timesUsed = timesUsed; myClone.donorItem = donorItem; myClone.devItem = devItem; myClone.canFirePointBlankShots = canFirePointBlankShots; @@ -235,13 +234,26 @@ namespace CalamityMod.Items SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld); } - bool belowHalfMana = player.statMana < player.statManaMax2 * 0.5f; - if (Main.myPlayer == player.whoAmI && player.Calamity().manaMonsterEnchant && Main.rand.NextBool(12) && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && belowHalfMana) + // Traitorous enchantment implementation + // Previously, this enchant was a 1/12 chance to fire a projectile for 165,000 base damage (yes, 165,000) when below half mana + // This was so unbelievably overpowered that with RNG it was possible to kill Exo Mechs in 20 seconds + // + // Traitorous has been reworked to be a guaranteed effect below 25% mana, which removes all your remaining mana + bool belowManaThreshold = player.statMana < player.statManaMax2 * 0.25f; + bool traitorousAlreadyInPlay = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + if (Main.myPlayer == player.whoAmI && player.Calamity().manaMonsterEnchant && !traitorousAlreadyInPlay && belowManaThreshold) { - // TODO -- 165,000 base damage? seriously? there's no way that can be right - int monsterDamage = (int)player.GetTotalDamage().ApplyTo(165000); + // Calculate how much damage to deal based on how much mana was consumed + int remainingMana = player.statMana; + int damagePerManaConsumed = 80; // TODO -- may not be balanced, but eating 150 mana to do 12,000 base damage seems okay + int monsterDamage = (int)player.GetTotalDamage().ApplyTo(remainingMana * damagePerManaConsumed); + + // Spawn the Mana Monster Vector2 shootVelocity = player.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f); Projectile.NewProjectile(source, player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), monsterDamage, 0f, player.whoAmI); + + // Set the player's mana to zero. + player.statMana = 0; } if (modPlayer.luxorsGift && !item.channel) @@ -318,7 +330,7 @@ namespace CalamityMod.Items } if (modPlayer.bloodflareMage && modPlayer.canFireBloodflareMageProjectile) { - if (item.CountsAsClass()) + if (item.CountsAsClass() && !item.channel) { modPlayer.canFireBloodflareMageProjectile = false; if (player.whoAmI == Main.myPlayer) @@ -331,7 +343,7 @@ namespace CalamityMod.Items } if (modPlayer.bloodflareRanged && modPlayer.canFireBloodflareRangedProjectile) { - if (item.CountsAsClass()) + if (item.CountsAsClass() && !item.channel) { modPlayer.canFireBloodflareRangedProjectile = false; if (player.whoAmI == Main.myPlayer) @@ -343,7 +355,7 @@ namespace CalamityMod.Items } } } - if (modPlayer.tarraMage) + if (modPlayer.tarraMage && !item.channel) { if (modPlayer.tarraCrits >= 5 && player.whoAmI == Main.myPlayer) { @@ -369,7 +381,7 @@ namespace CalamityMod.Items } if (modPlayer.ataxiaBolt && modPlayer.canFireAtaxiaRangedProjectile) { - if (item.CountsAsClass()) + if (item.CountsAsClass() && !item.channel) { modPlayer.canFireAtaxiaRangedProjectile = false; if (player.whoAmI == Main.myPlayer) @@ -381,7 +393,7 @@ namespace CalamityMod.Items } if (modPlayer.godSlayerRanged && modPlayer.canFireGodSlayerRangedProjectile) { - if (item.CountsAsClass()) + if (item.CountsAsClass() && !item.channel) { modPlayer.canFireGodSlayerRangedProjectile = false; if (player.whoAmI == Main.myPlayer) @@ -394,7 +406,7 @@ namespace CalamityMod.Items } if (modPlayer.ataxiaVolley && modPlayer.canFireAtaxiaRogueProjectile) { - if (item.CountsAsClass()) + if (item.CountsAsClass() && !item.channel) { modPlayer.canFireAtaxiaRogueProjectile = false; int flareID = ModContent.ProjectileType(); @@ -421,7 +433,7 @@ namespace CalamityMod.Items { if ((item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass()) && - Main.rand.NextBool(10)) + Main.rand.NextBool(10) && !item.channel) { if (player.whoAmI == Main.myPlayer) { @@ -433,7 +445,7 @@ namespace CalamityMod.Items } if (modPlayer.dynamoStemCells) { - if (item.CountsAsClass() && Main.rand.NextBool(20)) + if (item.CountsAsClass() && Main.rand.NextBool(20) && !item.channel) { double damageMult = item.useTime / 30D; if (damageMult < 0.35) @@ -451,7 +463,7 @@ namespace CalamityMod.Items } if (modPlayer.prismaticRegalia) { - if (item.CountsAsClass() && Main.rand.NextBool(20)) + if (item.CountsAsClass() && Main.rand.NextBool(20) && !item.channel) { if (player.whoAmI == Main.myPlayer) { @@ -470,7 +482,7 @@ namespace CalamityMod.Items } if (modPlayer.harpyWingBoost && modPlayer.harpyRing) { - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(5) && !item.channel) { if (player.whoAmI == Main.myPlayer) { @@ -519,7 +531,6 @@ namespace CalamityMod.Items #region Saving And Loading public override void SaveData(Item item, TagCompound tag) { - tag.Add("timesUsed", timesUsed); tag.Add("charge", Charge); tag.Add("enchantmentID", AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); tag.Add("DischargeEnchantExhaustion", DischargeEnchantExhaustion); @@ -529,7 +540,6 @@ namespace CalamityMod.Items public override void LoadData(Item item, TagCompound tag) { canFirePointBlankShots = tag.GetBool("canFirePointBlankShots"); - timesUsed = tag.GetInt("timesUsed"); // Changed charge from int to float. If an old charge int is present, load that instead. if (tag.ContainsKey("Charge")) @@ -554,7 +564,6 @@ namespace CalamityMod.Items // rip, no other flags. what a byte. writer.Write(flags); - writer.Write(timesUsed); writer.Write(Charge); writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); writer.Write(DischargeEnchantExhaustion); @@ -565,7 +574,6 @@ namespace CalamityMod.Items BitsByte flags = reader.ReadByte(); canFirePointBlankShots = flags[0]; - timesUsed = reader.ReadInt32(); Charge = reader.ReadSingle(); Enchantment? savedEnchantment = EnchantmentManager.FindByID(reader.ReadInt32()); @@ -619,6 +627,10 @@ namespace CalamityMod.Items if (item.type == ItemID.BottledHoney) player.AddBuff(BuffID.Honey, 7200); + // Give 1 minute of Mushy buff when consuming Mushrooms with Fungal Symbiote equipped. + if (item.type == ItemID.Mushroom && player.Calamity().fungalSymbiote) + player.AddBuff(ModContent.BuffType(), 3600); + // Moon Lord instantly spawns when Celestial Sigil is used. if (item.type == ItemID.CelestialSigil) { @@ -819,22 +831,6 @@ namespace CalamityMod.Items { return player.ownedProjectileCounts[item.shoot] <= 0; } - if (item.type == ItemID.InvisibilityPotion && player.FindBuffIndex(ModContent.BuffType()) > -1) - { - return false; - } - if ((item.type == ItemID.RegenerationPotion || item.type == ItemID.LifeforcePotion) && player.FindBuffIndex(ModContent.BuffType()) > -1) - { - return false; - } - if (item.type == ItemID.WrathPotion && player.FindBuffIndex(ModContent.BuffType()) > -1) - { - return false; - } - if (item.type == ItemID.RagePotion && player.FindBuffIndex(ModContent.BuffType()) > -1) - { - return false; - } if ((item.type == ItemID.SuperAbsorbantSponge || item.type == ItemID.EmptyBucket) && modPlayer.ZoneAbyss) { return false; @@ -862,7 +858,7 @@ namespace CalamityMod.Items bool templeCheck = Main.tile[x, y].WallType != WallID.LihzahrdBrickUnsafe || y <= Main.worldSurface || NPC.downedPlantBoss; if (templeCheck && !Collision.SolidCollision(teleportLocation, player.width, player.height)) { - int duration = CalamityPlayer.chaosStateDuration; + int duration = CalamityPlayer.areThereAnyDamnBosses ? CalamityPlayer.chaosStateDuration : 360; player.AddBuff(BuffID.ChaosState, duration, true); } } @@ -878,10 +874,6 @@ namespace CalamityMod.Items #region Modify Weapon Damage public override void ModifyWeaponDamage(Item item, Player player, ref StatModifier damage) { - // Nerf yoyo glove and bag because it's bad and stupid and dumb and bad. - if (player.yoyoGlove && ItemID.Sets.Yoyo[item.type]) - damage *= 0.66f; - if (item.type < ItemID.Count) return; @@ -1122,6 +1114,7 @@ namespace CalamityMod.Items player.buffImmune[BuffID.OnFire] = true; } + // TODO -- DELETE THIS LINE IN 1.4.4 PORT // Ankh Charm+ grants immunity to Petrification. if (item.type == ItemID.AnkhCharm || item.type == ItemID.AnkhShield) player.buffImmune[BuffID.Stoned] = true; @@ -1419,6 +1412,10 @@ namespace CalamityMod.Items if (item.type == ItemID.FleshKnuckles || item.type == ItemID.BerserkerGlove || item.type == ItemID.HeroShield) modPlayer.fleshKnuckles = true; + // Empress Wings nerf + if (item.wingSlot == 44) + player.wingTimeMax = 100; + if (item.type == ItemID.WormScarf) player.endurance -= 0.07f; @@ -1436,19 +1433,15 @@ namespace CalamityMod.Items { /* Prehardmode = 1 * Hardmode = 2 - * Post-Golem = 2 - * Post-Moon Lord = 2 - * Post-Provi = 2 - * Post-Polter = 3 - * Post-DoG = 3 - * Post-Yharon = 4 + * Post-Moon Lord = 3 + * Post-DoG = 4 */ - if (DownedBossSystem.downedYharon) + if (DownedBossSystem.downedDoG) player.statDefense += 3; - else if (DownedBossSystem.downedPolterghast || DownedBossSystem.downedDoG) + else if (NPC.downedMoonlord) player.statDefense += 2; - else if (Main.hardMode || NPC.downedGolemBoss || NPC.downedMoonlord || DownedBossSystem.downedProvidence) + else if (Main.hardMode) player.statDefense += 1; player.endurance += 0.0025f; @@ -1457,21 +1450,13 @@ namespace CalamityMod.Items { /* Prehardmode = 2 * Hardmode = 3 - * Post-Golem = 4 * Post-Moon Lord = 4 - * Post-Provi = 5 - * Post-Polter = 5 * Post-DoG = 6 - * Post-Yharon = 7 */ - if (DownedBossSystem.downedYharon) - player.statDefense += 5; - else if (DownedBossSystem.downedDoG) + if (DownedBossSystem.downedDoG) player.statDefense += 4; - else if (DownedBossSystem.downedProvidence || DownedBossSystem.downedPolterghast) - player.statDefense += 3; - else if (NPC.downedGolemBoss || NPC.downedMoonlord) + else if (NPC.downedMoonlord) player.statDefense += 2; else if (Main.hardMode) player.statDefense += 1; @@ -1482,25 +1467,15 @@ namespace CalamityMod.Items { /* Prehardmode = 3 * Hardmode = 5 - * Post-Golem = 5 * Post-Moon Lord = 6 - * Post-Provi = 7 - * Post-Polter = 8 - * Post-DoG = 9 - * Post-Yharon = 10 + * Post-DoG = 8 */ - if (DownedBossSystem.downedYharon) - player.statDefense += 7; - else if (DownedBossSystem.downedDoG) - player.statDefense += 6; - else if (DownedBossSystem.downedPolterghast) + if (DownedBossSystem.downedDoG) player.statDefense += 5; - else if (DownedBossSystem.downedProvidence) - player.statDefense += 4; else if (NPC.downedMoonlord) player.statDefense += 3; - else if (Main.hardMode || NPC.downedGolemBoss) + else if (Main.hardMode) player.statDefense += 2; player.endurance += 0.0075f; @@ -1509,26 +1484,14 @@ namespace CalamityMod.Items { /* Prehardmode = 4 * Hardmode = 6 - * Post-Golem = 7 * Post-Moon Lord = 8 - * Post-Provi = 9 - * Post-Polter = 10 - * Post-DoG = 11 - * Post-Yharon = 12 + * Post-DoG = 10 */ - if (DownedBossSystem.downedYharon) - player.statDefense += 8; - else if (DownedBossSystem.downedDoG) - player.statDefense += 7; - else if (DownedBossSystem.downedPolterghast) + if (DownedBossSystem.downedDoG) player.statDefense += 6; - else if (DownedBossSystem.downedProvidence) - player.statDefense += 5; else if (NPC.downedMoonlord) player.statDefense += 4; - else if (NPC.downedGolemBoss) - player.statDefense += 3; else if (Main.hardMode) player.statDefense += 2; @@ -1545,13 +1508,10 @@ namespace CalamityMod.Items float flightSpeedMult = 1f + (modPlayer.soaring ? 0.1f : 0f) + - (modPlayer.draconicSurge ? 0.1f : 0f) + (modPlayer.reaverSpeed ? 0.1f : 0f) + moveSpeedBoost; - float flightAccMult = 1f + - (modPlayer.draconicSurge ? 0.1f : 0f) + - moveSpeedBoost; + float flightAccMult = 1f + moveSpeedBoost; flightSpeedMult = MathHelper.Clamp(flightSpeedMult, 0.5f, 1.5f); speed *= flightSpeedMult; diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 212b7e5fe2..383679ead7 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -304,8 +304,6 @@ namespace CalamityMod.Items case ItemID.HallowedFishingCrateHard: var postProv = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); postProv.Add(ModContent.ItemType(), fifteenPercent, 5, 10); // 15% 5-10 Unholy Essence - postProv.Add(ModContent.ItemType(), fifteenPercent, 1, 2); // 15% 1-2 Holy Wrath Potion - postProv.Add(ModContent.ItemType(), fifteenPercent, 1, 2); // 15% 1-2 Profaned Rage Potion break; case ItemID.DungeonFishingCrate: @@ -344,7 +342,7 @@ namespace CalamityMod.Items case ItemID.LavaCrate: case ItemID.LavaCrateHard: - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Chaos + loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Chaos break; // Calamity does not touch Oasis Crates yet diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 175bdf9f42..dd93d1d8d5 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -174,11 +174,11 @@ namespace CalamityMod.Items if (item.type == ModContent.ItemType()) { List earthColors = new List() - { - new Color(255, 99, 146), - new Color(255, 228, 94), - new Color(127, 200, 248) - }; + { + new Color(255, 99, 146), + new Color(255, 228, 94), + new Color(127, 200, 248) + }; if (nameLine != null) { int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % earthColors.Count); @@ -253,9 +253,18 @@ namespace CalamityMod.Items // Numerous random tooltip edits which don't fit into another category #region Various Tooltip Edits - // Destroy this disgusting meme tooltip. + // Master Mode items also drop in Revengeance + // Only affects vanilla and Calamity items + if (item.master && (item.type < ItemID.Count || item.ModItem?.Mod is CalamityMod)) + EditTooltipByName("Master", (line) => line.Text += " or Revengeance"); + + // Add a tooltip about Slimed's effects + if (item.type == ItemID.SlimeGun) + EditTooltipByNum(0, (line) => line.Text += "\nSlimed enemies take more damage from fire-based debuffs"); + // Replace the meme tooltip with a useful one. if (item.type == ItemID.GelBalloon) - EditTooltipByNum(0, (line) => line.Text = ""); + EditTooltipByNum(0, (line) => line.Text = "Throws a mixture of slime and sparkling crystals" + + "\nSlimed enemies take more damage from fire-based debuffs"); // Flesh Knuckles giving extra max life. if (item.type == ItemID.FleshKnuckles || item.type == ItemID.HeroShield || item.type == ItemID.BerserkerGlove) @@ -296,14 +305,14 @@ namespace CalamityMod.Items if (item.type == ItemID.ArcheryPotion) EditTooltipByNum(0, (line) => line.Text = "20% increased arrow speed and 5% increased arrow damage"); + // Buffed Ironskin Potion tooltip + if (item.type == ItemID.IronskinPotion) + EditTooltipByNum(0, (line) => line.Text = "Increase defense by " + CalamityUtils.GetScalingDefense(-1)); + // Nerfed Swiftness Potion tooltip if (item.type == ItemID.SwiftnessPotion) EditTooltipByNum(0, (line) => line.Text = "15% increased movement speed"); - // Nerfed Endurance Potion tooltip - if (item.type == ItemID.EndurancePotion) - EditTooltipByNum(0, (line) => line.Text = "Reduces damage taken by 5%"); - // Hand Warmer has a side bonus with Snow armor if (item.type == ItemID.HandWarmer) { @@ -315,6 +324,13 @@ namespace CalamityMod.Items if (item.type == ItemID.GoldenFishingRod) EditTooltipByName("NeedsBait", (line) => line.Text += "\nIts fishing line will never break"); + // Information about graveyards + // There are no item sets for tombstones wtf + if (item.type == ItemID.Tombstone || item.type == ItemID.GraveMarker || item.type == ItemID.CrossGraveMarker || item.type == ItemID.Headstone || item.type == ItemID.Gravestone || item.type == ItemID.Obelisk + || item.type == ItemID.RichGravestone1 || item.type == ItemID.RichGravestone2 || item.type == ItemID.RichGravestone3 || item.type == ItemID.RichGravestone4 || item.type == ItemID.RichGravestone5) + EditTooltipByName("Material", (line) => line.Text += "\n20 of any tombstone turns the surrounding area into a graveyard" + + "\nGraveyards have various new item sales and recipes"); + // Eternity Crystal notifies the player that they can accelerate the invasion if (item.type == ItemID.DD2ElderCrystal) EditTooltipByNum(0, (line) => line.Text += "\nOnce placed you can right click the crystal to skip waves or increase the spawn rate of the invaders"); @@ -440,7 +456,7 @@ namespace CalamityMod.Items // Hallowed (and True Excalibur) if (item.type == ItemID.Excalibur || item.type == ItemID.Gungnir || item.type == ItemID.TrueExcalibur) - EditTooltipByName("Knockback", (line) => line.Text += "\nInflicts Holy Flames\nDeals double damage to enemies above 75% life"); + EditTooltipByName("Knockback", (line) => line.Text += "\nDeals double damage to enemies above 75% life"); #endregion // Other melee weapon tooltips @@ -456,12 +472,9 @@ namespace CalamityMod.Items if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) EditTooltipByName("Knockback", (line) => line.Text += "\nIgnores 50% of enemy defense"); - if (item.type == ItemID.LightsBane || item.type == ItemID.NightsEdge || item.type == ItemID.TrueNightsEdge || item.type == ItemID.BallOHurt || item.type == ItemID.CorruptYoyo) + if (item.type == ItemID.NightsEdge || item.type == ItemID.TrueNightsEdge) EditTooltipByName("Knockback", (line) => line.Text += "\nInflicts Shadowflame on hit"); - if (item.type == ItemID.BloodButcherer || item.type == ItemID.TheRottedFork || item.type == ItemID.TheMeatball || item.type == ItemID.CrimsonYoyo || item.type == ItemID.CrimsonRod) - EditTooltipByName("Knockback", (line) => line.Text += "\nInflicts Burning Blood on hit"); - if (item.type == ItemID.DeathSickle) EditTooltipByNum(0, (line) => line.Text += "\nInflicts Whispering Death on hit"); @@ -656,9 +669,9 @@ namespace CalamityMod.Items if (item.type == ItemID.MagmaStone || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose) EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("fire damage", "Hellfire")); - // Yoyo Glove/Bag apply a 0.66x damage multiplier on yoyos + // Yoyo Glove/Bag apply a 0.5x damage multiplier on the second yoyo if (item.type == ItemID.YoyoBag || item.type == ItemID.YoYoGlove) - EditTooltipByNum(0, (line) => line.Text += "\nYoyos will do 33% less damage"); + EditTooltipByNum(0, (line) => line.Text += "\nSecondary yoyos will do 50% less damage"); // Falcon Blade +20% move speed while holding if (item.type == ItemID.FalconBlade) @@ -677,11 +690,11 @@ namespace CalamityMod.Items // Tin if (item.type == ItemID.TinHelmet) - AddTooltip("4% increased critical strike chance"); + AddTooltip("3% increased critical strike chance"); if (item.type == ItemID.TinChainmail) AddTooltip("+1 life regen"); if (item.type == ItemID.TinGreaves) - AddTooltip("10% increased movement speed"); + AddTooltip("5% increased movement speed"); // Iron if (item.type == ItemID.IronHelmet || item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) @@ -693,11 +706,11 @@ namespace CalamityMod.Items // Silver if (item.type == ItemID.SilverHelmet) - AddTooltip("6% increased critical strike chance"); + AddTooltip("5% increased critical strike chance"); if (item.type == ItemID.SilverChainmail) AddTooltip("+2 life regen"); if (item.type == ItemID.SilverGreaves) - AddTooltip("10% increased movement speed"); + AddTooltip("8% increased movement speed"); // Tungsten if (item.type == ItemID.TungstenHelmet) @@ -705,7 +718,7 @@ namespace CalamityMod.Items if (item.type == ItemID.TungstenChainmail) AddTooltip("+1 life regen"); if (item.type == ItemID.TungstenGreaves) - AddTooltip("10% increased movement speed"); + AddTooltip("8% increased movement speed"); // Gold if (item.type == ItemID.GoldHelmet || item.type == ItemID.AncientGoldHelmet) @@ -713,7 +726,7 @@ namespace CalamityMod.Items if (item.type == ItemID.GoldChainmail) AddTooltip("Reduces damage taken by 5%"); if (item.type == ItemID.GoldGreaves) - AddTooltip("12% increased movement speed"); + AddTooltip("10% increased movement speed"); // Platinum if (item.type == ItemID.PlatinumHelmet) @@ -721,7 +734,7 @@ namespace CalamityMod.Items if (item.type == ItemID.PlatinumChainmail) AddTooltip("5% increased critical strike chance"); if (item.type == ItemID.PlatinumGreaves) - AddTooltip("12% increased movement speed"); + AddTooltip("10% increased movement speed"); // Shadow if (item.type == ItemID.ShadowHelmet || item.type == ItemID.AncientShadowHelmet || item.type == ItemID.ShadowScalemail || item.type == ItemID.AncientShadowScalemail || item.type == ItemID.ShadowGreaves || item.type == ItemID.AncientShadowGreaves) @@ -753,10 +766,6 @@ namespace CalamityMod.Items // Mythril if (item.type == ItemID.MythrilHood) EditTooltipByNum(0, (line) => line.Text = $"Increases maximum mana by {MythrilArmorSetChange.MaxManaBoost + 60}"); - if (item.type == ItemID.MythrilChainmail) - EditTooltipByNum(0, (line) => line.Text = $"{MythrilArmorSetChange.ChestplateDamagePercentageBoost + 7}% increased damage"); - if (item.type == ItemID.MythrilGreaves) - EditTooltipByNum(0, (line) => line.Text = $"{MythrilArmorSetChange.LeggingsCritChanceBoost + 10}% increased critical strike chance"); // Orichalcum if (item.type == ItemID.OrichalcumBreastplate) @@ -835,6 +844,9 @@ namespace CalamityMod.Items // Add mentions of what Calamity ores vanilla pickaxes can mine #region Pickaxe New Ore Tooltips + if (item.type == ItemID.GoldPickaxe || item.type == ItemID.PlatinumPickaxe) + EditTooltipByNum(0, (line) => line.Text = "Can mine Demonite, Crimtane, Meteorite, Sea Prisms and Sea Prism Crystals"); + if (item.type == ItemID.Picksaw) EditTooltipByNum(0, (line) => line.Text += "\nCan mine Scoria Ore located in the Abyss"); @@ -857,9 +869,9 @@ namespace CalamityMod.Items EditTooltipByName("Defense", (line) => line.Text += $"\n{GladiatorArmorSetChange.LeggingRogueVelocityBoostPercent}% increased rogue velocity"); // Forbidden (UNLESS you are wearing the Circlet, which is Summon/Rogue and does not get this line) - if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants + if ((item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) && !Main.LocalPlayer.Calamity().forbiddenCirclet) - EditTooltipByName("SetBonus", (line) => line.Text += "\nThe minion damage nerf is reduced while wielding magic weapons"); + EditTooltipByName("SetBonus", (line) => line.Text += "\nMinions no longer deal less damage while wielding magic weapons"); #endregion // Provide the full stats of every vanilla set of wings @@ -945,8 +957,10 @@ namespace CalamityMod.Items if (item.type == ItemID.SteampunkWings) AddWingStats(7.5f, 1f, 1, 180, "+8 defense, 10% increased movement speed,\n" + "4% increased damage, and 2% increased critical strike chance"); + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT if (item.type == ItemID.LeafWings) AddWingStats(6.25f, 1f, 1, 100, "+5 defense, 5% increased damage reduction,\n" + "and permanent Dryad's Blessing while wearing the Tiki Armor"); + // AddWingStats(7.5f, 1f, 1, 160, "+5 defense, 5% increased damage reduction,\n" + "and permanent Dryad's Blessing while wearing the Tiki Armor"); if (item.type == ItemID.BatWings) AddWingStats(7.5f, 1f, 1, 160, "At night or during an eclipse, you will gain the following boosts:\n" + @@ -999,7 +1013,7 @@ namespace CalamityMod.Items AddWingStats2(6f, 2.5f, 2, 150, null, "Equipable"); if (item.type == ItemID.RainbowWings) - AddWingStats(7f, 2.5f, 2, 150); + AddWingStats(7f, 2.5f, 2, 100); if (item.type == ItemID.LongRainbowTrailWings) AddWingStats(8f, 2.75f, 4, 180); diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index d4a6227d7b..547a3b423a 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -35,7 +35,11 @@ namespace CalamityMod.Items { ItemID.AdamantiteGlaive, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(65), ShootSpeedRatio(1.25f)) }, { ItemID.AdamantitePickaxe, Do(PickPower(180), UseTimeExact(8), TileBoostExact(+1)) }, { ItemID.AdamantiteRepeater, Do(PointBlank, UseExact(18), DamageExact(61)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.AdamantiteSword, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(77)) }, + // { ItemID.AdamantiteSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(77)) }, + { ItemID.AdamantiteWaraxe, Do(AxePower(160), UseTimeExact(10), TileBoostExact(+1)) }, { ItemID.Amarok, autoReuse }, { ItemID.AmberStaff, Do(UseTimeExact(15), UseAnimationExact(45), ReuseDelayExact(10)) }, @@ -44,7 +48,11 @@ namespace CalamityMod.Items { ItemID.AncientHallowedGreaves, Do(DefenseDelta(+2)) }, { ItemID.AncientHallowedPlateMail, Do(DefenseDelta(+3)) }, { ItemID.AnkhShield, Do(DefenseDelta(+8)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.AntlionClaw, Do(ScaleRatio(1.5f), DamageRatio(1.5f), UseExact(14)) }, + // { ItemID.AntlionClaw, Do(ScaleRatio(1.4f), DamageRatio(1.5f), UseExact(14)) }, // Mandible Blade + { ItemID.AquaScepter, Do(DamageExact(21), ShootSpeedExact(25f)) }, { ItemID.Arkhalis, trueMeleeNoSpeed }, { ItemID.BabyBirdStaff, Do(AutoReuse, UseExact(35)) }, @@ -53,7 +61,11 @@ namespace CalamityMod.Items { ItemID.BatScepter, Do(DamageExact(56)) }, { ItemID.BeamSword, Do(AutoReuse, UseMeleeSpeed, DamageExact(360), UseAnimationExact(60), ShootSpeedExact(23f)) }, { ItemID.BeeGun, Do(DamageExact(11)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.BeeKeeper, Do(UseTurn, ScaleRatio(1.5f), DamageExact(60)) }, + // { ItemID.BeeKeeper, Do(UseTurn, ScaleRatio(1.2f), DamageExact(60)) }, + { ItemID.BeesKnees, Do(PointBlank, DamageExact(18), UseExact(38)) }, { ItemID.BladedGlove, Do(DamageExact(15), UseExact(7)) }, { ItemID.BladeofGrass, Do(AutoReuse, UseTurn, ScaleRatio(1.8f), DamageExact(35)) }, @@ -67,19 +79,30 @@ namespace CalamityMod.Items { ItemID.Blowgun, Do(PointBlank, DamageExact(40)) }, { ItemID.Blowpipe, Do(PointBlank, DamageExact(16), UseExact(35)) }, { ItemID.BluePhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, - { ItemID.BluePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT + { ItemID.BluePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72)) }, + // { ItemID.BluePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.BlueSolution, Do(Value(Item.buyPrice(silver: 5))) }, - { ItemID.BoneArrow, Do(DamageExact(7)) }, { ItemID.BonePickaxe, Do(PickPower(55), UseTimeExact(6)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.BoneSword, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageRatio(1.25f)) }, + // { ItemID.BoneSword, Do(AutoReuse, UseTurn, ScaleRatio(1.3f)) }, + { ItemID.BoneWhip, autoReuse }, { ItemID.BookofSkulls, Do(ManaExact(12), ShootSpeedExact(5.5f)) }, { ItemID.BookStaff, Do(ManaExact(14)) }, // Tome of Infinite Wisdom { ItemID.Boomstick, Do(PointBlank, DamageExact(11)) }, - { ItemID.BorealWoodBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.BorealWoodBow, pointBlank }, { ItemID.BorealWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.BorealWoodSword, Do(AutoReuse, UseTurn) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(97)) }, + // { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, ScaleRatio(1.4f), DamageExact(97)) }, + { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0)) }, { ItemID.CactusPickaxe, Do(PickPower(34), UseTimeExact(9)) }, { ItemID.CactusSword, Do(AutoReuse, UseTurn) }, @@ -88,6 +111,7 @@ namespace CalamityMod.Items { ItemID.CandyCornRifle, pointBlank }, { ItemID.Cascade, Do(AutoReuse, DamageExact(39)) }, { ItemID.CelestialSigil, nonConsumableBossSummon }, + { ItemID.CellPhone, Do(UseExact(30)) }, { ItemID.ChainGuillotines, Do(DamageExact(100)) }, { ItemID.ChainGun, pointBlank }, { ItemID.ChainKnife, Do(AutoReuse, DamageExact(14)) }, @@ -105,27 +129,36 @@ namespace CalamityMod.Items { ItemID.ChlorophyteSaber, Do(UseMeleeSpeed, DamageExact(80), UseExact(10)) }, { ItemID.ChlorophyteShotbow, Do(PointBlank, DamageExact(80), UseExact(50)) }, { ItemID.ChlorophyteWarhammer, Do(HammerPower(90), UseTimeExact(8), TileBoostExact(+2)) }, - { ItemID.ChristmasTreeSword, Do(AutoReuse, UseTurn, UseMeleeSpeed, DamageExact(114)) }, + { ItemID.ChristmasTreeSword, Do(AutoReuse, UseTurn, UseMeleeSpeed) }, { ItemID.ClingerStaff, Do(DamageExact(118)) }, { ItemID.ClockworkAssaultRifle, Do(PointBlank, DamageExact(21)) }, - { ItemID.CobaltBreastplate, Do(DefenseDelta(+3)) }, + + // TODO -- DELETE THIS LINE IN 1.4.4 PORT + { ItemID.CobaltBreastplate, Do(DefenseDelta(+2)) }, + { ItemID.CobaltChainsaw, Do(TrueMeleeNoSpeed, AxePower(70), UseTimeExact(4), TileBoostExact(-1)) }, { ItemID.CobaltDrill, Do(TrueMeleeNoSpeed, PickPower(130), UseTimeExact(5)) }, - { ItemID.CobaltHat, Do(DefenseDelta(+2)) }, - { ItemID.CobaltHelmet, Do(DefenseDelta(+4)) }, - { ItemID.CobaltLeggings, Do(DefenseDelta(+2)) }, - { ItemID.CobaltMask, Do(DefenseDelta(+3)) }, + + // TODO -- DELETE THE FOLLOWING THREE LINES IN 1.4.4 PORT + { ItemID.CobaltHat, Do(DefenseDelta(+1)) }, + { ItemID.CobaltHelmet, Do(DefenseDelta(+2)) }, + { ItemID.CobaltMask, Do(DefenseDelta(+1)) }, + { ItemID.CobaltNaginata, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(90)) }, { ItemID.CobaltPickaxe, Do(PickPower(130), UseTimeExact(9)) }, { ItemID.CobaltRepeater, Do(PointBlank, DamageExact(50), UseExact(20)) }, { ItemID.CobaltShield, Do(DefenseDelta(+3)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.CobaltSword, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(80)) }, + // { ItemID.CobaltSword, Do(UseTurn, ScaleRatio(1.4f), DamageExact(80)) }, + { ItemID.CobaltWaraxe, Do(AxePower(125), UseTimeExact(12), TileBoostExact(+0)) }, { ItemID.Code1, Do(AutoReuse, DamageExact(25)) }, { ItemID.Code2, autoReuse }, { ItemID.CoolWhip, autoReuse }, { ItemID.CopperAxe, Do(AxePower(50), UseTimeExact(16), TileBoostExact(+0)) }, - { ItemID.CopperBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.CopperBow, pointBlank }, { ItemID.CopperBroadsword, Do(AutoReuse, UseTurn) }, { ItemID.CopperHammer, Do(HammerPower(35), UseTimeExact(12), TileBoostExact(+0)) }, { ItemID.CopperPickaxe, Do(PickPower(35), UseTimeExact(10), TileBoostExact(+0)) }, @@ -135,10 +168,12 @@ namespace CalamityMod.Items { ItemID.CrystalDart, Do(DamageExact(20)) }, { ItemID.CrystalSerpent, Do(DamageExact(45)) }, { ItemID.CrystalStorm, Do(DamageExact(40))}, - { ItemID.CursedArrow, Do(DamageRatio(1.1f)) }, - { ItemID.CursedBullet, Do(DamageExact(16)) }, { ItemID.CursedDart, Do(DamageExact(25)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.Cutlass, Do(UseRatio(0.8f), DamageRatio(2f)) }, + // { ItemID.Cutlass, Do(UseRatio(0.9f), DamageRatio(1.85f)) }, + // Vanilla 1.4 nerfed Daedalus Stormbow themselves. If further nerfs are needed, apply them here. // { ItemID.DaedalusStormbow, Do(DamageRatio(0.9f)) }, { ItemID.DaoofPow, Do(DamageExact(160)) }, @@ -146,22 +181,20 @@ namespace CalamityMod.Items { ItemID.DarkLance, Do(AutoReuse, TrueMelee, DamageExact(68)) }, { ItemID.DartPistol, pointBlank }, { ItemID.DartRifle, Do(PointBlank, DamageExact(58)) }, - // if Daybreak still needs a buff after the 1.4 explosion change, apply it here - // { ItemID.DayBreak, Do(DamageRatio(1.0f)) } - { ItemID.DD2BallistraTowerT1Popper, Do(AutoReuse, UseExact(30)) }, // Ballista Tier 1 + { ItemID.DD2BallistraTowerT1Popper, autoReuse }, // Ballista Tier 1 { ItemID.DD2BallistraTowerT2Popper, Do(AutoReuse, UseExact(25)) }, // Ballista Tier 2 { ItemID.DD2BallistraTowerT3Popper, Do(AutoReuse, UseExact(20)) }, // Ballista Tier 3 { ItemID.DD2BetsyBow, Do(DamageRatio(1.1f)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that - { ItemID.DD2ExplosiveTrapT1Popper, Do(AutoReuse, UseExact(30)) }, // Explosive Trap Tier 1 + { ItemID.DD2ExplosiveTrapT1Popper, autoReuse }, // Explosive Trap Tier 1 { ItemID.DD2ExplosiveTrapT2Popper, Do(AutoReuse, UseExact(25)) }, // Explosive Trap Tier 2 { ItemID.DD2ExplosiveTrapT3Popper, Do(AutoReuse, UseExact(20)) }, // Explosive Trap Tier 3 - { ItemID.DD2FlameburstTowerT1Popper, Do(AutoReuse, UseExact(30)) }, // Flameburst Tier 1 + { ItemID.DD2FlameburstTowerT1Popper, autoReuse }, // Flameburst Tier 1 { ItemID.DD2FlameburstTowerT2Popper, Do(AutoReuse, UseExact(25)) }, // Flameburst Tier 2 { ItemID.DD2FlameburstTowerT3Popper, Do(AutoReuse, UseExact(20)) }, // Flameburst Tier 3 - { ItemID.DD2LightningAuraT1Popper, Do(AutoReuse, UseExact(30)) }, // Lightning Aura Tier 1 + { ItemID.DD2LightningAuraT1Popper, autoReuse }, // Lightning Aura Tier 1 { ItemID.DD2LightningAuraT2Popper, Do(AutoReuse, UseExact(25)) }, // Lightning Aura Tier 2 { ItemID.DD2LightningAuraT3Popper, Do(AutoReuse, UseExact(20)) }, // Lightning Aura Tier 3 - { ItemID.DD2PhoenixBow, Do(PointBlank, UseExact(18)) }, // Phantom Phoenix + { ItemID.DD2PhoenixBow, pointBlank }, // Phantom Phoenix { ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed) }, // Flying Dragon { ItemID.DD2SquireDemonSword, Do(DamageExact(110), UseExact(25)) }, // Brand of the Inferno { ItemID.DeadlySphereStaff, Do(AutoReuse, UseExact(20)) }, @@ -173,29 +206,38 @@ namespace CalamityMod.Items { ItemID.DiamondStaff, Do(DamageExact(26)) }, { ItemID.Drax, Do(TrueMeleeNoSpeed, PickPower(200), AxePower(110), UseTimeExact(4), TileBoostExact(+1)) }, { ItemID.DyeTradersScimitar, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageRatio(1.33f)) }, - { ItemID.EbonwoodBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.EbonwoodBow, pointBlank }, { ItemID.EbonwoodHammer, Do(HammerPower(25), UseTimeExact(9), TileBoostExact(+0)) }, { ItemID.EbonwoodSword, Do(AutoReuse, UseTurn) }, { ItemID.ElectrosphereLauncher, Do(DamageRatio(1.1f)) }, - { ItemID.EldMelter, Do(DamageExact(113), ShootSpeedDelta(+3f)) }, // Elf Melter, intentionally not in alphabetical order to correct for typo + { ItemID.EldMelter, Do(DamageExact(84), ShootSpeedDelta(+3f)) }, // Elf Melter, intentionally not in alphabetical order to correct for typo { ItemID.EmeraldStaff, Do(DamageExact(28)) }, { ItemID.EmpressBlade, Do(AutoReuse, DamageExact(60), UseExact(20)) }, // Terraprisma + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.EnchantedBoomerang, Do(DamageRatio(2f), UseExact(28)) }, + // { ItemID.EnchantedBoomerang, Do(DamageExact(26), UseExact(28)) }, + { ItemID.EnchantedSword, Do(UseMeleeSpeed, ScaleRatio(1.5f), DamageExact(42), UseAnimationExact(20), ShootSpeedExact(15f)) }, - { ItemID.EndlessQuiver, Do(DamageRatio(1.1f)) }, { ItemID.EoCShield, Do(DefenseDelta(+1)) }, { ItemID.FairyQueenRangedItem, pointBlank }, { ItemID.Excalibur, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(125), UseAnimationExact(45)) }, { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.FalconBlade, Do(UseTurn, ScaleRatio(1.5f), DamageExact(35), UseExact(15)) }, + // { ItemID.FalconBlade, Do(UseTurn, ScaleRatio(1.35f), DamageExact(35), UseExact(15)) }, + { ItemID.FieryGreatsword, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(72), UseExact(45)) }, { ItemID.FireWhip, autoReuse }, // Unsure what to do with Celebration. Should it be treated as a serious weapon or not? Currently not changing it from vanilla. // { ItemID.FireworksLauncher, Do(DamageRatio(2f)) }, // Celebration + + // TODO -- DELETE THIS LINE IN 1.4.4 PORT { ItemID.Flamarang, Do(DamageExact(45)) }, + { ItemID.Flamelash, Do(DamageRatio(1.25f)) }, { ItemID.Flamethrower, Do(DamageExact(47), ShootSpeedDelta(+3f)) }, - { ItemID.FlamingArrow, Do(DamageRatio(1.1f)) }, { ItemID.FlareGun, pointBlank }, { ItemID.FleshGrinder, Do(HammerPower(70), UseTimeExact(13), TileBoostExact(+0)) }, { ItemID.FlintlockPistol, pointBlank }, @@ -204,18 +246,27 @@ namespace CalamityMod.Items { ItemID.FlowerofFrost, Do(AutoReuse, ManaExact(7), UseExact(30), DamageExact(70), ShootSpeedExact(14)) }, { ItemID.FlyingKnife, Do(DamageExact(70)) }, { ItemID.FormatC, autoReuse }, - { ItemID.Frostbrand, Do(UseMeleeSpeed, DamageExact(97), UseExact(23)) }, + { ItemID.Frostbrand, Do(UseMeleeSpeed, DamageExact(97)) }, { ItemID.FrostburnArrow, Do(DamageExact(8)) }, { ItemID.FrostStaff, Do(DamageExact(160), UseExact(37), ShootSpeedExact(20f)) }, // has 1 extra update { ItemID.FrozenShield, Do(DefenseDelta(+7)) }, { ItemID.FrozenTurtleShell, Do(DefenseExact(6)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.FruitcakeChakram, Do(DamageRatio(2f)) }, + // { ItemID.FruitcakeChakram, Do(DamageRatio(1.5f)) }, + { ItemID.Gatligator, Do(PointBlank, UseExact(6)) }, { ItemID.Gladius, Do(AutoReuse, TrueMelee) }, + { ItemID.GlowingMushroom, Do(Value(0)) }, { ItemID.GoblinBattleStandard, nonConsumableBossSummon }, { ItemID.GoldAxe, Do(AxePower(80), UseTimeExact(14), TileBoostExact(+0)) }, { ItemID.GoldBow, Do(PointBlank, DamageExact(12)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.GoldBroadsword, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageRatio(2f)) }, + // { ItemID.GoldBroadsword, Do(AutoReuse, UseTurn, ScaleRatio(1.25f), DamageRatio(1.75f)) }, + { ItemID.GoldenShower, Do(DamageExact(44)) }, { ItemID.GoldHammer, Do(HammerPower(60), UseTimeExact(9), TileBoostExact(+0)) }, { ItemID.GoldPickaxe, Do(PickPower(55), UseTimeExact(9)) }, @@ -223,7 +274,11 @@ namespace CalamityMod.Items { ItemID.GolemFist, Do(DamageExact(150)) }, { ItemID.Gradient, autoReuse }, { ItemID.GreenPhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, - { ItemID.GreenPhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT + { ItemID.GreenPhasesaber, Do(ScaleRatio(1.5f), DamageExact(72)) }, + // { ItemID.GreenPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.GreenSolution, Do(Value(Item.buyPrice(silver: 5))) }, { ItemID.GrenadeLauncher, Do(DamageRatio(1.5f)) }, { ItemID.GuideVoodooDoll, maxStack9999 }, @@ -236,31 +291,43 @@ namespace CalamityMod.Items { ItemID.Handgun, Do(PointBlank, UseExact(27), DamageExact(36)) }, { ItemID.Harpoon, pointBlank }, { ItemID.HelFire, autoReuse }, - { ItemID.HellfireArrow, Do(DamageRatio(1.1f)) }, { ItemID.HellwingBow, Do(PointBlank, DamageExact(16)) }, { ItemID.HeroShield, Do(DefenseDelta(+10)) }, { ItemID.HighVelocityBullet, Do(DamageExact(15)) }, - { ItemID.HolyArrow, Do(DamageRatio(1.1f)) }, { ItemID.HornetStaff, Do(AutoReuse, UseExact(30)) }, { ItemID.IceBlade, Do(UseMeleeSpeed, DamageExact(26), UseTimeExact(33)) }, { ItemID.IceBoomerang, Do(DamageExact(28), UseExact(25), ShootSpeedExact(10)) }, { ItemID.IceBow, Do(PointBlank, AutoReuse, DamageExact(120), UseExact(35)) }, { ItemID.IceRod, Do(UseExact(6), DamageExact(30), ShootSpeedExact(20)) }, { ItemID.IceSickle, Do(AutoReuse, UseMeleeSpeed, DamageExact(95), ShootSpeedExact(20f)) }, - { ItemID.IchorArrow, Do(DamageExact(15)) }, { ItemID.ImpStaff, Do(AutoReuse, UseExact(30)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.InfernoFork, Do(DamageRatio(1.66f)) }, + // { ItemID.InfernoFork, Do(DamageRatio(1.2f)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageRatio(0.75f)) }, + // { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(82)) }, + { ItemID.IronAxe, Do(AxePower(60), UseTimeExact(15), TileBoostExact(+0)) }, - { ItemID.IronBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.IronBow, pointBlank }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.IronBroadsword, Do(AutoReuse, UseTurn, DamageRatio(1.25f), ScaleRatio(1.2f)) }, + // { ItemID.IronBroadsword, Do(AutoReuse, UseTurn) }, + { ItemID.IronHammer, Do(HammerPower(45), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.IronPickaxe, Do(PickPower(40), UseTimeExact(8)) }, { ItemID.IronShortsword, Do(AutoReuse, TrueMelee, DamageRatio(1.25f)) }, { ItemID.JestersArrow, Do(DamageExact(6)) }, { ItemID.JoustingLance, trueMelee }, { ItemID.JungleYoyo, autoReuse }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.Katana, Do(UseExact(15), DamageRatio(1.5f), CritDelta(+30)) }, + // { ItemID.Katana, Do(UseExact(15), DamageRatio(1.35f), CritDelta(+30)) }, + { ItemID.Keybrand, Do(UseTurn, ScaleRatio(1.5f), DamageExact(110)) }, { ItemID.KOCannon, Do(DamageRatio(2.65f)) }, { ItemID.Kraken, autoReuse }, @@ -269,8 +336,12 @@ namespace CalamityMod.Items { ItemID.LastPrism, Do(DamageRatio(0.75f)) }, { ItemID.LavaSkull, Do(DefenseExact(4)) }, { ItemID.LeadAxe, Do(AxePower(60), UseTimeExact(15), TileBoostExact(+0)) }, - { ItemID.LeadBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.LeadBow, pointBlank }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.LeadBroadsword, Do(AutoReuse, UseTurn, DamageRatio(1.25f), ScaleRatio(1.2f)) }, + // { ItemID.LeadBroadsword, Do(AutoReuse, UseTurn) }, + { ItemID.LeadHammer, Do(HammerPower(45), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.LeadPickaxe, Do(PickPower(40), UseTimeExact(8)) }, { ItemID.LeadShortsword, Do(AutoReuse, TrueMelee, DamageRatio(1.25f)) }, @@ -280,7 +351,7 @@ namespace CalamityMod.Items { ItemID.LightDisc, Do(DamageExact(128)) }, { ItemID.LightsBane, Do(AutoReuse, UseTurn, DamageExact(34)) }, { ItemID.LucyTheAxe, Do(AxePower(150), UseExact(13), TileBoostExact(+1)) }, - { ItemID.LunarFlareBook, Do(DamageRatio(1.5f)) }, + { ItemID.LunarFlareBook, Do(DamageRatio(1.2f)) }, { ItemID.LunarHamaxeNebula, Do(HammerPower(100), AxePower(175), UseTimeExact(5), TileBoostExact(+4)) }, { ItemID.LunarHamaxeSolar, Do(HammerPower(100), AxePower(175), UseTimeExact(5), TileBoostExact(+4)) }, { ItemID.LunarHamaxeStardust, Do(HammerPower(100), AxePower(175), UseTimeExact(5), TileBoostExact(+4)) }, @@ -308,9 +379,13 @@ namespace CalamityMod.Items { ItemID.MonkStaffT1, Do(TrueMeleeNoSpeed, DamageExact(83)) }, // Sleepy Octopod { ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageRatio(2f)) }, // Ghastly Glaive { ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury - { ItemID.MoonlordArrow, Do(DamageRatio(1.1f)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.MoonlordTurretStaff, Do(UseExact(15), DamageRatio(1.5f)) }, + // { ItemID.MoonlordTurretStaff, Do(UseExact(15)) }, // Lunar Portal Staff + { ItemID.Muramasa, Do(ScaleRatio(1.5f), DamageRatio(1.5f), UseExact(14), CritDelta(+30)) }, + { ItemID.Mushroom, Do(Value(0)) }, { ItemID.MushroomSpear, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(100)) }, { ItemID.Musket, Do(PointBlank, DamageExact(25)) }, { ItemID.MythrilChainsaw, Do(TrueMeleeNoSpeed, AxePower(80), UseTimeExact(4), TileBoostExact(-1)) }, @@ -318,7 +393,11 @@ namespace CalamityMod.Items { ItemID.MythrilHalberd, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(95), ShootSpeedRatio(1.25f)) }, { ItemID.MythrilPickaxe, Do(PickPower(160), UseTimeExact(8)) }, { ItemID.MythrilRepeater, Do(PointBlank, DamageExact(58), UseExact(19)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.MythrilSword, Do(UseTurn, ScaleRatio(1.5f), DamageExact(100), UseExact(25)) }, + // { ItemID.MythrilSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(100)) }, + { ItemID.MythrilWaraxe, Do(AxePower(140), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.NaughtyPresent, nonConsumableBossSummon }, { ItemID.NebulaChainsaw, trueMeleeNoSpeed }, @@ -333,9 +412,17 @@ namespace CalamityMod.Items { ItemID.ObsidianSkullRose, Do(DefenseExact(4)) }, { ItemID.ObsidianSwordfish, Do(AutoReuse, TrueMelee, DamageExact(45)) }, { ItemID.OnyxBlaster, Do(PointBlank, UseTurn) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.OpticStaff, Do(AutoReuse, UseExact(25), DamageRatio(0.75f)) }, // NOTE: Optic Staff minions have local iframes, so they should be much better overall + // { ItemID.OpticStaff, Do(AutoReuse, UseExact(25)) }, + { ItemID.OrangePhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, - { ItemID.OrangePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT + { ItemID.OrangePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72)) }, + // { ItemID.OrangePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.OrichalcumBreastplate, Do(DefenseDelta(+3)) }, { ItemID.OrichalcumChainsaw, Do(TrueMeleeNoSpeed, AxePower(80), UseTimeExact(4), TileBoostExact(-1)) }, { ItemID.OrichalcumDrill, Do(TrueMeleeNoSpeed, PickPower(160), UseTimeExact(4)) }, @@ -346,7 +433,11 @@ namespace CalamityMod.Items { ItemID.OrichalcumMask, Do(DefenseDelta(+3)) }, { ItemID.OrichalcumPickaxe, Do(PickPower(160), UseTimeExact(8)) }, { ItemID.OrichalcumRepeater, Do(PointBlank, DamageExact(86), UseExact(27)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.OrichalcumSword, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(82)) }, + // { ItemID.OrichalcumSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(82)) }, + { ItemID.OrichalcumWaraxe, Do(AxePower(140), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.PainterPaintballGun, Do(PointBlank, DamageExact(8)) }, { ItemID.PaladinsHammer, Do(AutoReuse, DamageExact(100)) }, @@ -359,18 +450,31 @@ namespace CalamityMod.Items { ItemID.PalladiumMask, Do(DefenseDelta(+1)) }, { ItemID.PalladiumLeggings, Do(DefenseDelta(+3)) }, { ItemID.PalladiumPickaxe, Do(PickPower(130), UseTimeExact(9)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageRatio(3f)) }, + // { ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(96)) }, + { ItemID.PalladiumRepeater, Do(PointBlank, UseExact(25), DamageExact(75)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.PalladiumSword, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(100)) }, + // { ItemID.PalladiumSword, Do(UseTurn, ScaleRatio(1.4f), DamageExact(100)) }, + { ItemID.PalladiumWaraxe, Do(AxePower(125), UseTimeExact(12), TileBoostExact(+0)) }, - { ItemID.PalmWoodBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.PalmWoodBow, pointBlank }, + { ItemID.PalmWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.PalmWoodSword, Do(AutoReuse, UseTurn) }, { ItemID.PaperAirplaneA, autoReuse }, { ItemID.PaperAirplaneB, autoReuse }, { ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageRatio(2.31f), UseDelta(+8), ShootSpeedDelta(+3.4f), KnockbackDelta(+1f)) }, { ItemID.PearlwoodHammer, Do(HammerPower(25), UseTimeExact(4), UseAnimationExact(20), DamageRatio(4f), TileBoostExact(+0)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.PearlwoodSword, Do(AutoReuse, UseTurn, DamageRatio(4f)) }, + // { ItemID.PearlwoodSword, Do(UseTurn, DamageRatio(1.5f)) }, + { ItemID.PewMaticHorn, Do(DamageExact(23)) }, { ItemID.Phantasm, pointBlank }, { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, DamageExact(36), UseExact(27)) }, @@ -380,19 +484,26 @@ namespace CalamityMod.Items { ItemID.PirateMap, nonConsumableBossSummon }, { ItemID.PirateStaff, Do(AutoReuse, UseExact(25)) }, { ItemID.PlatinumAxe, Do(AxePower(80), UseTimeExact(14), TileBoostExact(+0)) }, - { ItemID.PlatinumBow, Do(PointBlank, DamageExact(13)) }, + { ItemID.PlatinumBow, pointBlank }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.PlatinumBroadsword, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageRatio(2f)) }, + // { ItemID.PlatinumBroadsword, Do(AutoReuse, UseTurn, ScaleRatio(1.25f), DamageExact(30)) }, + { ItemID.PlatinumHammer, Do(HammerPower(60), UseTimeExact(9), TileBoostExact(+0)) }, { ItemID.PlatinumPickaxe, Do(PickPower(55), UseTimeExact(9)) }, { ItemID.PlatinumShortsword, Do(AutoReuse, TrueMelee, DamageRatio(2f)) }, { ItemID.PoisonStaff, Do(DamageExact(57)) }, - { ItemID.ProximityMineLauncher, Do(DamageRatio(4f), UseRatio(0.8f)) }, { ItemID.PsychoKnife, Do(UseTurn, UseExact(11), AttackSpeedExact(0.5f), DamageRatio(3f)) }, { ItemID.PulseBow, Do(PointBlank, DamageRatio(1.2f)) }, { ItemID.PumpkinMoonMedallion, nonConsumableBossSummon }, { ItemID.PurpleClubberfish, Do(UseTurn, ScaleRatio(1.5f), DamageExact(45), KnockbackExact(10f)) }, { ItemID.PurplePhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, - { ItemID.PurplePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT + { ItemID.PurplePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72)) }, + // { ItemID.PurplePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.PurpleSolution, Do(Value(Item.buyPrice(silver: 5))) }, { ItemID.Pwnhammer, Do(HammerPower(80), UseTimeExact(11), TileBoostExact(+1)) }, { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20)) }, @@ -400,19 +511,24 @@ namespace CalamityMod.Items { ItemID.QueenSlimeCrystal, nonConsumableBossSummon }, { ItemID.QueenSpiderStaff, Do(UseExact(25)) }, { ItemID.RainbowCrystalStaff, Do(UseExact(15)) }, - { ItemID.RainbowRod, Do(DamageExact(35), ManaExact(15), UseExact(25)) }, + { ItemID.RainbowRod, Do(DamageExact(35), ManaExact(15)) }, { ItemID.RainbowWhip, autoReuse }, { ItemID.Rally, Do(AutoReuse, DamageExact(20)) }, { ItemID.RavenStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.Razorpine, Do(DamageRatio(0.75f)) }, { ItemID.ReaverShark, Do(PickPower(100), UseTimeExact(16)) }, { ItemID.RedPhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, - { ItemID.RedPhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT + { ItemID.RedPhasesaber, Do(ScaleRatio(1.5f), DamageExact(72)) }, + // { ItemID.RedPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.RedRyder, Do(PointBlank, DamageExact(24)) }, { ItemID.RedSolution, Do(Value(Item.buyPrice(silver: 5))) }, { ItemID.RedsYoyo, autoReuse }, { ItemID.Revolver, Do(PointBlank, AutoReuse) }, - { ItemID.RichMahoganyBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.RichMahoganyBow, pointBlank }, + { ItemID.RichMahoganyHammer, Do(HammerPower(25), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.RichMahoganySword, Do(AutoReuse, UseTurn) }, { ItemID.RocketIII, Do(DamageRatio(0.75f)) }, @@ -429,7 +545,8 @@ namespace CalamityMod.Items { ItemID.SDMG, pointBlank }, { ItemID.Seedler, Do(UseMeleeSpeed, DamageRatio(1.5f)) }, { ItemID.Shackle, Do(DefenseDelta(+2)) }, - { ItemID.ShadewoodBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.ShadewoodBow, pointBlank }, + { ItemID.ShadewoodHammer, Do(HammerPower(25), UseTimeExact(9), TileBoostExact(+0)) }, { ItemID.ShadewoodSword, Do(AutoReuse, UseTurn) }, { ItemID.ShadowbeamStaff, Do(DamageRatio(1.75f)) }, @@ -437,11 +554,22 @@ namespace CalamityMod.Items { ItemID.ShadowFlameHexDoll, Do(DamageExact(69), ShootSpeedExact(30)) }, { ItemID.ShadowFlameKnife, Do(DamageExact(70)) }, { ItemID.ShadowJoustingLance, trueMelee }, + + // TODO -- UNCOMMENT THE FOLLOWING LINES IN 1.4.4 PORT + // { ItemID.Shellphone, Do(UseExact(30)) }, + // { ItemID.ShellphoneSpawn, Do(UseExact(30)) }, + // { ItemID.ShellphoneOcean, Do(UseExact(30)) }, + // { ItemID.ShellphoneHell, Do(UseExact(30)) }, + { ItemID.Shotgun, Do(PointBlank, DamageExact(36), AutoReuse) }, { ItemID.ShroomiteDiggingClaw, Do(PickPower(200), AxePower(125), UseTimeExact(4), TileBoostExact(-1)) }, { ItemID.SilverAxe, Do(AxePower(70), UseTimeExact(14), TileBoostExact(+0)) }, - { ItemID.SilverBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.SilverBow, pointBlank }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.SilverBroadsword, Do(AutoReuse, UseTurn, DamageRatio(1.5f), ScaleRatio(1.3f)) }, + // { ItemID.SilverBroadsword, Do(AutoReuse, UseTurn, DamageRatio(1.15f), ScaleRatio(1.1f)) }, + { ItemID.SilverBullet, Do(DamageExact(8)) }, { ItemID.SilverHammer, Do(HammerPower(55), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.SilverPickaxe, Do(PickPower(50), UseTimeExact(11)) }, @@ -465,7 +593,7 @@ namespace CalamityMod.Items { ItemID.Spear, Do(AutoReuse, TrueMelee, DamageRatio(2f)) }, { ItemID.SpectreHamaxe, Do(HammerPower(90), AxePower(170), UseTimeExact(8), TileBoostExact(+4)) }, { ItemID.SpectrePickaxe, Do(PickPower(200), UseTimeExact(8), TileBoostExact(+4)) }, - { ItemID.SpectreStaff, Do(DamageRatio(3f)) }, + { ItemID.SpectreStaff, Do(DamageRatio(1.2f)) }, { ItemID.SpiderStaff, Do(AutoReuse, UseExact(25)) }, { ItemID.SpiritFlame, Do(UseExact(20), ManaExact(11), ShootSpeedExact(2f)) }, { ItemID.StaffofEarth, Do(DamageRatio(1.2f)) }, @@ -492,20 +620,24 @@ namespace CalamityMod.Items { ItemID.TentacleSpike, autoReuse }, { ItemID.TerraBlade, Do(UseMeleeSpeed) }, { ItemID.Terragrim, trueMeleeNoSpeed }, - // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, - // Terrarian is extremely overpowered and requires a heavy nerf. + // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, + // Terrarian is extremely overpowered and requires a heavy nerf. { ItemID.Terrarian, Do(AutoReuse, DamageExact(106)) }, { ItemID.TheAxe, Do(HammerPower(100), AxePower(175), UseTimeExact(7), TileBoostExact(+1)) }, { ItemID.TheBreaker, Do(HammerPower(70), UseTimeExact(13), TileBoostExact(+0)) }, { ItemID.TheEyeOfCthulhu, autoReuse }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.TheHorsemansBlade, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(95)) }, + // { ItemID.TheHorsemansBlade, Do(UseTurn, UseRatio(0.8f)) }, + { ItemID.TheRottedFork, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.TheUndertaker, Do(PointBlank, AutoReuse, UseExact(21)) }, { ItemID.ThornChakram, Do(DamageExact(32)) }, { ItemID.ThornWhip, autoReuse }, { ItemID.ThunderSpear, Do(AutoReuse, UseMeleeSpeed) }, // Storm Spear { ItemID.TinAxe, Do(AxePower(50), UseTimeExact(16), TileBoostExact(+0)) }, - { ItemID.TinBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.TinBow, pointBlank }, { ItemID.TinBroadsword, Do(AutoReuse, UseTurn) }, { ItemID.TinHammer, Do(HammerPower(35), UseTimeExact(12), TileBoostExact(+0)) }, { ItemID.TinPickaxe, Do(PickPower(35), UseTimeExact(10), TileBoostExact(+0)) }, @@ -514,7 +646,11 @@ namespace CalamityMod.Items { ItemID.TitaniumDrill, Do(TrueMeleeNoSpeed, PickPower(180), UseTimeExact(4), TileBoostExact(+1)) }, { ItemID.TitaniumPickaxe, Do(PickPower(180), UseTimeExact(8), TileBoostExact(+1)) }, { ItemID.TitaniumRepeater, Do(PointBlank, UseExact(29), DamageExact(122)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT { ItemID.TitaniumSword, Do(UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(77)) }, + // { ItemID.TitaniumSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(77)) }, + { ItemID.TitaniumTrident, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(72), ShootSpeedRatio(1.25f)) }, { ItemID.TitaniumWaraxe, Do(AxePower(160), UseTimeExact(10), TileBoostExact(+1)) }, { ItemID.TopazStaff, Do(ManaExact(2)) }, @@ -538,9 +674,10 @@ namespace CalamityMod.Items { ItemID.Valor, Do(DamageExact(32)) }, { ItemID.VampireFrogStaff, Do(AutoReuse, UseExact(30)) }, { ItemID.VampireKnives, Do(DamageRatio(1.33f)) }, - { ItemID.VenomArrow, Do(DamageRatio(1.1f)) }, { ItemID.VenomStaff, Do(DamageRatio(1.5f)) }, { ItemID.VenusMagnum, Do(AutoReuse, PointBlank) }, + { ItemID.ViciousMushroom, Do(Value(0)) }, + { ItemID.VileMushroom, Do(Value(0)) }, { ItemID.Vilethorn, Do(DamageExact(14)) }, { ItemID.VortexBeater, pointBlank }, { ItemID.VortexChainsaw, trueMeleeNoSpeed }, @@ -552,10 +689,13 @@ namespace CalamityMod.Items { ItemID.WaterBolt, Do(DamageExact(23)) }, { ItemID.WeatherPain, autoReuse }, { ItemID.WhitePhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, - { ItemID.WhitePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, - { ItemID.WoodenArrow, Do(DamageRatio(1.1f)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT + { ItemID.WhitePhasesaber, Do(ScaleRatio(1.5f), DamageExact(72)) }, + // { ItemID.WhitePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.WoodenBoomerang, Do(DamageRatio(2f), Value(Item.sellPrice(copper: 20))) }, - { ItemID.WoodenBow, Do(PointBlank, DamageRatio(1.1f)) }, + { ItemID.WoodenBow, pointBlank }, { ItemID.WoodenHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, { ItemID.WoodenSword, Do(AutoReuse, UseTurn) }, { ItemID.WoodYoyo, autoReuse }, @@ -564,10 +704,14 @@ namespace CalamityMod.Items { ItemID.XenoStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.Yelets, autoReuse }, { ItemID.YellowPhaseblade, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(51)) }, - { ItemID.YellowPhasesaber, Do(ScaleRatio(1.5f), DamageExact(72), UseExact(20)) }, + + // TODO -- REPLACE WITH COMMENTED LINE IN 1.4.4 PORT + { ItemID.YellowPhasesaber, Do(ScaleRatio(1.5f), DamageExact(72)) }, + // { ItemID.YellowPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, + { ItemID.ZapinatorGray, autoReuse }, { ItemID.ZapinatorOrange, autoReuse }, - { ItemID.ZombieArm, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), DamageExact(12), KnockbackExact(12f)) }, + { ItemID.ZombieArm, Do(AutoReuse, UseTurn, ScaleRatio(1.25f), KnockbackExact(12f)) }, }; } diff --git a/Items/DraedonMisc/DraedonsLogHell.cs b/Items/DraedonMisc/DraedonsLogHell.cs index 59410d79f6..11314dc087 100644 --- a/Items/DraedonMisc/DraedonsLogHell.cs +++ b/Items/DraedonMisc/DraedonsLogHell.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.DraedonMisc public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Draedon's Log - Hell"); - Tooltip.SetDefault("Click to view its contents"); + DisplayName.SetDefault("Environmental Pollution Log"); + Tooltip.SetDefault("[Environment Log] - Pollution and 'Wall of Flesh'\nClick to view its contents"); } public override void SetDefaults() diff --git a/Items/DraedonMisc/DraedonsLogJungle.cs b/Items/DraedonMisc/DraedonsLogJungle.cs index 9c2a5ad6d0..15b0881945 100644 --- a/Items/DraedonMisc/DraedonsLogJungle.cs +++ b/Items/DraedonMisc/DraedonsLogJungle.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.DraedonMisc public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Draedon's Log - The Jungle and Plague"); - Tooltip.SetDefault("Click to view its contents"); + DisplayName.SetDefault("Plague Nanomachine Log"); + Tooltip.SetDefault("[Nanomachine Experimentation Results] - 'The Plague'\nClick to view its contents"); } public override void SetDefaults() diff --git a/Items/DraedonMisc/DraedonsLogPlanetoid.cs b/Items/DraedonMisc/DraedonsLogPlanetoid.cs index 25a0ac3e0b..8eea39a9e4 100644 --- a/Items/DraedonMisc/DraedonsLogPlanetoid.cs +++ b/Items/DraedonMisc/DraedonsLogPlanetoid.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.DraedonMisc public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Draedon's Log - Space"); - Tooltip.SetDefault("Click to view its contents"); + DisplayName.SetDefault("Low Orbit Study Log"); + Tooltip.SetDefault("[Space and Soil Survey] - Low Terraria Orbit\nClick to view its contents"); } public override void SetDefaults() diff --git a/Items/DraedonMisc/DraedonsLogSnowBiome.cs b/Items/DraedonMisc/DraedonsLogSnowBiome.cs index b819ae0e56..0fba568110 100644 --- a/Items/DraedonMisc/DraedonsLogSnowBiome.cs +++ b/Items/DraedonMisc/DraedonsLogSnowBiome.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.DraedonMisc public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Draedon's Log - The Frozen Wasteland"); - Tooltip.SetDefault("Click to view its contents"); + DisplayName.SetDefault("Cryonic Material Log"); + Tooltip.SetDefault("[Material Science Report] - Archmage's 'Cryonic Metal'\nClick to view its contents"); } public override void SetDefaults() diff --git a/Items/DraedonMisc/DraedonsLogSunkenSea.cs b/Items/DraedonMisc/DraedonsLogSunkenSea.cs index a65ce9b63b..0507bc05f5 100644 --- a/Items/DraedonMisc/DraedonsLogSunkenSea.cs +++ b/Items/DraedonMisc/DraedonsLogSunkenSea.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.DraedonMisc public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Draedon's Log - Study on Sunken Aquatic Life"); - Tooltip.SetDefault("Click to view its contents"); + DisplayName.SetDefault("Marine Biology Log"); + Tooltip.SetDefault("[Bioform Research] - Aquatic Life of Ilmeris\nClick to view its contents"); } public override void SetDefaults() diff --git a/Items/Dyes/AstralBlueDye.cs b/Items/Dyes/AstralBlueDye.cs index 6113571893..7bd50895ca 100644 --- a/Items/Dyes/AstralBlueDye.cs +++ b/Items/Dyes/AstralBlueDye.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(). - AddIngredient(ItemID.BottledWater). + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). AddIngredient(). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/AstralOrangeDye.cs b/Items/Dyes/AstralOrangeDye.cs index 474ee83e73..76d25b66d7 100644 --- a/Items/Dyes/AstralOrangeDye.cs +++ b/Items/Dyes/AstralOrangeDye.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(). - AddIngredient(ItemID.BottledWater). + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). AddIngredient(). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/AstralSwirlDye.cs b/Items/Dyes/AstralSwirlDye.cs index f033bf3159..54bfebb3aa 100644 --- a/Items/Dyes/AstralSwirlDye.cs +++ b/Items/Dyes/AstralSwirlDye.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Placeables.Ores; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; @@ -30,7 +29,6 @@ namespace CalamityMod.Items.Dyes CreateRecipe(2). AddIngredient(). AddIngredient(). - AddIngredient(5). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Dyes/AuricDye.cs b/Items/Dyes/AuricDye.cs index cbed2aaf09..dfc0083393 100644 --- a/Items/Dyes/AuricDye.cs +++ b/Items/Dyes/AuricDye.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(). - AddIngredient(ItemID.BottledWater). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). AddIngredient(5). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/BloodflareDye.cs b/Items/Dyes/BloodflareDye.cs index 3da1c20844..1bdbb86938 100644 --- a/Items/Dyes/BloodflareDye.cs +++ b/Items/Dyes/BloodflareDye.cs @@ -28,9 +28,9 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). - AddIngredient(3). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). + AddIngredient(5). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Dyes/BlueCosmicFlameDye.cs b/Items/Dyes/BlueCosmicFlameDye.cs index c03daf9ff3..0b16e64bb4 100644 --- a/Items/Dyes/BlueCosmicFlameDye.cs +++ b/Items/Dyes/BlueCosmicFlameDye.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). AddIngredient(). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/BrimflameDye.cs b/Items/Dyes/BrimflameDye.cs index cc4f68ccfb..af5e36e068 100644 --- a/Items/Dyes/BrimflameDye.cs +++ b/Items/Dyes/BrimflameDye.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(). - AddIngredient(ItemID.BottledWater). + CreateRecipe(2). + AddIngredient(ItemID.BottledWater, 2). AddIngredient(3). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/CosmiliteDye.cs b/Items/Dyes/CosmiliteDye.cs index 9193190811..ab0c3fe2f8 100644 --- a/Items/Dyes/CosmiliteDye.cs +++ b/Items/Dyes/CosmiliteDye.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). AddIngredient(). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index c03b06e19a..8ae9fdeaa1 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). AddIngredient(). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index 921ef87638..e7536b95b4 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). AddIngredient(5). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/ExoDye.cs b/Items/Dyes/ExoDye.cs index 85d0eb73ea..e2678cd7bf 100644 --- a/Items/Dyes/ExoDye.cs +++ b/Items/Dyes/ExoDye.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Dyes { CreateRecipe(3). AddIngredient(ItemID.BottledWater, 3). - AddIngredient(). + AddIngredient(). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index a4dea3fc0e..f2f4eb3aa6 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). AddIngredient(5). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/PinkCosmicFlameDye.cs b/Items/Dyes/PinkCosmicFlameDye.cs index 1beb474c35..94c20f234b 100644 --- a/Items/Dyes/PinkCosmicFlameDye.cs +++ b/Items/Dyes/PinkCosmicFlameDye.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). AddIngredient(). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/ProfanedFlameDye.cs b/Items/Dyes/ProfanedFlameDye.cs index 60257aad43..8b239c54ed 100644 --- a/Items/Dyes/ProfanedFlameDye.cs +++ b/Items/Dyes/ProfanedFlameDye.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). - AddIngredient(3). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). + AddIngredient(5). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index 780c79161d..f6d55854b4 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). + CreateRecipe(10). + AddIngredient(ItemID.BottledWater, 10). AddIngredient(). AddTile(TileID.DyeVat). Register(); diff --git a/Items/Dyes/SlimeGodDye.cs b/Items/Dyes/SlimeGodDye.cs index 0c87e09d6f..bfa7720c45 100644 --- a/Items/Dyes/SlimeGodDye.cs +++ b/Items/Dyes/SlimeGodDye.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +29,6 @@ namespace CalamityMod.Items.Dyes CreateRecipe(2). AddIngredient(). AddIngredient(). - AddIngredient(). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Dyes/StratusDye.cs b/Items/Dyes/StratusDye.cs index a9fa1d0db8..afc286b3aa 100644 --- a/Items/Dyes/StratusDye.cs +++ b/Items/Dyes/StratusDye.cs @@ -29,11 +29,11 @@ namespace CalamityMod.Items.Dyes public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.BottledWater, 2). + CreateRecipe(3). + AddIngredient(ItemID.BottledWater, 3). + AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(). AddTile(TileID.DyeVat). Register(); } diff --git a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs index cc22ca4901..4974e0fae9 100644 --- a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs +++ b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs @@ -23,14 +23,14 @@ Revenge is a dish best served flaming hot"); { Item.damage = 20; Item.DamageType = DamageClass.Ranged; - Item.width = 36; - Item.height = 30; + Item.width = 42; + Item.height = 38; Item.useTime = 20; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item20; Item.autoReuse = true; @@ -38,10 +38,8 @@ Revenge is a dish best served flaming hot"); Item.shootSpeed = 11f; } - public override Vector2? HoldoutOrigin() //so it looks normal when holding - { - return new Vector2(10, 10); - } + //so it looks normal when holding + public override Vector2? HoldoutOrigin() => new Vector2(10, 10); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.png b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.png index 1497df9cc5..496ebe5139 100644 Binary files a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.png and b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.png differ diff --git a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs b/Items/Fishing/BrimstoneCragCatches/Havocfish.cs similarity index 85% rename from Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs rename to Items/Fishing/BrimstoneCragCatches/Havocfish.cs index ee7fa8f668..9d90a12d64 100644 --- a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Havocfish.cs @@ -5,11 +5,12 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { - public class ChaoticFish : ModItem + [LegacyName("ChaoticFish")] + public class Havocfish : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Chaotic Fish"); + DisplayName.SetDefault("Havocfish"); Tooltip.SetDefault("The horns lay a curse on those who touch it\n" + "Right click to extract essence"); SacrificeTotal = 10; @@ -32,6 +33,6 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches } public override bool CanRightClick() => true; - public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + public override void ModifyItemLoot(ItemLoot itemLoot) => itemLoot.Add(ModContent.ItemType(), 1, 5, 10); } } diff --git a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.png b/Items/Fishing/BrimstoneCragCatches/Havocfish.png similarity index 100% rename from Items/Fishing/BrimstoneCragCatches/ChaoticFish.png rename to Items/Fishing/BrimstoneCragCatches/Havocfish.png diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index 61884f5a17..37d24e2215 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 60; Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(1, 20, 0, 0); + Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.rare = ModContent.RarityType(); } @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Fishing.FishingRods { CreateRecipe(). AddIngredient(ItemID.WoodFishingPole). - AddIngredient(10). + AddIngredient(6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Fishing/FishingRods/FeralDoubleRod.cs b/Items/Fishing/FishingRods/FeralDoubleRod.cs index ec67c2dd22..ccbaa0d97f 100644 --- a/Items/Fishing/FishingRods/FeralDoubleRod.cs +++ b/Items/Fishing/FishingRods/FeralDoubleRod.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 40; Item.shootSpeed = 16f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; } @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(6). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index b96ad7c83d..2750d3dae1 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -28,15 +28,15 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 25; Item.shootSpeed = 14.5f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ModContent.ItemType(), 7). - AddIngredient(ItemID.SunplateBlock, 5). + AddIngredient(ModContent.ItemType(), 6). + AddIngredient(ItemID.SunplateBlock, 3). AddTile(TileID.SkyMill). Register(); } diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index 640ec71221..a94c9d3992 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -29,16 +29,16 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 20; Item.shootSpeed = 13f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } public override void AddRecipes() { CreateRecipe(). + AddIngredient(1). AddIngredient(5). AddIngredient(8). - AddIngredient(1). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index 4f636e4ab3..83404320a5 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 45; Item.shootSpeed = 17f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; } @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Fishing.FishingRods { CreateRecipe(). AddIngredient(ItemID.HotlineFishingHook). - AddIngredient(8). + AddIngredient(6). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Fishing/FishingRods/SlurperPole.cs b/Items/Fishing/FishingRods/SlurperPole.cs index 5ed47350f1..6d6c32e78c 100644 --- a/Items/Fishing/FishingRods/SlurperPole.cs +++ b/Items/Fishing/FishingRods/SlurperPole.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 25; Item.shootSpeed = 14f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; } } diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index 94d5063fbf..ccd79edb5e 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 75; Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(1, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.rare = ModContent.RarityType(); } @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(6). AddTile(). Register(); } diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index 059a20fa3c..b9030b7a32 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 35; Item.shootSpeed = 15f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(6). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index 159dc4111b..c4b0075534 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -27,13 +27,13 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.fishingPole = 10; Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(6). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Fishing/Spadefish.cs b/Items/Fishing/Spadefish.cs index 587ed38a1a..8d6b8acef1 100644 --- a/Items/Fishing/Spadefish.cs +++ b/Items/Fishing/Spadefish.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Fishing Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 5edcec4b1d..d0008900e4 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -66,20 +66,23 @@ namespace CalamityMod.Items.Fishing itemLoot.AddIf(() => WorldGen.crimson , ItemID.CrimsonSeeds, 20, seedMin, seedMax); itemLoot.AddIf(() => Main.hardMode , ItemID.HallowedSeeds, 20, seedMin, seedMax); + // Add Thorium Marine Kelp if Thorium is loaded. Mod thorium = CalamityMod.Instance.thorium; - if (thorium is not null) - { - var marineKelp = thorium.Find("MarineKelp"); - var marineKelpSeeds = thorium.Find("MarineKelpSeeds"); - if (marineKelp is not null && marineKelpSeeds is not null) - { - itemLoot.Add(marineKelp.Type, 4, herbMin, herbMax); - itemLoot.Add(marineKelpSeeds.Type, 10, seedMin, seedMax); - } - else - CalamityMod.Instance.Logger.Warn("Could not find either Marine Kelp or Marine Kelp Seeds from Thorium. These items will not be added to Stuffed Fish."); - } + if (thorium is null) + return; + var marineKelp = thorium.Find("MarineKelp"); + var marineKelpSeeds = thorium.Find("MarineKelpSeeds"); + if (marineKelp is not null && marineKelpSeeds is not null) + { + itemLoot.Add(marineKelp.Type, 4, herbMin, herbMax); + itemLoot.Add(marineKelpSeeds.Type, 10, seedMin, seedMax); + } + else + CalamityMod.Instance.Logger.Warn("Could not find either Marine Kelp or Marine Kelp Seeds from Thorium. These items will not be added to Stuffed Fish."); + + // Ozzatron 30DEC2022: It is unlikely SoA will ever be ported to 1.4 and beyond. Commenting this out indefinitely. + /* Mod soa = CalamityMod.Instance.soa; if (soa is not null) { @@ -101,6 +104,7 @@ namespace CalamityMod.Items.Fishing CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); } } + */ } } } diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.png b/Items/Fishing/SulphurCatches/AbyssalCrate.png deleted file mode 100644 index 880d23c93e..0000000000 Binary files a/Items/Fishing/SulphurCatches/AbyssalCrate.png and /dev/null differ diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/SulphurousCrate.cs similarity index 94% rename from Items/Fishing/SulphurCatches/AbyssalCrate.cs rename to Items/Fishing/SulphurCatches/SulphurousCrate.cs index 54e50b9841..72aee9d68b 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/SulphurousCrate.cs @@ -15,17 +15,18 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.GameContent.ItemDropRules; -using CrateTile = CalamityMod.Tiles.Abyss.AbyssalCrateTile; +using CrateTile = CalamityMod.Tiles.Abyss.SulphurousCrateTile; namespace CalamityMod.Items.Fishing.SulphurCatches { - public class AbyssalCrate : ModItem + [LegacyName("AbyssalCrate")] + public class SulphurousCrate : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 5; ItemID.Sets.IsFishingCrate[Type] = true; - DisplayName.SetDefault("Abyssal Crate"); + DisplayName.SetDefault("Sulphurous Crate"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); } @@ -55,7 +56,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches { // The contents of this crate depend massively on progression, so it uses a large number of LeadingConditionRules. var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); - var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitasClone); var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); @@ -72,7 +73,6 @@ namespace CalamityMod.Items.Fishing.SulphurCatches tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); scoriaAvailable.Add(ModContent.ItemType(), 5, 16, 28); scoriaAvailable.Add(ModContent.ItemType(), new Fraction(15, 100), 4, 7); tier3AcidRain.Add(ModContent.ItemType(), 10, 1, 5); diff --git a/Items/Fishing/SulphurCatches/SulphurousCrate.png b/Items/Fishing/SulphurCatches/SulphurousCrate.png new file mode 100644 index 0000000000..c2092079d6 Binary files /dev/null and b/Items/Fishing/SulphurCatches/SulphurousCrate.png differ diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs b/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs index 971093c99e..9296eafef9 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicSandfish.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void AnglerQuestChat(ref string description, ref string catchLocation) { - description = "You ever get to see what would happen if a lizard that lived in the desert scurried too deep underground? I did, and they sure are cool! But it’s way too slippery for me to get my hands on it now. You go and get it so I can keep it as a pet!"; + description = "You ever get to see what would happen if a lizard that lived in the desert scurried too deep underground? I did, and they sure are cool! But it's way too slippery for me to get my hands on it now. You go and get it so I can keep it as a pet!"; catchLocation = "Caught in the Sunken Sea."; } } diff --git a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs index 3498311a35..bfbda61160 100644 --- a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs +++ b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs @@ -27,20 +27,18 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.channel = true; //Channel so that you can hold the weapon [Important] Item.rare = ItemRarityID.Green; Item.mana = 5; - Item.width = 42; - Item.height = 34; + Item.width = 44; + Item.height = 44; Item.useTime = 20; Item.useAnimation = 20; Item.UseSound = SoundID.Item13; Item.useStyle = ItemUseStyleID.Shoot; Item.shootSpeed = 14f; - Item.shoot = ModContent.ProjectileType(); - Item.value = Item.sellPrice(silver: 40); + Item.shoot = ModContent.ProjectileType(); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; } - public override Vector2? HoldoutOrigin() //so it looks normal when holding - { - return new Vector2(10, 10); - } + //Looks scuffed with the laser when there is offset + //public override Vector2? HoldoutOrigin() => new Vector2(10, 10); } } diff --git a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.png b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.png index 20b8ceea28..9b18b9aeba 100644 Binary files a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.png and b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.png differ diff --git a/Items/LabFinders/CyanSeekingMechanism.cs b/Items/LabFinders/CyanSeekingMechanism.cs index f8bdafb1b1..0522188b9a 100644 --- a/Items/LabFinders/CyanSeekingMechanism.cs +++ b/Items/LabFinders/CyanSeekingMechanism.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.LabFinders Item.useTime = Item.useAnimation = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; - Item.Calamity().ChargePerUse = 15; + Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/CyanSeekingMechanism.png b/Items/LabFinders/CyanSeekingMechanism.png index edd68f889e..ba467af3d3 100644 Binary files a/Items/LabFinders/CyanSeekingMechanism.png and b/Items/LabFinders/CyanSeekingMechanism.png differ diff --git a/Items/LabFinders/GreenSeekingMechanism.cs b/Items/LabFinders/GreenSeekingMechanism.cs index 1f6bbff7c7..ffbaaecdcf 100644 --- a/Items/LabFinders/GreenSeekingMechanism.cs +++ b/Items/LabFinders/GreenSeekingMechanism.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.LabFinders Item.useTime = Item.useAnimation = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; - Item.Calamity().ChargePerUse = 15; + Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/OnyxSeekingMechanism.cs b/Items/LabFinders/OnyxSeekingMechanism.cs new file mode 100644 index 0000000000..b0f54b1e88 --- /dev/null +++ b/Items/LabFinders/OnyxSeekingMechanism.cs @@ -0,0 +1,46 @@ +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LabFinders +{ + public class OnyxSeekingMechanism : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Onyx Seeking Mechanism"); + Tooltip.SetDefault("Moves swiftly towards a lab within the caverns"); + } + + public override void SetDefaults() + { + Item.width = 24; + Item.height = 26; + Item.noUseGraphic = true; + Item.useStyle = ItemUseStyleID.Swing; + Item.useTime = Item.useAnimation = 36; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().MaxCharge = 100; + Item.Calamity().ChargePerUse = 10; + Item.Calamity().UsesCharge = true; + Item.rare = ModContent.RarityType(); + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.CavernLabCenter != Vector2.Zero; + + public override void AddRecipes() + { + //Temporary recipe probably + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.Obsidian, 25). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/LabFinders/OnyxSeekingMechanism.png b/Items/LabFinders/OnyxSeekingMechanism.png new file mode 100644 index 0000000000..1eb3900463 Binary files /dev/null and b/Items/LabFinders/OnyxSeekingMechanism.png differ diff --git a/Items/LabFinders/PurpleSeekingMechanism.png b/Items/LabFinders/PurpleSeekingMechanism.png deleted file mode 100644 index aaf94eb5f1..0000000000 Binary files a/Items/LabFinders/PurpleSeekingMechanism.png and /dev/null differ diff --git a/Items/LabFinders/RedSeekingMechanism.cs b/Items/LabFinders/RedSeekingMechanism.cs index dcca0a6bee..c6eca05151 100644 --- a/Items/LabFinders/RedSeekingMechanism.cs +++ b/Items/LabFinders/RedSeekingMechanism.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.LabFinders Item.useTime = Item.useAnimation = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; - Item.Calamity().ChargePerUse = 15; + Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; Item.rare = ModContent.RarityType(); } diff --git a/Items/LabFinders/RedSeekingMechanism.png b/Items/LabFinders/RedSeekingMechanism.png index 0b1ff1cb19..89766494df 100644 Binary files a/Items/LabFinders/RedSeekingMechanism.png and b/Items/LabFinders/RedSeekingMechanism.png differ diff --git a/Items/LabFinders/PurpleSeekingMechanism.cs b/Items/LabFinders/WhiteSeekingMechanism.cs similarity index 73% rename from Items/LabFinders/PurpleSeekingMechanism.cs rename to Items/LabFinders/WhiteSeekingMechanism.cs index 56c5736d4b..5c3aecd196 100644 --- a/Items/LabFinders/PurpleSeekingMechanism.cs +++ b/Items/LabFinders/WhiteSeekingMechanism.cs @@ -8,13 +8,13 @@ using Terraria.ModLoader; namespace CalamityMod.Items.LabFinders { - public class PurpleSeekingMechanism : ModItem + public class WhiteSeekingMechanism : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Purple Seeking Mechanism"); - Tooltip.SetDefault("Moves swiftly towards a lab within the sky"); + DisplayName.SetDefault("White Seeking Mechanism"); + Tooltip.SetDefault("Moves swiftly towards a lab within the frozen caverns"); } public override void SetDefaults() @@ -24,20 +24,20 @@ namespace CalamityMod.Items.LabFinders Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = Item.useAnimation = 36; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; - Item.Calamity().ChargePerUse = 15; + Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; Item.rare = ModContent.RarityType(); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.PlanetoidLabCenter != Vector2.Zero; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.IceLabCenter != Vector2.Zero; public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.Cloud, 20). + AddIngredient(ItemID.IceBlock, 50). AddTile(TileID.Anvils). Register(); } diff --git a/Items/LabFinders/WhiteSeekingMechanism.png b/Items/LabFinders/WhiteSeekingMechanism.png new file mode 100644 index 0000000000..535648073e Binary files /dev/null and b/Items/LabFinders/WhiteSeekingMechanism.png differ diff --git a/Items/LabFinders/YellowSeekingMechanism.cs b/Items/LabFinders/YellowSeekingMechanism.cs index 36b045645e..8fec0dbbaa 100644 --- a/Items/LabFinders/YellowSeekingMechanism.cs +++ b/Items/LabFinders/YellowSeekingMechanism.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.LabFinders { SacrificeTotal = 1; DisplayName.SetDefault("Yellow Seeking Mechanism"); - Tooltip.SetDefault("Moves swiftly towards a lab within the frozen caverns"); + Tooltip.SetDefault("Moves swiftly towards a lab within the sky"); } public override void SetDefaults() @@ -26,18 +26,18 @@ namespace CalamityMod.Items.LabFinders Item.useTime = Item.useAnimation = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; - Item.Calamity().ChargePerUse = 15; + Item.Calamity().ChargePerUse = 10; Item.Calamity().UsesCharge = true; Item.rare = ModContent.RarityType(); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.IceLabCenter != Vector2.Zero; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && CalamityWorld.PlanetoidLabCenter != Vector2.Zero; public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.IceBlock, 50). + AddIngredient(ItemID.Cloud, 20). AddTile(TileID.Anvils). Register(); } diff --git a/Items/LabFinders/YellowSeekingMechanism.png b/Items/LabFinders/YellowSeekingMechanism.png index d0d0dfe69c..4c2e5d351e 100644 Binary files a/Items/LabFinders/YellowSeekingMechanism.png and b/Items/LabFinders/YellowSeekingMechanism.png differ diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs deleted file mode 100644 index 057573607b..0000000000 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeAquaticScourge : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + - "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeAstralInfection.cs b/Items/LoreItems/KnowledgeAstralInfection.cs deleted file mode 100644 index 8f365e0d9a..0000000000 --- a/Items/LoreItems/KnowledgeAstralInfection.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeAstralInfection : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astral Infection"); - Tooltip.SetDefault("This twisted dreamscape, surrounded by unnatural pillars under a dark and hazy sky.\n" + - "Natural law has been upturned. What will you make of it?"); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Cyan; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs deleted file mode 100644 index 22fe7b8a87..0000000000 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeAstrumAureus : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus"); - Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + - "The destruction of this creature will not prevent the spread of the disease."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Lime; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs deleted file mode 100644 index b87e2f1c91..0000000000 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeAstrumDeus : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + - "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Cyan; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeBloodMoon.cs b/Items/LoreItems/KnowledgeBloodMoon.cs deleted file mode 100644 index 1dfdf9e90e..0000000000 --- a/Items/LoreItems/KnowledgeBloodMoon.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeBloodMoon : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Red Moon"); - Tooltip.SetDefault("We long ago feared the light of the red moon.\n" + - "Many went mad, others died, but a scant few became blessed with a wealth of cosmic understanding."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Cyan; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.AncientCultistTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.cs b/Items/LoreItems/KnowledgeBrainofCthulhu.cs deleted file mode 100644 index c32caab1f9..0000000000 --- a/Items/LoreItems/KnowledgeBrainofCthulhu.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeBrainofCthulhu : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Brain of Cthulhu"); - Tooltip.SetDefault("An eye and now a brain.\n" + - "Most likely another abomination spawned from this inchoate mass of flesh."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Green; - Item.autoReuse = false; - Item.useStyle = ItemUseStyleID.Swing; - Item.useAnimation = 20; - Item.useTime = 20; - Item.UseSound = SoundID.Item8; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.BrainofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeBrimstoneCrag.cs b/Items/LoreItems/KnowledgeBrimstoneCrag.cs deleted file mode 100644 index 632d88b8fd..0000000000 --- a/Items/LoreItems/KnowledgeBrimstoneCrag.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeBrimstoneCrag : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Crag"); - Tooltip.SetDefault("Ah... this place.\n" + - "The scent of broken promises, pain, and eventual death is heavy in the air..."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs deleted file mode 100644 index 69bdfa1dff..0000000000 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeBrimstoneElemental : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Elemental"); - Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + - "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs deleted file mode 100644 index 056c8b57ba..0000000000 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeCalamitas : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas"); - Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + - "Now that you have defeated her your destiny is clear.\n" + - "Come now, face me."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.consumable = false; - Item.rare = ModContent.RarityType(); - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeCalamitasClone.cs b/Items/LoreItems/KnowledgeCalamitasClone.cs deleted file mode 100644 index 1e3663d788..0000000000 --- a/Items/LoreItems/KnowledgeCalamitasClone.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeCalamitasClone : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas Clone"); - Tooltip.SetDefault("You are indeed stronger than I thought.\n" + - "Though the bloody inferno still lingers, observing your progress."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeCorruption.cs b/Items/LoreItems/KnowledgeCorruption.cs deleted file mode 100644 index 86234f98e4..0000000000 --- a/Items/LoreItems/KnowledgeCorruption.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeCorruption : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Corruption"); - Tooltip.SetDefault("The rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + - "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Green; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EaterofWorldsTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs deleted file mode 100644 index 92f00c3516..0000000000 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeCrabulon : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon"); - Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + - "It's interesting how creatures can adapt given certain circumstances."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Green; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeCrimson.cs b/Items/LoreItems/KnowledgeCrimson.cs deleted file mode 100644 index 4f2f6b8260..0000000000 --- a/Items/LoreItems/KnowledgeCrimson.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeCrimson : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Crimson"); - Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + - "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Green; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.BrainofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs deleted file mode 100644 index c4511382f7..0000000000 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeCryogen : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen"); - Tooltip.SetDefault("The archmage's prison.\n" + - "I am unsure if it has grown weaker over the decades of imprisonment."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs deleted file mode 100644 index 7d7826d45a..0000000000 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeDesertScourge : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Desert Scourge"); - Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + - "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + - "gluttonous husk, constantly on a voracious search for its next meal."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Blue; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs deleted file mode 100644 index 569b24d62d..0000000000 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeDestroyer : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Destroyer"); - Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + - "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DestroyerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs deleted file mode 100644 index 1e61229979..0000000000 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeDevourerofGods : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Devourer of Gods"); - Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + - "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.consumable = false; - Item.rare = ModContent.RarityType(); - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeDragonfolly.cs b/Items/LoreItems/KnowledgeDragonfolly.cs deleted file mode 100644 index dd44f3dd41..0000000000 --- a/Items/LoreItems/KnowledgeDragonfolly.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - [LegacyName("KnowledgeBumblebirb")] - public class KnowledgeDragonfolly : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Dragonfolly"); - Tooltip.SetDefault("A failure of twisted scientific ambition; it appears our faulted arrogance over life has shown once more in the results.\n" + - "Originally intended to be a clone of the Jungle Dragon, these were left to roam about the jungle, attacking anything in their path."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Purple; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs deleted file mode 100644 index 0230c84827..0000000000 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeDukeFishron : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duke Fishron"); - Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + - "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Yellow; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DukeFishronTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs deleted file mode 100644 index f3363c2c9d..0000000000 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeEaterofWorlds : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Eater of Worlds"); - Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + - "Seems likely, given the origins of this place."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Green; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EaterofWorldsTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeExoMechs.cs b/Items/LoreItems/KnowledgeExoMechs.cs deleted file mode 100644 index 37332d507d..0000000000 --- a/Items/LoreItems/KnowledgeExoMechs.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeExoMechs : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Exo Mechanical Trio"); - Tooltip.SetDefault("The fruits of masterful craftsmanship and optimization, created only with the objective to destroy.\n" + - "Yet in the end, they achieved little more than the original designs they were derived from."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.consumable = false; - Item.rare = ModContent.RarityType(); - } - - public override bool CanUseItem(Player player) => false; - - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs deleted file mode 100644 index 6d1dfd796d..0000000000 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeEyeofCthulhu : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Eye of Cthulhu"); - Tooltip.SetDefault("That eye... how peculiar.\n" + - "I sensed it watching you more intensely as you grew stronger."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Blue; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.EyeofCthulhuTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs deleted file mode 100644 index cccab2f7ef..0000000000 --- a/Items/LoreItems/KnowledgeGolem.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeGolem : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Golem"); - Tooltip.SetDefault("A primitive construct.\n" + - "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Yellow; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.GolemTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs deleted file mode 100644 index 1ed2c5d8ec..0000000000 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeHiveMind : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive Mind"); - Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + - "I do not believe killing it will lessen the corruption here."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Orange; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeKingSlime.cs b/Items/LoreItems/KnowledgeKingSlime.cs deleted file mode 100644 index 15b4773dbc..0000000000 --- a/Items/LoreItems/KnowledgeKingSlime.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeKingSlime : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("King Slime"); - Tooltip.SetDefault("Only a fool could be caught by this pitiful excuse for a hunter.\n" + - "Unfortunately, our world has no shortage of those."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Blue; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.KingSlimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeLeviathanAnahita.cs b/Items/LoreItems/KnowledgeLeviathanAnahita.cs deleted file mode 100644 index ea2f3ad28d..0000000000 --- a/Items/LoreItems/KnowledgeLeviathanAnahita.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - [LegacyName("KnowledgeLeviathanandSiren")] - public class KnowledgeLeviathanAnahita : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviathan and Anahita"); - Tooltip.SetDefault("An odd pair of creatures; one seeking companionship and the other seeking sustenance.\n" + - "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Lime; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs deleted file mode 100644 index a0eeed9cc1..0000000000 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeLunaticCultist : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lunatic Cultist"); - Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + - "Someone I once held in such contempt for his actions is now... deceased, his sealing ritual undone... prepare for the end.\n" + - "Your impending doom approaches..."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Cyan; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.AncientCultistTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeLunaticCultist.png b/Items/LoreItems/KnowledgeLunaticCultist.png deleted file mode 100644 index 5f55d521f5..0000000000 Binary files a/Items/LoreItems/KnowledgeLunaticCultist.png and /dev/null differ diff --git a/Items/LoreItems/KnowledgeMechs.cs b/Items/LoreItems/KnowledgeMechs.cs deleted file mode 100644 index 097c49ad4f..0000000000 --- a/Items/LoreItems/KnowledgeMechs.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeMechs : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Mechanical Trio"); - Tooltip.SetDefault("I see you have awakened Draedon's old toys.\n" + - "Once useful tools turned into savage beasts when their AIs went rogue, a mistake that Draedon failed to rectify in time."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.RetinazerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SpazmatismTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.DestroyerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronPrimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs deleted file mode 100644 index 0f4cd1ca4d..0000000000 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeMoonLord : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moon Lord"); - Tooltip.SetDefault("What a waste.\n" + - "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + - "However, that doesn't diminish the immense potential locked within it, released upon its death."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Red; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.MoonLordTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeMoonLord.png b/Items/LoreItems/KnowledgeMoonLord.png deleted file mode 100644 index b139537022..0000000000 Binary files a/Items/LoreItems/KnowledgeMoonLord.png and /dev/null differ diff --git a/Items/LoreItems/KnowledgeOcean.cs b/Items/LoreItems/KnowledgeOcean.cs deleted file mode 100644 index 02c3c07812..0000000000 --- a/Items/LoreItems/KnowledgeOcean.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeOcean : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Ocean"); - Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + - "You may awaken something more terrifying than death itself."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Lime; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) => false; - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeOcean.png b/Items/LoreItems/KnowledgeOcean.png deleted file mode 100644 index 74d0d2b0ce..0000000000 Binary files a/Items/LoreItems/KnowledgeOcean.png and /dev/null differ diff --git a/Items/LoreItems/KnowledgeOldDuke.cs b/Items/LoreItems/KnowledgeOldDuke.cs deleted file mode 100644 index cab1a2821d..0000000000 --- a/Items/LoreItems/KnowledgeOldDuke.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeOldDuke : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Old Duke"); - Tooltip.SetDefault("Strange, to find out that the mutant terror of the seas was not alone in its unique biology.\n" + - "Perhaps I was mistaken to classify the creature from its relation to pigrons alone."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ModContent.RarityType(); - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs deleted file mode 100644 index a85538bc2e..0000000000 --- a/Items/LoreItems/KnowledgePerforators.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgePerforators : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforators and their Hive"); - Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Orange; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs deleted file mode 100644 index 9910acea88..0000000000 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgePlaguebringerGoliath : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Plaguebringer Goliath"); - Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + - "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Yellow; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs deleted file mode 100644 index 0b322f8f19..0000000000 --- a/Items/LoreItems/KnowledgePlantera.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgePlantera : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plantera"); - Tooltip.SetDefault("Well done, you killed a plant.\n" + - "It was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + - "I wish you luck in dealing with the fallout."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.LightPurple; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.PlanteraTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs deleted file mode 100644 index ef2714fa56..0000000000 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgePolterghast : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Polterghast"); - Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + - "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.consumable = false; - Item.rare = ModContent.RarityType(); - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeProfanedGuardians.cs b/Items/LoreItems/KnowledgeProfanedGuardians.cs deleted file mode 100644 index b917bb3431..0000000000 --- a/Items/LoreItems/KnowledgeProfanedGuardians.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeProfanedGuardians : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Profaned Guardians"); - Tooltip.SetDefault("The ever-rejuvenating guardians of the profaned flame.\n" + - "Much like a phoenix from the ashes their deaths are simply a part of their life cycle.\n" + - "Many times my forces have had to destroy these beings in search of the Profaned Goddess."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Purple; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs deleted file mode 100644 index bbad13b0e8..0000000000 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeProvidence : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Providence, the Profaned Goddess"); - Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + - "What would have become of us had she not been defeated is a frightening concept to consider."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.consumable = false; - Item.rare = ModContent.RarityType(); - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs deleted file mode 100644 index 62af6853a4..0000000000 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ /dev/null @@ -1,36 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeQueenBee : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Queen Bee"); - Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations... given the ability to control them."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Orange; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.QueenBeeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs deleted file mode 100644 index 801c120ad5..0000000000 --- a/Items/LoreItems/KnowledgeRavager.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeRavager : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + - "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Yellow; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeSentinels.cs b/Items/LoreItems/KnowledgeSentinels.cs deleted file mode 100644 index 6056a32d0c..0000000000 --- a/Items/LoreItems/KnowledgeSentinels.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeSentinels : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Sentinels of the Devourer"); - Tooltip.SetDefault("Signus. The Void. The Weaver.\n" + - "Each represent one of the Devourer’s largest spheres of influence.\n" + - "Dispatching them has most likely invoked its anger and marked you as a target for destruction."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.consumable = false; - Item.rare = ModContent.RarityType(); - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeSentinels.png b/Items/LoreItems/KnowledgeSentinels.png deleted file mode 100644 index 503d18f9a0..0000000000 Binary files a/Items/LoreItems/KnowledgeSentinels.png and /dev/null differ diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs deleted file mode 100644 index 30d9729757..0000000000 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeSkeletron : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skeletron"); - Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + - "After they are afflicted they become an immortal vessel for an ancient demon of the underworld."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Orange; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs deleted file mode 100644 index c2e625d395..0000000000 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeSkeletronPrime : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skeletron Prime"); - Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + - "Draedon obviously took several liberties with its design... I am not impressed."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SkeletronPrimeTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs deleted file mode 100644 index 99853650eb..0000000000 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeSlimeGod : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Slime God"); - Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + - "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.LightRed; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeSulphurSea.cs b/Items/LoreItems/KnowledgeSulphurSea.cs deleted file mode 100644 index 2ccf0260bd..0000000000 --- a/Items/LoreItems/KnowledgeSulphurSea.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeSulphurSea : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Sulphur Sea"); - Tooltip.SetDefault("I remember the serene waves and the clear breeze.\n" + - "The bitterness of my youth has long since subsided, but it is far too late. I must never repeat a mistake like this again."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) => false; - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs deleted file mode 100644 index 4fbdeae703..0000000000 --- a/Items/LoreItems/KnowledgeTwins.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeTwins : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Twins"); - Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + - "These creatures did not belong in this world, it's best to be rid of them."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.Pink; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.RetinazerTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.SpazmatismTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeUnderworld.cs b/Items/LoreItems/KnowledgeUnderworld.cs deleted file mode 100644 index 7f6d7378bb..0000000000 --- a/Items/LoreItems/KnowledgeUnderworld.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeUnderworld : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Underworld"); - Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of... 'people'.\n" + - "Unfortunately for them, they were twisted by their inner demons until they were beyond saving."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.LightRed; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.WallofFleshTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs deleted file mode 100644 index 15fe0542eb..0000000000 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeWallofFlesh : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wall of Flesh"); - Tooltip.SetDefault("I see the deed is done.\n" + - "The unholy amalgamation of flesh and hatred has been defeated.\n" + - "Prepare to face the terrors that lurk in the light and dark parts of this world."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.rare = ItemRarityID.LightRed; - Item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ItemID.WallofFleshTrophy).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs deleted file mode 100644 index e3eab00918..0000000000 --- a/Items/LoreItems/KnowledgeYharon.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.LoreItems -{ - public class KnowledgeYharon : LoreItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jungle Dragon, Yharon"); - Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + - "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse."); - SacrificeTotal = 1; - ItemID.Sets.ItemNoGravity[Item.type] = true; - } - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.consumable = false; - Item.rare = ModContent.RarityType(); - } - - public override bool CanUseItem(Player player) - { - return false; - } - - public override void AddRecipes() - { - CreateRecipe(1).AddTile(TileID.Bookcases).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 10).Register(); - } - } -} diff --git a/Items/LoreItems/LoreAbyss.cs b/Items/LoreItems/LoreAbyss.cs new file mode 100644 index 0000000000..928ebe2437 --- /dev/null +++ b/Items/LoreItems/LoreAbyss.cs @@ -0,0 +1,47 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeOcean")] + public class LoreAbyss : LoreItem + { + public override string Lore => +@"While there are many sightless crevasses in the deep sea, this one is a unique geological marvel. +It is located unsettlingly close to the shoreline. Somehow, even eons of tectonics could not seal or crush it. +The isolated Abyss is the debatably tranquil home of the naiad Anahita and some reclusive sea creatures. +Here, I disposed of the burgeoning remains of Silva, the Goddess of Life itself. Obviously, she of all Gods refused to truly die. +My wishes were that she would be forgotten, but her tenacity is remarkable. +Diffused, her influence inundated that pit of crushing pressure with flora and fauna aplenty. +Her great roots continue to thrash and tear at the impossibly dense stone, growing uncontrollably. +She will soon remake it in her image. I can think of no worse fate for this accursed, hadal domain."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Abyss"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreAbyss.png b/Items/LoreItems/LoreAbyss.png new file mode 100644 index 0000000000..c095972d59 Binary files /dev/null and b/Items/LoreItems/LoreAbyss.png differ diff --git a/Items/LoreItems/LoreAquaticScourge.cs b/Items/LoreItems/LoreAquaticScourge.cs new file mode 100644 index 0000000000..06086f8d70 --- /dev/null +++ b/Items/LoreItems/LoreAquaticScourge.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeAquaticScourge")] + public class LoreAquaticScourge : LoreItem + { + public override string Lore => +@"Another once grand sea serpent, well-adapted to its harsh environs. +Unlike the other Scourge, which was half starved and chasing scraps for its next meal, it lived comfortably. +Microorganisms evolve rapidly, so it was able to maintain its filter feeding habits as the sea putrefied. +What a stark contrast to the rest of the ecosystem. Nearly every other creature in the Sulphur Sea is hostile. +A shame that its last bastion of tranquility has fallen."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Aquatic Scourge"); + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 26; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeAquaticScourge.png b/Items/LoreItems/LoreAquaticScourge.png similarity index 100% rename from Items/LoreItems/KnowledgeAquaticScourge.png rename to Items/LoreItems/LoreAquaticScourge.png diff --git a/Items/LoreItems/LoreArchmage.cs b/Items/LoreItems/LoreArchmage.cs new file mode 100644 index 0000000000..e8c9727d78 --- /dev/null +++ b/Items/LoreItems/LoreArchmage.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeCryogen")] + public class LoreArchmage : LoreItem + { + public override string Lore => +@"He yet lives…?! I thought him slain by Calamitas. It appears she imprisoned the Archmage to spare his life. +I assumed that frigid mass was an old construct of his, running amok without its master to shepherd it. +Permafrost was an old ally of mine, wielding the prestigious title of Archmage and great renown. +His wisdom guided my original conquests, or rather, made much of them possible at all. +As my crusade evolved and my ambitions grew, he expressed vehement disapproval. +Where once he saw justice, there was now tyranny. He departed, and the Witch not long after."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Archmage"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeCryogen.png b/Items/LoreItems/LoreArchmage.png similarity index 100% rename from Items/LoreItems/KnowledgeCryogen.png rename to Items/LoreItems/LoreArchmage.png diff --git a/Items/LoreItems/LoreAstralInfection.cs b/Items/LoreItems/LoreAstralInfection.cs new file mode 100644 index 0000000000..2d689ec930 --- /dev/null +++ b/Items/LoreItems/LoreAstralInfection.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeAstralInfection")] + public class LoreAstralInfection : LoreItem + { + public override string Lore => +@"This twisted dreamscape is a starborne equivalent of the mundane rot you see in your lands. +I do not claim to understand the process in detail, but even the stars above can die. Left unchecked, their corpses bloat and fester. +Typically, some semblance of order is maintained. It is not unlike the circle of life. +Cosmic beings patrol the fathomless void and pick at the carrion, leaving clean bones. +The infection itself is a disturbance from deep space. It has a mind of its own, and projects its will upon life and land. +Those whose minds can grasp the true form of the universe, are largely immune. +They cannot be starstruck by a supposed higher truth, let alone one preached by a pustule."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Astral Infection"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Cyan; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeAstralInfection.png b/Items/LoreItems/LoreAstralInfection.png similarity index 100% rename from Items/LoreItems/KnowledgeAstralInfection.png rename to Items/LoreItems/LoreAstralInfection.png diff --git a/Items/LoreItems/LoreAstrumAureus.cs b/Items/LoreItems/LoreAstrumAureus.cs new file mode 100644 index 0000000000..b066ec88bd --- /dev/null +++ b/Items/LoreItems/LoreAstrumAureus.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeAstrumAureus")] + public class LoreAstrumAureus : LoreItem + { + public override string Lore => +@"Ever pragmatic, Draedon dispatched this machine to locate and analyze the source of the Astral Infection. +While nominally for reconnaissance, the Aureus model is heavily armed and can scale any terrain. +It performed admirably, at least until it was assimilated into the Infection. +Sapient minds have enough willpower to resist the Infection's call indefinitely. +However, even the finest silicon is not beyond its reach. Draedon prefers his creations to serve, after all. +With this experiment concluded, he will certainly be examining you next. Watch yourself."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Astrum Aureus"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeAstrumAureus.png b/Items/LoreItems/LoreAstrumAureus.png similarity index 100% rename from Items/LoreItems/KnowledgeAstrumAureus.png rename to Items/LoreItems/LoreAstrumAureus.png diff --git a/Items/LoreItems/LoreAstrumDeus.cs b/Items/LoreItems/LoreAstrumDeus.cs new file mode 100644 index 0000000000..54d1e7052d --- /dev/null +++ b/Items/LoreItems/LoreAstrumDeus.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeAstrumDeus")] + public class LoreAstrumDeus : LoreItem + { + public override string Lore => +@"On our world, this being is revered as the God of the night sky. It is said to devour dying stars and birth new ones in turn. +Unlike the many Gods you or I know, it is guiltless. An important distinction, for it was equally as diseased as they. +The infection that tainted its body is from beyond Terraria. Neither I nor Draedon recognize it fully. +With its will subsumed, it hurled a chunk of infested astral matter at our world, then came to guard it. +Thankfully, such a grandiose being that walks amongst the stars is likely not truly dead. +While the land has paid a terrible price, the price of a wrongful conviction is higher still."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Astrum Deus"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Cyan; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeAstrumDeus.png b/Items/LoreItems/LoreAstrumDeus.png similarity index 100% rename from Items/LoreItems/KnowledgeAstrumDeus.png rename to Items/LoreItems/LoreAstrumDeus.png diff --git a/Items/LoreItems/LoreAwakening.cs b/Items/LoreItems/LoreAwakening.cs new file mode 100644 index 0000000000..b544788aea --- /dev/null +++ b/Items/LoreItems/LoreAwakening.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Items.LoreItems +{ + public class LoreAwakening : LoreItem + { + public override string Lore => +@"The tombs of the Dragons stir. My eyes lift to see ancient dust dancing from high ledges. +These grand wings… how long has it been since I was a hero worthy of their name? +It feels like centuries have passed, and all I've done is blink. +Look upon my works, as they are. Ruined. None would dare seek me out, tread my path. +Naught awaits them in this cruel world."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Awakening"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.ArmorStatue). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreAwakening.png b/Items/LoreItems/LoreAwakening.png new file mode 100644 index 0000000000..52d10734a2 Binary files /dev/null and b/Items/LoreItems/LoreAwakening.png differ diff --git a/Items/LoreItems/LoreAzafure.cs b/Items/LoreItems/LoreAzafure.cs new file mode 100644 index 0000000000..4324d0f2ef --- /dev/null +++ b/Items/LoreItems/LoreAzafure.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeBrimstoneCrag")] + public class LoreAzafure : LoreItem + { + public override string Lore => +@"Oft called the First City, its tumultuous history stretches back to the Draconic Era. +An odd jewel of civilization, the immense heat of the underworld provided it unlimited potential in defense and industry. +Such was the renown of the forgemasters that when I swayed them to my cause, I was never lacking for arms. +It pains me to say even in hindsight, but their artisanry paved the downfall of the entire city. +For the Witch and I, the air here will forever be laden with regret. There is nothing to be done."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Azafure"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeBrimstoneCrag.png b/Items/LoreItems/LoreAzafure.png similarity index 100% rename from Items/LoreItems/KnowledgeBrimstoneCrag.png rename to Items/LoreItems/LoreAzafure.png diff --git a/Items/LoreItems/LoreBloodMoon.cs b/Items/LoreItems/LoreBloodMoon.cs new file mode 100644 index 0000000000..11c2d6706c --- /dev/null +++ b/Items/LoreItems/LoreBloodMoon.cs @@ -0,0 +1,40 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeBloodMoon")] + public class LoreBloodMoon : LoreItem + { + public override string Lore => +@"This malevolence is not the work of any God. Blood moons trace their origins to the dawn of history. +It is an occurrence equally sinister and banal. Everyone is acclimated to the shambling hordes of undead. +Organized societies are not threatened in the slightest. If anything, they welcome the opportunity to train green foot soldiers. +Those with fire in their veins may strike out on their own, to revel in the slaughter. +That is how I remember the sleepless nights from my younger days… Knee deep in corpses."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Blood Moon"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.BloodMoonStarter). + AddIngredient(ItemID.SoulofNight, 3). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeBloodMoon.png b/Items/LoreItems/LoreBloodMoon.png similarity index 100% rename from Items/LoreItems/KnowledgeBloodMoon.png rename to Items/LoreItems/LoreBloodMoon.png diff --git a/Items/LoreItems/LoreBrainofCthulhu.cs b/Items/LoreItems/LoreBrainofCthulhu.cs new file mode 100644 index 0000000000..7c1d39a915 --- /dev/null +++ b/Items/LoreItems/LoreBrainofCthulhu.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeBrainofCthulhu")] + public class LoreBrainofCthulhu : LoreItem + { + public override string Lore => +@"It is true that unspeakable abominations may now be commonplace, largely by my hand. +Though they have always been a product of the folly of the Gods, the same Gods would cull them in equal measure. +My decimation of the falsely divine left many old horrors unconstrained, with new ones birthed every year. +Now, they are your stepping stones."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Brain of Cthulhu"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.BrainofCthulhuTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.png b/Items/LoreItems/LoreBrainofCthulhu.png similarity index 100% rename from Items/LoreItems/KnowledgeBrainofCthulhu.png rename to Items/LoreItems/LoreBrainofCthulhu.png diff --git a/Items/LoreItems/LoreBrimstoneElemental.cs b/Items/LoreItems/LoreBrimstoneElemental.cs new file mode 100644 index 0000000000..8c48c1bf22 --- /dev/null +++ b/Items/LoreItems/LoreBrimstoneElemental.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeBrimstoneElemental")] + public class LoreBrimstoneElemental : LoreItem + { + public override string Lore => +@"A peculiar being. Until recently, she had laid dormant for ages, posing as the city's silent matron. +As its economy boomed, traces of brimstone found their way all across the known world. +It was never clear why her slumber ended. At first she stirred. The people were cautiously optimistic. +When she woke, it was horrific. Her inferno billowed through the streets. None were safe. +Fate had a sick sense of humor that day, for Calamitas was there to match her. +Perhaps the two were attuned somehow. They fought to a standstill, fire against fire. +Neither were victorious, and despite her intentions, the city was razed by her flames."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Brimstone Elemental"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.png b/Items/LoreItems/LoreBrimstoneElemental.png similarity index 100% rename from Items/LoreItems/KnowledgeBrimstoneElemental.png rename to Items/LoreItems/LoreBrimstoneElemental.png diff --git a/Items/LoreItems/LoreCalamitas.cs b/Items/LoreItems/LoreCalamitas.cs new file mode 100644 index 0000000000..9eacbfa460 --- /dev/null +++ b/Items/LoreItems/LoreCalamitas.cs @@ -0,0 +1,48 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeCalamitas")] + public class LoreCalamitas : LoreItem + { + public override string Lore => +@"None have borne the brunt of misfortune quite like the Brimstone Witch, Calamitas. +When first I saw her, she was still a girl. Prostrated in my court, garbed in charred rags, trembling. +I could not grasp the unfathomable, raw power of the fell magics that coursed through her. +She could scant control it herself. Permafrost recognized this immediately. With a pained face, he counseled me to look after her. +The Witch entered his tutelage, and soon after, my service. She was ablaze with desire to douse the Gods in her wicked wrath. +Indeed, the faithful already quaked in her presence. Her name was a moniker of theirs, one uttered quietly in fear. +In my campaigns, I counted on her sheer capacity for annihilation as my ace in the hole. +No man, no army, no city, and no God could stand against her unbridled fury. +Eventually, the girl's horrific sin was too much for her to bear. She left my side along with her mentor. +The weight of her deeds haunts her to this day. She despises me, and I cannot blame her. +Please, if you would, show her respect where I did not."; + + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Calamitas"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeCalamitas.png b/Items/LoreItems/LoreCalamitas.png similarity index 100% rename from Items/LoreItems/KnowledgeCalamitas.png rename to Items/LoreItems/LoreCalamitas.png diff --git a/Items/LoreItems/LoreCalamitasClone.cs b/Items/LoreItems/LoreCalamitasClone.cs new file mode 100644 index 0000000000..88d4e38d87 --- /dev/null +++ b/Items/LoreItems/LoreCalamitasClone.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeCalamitasClone")] + public class LoreCalamitasClone : LoreItem + { + public override string Lore => +@"I had seen this monster roaming the night in the past, and thought nothing of it. +With its technology, it was certainly one of Draedon's creations. +But, to think it was housing a clone of the Witch… Detestable. +Surely Calamitas would want nothing to do with such a project. +I know not how it wields her brimstone magic. Perhaps some day one of us may find answers."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Calamitas Clone"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeCalamitasClone.png b/Items/LoreItems/LoreCalamitasClone.png similarity index 100% rename from Items/LoreItems/KnowledgeCalamitasClone.png rename to Items/LoreItems/LoreCalamitasClone.png diff --git a/Items/LoreItems/LoreCeaselessVoid.cs b/Items/LoreItems/LoreCeaselessVoid.cs new file mode 100644 index 0000000000..6febed05f9 --- /dev/null +++ b/Items/LoreItems/LoreCeaselessVoid.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeSentinels")] + public class LoreCeaselessVoid : LoreItem + { + public override string Lore => +@"A contained, previously inert portal sealed in the Dungeon. The presiding cult kept it a closely guarded secret. +Upon sighting the Devourer of Gods, their leader hurriedly led me to its chamber to reveal its existence to me. +The portal led to the Devourer's home. It was identical to his, only ancient and perfectly stable. +The serpent claimed it, too, was his creation. Its permanence was a mistake he later rectified. +But this rift was unquestionably far older than he. It dated back to the Golden Age of Dragons. +His lie was thin and forced. Something far more powerful than the Devourer was at hand. +Its eerie persistence gnawed at my mind. It did not just threaten me. It threatened everyone. Everything. +Even faced with such lies and eminent danger, I simply walked away, and did not return."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Ceaseless Void"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreCeaselessVoid.png b/Items/LoreItems/LoreCeaselessVoid.png new file mode 100644 index 0000000000..59b54cf248 Binary files /dev/null and b/Items/LoreItems/LoreCeaselessVoid.png differ diff --git a/Items/LoreItems/LoreCorruption.cs b/Items/LoreItems/LoreCorruption.cs new file mode 100644 index 0000000000..0421e22fce --- /dev/null +++ b/Items/LoreItems/LoreCorruption.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeCorruption")] + public class LoreCorruption : LoreItem + { + public override string Lore => +@"To not properly dispose of the essence of a slain God is a fatal mistake. This wasteland stands as proof of such. +Having slain my first Gods, I turned a blind eye as corrupt essence gushed from their rent forms and burrowed into the bowels of Terraria. +The mere existence of this putrid place proves that the Gods of old were beyond redemption."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Corruption"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.EaterofWorldsTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeCorruption.png b/Items/LoreItems/LoreCorruption.png similarity index 100% rename from Items/LoreItems/KnowledgeCorruption.png rename to Items/LoreItems/LoreCorruption.png diff --git a/Items/LoreItems/LoreCrabulon.cs b/Items/LoreItems/LoreCrabulon.cs new file mode 100644 index 0000000000..d2db79a46f --- /dev/null +++ b/Items/LoreItems/LoreCrabulon.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeCrabulon")] + public class LoreCrabulon : LoreItem + { + public override string Lore => +@"Fungus and a sea crab. One sought a host; the other, a new home. +These mushrooms possess a disturbing amount of tenacity. Nothing that lays down to die in their domain is left to rest. +It is this sort of ghastly, forceful exertion of control over the unwilling that led me down my path."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Crabulon"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeCrabulon.png b/Items/LoreItems/LoreCrabulon.png similarity index 100% rename from Items/LoreItems/KnowledgeCrabulon.png rename to Items/LoreItems/LoreCrabulon.png diff --git a/Items/LoreItems/LoreCrimson.cs b/Items/LoreItems/LoreCrimson.cs new file mode 100644 index 0000000000..e1a4eea9a8 --- /dev/null +++ b/Items/LoreItems/LoreCrimson.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeCrimson")] + public class LoreCrimson : LoreItem + { + public override string Lore => +@"The foul air, the morbid fauna, the disgusting terrain… Here lies my first mistake of my crusade. +The essence of a God does not simply vanish when the body dies. It must be properly disposed of or destroyed entirely. +Essence of a pious God could never fester into a mire as dreadful as this."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Crimson"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.BrainofCthulhuTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeCrimson.png b/Items/LoreItems/LoreCrimson.png similarity index 100% rename from Items/LoreItems/KnowledgeCrimson.png rename to Items/LoreItems/LoreCrimson.png diff --git a/Items/LoreItems/LoreCynosure.cs b/Items/LoreItems/LoreCynosure.cs new file mode 100644 index 0000000000..33f37a72e6 --- /dev/null +++ b/Items/LoreItems/LoreCynosure.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + public class LoreCynosure : LoreItem + { + public override string Lore => +@"You now stand at the brink of infinity. The power you have amassed is extraordinary. +Valor and deceit, truth and falsehood, loyalty and betrayal… you are beyond these notions. +All, you have rent asunder as they crossed your path. The very land now bends to your will. +Do you not see how the grass parts where you step, how the stars illuminate where you gaze? +Terraria itself kneels to you, whether it be out of fear or respect. +This is the strength the Dragons held. The primordial power they commanded. +Little stands between us now. If you did not seek battle with me, I doubt you would have come so far. +When you are prepared, seek the grave of the Light, at the summit of the Dragon Aerie. +I await your challenge."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Cynosure"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreCynosure.png b/Items/LoreItems/LoreCynosure.png new file mode 100644 index 0000000000..c309c764a7 Binary files /dev/null and b/Items/LoreItems/LoreCynosure.png differ diff --git a/Items/LoreItems/LoreDesertScourge.cs b/Items/LoreItems/LoreDesertScourge.cs new file mode 100644 index 0000000000..ed229ac71f --- /dev/null +++ b/Items/LoreItems/LoreDesertScourge.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeDesertScourge")] + public class LoreDesertScourge : LoreItem + { + public override string Lore => +@"Once, it was a majestic sea serpent that threatened none but the microscopic creatures it consumed. +After Ilmeris was incinerated, it became familiar with the hunt. To survive, it quickly learned to seek greater prey. +Unfortunately for the scourge, it seems that it too was prey in the end. After all, there is always a bigger fish in the sea."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Desert Scourge"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeDesertScourge.png b/Items/LoreItems/LoreDesertScourge.png similarity index 100% rename from Items/LoreItems/KnowledgeDesertScourge.png rename to Items/LoreItems/LoreDesertScourge.png diff --git a/Items/LoreItems/LoreDestroyer.cs b/Items/LoreItems/LoreDestroyer.cs new file mode 100644 index 0000000000..d87ea3a2e5 --- /dev/null +++ b/Items/LoreItems/LoreDestroyer.cs @@ -0,0 +1,40 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeDestroyer")] + public class LoreDestroyer : LoreItem + { + public override string Lore => +@"The Godseeker Knights of my company were far and away my finest soldiers. +They championed my cause, and I championed them in return. +I bestowed upon them hulking armor and colossal weaponry, so their Might would never falter. +Some days, I would take time to train by their side, inspiring them to new heights of righteous fury. +Draedon understood well, and granted them these massive forms, bristling with weaponry and interlocked armor forged of blessed metal. +While in truth it was repurposed mining equipment, their sheer presence on the battlefield was immense."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Destroyer"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.DestroyerTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeDestroyer.png b/Items/LoreItems/LoreDestroyer.png similarity index 100% rename from Items/LoreItems/KnowledgeDestroyer.png rename to Items/LoreItems/LoreDestroyer.png diff --git a/Items/LoreItems/LoreDevourerofGods.cs b/Items/LoreItems/LoreDevourerofGods.cs new file mode 100644 index 0000000000..d79ae51872 --- /dev/null +++ b/Items/LoreItems/LoreDevourerofGods.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeDevourerofGods")] + public class LoreDevourerofGods : LoreItem + { + public override string Lore => +@"The infamous, otherworldly glutton, in the flesh. His imposing title was self-granted, but truth made it stick. +He is a formidable foe, capable of swallowing Gods whole, absorbing their essence in its entirety. +I ordered Draedon to armor his gargantuan form, so he could safely best even great Gods in single combat. +Fittingly, he had a serpent's tongue. He manipulated me incessantly, driving me to awful acts. +I recruited him out of desperation. My war had dragged on for decades, and I would do anything to have it end. +It was then my negligence was born. My descent began the moment recruiting this scoundrel crossed my mind. +His absence of loyalty was clear as day, even at the time. However, I suspect it goes beyond that. +The Devourer's alien capabilities and domineering tactics hint that his allegiance lay elsewhere. +Is he but one soldier, of a malevolence far beyond…?"; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Devourer of Gods"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeDevourerofGods.png b/Items/LoreItems/LoreDevourerofGods.png similarity index 100% rename from Items/LoreItems/KnowledgeDevourerofGods.png rename to Items/LoreItems/LoreDevourerofGods.png diff --git a/Items/LoreItems/LoreDragonfolly.cs b/Items/LoreItems/LoreDragonfolly.cs new file mode 100644 index 0000000000..b4e589a8af --- /dev/null +++ b/Items/LoreItems/LoreDragonfolly.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeBumblebirb", "KnowledgeDragonfolly")] + public class LoreDragonfolly : LoreItem + { + public override string Lore => +@"Near the close of the Draconic Era, there are records of the “impure” Dragon species. +Wyverns, basilisks, Pigrons and the like are documented, though none are sure how exactly they came to be. +To this day, scholars argue over the true names and lineages of these creatures. +Names aside, it is clear the first offshoots are pure enough to retain the great strength of their forebears. +Naturally, this led them to be targeted by cruel divine mandates, and most were hunted to extinction. +It is known that Fishrons, Follies, and the Abyssal Wyrms survived the purging hunts of the Deific Era. +Notably, they now are all reclusive or exceedingly violent. It is tragic how they evolved to be that way."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Dragonfolly"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Purple; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeDragonfolly.png b/Items/LoreItems/LoreDragonfolly.png similarity index 100% rename from Items/LoreItems/KnowledgeDragonfolly.png rename to Items/LoreItems/LoreDragonfolly.png diff --git a/Items/LoreItems/LoreDukeFishron.cs b/Items/LoreItems/LoreDukeFishron.cs new file mode 100644 index 0000000000..553f4dca7d --- /dev/null +++ b/Items/LoreItems/LoreDukeFishron.cs @@ -0,0 +1,39 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeDukeFishron")] + public class LoreDukeFishron : LoreItem + { + public override string Lore => +@"Outlandish as they may seem, this species is the single mightiest of the seas. +They are relentless hunters and can easily spend significant time out of the water. +Folklore holds that the Fishrons claim heritage from the true Dragons, countless years back. +While there are many such tales of creatures of draconic descent, this case is factual. +Genetic heritage or not, though, the Fishrons lack Dragonblood, or Auric souls. I would well know."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Duke Fishron"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.DukeFishronTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeDukeFishron.png b/Items/LoreItems/LoreDukeFishron.png similarity index 100% rename from Items/LoreItems/KnowledgeDukeFishron.png rename to Items/LoreItems/LoreDukeFishron.png diff --git a/Items/LoreItems/LoreEaterofWorlds.cs b/Items/LoreItems/LoreEaterofWorlds.cs new file mode 100644 index 0000000000..37d0bafb87 --- /dev/null +++ b/Items/LoreItems/LoreEaterofWorlds.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeEaterofWorlds")] + public class LoreEaterofWorlds : LoreItem + { + public override string Lore => +@"Any powerful being will call forth fable and legend, of both its grandeur and terror. That monstrous worm was no exception. +That measly thing, devouring a planet? Ridiculous. However, ridicule spreads quickly with even an ounce of truth behind it. +One will not need to search long for examples. We are all surrounded by rampant superstition and assumption. +I myself have been subjected to a litany of baseless boasts and accusations in my time."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Eater of Worlds"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Green; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.EaterofWorldsTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.png b/Items/LoreItems/LoreEaterofWorlds.png similarity index 100% rename from Items/LoreItems/KnowledgeEaterofWorlds.png rename to Items/LoreItems/LoreEaterofWorlds.png diff --git a/Items/LoreItems/LoreEmpressofLight.cs b/Items/LoreItems/LoreEmpressofLight.cs new file mode 100644 index 0000000000..69dbbd50c7 --- /dev/null +++ b/Items/LoreItems/LoreEmpressofLight.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Items.LoreItems +{ + public class LoreEmpressofLight : LoreItem + { + public override string Lore => +@"Though her title is lofty, she is more an emissary for the powers beyond and forces of nature. +In broad daylight, she can channel the Primordial Light itself, making her nigh untouchable. +Thankfully, left with only starlight to wield, she falls like any other graceless despot. +Her penchant for leeching the strength of other great beings is uniquely deplorable. +It made her sickeningly obedient. Dependent, but willingly so, as they enabled her to slake her base thirst. +I had deigned to slay her myself for her treachery, but she was a notoriously evasive mark."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Empress of Light"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.FairyQueenTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreEmpressofLight.png b/Items/LoreItems/LoreEmpressofLight.png new file mode 100644 index 0000000000..30177574e1 Binary files /dev/null and b/Items/LoreItems/LoreEmpressofLight.png differ diff --git a/Items/LoreItems/LoreExoMechs.cs b/Items/LoreItems/LoreExoMechs.cs new file mode 100644 index 0000000000..d92349e478 --- /dev/null +++ b/Items/LoreItems/LoreExoMechs.cs @@ -0,0 +1,58 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeExoMechs")] + public class LoreExoMechs : LoreItem + { + public override string Lore => +@"What a terrifying marvel of engineering. Draedon's specialty always lay in the machines of war, but these are immaculate. +His bold claim that no God can match his work is, however, incorrect. He is not privy to the Traitor almighty. +Regardless, from steel and wit alone, he has forged engines of destruction that rival Calamitas. +It brings me little comfort to remark that even she, at least, has a heart to speak of. +Draedon is an amoral monster beyond compare. He is entirely devoid of humanity and compassion. +With technology this incomprehensibly advanced, he stands at the precipice of apotheosis. +He can fabricate such dreadful, synthetic nightmares at will. His resources must be nigh unlimited. +Were he to lose his temper, if he even has one, all of life's hopes would be smothered in an instant, silenced by a torrent of silicon. +Though, perhaps you may leverage his unimaginable craft to your advantage, and seek insight from him."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Exo Mechanical Trio"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeExoMechs.png b/Items/LoreItems/LoreExoMechs.png similarity index 100% rename from Items/LoreItems/KnowledgeExoMechs.png rename to Items/LoreItems/LoreExoMechs.png diff --git a/Items/LoreItems/LoreEyeofCthulhu.cs b/Items/LoreItems/LoreEyeofCthulhu.cs new file mode 100644 index 0000000000..c66c02c8ea --- /dev/null +++ b/Items/LoreItems/LoreEyeofCthulhu.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeEyeofCthulhu")] + public class LoreEyeofCthulhu : LoreItem + { + public override string Lore => +@"In ages past, heroes made names for themselves facing such monsters. +Now they run rampant, spawning from vile influences left unchecked. They blend well with the horrific injustice of their forebears. +Slaying one merely paves the way for a dozen more. Surely this does not concern you, either."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Eye of Cthulhu"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.EyeofCthulhuTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.png b/Items/LoreItems/LoreEyeofCthulhu.png similarity index 100% rename from Items/LoreItems/KnowledgeEyeofCthulhu.png rename to Items/LoreItems/LoreEyeofCthulhu.png diff --git a/Items/LoreItems/LoreGolem.cs b/Items/LoreItems/LoreGolem.cs new file mode 100644 index 0000000000..29f9b46cc9 --- /dev/null +++ b/Items/LoreItems/LoreGolem.cs @@ -0,0 +1,40 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeGolem")] + public class LoreGolem : LoreItem + { + public override string Lore => +@"What a sad, piteous thing. Truly, a mockery in every sense of the word. +The Lihzahrds were abandoned by their deity long ago. They set upon creating the idol as a replacement. +The result is an amalgamation of the concepts and themes of many Gods, most prominently the heat of the sun. +It is a far cry from a mechanical god… for the better. The alternative is too chilling to consider. +While I believe it barely deserves mention, the Lihzahrds revere it unflinchingly. +I see no need to intervene in affairs beneath me and my people."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Golem"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.GolemTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeGolem.png b/Items/LoreItems/LoreGolem.png similarity index 100% rename from Items/LoreItems/KnowledgeGolem.png rename to Items/LoreItems/LoreGolem.png diff --git a/Items/LoreItems/LoreHiveMind.cs b/Items/LoreItems/LoreHiveMind.cs new file mode 100644 index 0000000000..c82866a47a --- /dev/null +++ b/Items/LoreItems/LoreHiveMind.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeHiveMind")] + public class LoreHiveMind : LoreItem + { + public override string Lore => +@"Some semblance of a God's mind may survive death, like the twitches of a crushed insect. +What little remains attempts to convene, to coalesce in worship, so that its power may yet be restored. How pitiful. +Fortunately for us, the futility of this effort is unmatched. The biomass obeys, but nothing is accomplished. +Far from all divine power flows from faith. A God is forged of its own strength; followers may choose to worship."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Hive Mind"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Orange; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeHiveMind.png b/Items/LoreItems/LoreHiveMind.png similarity index 100% rename from Items/LoreItems/KnowledgeHiveMind.png rename to Items/LoreItems/LoreHiveMind.png diff --git a/Items/LoreItems/LoreItem.cs b/Items/LoreItems/LoreItem.cs index e22f352921..aa9aed1d53 100644 --- a/Items/LoreItems/LoreItem.cs +++ b/Items/LoreItems/LoreItem.cs @@ -1,4 +1,7 @@ +using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Input; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -6,11 +9,71 @@ namespace CalamityMod.Items.LoreItems { public abstract class LoreItem : ModItem { + // This line is the short, generic lore tooltip which indicates there is more to be read. + // It can be overridden as desired for flavor. + public virtual string ShortTooltip => "Whispers from on high dance in your ears..."; + public virtual Color ShortTooltipColor => new(227, 175, 64); // #E3AF40 + + // This line is what tells the player to hold Shift. There is essentially no reason to change it + public virtual string LeftShiftExpandTooltip => "Press \"Left Shift\" to listen closer"; + public virtual Color LeftShiftExpandColor => new(190, 190, 190); // #BEBEBE + + // This string contains the actual lore of the lore item + public virtual string Lore => ""; + // By default, lore text appears in white, but this can be changed. + public virtual Color? LoreColor => null; + + public override void SetStaticDefaults() + { + string basicLine = ShortTooltipColor.ColorMessage(ShortTooltip, true); + string leftShift = LeftShiftExpandColor.ColorMessage(LeftShiftExpandTooltip, false); + Tooltip.SetDefault(basicLine + leftShift); + SacrificeTotal = 1; + ItemID.Sets.ItemNoGravity[Item.type] = true; + } + + public override bool CanUseItem(Player player) => false; + public override Color? GetAlpha(Color lightColor) => Color.White; - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.LoreItems; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.LoreItems; + } + + // All lore items use the same code for holding SHIFT to extend tooltips. + // Original code lifted from Iban's extended armor tooltips. + public override void ModifyTooltips(List tooltips) + { + // Only perform any changes while holding SHIFT. + if (Main.keyState.IsKeyDown(Keys.LeftShift)) + { + // Count up all standard vanilla tooltip lines while holding SHIFT, so they may be removed. + int tooltipIndex = -1; + int tooltipCount = 0; + for (int i = 0; i < tooltips.Count; i++) + { + if (tooltips[i].Name.StartsWith("Tooltip")) + { + if (tooltipIndex == -1) + tooltipIndex = i; + + tooltipCount++; + } + } + + if (tooltipIndex != -1) + { + // Remove all standard tooltips. + tooltips.RemoveRange(tooltipIndex, tooltipCount); + + // Replace them with the full lore. + TooltipLine fullLore = new(Mod, "CalamityMod:Lore", Lore); + if (LoreColor.HasValue) + fullLore.OverrideColor = LoreColor.Value; + tooltips.Insert(tooltipIndex, fullLore); + } + } + } } } diff --git a/Items/LoreItems/LoreKingSlime.cs b/Items/LoreItems/LoreKingSlime.cs new file mode 100644 index 0000000000..d1522fb504 --- /dev/null +++ b/Items/LoreItems/LoreKingSlime.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeKingSlime")] + public class LoreKingSlime : LoreItem + { + public override string Lore => +@"Given time, these gelatinous creatures absorb each other and slowly grow in both size and strength. +There is little need to worry about this. Naturally, slimes are nearly mindless and amass only by chance. +Though it appears they are capable of absorbing knowledge, if only in rudimentary form."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("King Slime"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.KingSlimeTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeKingSlime.png b/Items/LoreItems/LoreKingSlime.png similarity index 100% rename from Items/LoreItems/KnowledgeKingSlime.png rename to Items/LoreItems/LoreKingSlime.png diff --git a/Items/LoreItems/LoreLeviathanAnahita.cs b/Items/LoreItems/LoreLeviathanAnahita.cs new file mode 100644 index 0000000000..9107244799 --- /dev/null +++ b/Items/LoreItems/LoreLeviathanAnahita.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeLeviathanandSiren", "KnowledgeLeviathanAnahita")] + public class LoreLeviathanAnahita : LoreItem + { + public override string Lore => +@"Although she claims dominion over all the world's oceans, in truth she is a recluse of the deep. +Elementals pose a grave threat to all those around them. Other Elementals are no exception. +Anahita was driven from her home in the Abyss by Silva's encroaching greenery. +Accounts vary as to the majestic beast at her side. Some claim Anahita summoned the Leviathan herself. +Regardless of what you believe, they are inseparable even in death. +Such stalwart loyalty! It reminds me of Yharon."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Leviathan and Anahita"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Lime; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeLeviathanAnahita.png b/Items/LoreItems/LoreLeviathanAnahita.png similarity index 100% rename from Items/LoreItems/KnowledgeLeviathanAnahita.png rename to Items/LoreItems/LoreLeviathanAnahita.png diff --git a/Items/LoreItems/LoreMechs.cs b/Items/LoreItems/LoreMechs.cs new file mode 100644 index 0000000000..f60319d07a --- /dev/null +++ b/Items/LoreItems/LoreMechs.cs @@ -0,0 +1,52 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeMechs")] + public class LoreMechs : LoreItem + { + public override string Lore => +@"These unwieldy beasts of steel were the experiments of Draedon, my former colleague and prodigious engineer. +His intent was to fuel a war machine with soul energy, allowing it to fight with purpose and zeal. +The creations were a success; so much so, that the souls continued to express their own free will. +Draedon was displeased. But these were my soldiers, and their loyalty was forged anew in iron. +I dismissed them from duty, and yet here they are, scouring the land for evidence of the divine. +Unfortunately for you, that puts you in their crosshairs. Give them a battle worth dying in."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Mechanical Trio"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.RetinazerTrophy). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(ItemID.SpazmatismTrophy). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(ItemID.DestroyerTrophy). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(ItemID.SkeletronPrimeTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeMechs.png b/Items/LoreItems/LoreMechs.png similarity index 100% rename from Items/LoreItems/KnowledgeMechs.png rename to Items/LoreItems/LoreMechs.png diff --git a/Items/LoreItems/LoreOldDuke.cs b/Items/LoreItems/LoreOldDuke.cs new file mode 100644 index 0000000000..4859462204 --- /dev/null +++ b/Items/LoreItems/LoreOldDuke.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeOldDuke")] + public class LoreOldDuke : LoreItem + { + public override string Lore => +@"That was possibly one of the oldest mundane living beings on the face of the planet. +The first Fishrons were spotted in the middle of the Draconic Era. What exotic prestige…! +Fishrons were one of the original offshoots of pure-blooded Auric Dragons. +They are so old and venerated that many historians are convinced they are the original sea monsters of folklore. +This particular Duke's guile is self-evident; it evaded centuries of hunting, and until now had survived a most thorough poisoning. +Above almost all others, this creature was a living fable. One must wonder what goes through the mind of a fading legend."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Old Duke"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ModContent.RarityType(); + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeOldDuke.png b/Items/LoreItems/LoreOldDuke.png similarity index 100% rename from Items/LoreItems/KnowledgeOldDuke.png rename to Items/LoreItems/LoreOldDuke.png diff --git a/Items/LoreItems/LorePerforators.cs b/Items/LoreItems/LorePerforators.cs new file mode 100644 index 0000000000..0e5ffbf491 --- /dev/null +++ b/Items/LoreItems/LorePerforators.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgePerforators")] + public class LorePerforators : LoreItem + { + public override string Lore => +@"These creatures were unique, for they wielded the slain Gods' power as purely as possible, veins flowing with spilt ichor. +All that exists in the Crimson is truly the divine turned inside out; their gore now glistens with its perverse treachery, for all to bear witness. +The mire reeks of centuries of vile manipulation and callous domination of the hapless. +Judgment is long passed, and extinction is left waiting."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Perforators and Their Hive"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Orange; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgePerforators.png b/Items/LoreItems/LorePerforators.png similarity index 100% rename from Items/LoreItems/KnowledgePerforators.png rename to Items/LoreItems/LorePerforators.png diff --git a/Items/LoreItems/LorePlaguebringerGoliath.cs b/Items/LoreItems/LorePlaguebringerGoliath.cs new file mode 100644 index 0000000000..8a2a67f2c1 --- /dev/null +++ b/Items/LoreItems/LorePlaguebringerGoliath.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgePlaguebringerGoliath")] + public class LorePlaguebringerGoliath : LoreItem + { + public override string Lore => +@"An innocent queen, forced to bear an agonizing existence. This is nothing short of a crime against nature. +Without consulting me, Draedon sought to weaponize the already well-organized Jungle bees. +When he revealed his finished project, I was enraged. Enslaving the bees was despicable. +Draedon cared little for my outrage and returned to his other work without further incident. +From that point on, I stopped making requests of Draedon. He had shown me his true colors. +In my later days I was far from virtuous. But I would not shackle a creature to fight in my name. +That would make me no better than the divine scoundrels I pursued."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Plaguebringer Goliath"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.png b/Items/LoreItems/LorePlaguebringerGoliath.png similarity index 100% rename from Items/LoreItems/KnowledgePlaguebringerGoliath.png rename to Items/LoreItems/LorePlaguebringerGoliath.png diff --git a/Items/LoreItems/LorePlantera.cs b/Items/LoreItems/LorePlantera.cs new file mode 100644 index 0000000000..0eb8f19b82 --- /dev/null +++ b/Items/LoreItems/LorePlantera.cs @@ -0,0 +1,42 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgePlantera")] + public class LorePlantera : LoreItem + { + // Well done, you killed a plant. + public override string Lore => +@"This floral aberration is another example of the volatile power of harnessed souls. +Taking their mastery of agriculture to new heights, the Jungle settlers bred a special sprout. +Through ritual blessing of the soil, it was fed legions of souls. +Elders of the village wished to bring forth a new age of botanical prosperity. +Indeed, the plant was awe inspiring. But it was wild and untamed, with a will of its own. +Now that you have slain it, still more disorderly spiritual energies are flooding the lands. +The village's ignorance was shameful in its own right, but this is worse still."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Plantera"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightPurple; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.PlanteraTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgePlantera.png b/Items/LoreItems/LorePlantera.png similarity index 100% rename from Items/LoreItems/KnowledgePlantera.png rename to Items/LoreItems/LorePlantera.png diff --git a/Items/LoreItems/LorePolterghast.cs b/Items/LoreItems/LorePolterghast.cs new file mode 100644 index 0000000000..d554604aa1 --- /dev/null +++ b/Items/LoreItems/LorePolterghast.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgePolterghast")] + public class LorePolterghast : LoreItem + { + public override string Lore => +@"The further my war dragged on, the further I sank into negligence. This specter is the crux of my failure. +I hid behind my excuses, calling them duties. Fighting the gods. Training. Ruling. +I had the time and resources to devote. I was simply paralyzed by apathy. +The scores of prisoners I kept in the dungeon I claimed perished alongside their jailors. +Within those hexed walls, none may know rest, and their souls coalesced into a formless monster. +Boiling with rage, wallowing in sorrow, screaming in madness. The amalgamation was uncontrollable. +The dragon cult was furious, their leader demanding I put the haunt down myself. +I did not answer. I had long since become deaf to the world outside my crusade. Do not fall as I have."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Polterghast"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgePolterghast.png b/Items/LoreItems/LorePolterghast.png similarity index 100% rename from Items/LoreItems/KnowledgePolterghast.png rename to Items/LoreItems/LorePolterghast.png diff --git a/Items/LoreItems/LorePrelude.cs b/Items/LoreItems/LorePrelude.cs new file mode 100644 index 0000000000..39052d851a --- /dev/null +++ b/Items/LoreItems/LorePrelude.cs @@ -0,0 +1,42 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeLunaticCultist")] + public class LorePrelude : LoreItem + { + public override string Lore => +@"In ages past, now named the Draconic Era, the majestic Dragons protected Terraria from all threats. +Their famed might was put to the ultimate test by an aberrant behemoth from beyond the stars. +Fighting with all their strength, the Dragons could wound and weaken it, but not destroy it. +Lacking options, they tore the monster down to a shadow of its former self, and sealed it away. +What is left of it now lies imprisoned in the Moon, as far away as the Dragons could banish it. +Much of dragonkind was lost as casualties in that struggle, and they never recovered. +Zeratros himself was gravely injured. It seemed his power, along with his life, would be lost forever. +One mortal, sworn to the service of the Dragons, rose in determination to save their virtuous King."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Prelude"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Cyan; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.AncientCultistTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LorePrelude.png b/Items/LoreItems/LorePrelude.png new file mode 100644 index 0000000000..2066dbfb09 Binary files /dev/null and b/Items/LoreItems/LorePrelude.png differ diff --git a/Items/LoreItems/LoreProfanedGuardians.cs b/Items/LoreItems/LoreProfanedGuardians.cs new file mode 100644 index 0000000000..45bc7f2ba5 --- /dev/null +++ b/Items/LoreItems/LoreProfanedGuardians.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeProfanedGuardians")] + public class LoreProfanedGuardians : LoreItem + { + public override string Lore => +@"The Guardians are rather simple constructs, extensions of the Profaned Goddess' power. +They are given partial autonomy to hunt down threats and are rarely seen outside of temples sanctified in her name. +She has been attempting to expand her domain, and it is no surprise she sees you as her largest threat. +After all, it was you that finished off the star-spawned horror that catalyzed the downfall of the Dragons. +Draw her out from hiding. Have no mercy, for the Profaned Goddess shows none herself."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Profaned Guardians"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Purple; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeProfanedGuardians.png b/Items/LoreItems/LoreProfanedGuardians.png similarity index 100% rename from Items/LoreItems/KnowledgeProfanedGuardians.png rename to Items/LoreItems/LoreProfanedGuardians.png diff --git a/Items/LoreItems/LoreProvidence.cs b/Items/LoreItems/LoreProvidence.cs new file mode 100644 index 0000000000..07ceffd11d --- /dev/null +++ b/Items/LoreItems/LoreProvidence.cs @@ -0,0 +1,43 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeProvidence")] + public class LoreProvidence : LoreItem + { + public override string Lore => +@"A glorious day. +Deeds of valor of this caliber are enshrined in legend. Of this age, only the Witch, Braelor and myself can compare. +Providence was perhaps one of the wickedest Gods, hellbent on purification through erasure. +Her worshippers saw little value in life. Pain was not a price they felt justified to pay. +The Profaned Goddess promised her followers she would end inequality by reducing all to featureless ash. +Those devoted to her were weak-willed, and yet she reigned as one of the mightiest Gods. +Perhaps it was their easily-swayed nature, that let her draw so much power from them…"; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Providence, the Profaned Goddess"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeProvidence.png b/Items/LoreItems/LoreProvidence.png similarity index 100% rename from Items/LoreItems/KnowledgeProvidence.png rename to Items/LoreItems/LoreProvidence.png diff --git a/Items/LoreItems/LoreQueenBee.cs b/Items/LoreItems/LoreQueenBee.cs new file mode 100644 index 0000000000..5e6e6b79d0 --- /dev/null +++ b/Items/LoreItems/LoreQueenBee.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeQueenBee")] + public class LoreQueenBee : LoreItem + { + public override string Lore => +@"While of tremendous size, these creatures are docile until aggravated. Their idyllic demeanor is a rarity nowadays, a thing of beauty. +In the past, entire villages would spring up around these grand hives, peacefully harvesting their share of the honey and protecting them from danger. +Though its death is understandable given the circumstances, I do feel pity for these majestic beings. +Fate was cruel to many of their kind."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Queen Bee"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Orange; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.QueenBeeTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeQueenBee.png b/Items/LoreItems/LoreQueenBee.png similarity index 100% rename from Items/LoreItems/KnowledgeQueenBee.png rename to Items/LoreItems/LoreQueenBee.png diff --git a/Items/LoreItems/LoreQueenSlime.cs b/Items/LoreItems/LoreQueenSlime.cs new file mode 100644 index 0000000000..80770d2f4e --- /dev/null +++ b/Items/LoreItems/LoreQueenSlime.cs @@ -0,0 +1,36 @@ +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Items.LoreItems +{ + public class LoreQueenSlime : LoreItem + { + public override string Lore => +@"Having fled after your battle, it seems the Slime God fashioned a new guardian from the unleashed essences. +Ensnared in the absorption process of its newfound power, it could not flee again. +Or, perhaps, it was overcome by arrogance or desperation. +A glorious hunt, a fine foe. Now you know you must chase them to the ends of Terraria."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Queen Slime"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.QueenSlimeTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreQueenSlime.png b/Items/LoreItems/LoreQueenSlime.png new file mode 100644 index 0000000000..bbe25d2379 Binary files /dev/null and b/Items/LoreItems/LoreQueenSlime.png differ diff --git a/Items/LoreItems/LoreRavager.cs b/Items/LoreItems/LoreRavager.cs new file mode 100644 index 0000000000..f11010ebae --- /dev/null +++ b/Items/LoreItems/LoreRavager.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeRavager")] + public class LoreRavager : LoreItem + { + public override string Lore => +@"A sickening flesh golem built for the sole purpose of savage, relentless destruction. +The monstrosity was a desperate bid to turn the tides against my God-seeking armies. +I could scarcely believe it myself, but it was born of a ritual of great sacrifice, performed in ardent faith. +The ritual condemned and fused the bodies and souls of their fallen allies into this hideous thing. +When the warlocks pledged their very lives to it as an offering, it awoke and swiftly slew them. +Now caked in fresh blood, it hungered for more, and set off on an aimless rampage. +I suppose its brutality serves as a reminder to be careful what you believe."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Ravager"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Yellow; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeRavager.png b/Items/LoreItems/LoreRavager.png similarity index 100% rename from Items/LoreItems/KnowledgeRavager.png rename to Items/LoreItems/LoreRavager.png diff --git a/Items/LoreItems/LoreRequiem.cs b/Items/LoreItems/LoreRequiem.cs new file mode 100644 index 0000000000..ecf79b1b95 --- /dev/null +++ b/Items/LoreItems/LoreRequiem.cs @@ -0,0 +1,43 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeMoonLord")] + public class LoreRequiem : LoreItem + { + public override string Lore => +@"As the Light Dragon was fading, the monk visited him. Nearly none understand what transpired that day. +Most say his passing was eased. The truth? Zeratros' Auric soul was consumed, utterly. +The monk stood, wreathed in Primordial Light, and declared themselves Xeroc, the First God. +When a Dragon is laid to rest on the Aerie, its powers are relinquished so they may one day return. +Xeroc renounced their sworn oath and broke the cycle, becoming a traitor without equal. +Word of the ascension spread quickly. Many attempted to follow suit and claim an Auric soul for themselves. +Now you know… Good intentions or no, all Gods are sinners. Each and every one complicit in genocide. +Wherever your journey may lead, whether you are with me or against, may fortune favor you. +For nothing else will."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Requiem"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Red; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.MoonLordTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreRequiem.png b/Items/LoreItems/LoreRequiem.png new file mode 100644 index 0000000000..791be4707c Binary files /dev/null and b/Items/LoreItems/LoreRequiem.png differ diff --git a/Items/LoreItems/LoreSignus.cs b/Items/LoreItems/LoreSignus.cs new file mode 100644 index 0000000000..f4c1b72a9d --- /dev/null +++ b/Items/LoreItems/LoreSignus.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + public class LoreSignus : LoreItem + { + public override string Lore => +@"An aberration that defies all explanation, borne of the Distortion and revered by the Onyx Kinsmen. +Almost all information about this entity is sourced from that enigmatic clan. All else is hearsay. +It has been reported to manifest in multiple places at once. Its capacity for deceit and ruthless cunning is peerless. +Statis' compatriot Braelor dueled me to a standstill. With our blades locked, the ronin lunged for the lethal blow. +The Devourer is not one for honor or loyalty. But he sensed weakness. Hesitation. An easy prey. +The serpent ensnared both my assailants in a dimensional vortex. He assured me they were as good as dead. +Yet, Statis must have struck a bargain with Signus, as he escaped his banishment unscathed."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Signus"); // Signus, the Blade Between? + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreSignus.png b/Items/LoreItems/LoreSignus.png new file mode 100644 index 0000000000..39b5299a67 Binary files /dev/null and b/Items/LoreItems/LoreSignus.png differ diff --git a/Items/LoreItems/LoreSkeletron.cs b/Items/LoreItems/LoreSkeletron.cs new file mode 100644 index 0000000000..ae6ee9407d --- /dev/null +++ b/Items/LoreItems/LoreSkeletron.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeSkeletron")] + public class LoreSkeletron : LoreItem + { + public override string Lore => +@"A sorry old man, cursed by an even older cult, caught trespassing on their ancient library. +They were once my friends. Their leader is infatuated with Dragons, and dreams of resurrecting one. +The very walls of that place are cursed further still. The magic has long since faded, and the soldiers rotted. +Do not expect to learn much from those tattered tomes. They were penned with misguided zeal."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Skeletron"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Orange; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.SkeletronTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeSkeletron.png b/Items/LoreItems/LoreSkeletron.png similarity index 100% rename from Items/LoreItems/KnowledgeSkeletron.png rename to Items/LoreItems/LoreSkeletron.png diff --git a/Items/LoreItems/LoreSkeletronPrime.cs b/Items/LoreItems/LoreSkeletronPrime.cs new file mode 100644 index 0000000000..714ee037f2 --- /dev/null +++ b/Items/LoreItems/LoreSkeletronPrime.cs @@ -0,0 +1,39 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeSkeletronPrime")] + public class LoreSkeletronPrime : LoreItem + { + public override string Lore => +@"So consumed by hatred were some souls, that they pledged they would do anything in my name. +Their devotion was unerring. Absolute. No atrocity was beyond them; their vengeance knew no bounds. +I organized them into shock troops, dreaded for their flamethrowers and incendiaries. +Leveling places of worship and torching those falsely devout, their expertise lay in unmaking faith with flame. +Draedon understood well. For them he crafted a visage so grim, it evoked oblivion itself."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Skeletron Prime"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.SkeletronPrimeTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.png b/Items/LoreItems/LoreSkeletronPrime.png similarity index 100% rename from Items/LoreItems/KnowledgeSkeletronPrime.png rename to Items/LoreItems/LoreSkeletronPrime.png diff --git a/Items/LoreItems/LoreSlimeGod.cs b/Items/LoreItems/LoreSlimeGod.cs new file mode 100644 index 0000000000..4aa65a7c00 --- /dev/null +++ b/Items/LoreItems/LoreSlimeGod.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeSlimeGod")] + public class LoreSlimeGod : LoreItem + { + public override string Lore => +@"An old clan once revered this thing as a paragon of the balance of nature. Now its purity is sullied by freshly absorbed muck and grime. +The gelatinous being neither knows nor cares for the last surviving clansman. +Such tragedy is all too common in worship. +Alas, the Slime God is wise enough to be cowardly, fleeing battles it cannot win when its servants are destroyed. +Perhaps fortune will favor you if you catch it unaware."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Slime God"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeSlimeGod.png b/Items/LoreItems/LoreSlimeGod.png similarity index 100% rename from Items/LoreItems/KnowledgeSlimeGod.png rename to Items/LoreItems/LoreSlimeGod.png diff --git a/Items/LoreItems/LoreStormWeaver.cs b/Items/LoreItems/LoreStormWeaver.cs new file mode 100644 index 0000000000..76ab9406fd --- /dev/null +++ b/Items/LoreItems/LoreStormWeaver.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + public class LoreStormWeaver : LoreItem + { + public override string Lore => +@"This beast, while of lesser stature than the Devourer, is a great danger in its own right. +They are clearly of the same species. Even this serpent was known to devour Wyverns whole. +Very little is known about the realm or space that the Great Devourer hails from. +Even Draedon and his obsessive research has been unable to discern its true nature. +The Weaver slipped through a rift from this place opened by the Devourer, and he has monitored it since. +In his mind, the lesser serpent's similar powers could lead it to be too threatening for him to let live. +He thinks himself invincible. Little does he know, he has ever stood in a similar position."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Storm Weaver"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/LoreStormWeaver.png b/Items/LoreItems/LoreStormWeaver.png new file mode 100644 index 0000000000..f38d8b2f0f Binary files /dev/null and b/Items/LoreItems/LoreStormWeaver.png differ diff --git a/Items/LoreItems/LoreSulphurSea.cs b/Items/LoreItems/LoreSulphurSea.cs new file mode 100644 index 0000000000..cb73763195 --- /dev/null +++ b/Items/LoreItems/LoreSulphurSea.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeSulphurSea")] + public class LoreSulphurSea : LoreItem + { + public override string Lore => +@"This seaside has never been pleasant, though it has seen far better days. +Incessant fumes rising from the industry of Azafure inundate the water with caustic ions. +Yet still, the hardy life adapted. No doubt aided by Silva as she burrowed through to the underworld. +Long considered uninhabitable, its further deterioration led Draedon to designate it as a dumping ground. +Years of careless mass waste disposal has now left the coast's transformation irreversible."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Sulphur Sea"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeSulphurSea.png b/Items/LoreItems/LoreSulphurSea.png similarity index 100% rename from Items/LoreItems/KnowledgeSulphurSea.png rename to Items/LoreItems/LoreSulphurSea.png diff --git a/Items/LoreItems/LoreTwins.cs b/Items/LoreItems/LoreTwins.cs new file mode 100644 index 0000000000..c57048625d --- /dev/null +++ b/Items/LoreItems/LoreTwins.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeTwins")] + public class LoreTwins : LoreItem + { + public override string Lore => +@"Not all of warfare is open combat. Logistics and intelligence are paramount to decisive victory. +These machines are my finest scouts and agents, reborn in a form that gives them Sight unrivaled. +Archers or snipers, spies or assassins. An enemy is only as safe as you allow him to be. +Draedon understood well that the only fair fight is the one you win. +His assistance was infallible, and his calculus cold and cruel. +Not even the most evasive target stood a chance."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Twins"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.Pink; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.RetinazerTrophy). + AddTile(TileID.Bookcases). + Register(); + CreateRecipe(). + AddIngredient(ItemID.SpazmatismTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeTwins.png b/Items/LoreItems/LoreTwins.png similarity index 100% rename from Items/LoreItems/KnowledgeTwins.png rename to Items/LoreItems/LoreTwins.png diff --git a/Items/LoreItems/LoreUnderworld.cs b/Items/LoreItems/LoreUnderworld.cs new file mode 100644 index 0000000000..4e0e3587be --- /dev/null +++ b/Items/LoreItems/LoreUnderworld.cs @@ -0,0 +1,39 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeUnderworld")] + public class LoreUnderworld : LoreItem + { + public override string Lore => +@"The hellish reputation the underworld gets is rather a modern thing. +The layers of ash choking the previously great cities are still warm. +The more domineering of Gods wished for me to champion their cause, and rule their society from here. +Yet, surrounded by magma as it were, Azafure simply burned when their wishes were not met. +Such is the unfortunate price of war, though I have no regrets fighting for my people."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Underworld"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.WallofFleshTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeUnderworld.png b/Items/LoreItems/LoreUnderworld.png similarity index 100% rename from Items/LoreItems/KnowledgeUnderworld.png rename to Items/LoreItems/LoreUnderworld.png diff --git a/Items/LoreItems/LoreWallofFlesh.cs b/Items/LoreItems/LoreWallofFlesh.cs new file mode 100644 index 0000000000..e95e8e821b --- /dev/null +++ b/Items/LoreItems/LoreWallofFlesh.cs @@ -0,0 +1,40 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeWallofFlesh")] + public class LoreWallofFlesh : LoreItem + { + public override string Lore => +@"To contain the essence of a slain God is no small thing. It is rather a towering, ghastly construct. +The Wall was lashed together with foul sinew and fouler magics, forming a rudimentary prison of flesh. +It served its purpose: halting the diffusion of undue divine influence. +Were it not for this alchemical breakthrough, the very world I fought for may have been lost in the carnage I wrought. +My methods have since evolved. I need not contain such essences, when they can be devoured. +May you channel my valor in combating the resulting outpour of energies."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("The Wall of Flesh"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.consumable = false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.WallofFleshTrophy). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeWallofFlesh.png b/Items/LoreItems/LoreWallofFlesh.png similarity index 100% rename from Items/LoreItems/KnowledgeWallofFlesh.png rename to Items/LoreItems/LoreWallofFlesh.png diff --git a/Items/LoreItems/LoreYharon.cs b/Items/LoreItems/LoreYharon.cs new file mode 100644 index 0000000000..9ba5141ca0 --- /dev/null +++ b/Items/LoreItems/LoreYharon.cs @@ -0,0 +1,50 @@ +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.LoreItems +{ + [LegacyName("KnowledgeYharon")] + public class LoreYharon : LoreItem + { + public override string Lore => +@"The return of the Age of Dragons, dashed. Just like that, it is but ashes in the wind… +Yharon was the last of the Auric Dragons. As a phoenix, his domain of power includes rebirth. +The Gods thought him culled with the rest of his kind, but he returned as an egg, hidden on the Aerie. +I was destined to consume his Auric soul when he hatched, and rule forever as God-King. + +[c/FCA92B:Destiny is for the weak.] + +I rejected their whims, and upended their scheme. I was sentenced to execution for treason. +Their meek, ingratiated swine cast both Yharon's egg and I into the magma of Hell. +The intense heat hideously scarred me, but birthed Yharon anew. He rose, wreathed in fire, and saved my life. +From that day, our souls were one. He shared with me the tale of Zeratros, and the genocide of his kind. +I promised him I would have justice. So the war began, Yharon rallying all as a beacon of hope. +Now, that hope is long withered. I am but a husk of the hero I once was, and this is the ultimate proof. +Yharon may yet return, as he does, but he… he has bade me farewell."; + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + DisplayName.SetDefault("Yharon, Resplendent Phoenix"); + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.consumable = false; + Item.rare = ModContent.RarityType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/LoreItems/KnowledgeYharon.png b/Items/LoreItems/LoreYharon.png similarity index 100% rename from Items/LoreItems/KnowledgeYharon.png rename to Items/LoreItems/LoreYharon.png diff --git a/Items/Materials/AerialiteBar.png b/Items/Materials/AerialiteBar.png index 43b3240acd..1f020023f9 100644 Binary files a/Items/Materials/AerialiteBar.png and b/Items/Materials/AerialiteBar.png differ diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index 80ebef063a..17222cd623 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Auric Bar"); - Tooltip.SetDefault("Godlike power emanates from the metal"); + Tooltip.SetDefault("Boundless power emanates from the metal"); ItemID.Sets.SortingPriorityMaterials[Type] = 120; } diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index d11dba26c1..d304b6d08a 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 10; - Item.height = 10; + Item.width = 18; + Item.height = 18; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 1, copper: 20); Item.rare = ItemRarityID.Blue; diff --git a/Items/Materials/BloodOrb.png b/Items/Materials/BloodOrb.png index ab5ccc9248..c1d024d4a7 100644 Binary files a/Items/Materials/BloodOrb.png and b/Items/Materials/BloodOrb.png differ diff --git a/Items/Materials/CoreofCalamity.cs b/Items/Materials/CoreofCalamity.cs index aa9ac1e41d..395796ddd5 100644 --- a/Items/Materials/CoreofCalamity.cs +++ b/Items/Materials/CoreofCalamity.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Core of Calamity"); - ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar + ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } public override void SetDefaults() @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Materials CreateRecipe(). AddIngredient(3). AddIngredient(3). - AddIngredient(3). + AddIngredient(3). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Materials/CoreofChaos.cs b/Items/Materials/CoreofHavoc.cs similarity index 88% rename from Items/Materials/CoreofChaos.cs rename to Items/Materials/CoreofHavoc.cs index 829a8b76b1..0472200446 100644 --- a/Items/Materials/CoreofChaos.cs +++ b/Items/Materials/CoreofHavoc.cs @@ -6,14 +6,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Materials { - public class CoreofChaos : ModItem + [LegacyName("CoreofChaos")] + public class CoreofHavoc : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 25; ItemID.Sets.ItemNoGravity[Item.type] = true; - DisplayName.SetDefault("Core of Chaos"); + DisplayName.SetDefault("Core of Havoc"); ItemID.Sets.SortingPriorityMaterials[Type] = 94; // Spectre Bar } @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Materials } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofChaosGlow").Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Materials/CoreofHavocGlow").Value); } public override void Update(ref float gravity, ref float maxFallSpeed) @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(3). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.Ectoplasm). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Materials/CoreofChaos.png b/Items/Materials/CoreofHavoc.png similarity index 100% rename from Items/Materials/CoreofChaos.png rename to Items/Materials/CoreofHavoc.png diff --git a/Items/Materials/CoreofChaosGlow.png b/Items/Materials/CoreofHavocGlow.png similarity index 100% rename from Items/Materials/CoreofChaosGlow.png rename to Items/Materials/CoreofHavocGlow.png diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index 3cf0d46f16..02c0d4d782 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { Item.createTile = ModContent.TileType(); - Item.width = 30; + Item.width = 32; Item.height = 24; Item.maxStack = 999; Item.value = Item.sellPrice(gold: 20); @@ -39,14 +39,14 @@ namespace CalamityMod.Items.Materials public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/CosmiliteBar_Animated").Value; - spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 10), Color.White, 0f, origin, scale, SpriteEffects.None, 0); return false; } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { Texture2D texture = ModContent.Request("CalamityMod/Items/Materials/CosmiliteBar_Animated").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 6), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 6, 10), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); return false; } diff --git a/Items/Materials/CosmiliteBar.png b/Items/Materials/CosmiliteBar.png index 8094a536be..72aa42d285 100644 Binary files a/Items/Materials/CosmiliteBar.png and b/Items/Materials/CosmiliteBar.png differ diff --git a/Items/Materials/CosmiliteBar_Animated.png b/Items/Materials/CosmiliteBar_Animated.png index e010cb878a..a83cd9cc4e 100644 Binary files a/Items/Materials/CosmiliteBar_Animated.png and b/Items/Materials/CosmiliteBar_Animated.png differ diff --git a/Items/Materials/CryonicBar.cs b/Items/Materials/CryonicBar.cs index e8fbd23811..091bb752f1 100644 --- a/Items/Materials/CryonicBar.cs +++ b/Items/Materials/CryonicBar.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(4). AddTile(TileID.AdamantiteForge). Register(); } diff --git a/Items/Materials/EssenceofChaos.png b/Items/Materials/EssenceofChaos.png deleted file mode 100644 index 11769b92d3..0000000000 Binary files a/Items/Materials/EssenceofChaos.png and /dev/null differ diff --git a/Items/Materials/EssenceofEleum.cs b/Items/Materials/EssenceofEleum.cs index 3cd1b111a3..f1bef8cf07 100644 --- a/Items/Materials/EssenceofEleum.cs +++ b/Items/Materials/EssenceofEleum.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 34; - Item.height = 26; + Item.width = 28; + Item.height = 24; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightRed; diff --git a/Items/Materials/EssenceofEleum.png b/Items/Materials/EssenceofEleum.png index 7d304ee8a8..43c0bc2f17 100644 Binary files a/Items/Materials/EssenceofEleum.png and b/Items/Materials/EssenceofEleum.png differ diff --git a/Items/Materials/EssenceofChaos.cs b/Items/Materials/EssenceofHavoc.cs similarity index 86% rename from Items/Materials/EssenceofChaos.cs rename to Items/Materials/EssenceofHavoc.cs index 923cfe613f..cf28af3bd5 100644 --- a/Items/Materials/EssenceofChaos.cs +++ b/Items/Materials/EssenceofHavoc.cs @@ -7,22 +7,23 @@ using Terraria.GameContent; namespace CalamityMod.Items.Materials { - public class EssenceofChaos : ModItem + [LegacyName("EssenceofChaos")] + public class EssenceofHavoc : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 25; ItemID.Sets.ItemNoGravity[Item.type] = true; - DisplayName.SetDefault("Essence of Chaos"); + DisplayName.SetDefault("Essence of Havoc"); Tooltip.SetDefault("The essence of chaotic creatures"); ItemID.Sets.SortingPriorityMaterials[Type] = 71; // Soul of Light } public override void SetDefaults() { - Item.width = 34; - Item.height = 24; + Item.width = 36; + Item.height = 22; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightRed; diff --git a/Items/Materials/EssenceofHavoc.png b/Items/Materials/EssenceofHavoc.png new file mode 100644 index 0000000000..7cc2ec51f0 Binary files /dev/null and b/Items/Materials/EssenceofHavoc.png differ diff --git a/Items/Materials/EssenceofSunlight.cs b/Items/Materials/EssenceofSunlight.cs index de1c29d200..aad7f15a58 100644 --- a/Items/Materials/EssenceofSunlight.cs +++ b/Items/Materials/EssenceofSunlight.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 30; - Item.height = 24; + Item.width = 32; + Item.height = 26; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightRed; diff --git a/Items/Materials/EssenceofSunlight.png b/Items/Materials/EssenceofSunlight.png index 284db040ae..78501d3181 100644 Binary files a/Items/Materials/EssenceofSunlight.png and b/Items/Materials/EssenceofSunlight.png differ diff --git a/Items/Materials/LifeAlloy.cs b/Items/Materials/LifeAlloy.cs index b57e1e9087..4d7ff757b8 100644 --- a/Items/Materials/LifeAlloy.cs +++ b/Items/Materials/LifeAlloy.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials { SacrificeTotal = 25; DisplayName.SetDefault("Life Alloy"); - ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment + ItemID.Sets.SortingPriorityMaterials[Type] = 95; // Stardust Fragment } public override void SetDefaults() diff --git a/Items/Materials/MurkyPaste.cs b/Items/Materials/MurkyPaste.cs index f9d776f375..730e97e828 100644 --- a/Items/Materials/MurkyPaste.cs +++ b/Items/Materials/MurkyPaste.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 20; - Item.height = 20; + Item.width = 24; + Item.height = 32; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.Blue; diff --git a/Items/Materials/MurkyPaste.png b/Items/Materials/MurkyPaste.png index 76bce20bf0..7e472bd753 100644 Binary files a/Items/Materials/MurkyPaste.png and b/Items/Materials/MurkyPaste.png differ diff --git a/Items/Materials/PearlShard.cs b/Items/Materials/PearlShard.cs index 9f21ef24a8..9d6b7f7f5e 100644 --- a/Items/Materials/PearlShard.cs +++ b/Items/Materials/PearlShard.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - Item.width = 14; - Item.height = 14; + Item.width = 20; + Item.height = 26; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.Green; diff --git a/Items/Materials/PearlShard.png b/Items/Materials/PearlShard.png index 89e5ea4508..564576a926 100644 Binary files a/Items/Materials/PearlShard.png and b/Items/Materials/PearlShard.png differ diff --git a/Items/Materials/PerennialBar.cs b/Items/Materials/PerennialBar.cs index c3a2ad5a0c..382f4ba02b 100644 --- a/Items/Materials/PerennialBar.cs +++ b/Items/Materials/PerennialBar.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(4). AddTile(TileID.AdamantiteForge). Register(); } diff --git a/Items/Materials/PerennialBar.png b/Items/Materials/PerennialBar.png index d0b394065f..507f9470a4 100644 Binary files a/Items/Materials/PerennialBar.png and b/Items/Materials/PerennialBar.png differ diff --git a/Items/Materials/ScoriaBar.cs b/Items/Materials/ScoriaBar.cs index 3b3f71c834..09ae686d83 100644 --- a/Items/Materials/ScoriaBar.cs +++ b/Items/Materials/ScoriaBar.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(4). AddTile(TileID.AdamantiteForge). Register(); } diff --git a/Items/Materials/UelibloomBar.cs b/Items/Materials/UelibloomBar.cs index e16bad297c..d76aaf4bbc 100644 --- a/Items/Materials/UelibloomBar.cs +++ b/Items/Materials/UelibloomBar.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(4). AddTile(TileID.AdamantiteForge). Register(); } diff --git a/Items/Materials/UnholyCore.cs b/Items/Materials/UnholyCore.cs index e338956835..be32536dc7 100644 --- a/Items/Materials/UnholyCore.cs +++ b/Items/Materials/UnholyCore.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(4). AddIngredient(ItemID.Hellstone, 4). AddTile(TileID.Hellforge). Register(); diff --git a/Items/Materials/YharonSoulFragment.cs b/Items/Materials/YharonSoulFragment.cs index 8f57f064b5..653e31f524 100644 --- a/Items/Materials/YharonSoulFragment.cs +++ b/Items/Materials/YharonSoulFragment.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.ItemNoGravity[Item.type] = true; DisplayName.SetDefault("Yharon Soul Fragment"); - Tooltip.SetDefault("A shard of a godly soul"); + Tooltip.SetDefault("A shard of a draconic Auric Soul"); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/MomentumCapacitor.cs b/Items/MomentumCapacitor.cs index 0bba490815..3019595d1b 100644 --- a/Items/MomentumCapacitor.cs +++ b/Items/MomentumCapacitor.cs @@ -16,14 +16,14 @@ namespace CalamityMod.Items { SacrificeTotal = 1; DisplayName.SetDefault("Momentum Capacitor"); - Tooltip.SetDefault("While using the Momentum Capacitor,\n" + "your top speed will continuously and uncontrollably increase"); + Tooltip.SetDefault("While using the Momentum Capacitor,\n" + "your top speed will continuously and uncontrollably increase\n" + "This effect only works if there are no bosses alive"); } public override void SetDefaults() { Item.width = 28; Item.height = 32; - Item.value = Item.buyPrice(gold: 36); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.useStyle = ItemUseStyleID.HoldUp; @@ -41,11 +41,14 @@ namespace CalamityMod.Items public override bool? UseItem(Player player) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.momentumCapacitorTime = TotalFadeTime; - modPlayer.momentumCapacitorBoost += Main.rand.NextFloat(0.5f, 3.5f) * MomentumChargePerFrame; - if (modPlayer.momentumCapacitorBoost >= MaxMomentumCharge) - modPlayer.momentumCapacitorBoost = MaxMomentumCharge; + if (!CalamityPlayer.areThereAnyDamnBosses) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.momentumCapacitorTime = TotalFadeTime; + modPlayer.momentumCapacitorBoost += Main.rand.NextFloat(0.5f, 3.5f) * MomentumChargePerFrame; + if (modPlayer.momentumCapacitorBoost >= MaxMomentumCharge) + modPlayer.momentumCapacitorBoost = MaxMomentumCharge; + } return null; } } diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index 9ee286545f..3e03ae4e5b 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Mounts MountData.heightBoost = 35; MountData.fallDamage = 0f; MountData.runSpeed = 5.6f; - MountData.dashSpeed = 16.8f; - MountData.flightTimeMax = 500; + MountData.dashSpeed = 17.6f; + MountData.flightTimeMax = 9999; MountData.fatigueMax = 0; MountData.jumpHeight = 12; MountData.acceleration = 0.4f; - MountData.jumpSpeed = 8.01f; + MountData.jumpSpeed = 9.21f; MountData.swimSpeed = 4f; MountData.blockExtraJumps = false; MountData.totalFrames = 15; @@ -143,7 +143,7 @@ namespace CalamityMod.Items.Mounts if (player.mount.PlayerOffset == 28) { if (!player.flapSound) - SoundEngine.PlaySound(SoundID.Item32, player.position); + SoundEngine.PlaySound(SoundID.Item32, player.Center); player.flapSound = true; } else diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index dacac77075..96a42a0293 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.Mounts; +using CalamityMod.Buffs.Mounts; using Microsoft.Xna.Framework; using System; using Terraria; @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Mounts MountData.heightBoost = 36; MountData.fallDamage = 0f; MountData.runSpeed = 5f; - MountData.dashSpeed = 15f; + MountData.dashSpeed = 10f; MountData.flightTimeMax = 750; MountData.fatigueMax = 0; MountData.jumpHeight = 12; - MountData.acceleration = 0.35f; + MountData.acceleration = 0.6f; MountData.jumpSpeed = 9f; MountData.swimSpeed = 6f; MountData.blockExtraJumps = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Mounts array[5] = 40; array[6] = 40; array[7] = 40; - array[8] = 38; //wing flap sound + array[8] = 38; // Wing flap sound array[9] = 40; array[10] = 40; array[12] = 28; @@ -46,13 +46,13 @@ namespace CalamityMod.Items.Mounts MountData.playerYOffsets = array; MountData.xOffset = -56; MountData.bodyFrame = 3; - MountData.yOffset = -20; //done - MountData.playerHeadOffset = 38; //30 + MountData.yOffset = -20; + MountData.playerHeadOffset = 38; MountData.standingFrameCount = 5; MountData.standingFrameDelay = 12; MountData.standingFrameStart = 0; MountData.runningFrameCount = MountData.standingFrameCount; - MountData.runningFrameDelay = 48; //36 + MountData.runningFrameDelay = 48; MountData.runningFrameStart = 11; MountData.flyingFrameCount = 6; MountData.flyingFrameDelay = MountData.flyingFrameCount; @@ -60,8 +60,8 @@ namespace CalamityMod.Items.Mounts MountData.inAirFrameCount = MountData.flyingFrameCount; MountData.inAirFrameDelay = MountData.standingFrameDelay; MountData.inAirFrameStart = MountData.standingFrameCount; - MountData.idleFrameCount = MountData.standingFrameCount; //done - MountData.idleFrameDelay = MountData.standingFrameDelay; //done + MountData.idleFrameCount = MountData.standingFrameCount; + MountData.idleFrameDelay = MountData.standingFrameDelay; MountData.idleFrameStart = MountData.standingFrameStart; MountData.idleFrameLoop = true; MountData.swimFrameCount = MountData.inAirFrameCount; @@ -78,6 +78,7 @@ namespace CalamityMod.Items.Mounts public override void UpdateEffects(Player player) { Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 0f, 1f); + if (Math.Abs(player.velocity.X) > 6f || Math.Abs(player.velocity.Y) > 6f) { int rand = Main.rand.Next(3); @@ -106,12 +107,40 @@ namespace CalamityMod.Items.Mounts int dust2 = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, rand, 0, 0, 0, default); Main.dust[dust2].noGravity = true; } + + // Same as Celestial Starboard vertical velocity increase while holding W + if (player.controlJump && player.TryingToHoverUp) + { + player.velocity.Y -= 0.4f * player.gravDir; + if (player.gravDir == 1f) + { + if (player.velocity.Y > 0f) + player.velocity.Y -= 1f; + else if (player.velocity.Y > 0f - MountData.jumpSpeed) + player.velocity.Y -= 0.2f; + + if (player.velocity.Y < (0f - MountData.jumpSpeed) * 3f) + player.velocity.Y = (0f - MountData.jumpSpeed) * 3f; + } + else + { + if (player.velocity.Y < 0f) + player.velocity.Y += 1f; + else if (player.velocity.Y < MountData.jumpSpeed) + player.velocity.Y += 0.2f; + + if (player.velocity.Y > MountData.jumpSpeed * 3f) + player.velocity.Y = MountData.jumpSpeed * 3f; + } + } + if (player.velocity.Y != 0f) { if (player.mount.PlayerOffset == 38) { if (!player.flapSound) - SoundEngine.PlaySound(SoundID.Item32, player.position); + SoundEngine.PlaySound(SoundID.Item32, player.Center); + player.flapSound = true; } else diff --git a/Items/Mounts/GazeOfCrysthamyr.cs b/Items/Mounts/GazeOfCrysthamyr.cs index 8ccda72dee..83eea21c10 100644 --- a/Items/Mounts/GazeOfCrysthamyr.cs +++ b/Items/Mounts/GazeOfCrysthamyr.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Mounts public override void SetStaticDefaults() { DisplayName.SetDefault("Gaze of Crysthamyr"); - Tooltip.SetDefault("Summons a shadow dragon"); + Tooltip.SetDefault("Summons a shadow dragon\n" + + "Hold W to ascend faster"); SacrificeTotal = 1; } @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Mounts { CreateRecipe(). AddIngredient(ItemID.DD2PetDragon). - AddIngredient(ItemID.SoulofNight, 100). + AddIngredient(ItemID.SoulofNight, 10). AddIngredient(10). AddIngredient(25). AddTile(). diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index df833d2c9b..a03f2d8052 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -152,7 +152,7 @@ namespace CalamityMod.Items.Mounts }; if (tile.HasTile && !player.noBuilding && !Main.tileContainer[tile.TileType] && - tileExcludeList.TrueForAll(z => tile.TileType != z) && pickReq < highestPickPower && canBreakTileCheck) + tileExcludeList.TrueForAll(z => tile.TileType != z) && pickReq <= highestPickPower && canBreakTileCheck) { WorldGen.KillTile(x, y, false, false, false); if (!Main.tile[x, y].HasTile && Main.netMode != NetmodeID.SinglePlayer) diff --git a/Items/PermanentBoosters/BloodOrange.cs b/Items/PermanentBoosters/BloodOrange.cs index 50a4e30324..2c1c04def9 100644 --- a/Items/PermanentBoosters/BloodOrange.cs +++ b/Items/PermanentBoosters/BloodOrange.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Items.PermanentBoosters DisplayName.SetDefault("Blood Orange"); Tooltip.SetDefault("It has a distinctly sweet flavor and a strong aroma\n" + "Permanently increases maximum life by 25\n" + - "Can only be used if the max amount of life fruit has been consumed\n" + - ""); + "Can only be used if the max amount of life fruit has been consumed"); SacrificeTotal = 1; // For some reason Life/Mana boosting items are in this set (along with Magic Mirror+) ItemID.Sets.SortingPriorityBossSpawns[Type] = 18; // Life Fruit @@ -81,11 +80,10 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(ItemID.LifeFruit, 5). - AddIngredient(ItemID.OrangeBloodroot). AddIngredient(10). + AddIngredient(ItemID.SoulofFright, 5). AddIngredient(ItemID.SoulofMight, 5). AddIngredient(ItemID.SoulofSight, 5). - AddIngredient(ItemID.SoulofFright, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index bb3e535373..917314d001 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -74,8 +74,8 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(ItemID.MeteoriteBar, 10). - AddIngredient(ItemID.FallenStar, 20). - AddIngredient(150). + AddIngredient(ItemID.FallenStar, 10). + AddIngredient(50). AddTile(TileID.Anvils). Register(); } diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index 9c41bb4f7e..afb31bcd68 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -83,7 +83,6 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(ItemID.LifeFruit, 5). - AddIngredient(ItemID.SkyBlueFlower). AddIngredient(ItemID.FragmentSolar, 15). AddIngredient(5). AddIngredient(). diff --git a/Items/PermanentBoosters/Elderberry.cs b/Items/PermanentBoosters/Elderberry.cs index 4e58b85b92..fd95605c79 100644 --- a/Items/PermanentBoosters/Elderberry.cs +++ b/Items/PermanentBoosters/Elderberry.cs @@ -82,7 +82,6 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(ItemID.LifeFruit, 5). - AddIngredient(ItemID.BlueBerries). AddIngredient(10). AddIngredient(10). AddIngredient(20). diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index 16e59df693..8edc22b45f 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -73,10 +73,9 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.MeteoriteBar, 25). AddIngredient(25). AddIngredient(ItemID.FragmentNebula, 20). - AddIngredient(ItemID.FallenStar, 50). + AddIngredient(ItemID.FallenStar, 20). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 381ac019b6..bde8646184 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -81,7 +81,6 @@ namespace CalamityMod.Items.PermanentBoosters { CreateRecipe(). AddIngredient(ItemID.LifeFruit, 5). - AddIngredient(ItemID.TealMushroom). AddIngredient(5). AddIngredient(5). AddIngredient(10). diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index 07b6dfa1ca..111ecea66c 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -73,8 +73,8 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddIngredient(100). + AddIngredient(5). + AddIngredient(25). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Pets/AbyssShellFossil.cs b/Items/Pets/AbyssShellFossil.cs new file mode 100644 index 0000000000..d1b03f59ad --- /dev/null +++ b/Items/Pets/AbyssShellFossil.cs @@ -0,0 +1,49 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class AbyssShellFossil : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Abyss Shell Fossil"); + Tooltip.SetDefault("A fossil of a prehistoric creature, long forgotten in the deep abyss" + + "\nSummons a pet Escargidolon Snail to follow you" + + "\nSlightly reduces creatures' ability to detect you in the abyss while equipped"); + } + + public override void SetDefaults() + { + Item.damage = 0; + Item.width = 42; + Item.height = 30; + Item.useAnimation = 20; + Item.useTime = 20; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + + Item.value = Item.sellPrice(platinum: 1); + Item.rare = ModContent.RarityType(); + Item.Calamity().devItem = true; + + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + Item.UseSound = SoundID.Item2; + } + + 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/AbyssShellFossil.png b/Items/Pets/AbyssShellFossil.png new file mode 100644 index 0000000000..c8f41db315 Binary files /dev/null and b/Items/Pets/AbyssShellFossil.png differ diff --git a/Items/Pets/HermitsBoxofOneHundredMedicines.cs b/Items/Pets/HermitsBoxofOneHundredMedicines.cs index 087361c992..85fae2d987 100644 --- a/Items/Pets/HermitsBoxofOneHundredMedicines.cs +++ b/Items/Pets/HermitsBoxofOneHundredMedicines.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Pets SacrificeTotal = 1; DisplayName.SetDefault("Hermit's Box of One Hundred Medicines"); Tooltip.SetDefault("As the ice melts in the springs\n" + - "And waves wash the old moss’ hair...\n" + + "And waves wash the old moss' hair...\n" + "Thank you, Goodbye.\n" + "Summons the Third Sage\n" + "Use the item with right click in the hotbar to toggle the Third Sage's blessing.\n" + diff --git a/Items/Pets/ThiefsDime.cs b/Items/Pets/ThiefsDime.cs new file mode 100644 index 0000000000..1d0c4023eb --- /dev/null +++ b/Items/Pets/ThiefsDime.cs @@ -0,0 +1,38 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Pets +{ + public class ThiefsDime : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Thief's Dime"); + Tooltip.SetDefault("Once worthless treasure, now a relic of a thief's companionship\n" + + "Summons Goldie the coin to light your way and collects nearby coins\n" + + "Provides a small amount of light in the abyss"); + } + + public override void SetDefaults() + { + Item.CloneDefaults(ItemID.WispinaBottle); + Item.UseSound = SoundID.CoinPickup; + Item.shoot = ModContent.ProjectileType(); + Item.buffType = ModContent.BuffType(); + + Item.value = Item.sellPrice(gold: 20); //Buy price of 1 Platinum + Item.rare = ItemRarityID.Pink; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + player.AddBuff(Item.buffType, 3600, true); + } + } +} diff --git a/Items/Accessories/ThiefsDime.png b/Items/Pets/ThiefsDime.png similarity index 100% rename from Items/Accessories/ThiefsDime.png rename to Items/Pets/ThiefsDime.png diff --git a/Items/Placeables/AerialiteBrick.cs b/Items/Placeables/AerialiteBrick.cs index 794e41d43a..5be441e3e6 100644 --- a/Items/Placeables/AerialiteBrick.cs +++ b/Items/Placeables/AerialiteBrick.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { - CreateRecipe(10). + CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). AddIngredient(). - AddRecipeGroup("AnyStoneBlock"). AddTile(TileID.Furnaces). Register(); diff --git a/Items/Placeables/AstralBar.cs b/Items/Placeables/AstralBar.cs index 84c3802272..f2f71c90a0 100644 --- a/Items/Placeables/AstralBar.cs +++ b/Items/Placeables/AstralBar.cs @@ -1,6 +1,7 @@ - -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Items.Placeables { public class AstralBar : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { SacrificeTotal = 25; @@ -25,13 +28,27 @@ namespace CalamityMod.Items.Placeables Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 16; - Item.height = 16; + Item.width = 32; + Item.height = 26; Item.maxStack = 99; Item.rare = ItemRarityID.Cyan; Item.value = Item.sellPrice(gold: 1, silver: 20); } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Placeables/AstralBar_Animated").Value; + spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/Placeables/AstralBar_Animated").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 5, 12), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Placeables/AstralBar.png b/Items/Placeables/AstralBar.png index 02fc188d90..c2612646b3 100644 Binary files a/Items/Placeables/AstralBar.png and b/Items/Placeables/AstralBar.png differ diff --git a/Items/Placeables/AstralBar_Animated.png b/Items/Placeables/AstralBar_Animated.png new file mode 100644 index 0000000000..8e3f94d023 Binary files /dev/null and b/Items/Placeables/AstralBar_Animated.png differ diff --git a/Items/Placeables/AstralGrassSeeds.cs b/Items/Placeables/AstralGrassSeeds.cs new file mode 100644 index 0000000000..93c3fd06ca --- /dev/null +++ b/Items/Placeables/AstralGrassSeeds.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Items.Placeables +{ + public class AstralGrassSeeds : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Grass Seeds"); + Tooltip.SetDefault("Places grass on astral dirt"); + } + + public override void SetDefaults() + { + Item.useTurn = true; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.maxStack = 999; + } + + public override bool? UseItem(Player player) + { + Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); + + if (tile.HasTile && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY)) + { + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + + SoundEngine.PlaySound(SoundID.Dig, player.Center); + + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/AstralGrassSeeds.png b/Items/Placeables/AstralGrassSeeds.png new file mode 100644 index 0000000000..5d3fe7e85f Binary files /dev/null and b/Items/Placeables/AstralGrassSeeds.png differ diff --git a/Items/Placeables/Banners/FlounderBanner.cs b/Items/Placeables/Banners/AndroombaBanner.cs similarity index 90% rename from Items/Placeables/Banners/FlounderBanner.cs rename to Items/Placeables/Banners/AndroombaBanner.cs index c8f9ec5261..0c81f3c303 100644 --- a/Items/Placeables/Banners/FlounderBanner.cs +++ b/Items/Placeables/Banners/AndroombaBanner.cs @@ -5,12 +5,12 @@ using Terraria.ID; namespace CalamityMod.Items.Placeables.Banners { - public class FlounderBanner : ModItem + public class AndroombaBanner : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Flounder"); + Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Androomba"); } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Banners Item.rare = ItemRarityID.Blue; Item.value = Item.buyPrice(0, 0, 10, 0); Item.createTile = ModContent.TileType(); - Item.placeStyle = 1; + Item.placeStyle = 6; } } } diff --git a/Items/Placeables/Banners/AndroombaBanner.png b/Items/Placeables/Banners/AndroombaBanner.png new file mode 100644 index 0000000000..6177e8a826 Binary files /dev/null and b/Items/Placeables/Banners/AndroombaBanner.png differ diff --git a/Items/Placeables/Banners/CatfishBanner.cs b/Items/Placeables/Banners/RepairUnitBanner.cs similarity index 90% rename from Items/Placeables/Banners/CatfishBanner.cs rename to Items/Placeables/Banners/RepairUnitBanner.cs index 4732da74cd..f0c1aa11ec 100644 --- a/Items/Placeables/Banners/CatfishBanner.cs +++ b/Items/Placeables/Banners/RepairUnitBanner.cs @@ -5,12 +5,12 @@ using Terraria.ID; namespace CalamityMod.Items.Placeables.Banners { - public class CatfishBanner : ModItem + public class RepairUnitBanner : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Catfish"); + Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Repair Unit"); } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Banners Item.rare = ItemRarityID.Blue; Item.value = Item.buyPrice(0, 0, 10, 0); Item.createTile = ModContent.TileType(); - Item.placeStyle = 4; + Item.placeStyle = 0; } } } diff --git a/Items/Placeables/Banners/RepairUnitBanner.png b/Items/Placeables/Banners/RepairUnitBanner.png new file mode 100644 index 0000000000..59731704ec Binary files /dev/null and b/Items/Placeables/Banners/RepairUnitBanner.png differ diff --git a/Items/Placeables/Banners/SulflounderBanner.cs b/Items/Placeables/Banners/SulflounderBanner.cs new file mode 100644 index 0000000000..23ba22740b --- /dev/null +++ b/Items/Placeables/Banners/SulflounderBanner.cs @@ -0,0 +1,34 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Banners +{ + [LegacyName("FlounderBanner")] + public class SulflounderBanner : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Sulflounder"); + } + + public override void SetDefaults() + { + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 1; + } + } +} diff --git a/Items/Placeables/Banners/FlounderBanner.png b/Items/Placeables/Banners/SulflounderBanner.png similarity index 100% rename from Items/Placeables/Banners/FlounderBanner.png rename to Items/Placeables/Banners/SulflounderBanner.png diff --git a/Items/Placeables/Banners/ToxicatfishBanner.cs b/Items/Placeables/Banners/ToxicatfishBanner.cs new file mode 100644 index 0000000000..8e066907e3 --- /dev/null +++ b/Items/Placeables/Banners/ToxicatfishBanner.cs @@ -0,0 +1,34 @@ +using CalamityMod.Tiles; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Banners +{ + [LegacyName("CatfishBanner")] + public class ToxicatfishBanner : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Toxicatfish"); + } + + public override void SetDefaults() + { + Item.width = 10; + Item.height = 24; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Blue; + Item.value = Item.buyPrice(0, 0, 10, 0); + Item.createTile = ModContent.TileType(); + Item.placeStyle = 4; + } + } +} diff --git a/Items/Placeables/Banners/CatfishBanner.png b/Items/Placeables/Banners/ToxicatfishBanner.png similarity index 100% rename from Items/Placeables/Banners/CatfishBanner.png rename to Items/Placeables/Banners/ToxicatfishBanner.png diff --git a/Items/Placeables/BrimstoneSlab.cs b/Items/Placeables/BrimstoneSlab.cs new file mode 100644 index 0000000000..8a544d76bd --- /dev/null +++ b/Items/Placeables/BrimstoneSlab.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class BrimstoneSlab : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(25). + AddIngredient(ModContent.ItemType()). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/BrimstoneSlab.png b/Items/Placeables/BrimstoneSlab.png new file mode 100644 index 0000000000..589e97e933 Binary files /dev/null and b/Items/Placeables/BrimstoneSlab.png differ diff --git a/Items/Placeables/CinderBlossomSeeds.cs b/Items/Placeables/CinderBlossomSeeds.cs new file mode 100644 index 0000000000..4762bcdce0 --- /dev/null +++ b/Items/Placeables/CinderBlossomSeeds.cs @@ -0,0 +1,46 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Items.Placeables +{ + public class CinderBlossomSeeds : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cinder Blossom Seeds"); + Tooltip.SetDefault("Places cinder blossom grass on scorched remains"); + } + + public override void SetDefaults() + { + Item.useTurn = true; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.maxStack = 999; + } + + public override bool? UseItem(Player player) + { + Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); + Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1); + + if (tile.HasTile && !tileAbove.HasTile && tileAbove.LiquidAmount == 0 && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY)) + { + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + + SoundEngine.PlaySound(SoundID.Dig, player.Center); + + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/CinderBlossomSeeds.png b/Items/Placeables/CinderBlossomSeeds.png new file mode 100644 index 0000000000..2062ad9a82 Binary files /dev/null and b/Items/Placeables/CinderBlossomSeeds.png differ diff --git a/Items/Placeables/CryonicBrick.cs b/Items/Placeables/CryonicBrick.cs index 2b19f1265b..837548989d 100644 --- a/Items/Placeables/CryonicBrick.cs +++ b/Items/Placeables/CryonicBrick.cs @@ -27,12 +27,11 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { - CreateRecipe(10). + CreateRecipe(50). + AddRecipeGroup("AnyStoneBlock", 50). AddIngredient(). - AddRecipeGroup("AnyStoneBlock"). AddTile(TileID.Furnaces). Register(); - CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). diff --git a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs index 37c6ff3c14..4aa480d944 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). AddRecipeGroup("IronBar"). - AddRecipeGroup("AnyStoneBlock", 3). AddTile(TileID.HeavyWorkBench). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 4). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs index c47b62485e..5a8beee0a5 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs @@ -27,31 +27,31 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). AddRecipeGroup("IronBar"). - AddRecipeGroup("AnyStoneBlock", 3). AddTile(TileID.HeavyWorkBench). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType()). AddTile(TileID.Anvils). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 2). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 4). AddTile(TileID.WorkBenches). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 4). AddTile(TileID.WorkBenches). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 4). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Placeables/DraedonStructures/RustedPlating.cs b/Items/Placeables/DraedonStructures/RustedPlating.cs index eaa7fe2075..30bcc590b1 100644 --- a/Items/Placeables/DraedonStructures/RustedPlating.cs +++ b/Items/Placeables/DraedonStructures/RustedPlating.cs @@ -27,31 +27,31 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). AddRecipeGroup("IronBar"). - AddRecipeGroup("AnyStoneBlock", 3). AddTile(TileID.HeavyWorkBench). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType()). AddTile(TileID.Anvils). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 2). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 4). AddTile(TileID.WorkBenches). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 4). AddTile(TileID.WorkBenches). Register(); - CreateRecipe(1). + CreateRecipe(). AddIngredient(ModContent.ItemType(), 4). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Placeables/EutrophicSand.png b/Items/Placeables/EutrophicSand.png index 2a2a517f1e..7c24e485a2 100644 Binary files a/Items/Placeables/EutrophicSand.png and b/Items/Placeables/EutrophicSand.png differ diff --git a/Items/Placeables/Furniture/AbyssTreasureChest.cs b/Items/Placeables/Furniture/AbyssTreasureChest.cs new file mode 100644 index 0000000000..9df1cff526 --- /dev/null +++ b/Items/Placeables/Furniture/AbyssTreasureChest.cs @@ -0,0 +1,31 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Abyss; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class AbyssTreasureChest : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Ancient Treasure Chest"); + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 22; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = 500; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/AbyssTreasureChest.png b/Items/Placeables/Furniture/AbyssTreasureChest.png new file mode 100644 index 0000000000..2998dd9962 Binary files /dev/null and b/Items/Placeables/Furniture/AbyssTreasureChest.png differ diff --git a/Items/Placeables/Furniture/AlgalPrismTorch.cs b/Items/Placeables/Furniture/AlgalPrismTorch.cs new file mode 100644 index 0000000000..b3fafb6b41 --- /dev/null +++ b/Items/Placeables/Furniture/AlgalPrismTorch.cs @@ -0,0 +1,72 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class AlgalPrismTorch : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + Tooltip.SetDefault("Can be placed in water"); + ItemID.Sets.Torches[Item.type] = true; + // Right now this causes some Cursed Inferno dust until tmod fixes AutoLightSelect, it's a small sacrifice + ItemID.Sets.WaterTorches[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 16; + Item.maxStack = 99; + Item.holdStyle = 1; + Item.noWet = false; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.value = 500; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // Vanilla usually matches sorting methods with the right type of item, but sometimes, like with torches, it doesn't. Make sure to set whichever items manually if need be. + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Torches; + } + + public override void HoldItem(Player player) + { + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 68); + } + Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); + Lighting.AddLight(position, 0.7f, 1.2f, 0.9f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.7f, 1.2f, 0.9f); + } + + // This function doesn't even work.... + public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) + { + wetTorch = true; + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/AlgalPrismTorch.png b/Items/Placeables/Furniture/AlgalPrismTorch.png new file mode 100644 index 0000000000..9886b6fad9 Binary files /dev/null and b/Items/Placeables/Furniture/AlgalPrismTorch.png differ diff --git a/Items/Placeables/Furniture/AlgalPrismTorch_Flame.png b/Items/Placeables/Furniture/AlgalPrismTorch_Flame.png new file mode 100644 index 0000000000..2d274347a8 Binary files /dev/null and b/Items/Placeables/Furniture/AlgalPrismTorch_Flame.png differ diff --git a/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs b/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs index 1455c25974..264a837f59 100644 --- a/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AquaticScourgeRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Scourge Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs b/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs index 58135da2b3..d69f2b6a61 100644 --- a/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/AstrumDeusRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Astrum Deus Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs b/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs index e71a165955..f85a64fa42 100644 --- a/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/BrimstoneElementalRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Elemental Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs b/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs index 42d647a152..97bfe4bc5b 100644 --- a/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CalamitasCloneRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Calamitas Clone Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs b/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs index aab17b1e85..0b8353874f 100644 --- a/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CeaselessVoidRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Ceaseless Void Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs b/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs index 0dfb81f8ea..1fd4da0466 100644 --- a/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/CryogenRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Cryogen Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs index 9c6fd55a10..cecefc9d19 100644 --- a/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DesertScourgeRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Desert Scourge Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs b/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs index ce77280110..b14614fb5a 100644 --- a/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DevourerOfGodsRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Devourer of Gods Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs b/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs index 6138ea30cf..e8004de7d0 100644 --- a/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/DragonfollyRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Dragonfolly Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs b/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs index ac6d854bc6..a39cf5564b 100644 --- a/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/HiveMindRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Hive Mind Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs index 34853208be..55e7816cda 100644 --- a/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PerforatorsRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Perforators Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs b/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs index 565dde98d5..c31446f154 100644 --- a/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PlaguebringerGoliathRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer Goliath Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs b/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs index 871faf398c..4626a21e68 100644 --- a/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/PolterghastRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Polterghast Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs b/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs index f5ccdbb341..2bf6c6d295 100644 --- a/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.cs @@ -9,14 +9,12 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Guardians Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); SacrificeTotal = 1; } public override void SetDefaults() { // Vanilla has many useful methods like these, use them! This substitutes setting Item.createTile and Item.placeStyle aswell as setting a few values that are common across all placeable items - Item.DefaultToPlaceableTile(ModContent.TileType(), 0); Item.width = 30; diff --git a/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.png b/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.png index ab6b633316..55289a5bd3 100644 Binary files a/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.png and b/Items/Placeables/Furniture/BossRelics/ProfanedGuardiansRelic.png differ diff --git a/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs b/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs index 6ecee79262..692c07f0cd 100644 --- a/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/RavagerRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Ravager Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs b/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs index 94f9c6d478..710860334c 100644 --- a/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs +++ b/Items/Placeables/Furniture/BossRelics/StormWeaverRelic.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture.BossRelics public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver Relic"); - Tooltip.SetDefault("A glimpse into what will be..."); + Tooltip.SetDefault("A glimpse into what could have been..."); SacrificeTotal = 1; } diff --git a/Items/Placeables/Furniture/ChaosCandle.cs b/Items/Placeables/Furniture/ChaosCandle.cs index a443ceee9e..acf09a35c3 100644 --- a/Items/Placeables/Furniture/ChaosCandle.cs +++ b/Items/Placeables/Furniture/ChaosCandle.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ItemID.WaterCandle, 3).AddIngredient(ItemID.SoulofNight, 3).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(1).AddIngredient(ItemID.WaterCandle, 3).AddIngredient(ItemID.SoulofNight, 3).AddIngredient(ModContent.ItemType(), 2).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Furniture/CorruptionEffigy.cs b/Items/Placeables/Furniture/CorruptionEffigy.cs index f83340e4ed..3d39bef9bc 100644 --- a/Items/Placeables/Furniture/CorruptionEffigy.cs +++ b/Items/Placeables/Furniture/CorruptionEffigy.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { - Item.width = 26; + Item.width = 28; Item.height = 32; Item.maxStack = 99; Item.useTurn = true; diff --git a/Items/Placeables/Furniture/CorruptionEffigy.png b/Items/Placeables/Furniture/CorruptionEffigy.png index d7ba8c6e67..8885e6ffce 100644 Binary files a/Items/Placeables/Furniture/CorruptionEffigy.png and b/Items/Placeables/Furniture/CorruptionEffigy.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs index 234703f2dd..a7c1a0ce0e 100644 --- a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs @@ -42,11 +42,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1). - AddIngredient(ModContent.ItemType(), 30). - AddIngredient(ModContent.ItemType(), 5). - AddIngredient(ModContent.ItemType(), 1). - AddTile(ModContent.TileType()). + CreateRecipe(). + AddIngredient(30). + AddIngredient(5). + AddIngredient(). + AddTile(). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs index 729c1679a3..4b6a0bc31b 100644 --- a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs @@ -34,7 +34,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); + CreateRecipe(). + AddIngredient(10). + AddIngredient(10). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index b10e136ad9..bf58020dac 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -35,7 +35,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 10).AddTile(TileID.Anvils).Register(); + CreateRecipe(). + AddIngredient(10). + AddIngredient(10). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs index f0d22ed2f3..6bee2a0978 100644 --- a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs @@ -32,7 +32,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddIngredient(ItemID.JungleSpores, 5).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(). + AddIngredient(20). + AddIngredient(ItemID.JungleSpores, 5). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index 154d1a8ae1..7d294e4cbd 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -42,7 +42,14 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddRecipeGroup("HardmodeAnvil").AddIngredient(ModContent.ItemType(), 10).AddIngredient(ItemID.LunarBar, 10).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(). + AddRecipeGroup("HardmodeAnvil"). + AddIngredient(10). + AddIngredient(ItemID.LunarBar, 10). + AddIngredient(12). + AddIngredient(20). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index 21ceba638a..6b28c7b33a 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -40,7 +40,15 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddRecipeGroup("HardmodeForge").AddIngredient(ItemID.TinkerersWorkshop).AddIngredient(ItemID.LunarCraftingStation).AddIngredient(ModContent.ItemType(), 15).AddIngredient(ModContent.ItemType(), 12).AddIngredient(ModContent.ItemType(), 25).Register(); + CreateRecipe(). + AddIngredient(). + AddRecipeGroup("HardmodeForge"). + AddIngredient(ItemID.TinkerersWorkshop). + AddIngredient(ItemID.LunarCraftingStation). + AddIngredient(15). + AddIngredient(12). + AddIngredient(25). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs b/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs index 76c1e28a99..46af098525 100644 --- a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs @@ -33,7 +33,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 20).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(). + AddIngredient(20). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs index bcb1c790a6..dac1ae4f42 100644 --- a/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Items/Placeables/Furniture/CraftingStations/PlagueInfuser.cs @@ -32,9 +32,9 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1). + CreateRecipe(). AddRecipeGroup("IronBar", 10). - AddIngredient(ModContent.ItemType(), 20). + AddIngredient(20). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs index 7553ad3858..6b64cdd2d4 100644 --- a/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs +++ b/Items/Placeables/Furniture/CraftingStations/ProfanedCrucible.cs @@ -35,7 +35,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(). + AddIngredient(10). + AddIngredient(5). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs index 1ccf0ae407..d55c80e3d9 100644 --- a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs +++ b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs @@ -34,7 +34,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddRecipeGroup("AnyGoldBar", 5).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(). + AddIngredient(10). + AddRecipeGroup("AnyGoldBar", 5). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs index f2a5481d56..cb97f04ce4 100644 --- a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs +++ b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs @@ -32,7 +32,11 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ItemID.Solidifier).AddTile(TileID.Anvils).Register(); + CreateRecipe(). + AddIngredient(ItemID.Solidifier). + AddIngredient(5). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs index 219a9591f2..d1e67cd077 100644 --- a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs +++ b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.cs @@ -32,7 +32,10 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 25).AddTile(TileID.Anvils).Register(); + CreateRecipe(). + AddIngredient(25). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs b/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs new file mode 100644 index 0000000000..e2831a7442 --- /dev/null +++ b/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Materials; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +{ + public class WulfrumLabstationItem : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + Tooltip.SetDefault("Used for special crafting"); + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.png b/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.png new file mode 100644 index 0000000000..24f39d0e87 Binary files /dev/null and b/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.png differ diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 917f5ffb77..ecad7d3064 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings DisplayName.SetDefault("Thank You"); Tooltip.SetDefault("Thanks to the entire team, everyone who supported, and those who all play the mod and keep it alive!\n" + "The confines of this painting is not enough to fit the entire team\n" + - "Hold SHIFT to see a list of past and current devs and CTRL to see past and current testers"); + "Hold SHIFT to see a list of past and current developers"); SacrificeTotal = 1; } @@ -40,46 +40,24 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings public override void ModifyTooltips(List tooltips) { - if (!Main.keyState.IsKeyDown(LeftShift) && !Main.keyState.IsKeyDown(LeftControl)) + if (!Main.keyState.IsKeyDown(LeftShift)) return; - bool tester = false; - if (Main.keyState.IsKeyDown(LeftControl)) - tester = true; - string tooltip = ""; - if (!tester) + int namesPerLine = 5; + for (int i = 0; i < devList.Count; i++) { - int namesPerLine = 5; - for (int i = 0; i < devList.Count; i++) - { - tooltip += devList[i]; + tooltip += devList[i]; - if (i == devList.Count - 1) - break; + if (i == devList.Count - 1) + break; - if (i % namesPerLine == 0) - tooltip += "\n"; - else - tooltip += ", "; - } - } - else - { - int namesPerLine = 5; - for (int i = 0; i < testerList.Count; i++) - { - tooltip += testerList[i]; + if (i % namesPerLine == 0) + tooltip += "\n"; - if (i == testerList.Count - 1) - break; - - if (i % namesPerLine == namesPerLine - 1) - tooltip += "\n"; - else - tooltip += ", "; - } + else + tooltip += ", "; } TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); @@ -90,65 +68,97 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings public static IList devList = new List() { "Fabsol, the mod's founder and owner", // Fabsol gets a line to himself + "Altix", + "apotofkoolaid", + "AquaSG", + "Atalya", "Ben-TK", - "Bravioli", - "CDMusic", + "Cei", "Cobalion", "Cooper", - "Daim", - "Dominic Karma", - "Enreden", - "GramOfSalt", - "IbanPlay", - "Inanis", - "Lilac", + "CrabBar", + "Done", + "DylanDoe21", + "Heart Plus Up!", + "Hugekraken", + "Ian-1KV", + "Lilac Olligoci", "LordMetarex", - "MarieArk", - "Merkalto", - "Minecat", - "Mrrp", + "Memes", + "Mercutio 'Merkalto' Takle", + "Moonburn", + "Mr.Small", "Nycro", "Ozzatron", "Piky", - "Phupperbat", - "Popo", - "RoverdriveX", - "Runefield", - "Skeletony", - "Sok", - "spooktacular", - "Tinymanx", + "PokerFace", + "Shade", + "SharZz", + "Shayy", + "Spider Prov", + "StipulateVenus", + "That Blasterd Basterd", "Tomat", - "Uncle Danny", + "Triangle", + "Uberransy", + "Xyk", "YuH", - "Altalyra", - "ApidemDragon", - "Amadis", + "Afzofa", + "AdipemDragon", + "Akeeli", "Aleksh", + "Alphi", + "Altalyra", + "Amadis", "AstroKnight", + "Blast", "Blockaroz", "Boffin", + "Bravioli", + "CDMusic", + "Chetto", + "Chill Dude", + "Daim", "DarkTiny", + "Demik", "DM Dokuro", + "Dominic Karma", + "Doog", + "drh", + "dwshin", "Earth", "EchoDuck", + "Ein", "ENNWAY", + "Enreden", + "Epsilon", + "Fargowilta", "Frous", "Gahtao", "Gamagamer64", + "GramOfSalt", "Graydee", "Grox the Great", + "Hectique", "Huggles", + "IbanPlay", + "Inanis", "JaceDaDorito", "Jenosis", "jontchua", "Khaelis", "KnightyKnight", "L0st", + "Leon", "Leviathan", + "Lompl Allimath", + "MarieArk", + "Minecat", "MishiroUsui", + "Mrrp", "Nao", + "Neverglide", "Nincity", "Niorin", "Nitro", @@ -156,66 +166,39 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "PaleoStar", "Pbtopacio", "Phantasmal Deathray", + "Phupperbat", "Pinkie Poss", "pixlgray", "Poly", + "Popo", "President Waluigi", "Puff", "Purple Necromancer", + "RoverdriveX", + "Runefield", + "Sargassum", "sentri", "Shucks", "Silver-Lord of Ash", "SixteenInMono", + "Skeletony", + "Sok", + "spooktacular", "Spoopyro", "Svante", + "Teragat", "Terry N. Muse", + "ThousandFields", + "TikiWiki", + "Tinymanx", "Trivaxy", + "Uncle Danny", "Vaikyia", "Vladimier", + "Yatagarasu", "Yuyutsu", "Zach", "Ziggums", }; - - public static IList testerList = new List() - { - "Afzofa", - "Altix", - "AquaSG", - "Atalya", - "Blast", - "CrabBar", - "Demik", - "Ein", - "Epsilon", - "Fargowilta", - "Ian-1KV", - "Leon", - "Lompl Allimath", - "Memes", - "Shayy", - "StipulateVenus", - "Storm2103", - "That Blasterd Basterd", - "TikiWiki", - "Uberransy", - "Spider Prov", - "Xyk", - - "Akeeli", - "Alphi", - "Cei", - "Chetto", - "Chill Dude", - "Doog", - "drh", - "Hectique", - "Neverglide", - "Sargassum", - "ThousandFields", - "Teragat", - "Yatagarasu", - }; - } } diff --git a/Items/Placeables/Furniture/GloomTorch.cs b/Items/Placeables/Furniture/GloomTorch.cs new file mode 100644 index 0000000000..1f833a29b3 --- /dev/null +++ b/Items/Placeables/Furniture/GloomTorch.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class GloomTorch : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + ItemID.Sets.Torches[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 18; + Item.maxStack = 99; + Item.holdStyle = 1; + Item.noWet = true; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.value = 500; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // Vanilla usually matches sorting methods with the right type of item, but sometimes, like with torches, it doesn't. Make sure to set whichever items manually if need be. + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Torches; + } + + public override void HoldItem(Player player) + { + Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); + + if (!Item.wet) + Lighting.AddLight(position, 0.9f, 1.2f, 0.3f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.5f, 0.75f, 1.2f); + } + + // This function doesn't even work.... + public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) + { + dryTorch = true; + wetTorch = false; + glowstick = false; + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/GloomTorch.png b/Items/Placeables/Furniture/GloomTorch.png new file mode 100644 index 0000000000..d82c0d6d0c Binary files /dev/null and b/Items/Placeables/Furniture/GloomTorch.png differ diff --git a/Items/Placeables/Furniture/GloomTorch_Flame.png b/Items/Placeables/Furniture/GloomTorch_Flame.png new file mode 100644 index 0000000000..c1ae41f4c9 Binary files /dev/null and b/Items/Placeables/Furniture/GloomTorch_Flame.png differ diff --git a/Items/Placeables/Furniture/LanternCenter.cs b/Items/Placeables/Furniture/LanternCenter.cs new file mode 100644 index 0000000000..3baf19b4c3 --- /dev/null +++ b/Items/Placeables/Furniture/LanternCenter.cs @@ -0,0 +1,33 @@ +using CalamityMod.Tiles.Furniture; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class LanternCenter : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + DisplayName.SetDefault("Lantern Center"); + Tooltip.SetDefault("Lights up the night sky with celebratory lanterns"); + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 99; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.value = Item.buyPrice(0, 20, 0, 0); //Same price as Party Center + Item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + } + } +} diff --git a/Items/Placeables/Furniture/LanternCenter.png b/Items/Placeables/Furniture/LanternCenter.png new file mode 100644 index 0000000000..e74afd97ad Binary files /dev/null and b/Items/Placeables/Furniture/LanternCenter.png differ diff --git a/Items/Placeables/Furniture/NavyPrismTorch.cs b/Items/Placeables/Furniture/NavyPrismTorch.cs new file mode 100644 index 0000000000..f10993a2dc --- /dev/null +++ b/Items/Placeables/Furniture/NavyPrismTorch.cs @@ -0,0 +1,72 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class NavyPrismTorch : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + Tooltip.SetDefault("Can be placed in water"); + ItemID.Sets.Torches[Item.type] = true; + // Right now this causes some Cursed Inferno dust until tmod fixes AutoLightSelect, it's a small sacrifice + ItemID.Sets.WaterTorches[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 16; + Item.maxStack = 99; + Item.holdStyle = 1; + Item.noWet = false; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.value = 500; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // Vanilla usually matches sorting methods with the right type of item, but sometimes, like with torches, it doesn't. Make sure to set whichever items manually if need be. + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Torches; + } + + public override void HoldItem(Player player) + { + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 68); + } + Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); + Lighting.AddLight(position, 0.8f, 1.2f, 1.2f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.8f, 1.2f, 1.2f); + } + + // This function doesn't even work.... + public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) + { + wetTorch = true; + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/NavyPrismTorch.png b/Items/Placeables/Furniture/NavyPrismTorch.png new file mode 100644 index 0000000000..3e43016699 Binary files /dev/null and b/Items/Placeables/Furniture/NavyPrismTorch.png differ diff --git a/Items/Placeables/Furniture/NavyPrismTorch_Flame.png b/Items/Placeables/Furniture/NavyPrismTorch_Flame.png new file mode 100644 index 0000000000..0cbcb34be4 Binary files /dev/null and b/Items/Placeables/Furniture/NavyPrismTorch_Flame.png differ diff --git a/Items/Placeables/Furniture/RefractivePrismTorch.cs b/Items/Placeables/Furniture/RefractivePrismTorch.cs new file mode 100644 index 0000000000..bfed2eba5e --- /dev/null +++ b/Items/Placeables/Furniture/RefractivePrismTorch.cs @@ -0,0 +1,72 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class RefractivePrismTorch : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + Tooltip.SetDefault("Can be placed in water"); + ItemID.Sets.Torches[Item.type] = true; + // Right now this causes some Cursed Inferno dust until tmod fixes AutoLightSelect, it's a small sacrifice + ItemID.Sets.WaterTorches[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 16; + Item.maxStack = 99; + Item.holdStyle = 1; + Item.noWet = false; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.value = 500; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // Vanilla usually matches sorting methods with the right type of item, but sometimes, like with torches, it doesn't. Make sure to set whichever items manually if need be. + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Torches; + } + + public override void HoldItem(Player player) + { + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, Main.rand.Next(68, 71)); + } + Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); + Lighting.AddLight(position, 1f, 0.9f, 1.2f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 1f, 0.9f, 1.2f); + } + + // This function doesn't even work.... + public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) + { + wetTorch = true; + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/RefractivePrismTorch.png b/Items/Placeables/Furniture/RefractivePrismTorch.png new file mode 100644 index 0000000000..853bec3375 Binary files /dev/null and b/Items/Placeables/Furniture/RefractivePrismTorch.png differ diff --git a/Items/Placeables/Furniture/RefractivePrismTorch_Flame.png b/Items/Placeables/Furniture/RefractivePrismTorch_Flame.png new file mode 100644 index 0000000000..5fc8095199 Binary files /dev/null and b/Items/Placeables/Furniture/RefractivePrismTorch_Flame.png differ diff --git a/Items/Placeables/Furniture/SulphurousTorch.cs b/Items/Placeables/Furniture/SulphurousTorch.cs new file mode 100644 index 0000000000..5e74c2d380 --- /dev/null +++ b/Items/Placeables/Furniture/SulphurousTorch.cs @@ -0,0 +1,72 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class SulphurousTorch : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + Tooltip.SetDefault("Can be placed in water"); + ItemID.Sets.Torches[Item.type] = true; + // Right now this causes some Cursed Inferno dust until tmod fixes AutoLightSelect, it's a small sacrifice + ItemID.Sets.WaterTorches[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 18; + Item.maxStack = 99; + Item.holdStyle = 1; + Item.noWet = false; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.flame = true; + Item.value = 500; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // Vanilla usually matches sorting methods with the right type of item, but sometimes, like with torches, it doesn't. Make sure to set whichever items manually if need be. + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Torches; + } + + public override void HoldItem(Player player) + { + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) + { + Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 78); + } + Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true); + Lighting.AddLight(position, 0.9f, 1.2f, 0.3f); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.9f, 1.2f, 0.3f); + } + + // This function doesn't even work.... + public override void AutoLightSelect(ref bool dryTorch, ref bool wetTorch, ref bool glowstick) + { + wetTorch = true; + } + + public override void AddRecipes() + { + CreateRecipe(3). + AddIngredient(ItemID.Torch, 3). + AddIngredient(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/SulphurousTorch.png b/Items/Placeables/Furniture/SulphurousTorch.png new file mode 100644 index 0000000000..a030dab20d Binary files /dev/null and b/Items/Placeables/Furniture/SulphurousTorch.png differ diff --git a/Items/Placeables/Furniture/SulphurousTorch_Flame.png b/Items/Placeables/Furniture/SulphurousTorch_Flame.png new file mode 100644 index 0000000000..f4b0ce6bf9 Binary files /dev/null and b/Items/Placeables/Furniture/SulphurousTorch_Flame.png differ diff --git a/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs b/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs similarity index 70% rename from Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs rename to Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs index 8c498e46a5..05c746b50d 100644 --- a/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.cs @@ -1,15 +1,16 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ModLoader; using Terraria.ID; namespace CalamityMod.Items.Placeables.Furniture.Trophies { - public class CalamitasTrophy : ModItem + [LegacyName("CalamitasTrophy")] + public class CalamitasCloneTrophy : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Calamitas Trophy"); + DisplayName.SetDefault("Calamitas Clone Trophy"); } public override void SetDefaults() @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies Item.consumable = true; Item.value = 50000; Item.rare = ItemRarityID.Blue; - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); } } } diff --git a/Items/Placeables/Furniture/Trophies/CalamitasTrophy.png b/Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.png similarity index 100% rename from Items/Placeables/Furniture/Trophies/CalamitasTrophy.png rename to Items/Placeables/Furniture/Trophies/CalamitasCloneTrophy.png diff --git a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs index 64444473ac..8b9ad71bd0 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.Furniture.BossTrophies; +using CalamityMod.Tiles.Furniture.BossTrophies; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.Trophies @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Supreme Calamitas Trophy"); + DisplayName.SetDefault("Calamitas Trophy"); } public override void SetDefaults() diff --git a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs index 909ff476a4..8f5988d901 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTorch.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTorch.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void HoldItem(Player player) { - if (Main.rand.Next(player.itemAnimation > 0 ? 10 : 20) == 0) + if (Main.rand.NextBool(player.itemAnimation > 0 ? 10 : 20)) { Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, 180); } @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss public override void AddRecipes() { - CreateRecipe(3).AddIngredient(ItemID.Torch, 3).AddIngredient(ModContent.ItemType()).Register(); + CreateRecipe(3).AddIngredient(ItemID.Torch, 3).AddIngredient(ModContent.ItemType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientBasin.cs b/Items/Placeables/FurnitureAncient/AncientBasin.cs index b6b40475ac..3930de9c9f 100644 --- a/Items/Placeables/FurnitureAncient/AncientBasin.cs +++ b/Items/Placeables/FurnitureAncient/AncientBasin.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAncient/AncientMonolith.cs b/Items/Placeables/FurnitureAncient/AncientMonolith.cs index 8a8635ea3f..63a3658836 100644 --- a/Items/Placeables/FurnitureAncient/AncientMonolith.cs +++ b/Items/Placeables/FurnitureAncient/AncientMonolith.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 9).AddTile(ModContent.TileType()).Register(); + CreateRecipe(1).AddIngredient(ModContent.ItemType(), 10).AddIngredient(ModContent.ItemType(), 9).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs b/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs new file mode 100644 index 0000000000..9565c9b6b7 --- /dev/null +++ b/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAshen +{ + public class AshenAccentSlab : ModItem + { + public override string Texture => "CalamityMod/Items/Placeables/FurnitureAshen/AshenSlab"; + + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + Tooltip.SetDefault("An Ashen Slab variant that merges differently with nearby blocks\n" + + "Favored by advanced builders"); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(50). + AddIngredient(50). + AddIngredient(). + AddTile(). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureAshen/AshenSlab.cs b/Items/Placeables/FurnitureAshen/AshenSlab.cs index 6f779e0945..fa0d0debd2 100644 --- a/Items/Placeables/FurnitureAshen/AshenSlab.cs +++ b/Items/Placeables/FurnitureAshen/AshenSlab.cs @@ -29,8 +29,15 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen public override void AddRecipes() { - CreateRecipe(5).AddIngredient(ModContent.ItemType(), 4).AddIngredient(ModContent.ItemType(), 1).AddTile(ModContent.TileType()).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(50). + AddIngredient(50). + AddIngredient(). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs index 689440738c..da16684b48 100644 --- a/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Items/Placeables/FurnitureCosmilite/CosmiliteBrick.cs @@ -28,9 +28,19 @@ namespace CalamityMod.Items.Placeables.FurnitureCosmilite public override void AddRecipes() { - CreateRecipe(20).AddIngredient(ModContent.ItemType(), 1).AddRecipeGroup("AnyStoneBlock", 20).AddTile(ModContent.TileType()).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); + CreateRecipe(200). + AddRecipeGroup("AnyStoneBlock", 200). + AddIngredient(). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + CreateRecipe(). + AddIngredient(2). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoPlating.cs b/Items/Placeables/FurnitureExo/ExoPlating.cs index 5f19777591..be5c67d88b 100644 --- a/Items/Placeables/FurnitureExo/ExoPlating.cs +++ b/Items/Placeables/FurnitureExo/ExoPlating.cs @@ -38,9 +38,18 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void AddRecipes() { - CreateRecipe(200).AddRecipeGroup("AnyStoneBlock", 200).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(400). + AddRecipeGroup("AnyStoneBlock", 400). + AddIngredient(). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(2). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs index 86ebbf5e69..a1105836ed 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs @@ -38,9 +38,18 @@ namespace CalamityMod.Items.Placeables.FurnitureExo public override void AddRecipes() { - CreateRecipe(200).AddIngredient(ItemID.Glass, 200).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(400). + AddIngredient(ItemID.Glass, 400). + AddIngredient(). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(2). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs b/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs index d8ddcbc6b9..0a48464b08 100644 --- a/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Items/Placeables/FurnitureOtherworldly/OtherworldlyStone.cs @@ -30,9 +30,22 @@ namespace CalamityMod.Items.Placeables.FurnitureOtherworldly public override void AddRecipes() { - CreateRecipe(150).AddRecipeGroup("AnyStoneBlock", 150).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Silk, 15).AddTile(TileID.LunarCraftingStation).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(200). + AddRecipeGroup("AnyStoneBlock", 200). + AddIngredient(). + AddIngredient(). + AddIngredient(). + AddIngredient(ItemID.Silk, 10). + AddTile(TileID.LunarCraftingStation). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + CreateRecipe(). + AddIngredient(2). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Placeables/FurniturePlagued/PlaguedContainmentBrick.cs b/Items/Placeables/FurniturePlagued/PlaguedContainmentBrick.cs index 628a1497f9..b26138bae1 100644 --- a/Items/Placeables/FurniturePlagued/PlaguedContainmentBrick.cs +++ b/Items/Placeables/FurniturePlagued/PlaguedContainmentBrick.cs @@ -30,9 +30,19 @@ namespace CalamityMod.Items.Placeables.FurniturePlagued public override void AddRecipes() { - CreateRecipe(10).AddRecipeGroup("AnyStoneBlock", 10).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); + CreateRecipe(50). + AddRecipeGroup("AnyStoneBlock", 50). + AddIngredient(). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(2). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs index 9cc68dddc7..c9e4c6805c 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedCrystal.cs @@ -27,8 +27,15 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void AddRecipes() { - CreateRecipe(20).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.Glass, 20).AddTile(TileID.LunarCraftingStation).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(50). + AddIngredient(ItemID.Glass, 50). + AddIngredient(). + AddTile(TileID.LunarCraftingStation). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs index ee9b414587..2eb1404856 100644 --- a/Items/Placeables/FurnitureProfaned/ProfanedRock.cs +++ b/Items/Placeables/FurnitureProfaned/ProfanedRock.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; @@ -27,9 +27,19 @@ namespace CalamityMod.Items.Placeables.FurnitureProfaned public override void AddRecipes() { - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); - CreateRecipe(20).AddIngredient(ModContent.ItemType()).AddRecipeGroup("AnyStoneBlock", 20).AddTile(TileID.LunarCraftingStation).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(50). + AddRecipeGroup("AnyStoneBlock", 50). + AddIngredient(). + AddTile(TileID.LunarCraftingStation). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + CreateRecipe(). + AddIngredient(2). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs index 0d026cc0be..037701eb7e 100644 --- a/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs +++ b/Items/Placeables/FurnitureSacrilegious/OccultBrickItem.cs @@ -32,18 +32,16 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious public override void AddRecipes() { - CreateRecipe(200). - AddRecipeGroup("AnyStoneBlock", 200). - AddIngredient(ModContent.ItemType()). - AddTile(ModContent.TileType()). + CreateRecipe(400). + AddRecipeGroup("AnyStoneBlock", 400). + AddIngredient(). + AddTile(). Register(); - - CreateRecipe(1). - AddIngredient(ModContent.ItemType(), 2). + CreateRecipe(). + AddIngredient(2). Register(); - - CreateRecipe(1). - AddIngredient(ModContent.ItemType(), 4). + CreateRecipe(). + AddIngredient(4). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs index 91a2c69d69..62421492c2 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs @@ -28,9 +28,20 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva public override void AddRecipes() { - CreateRecipe(400).AddIngredient(ItemID.CrystalBlock, 200).AddRecipeGroup("AnyGoldBar", 25).AddIngredient(ModContent.ItemType(), 5).AddIngredient(ModContent.ItemType()).AddTile(ModContent.TileType()).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(ModContent.TileType()).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(ModContent.TileType()).Register(); + CreateRecipe(200). + AddIngredient(ItemID.Glass, 200). + AddIngredient(4). + AddIngredient(). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(). + Register(); + CreateRecipe(). + AddIngredient(2). + AddTile(). + Register(); } } } diff --git a/Items/Placeables/FurnitureStratus/StratusBricks.cs b/Items/Placeables/FurnitureStratus/StratusBricks.cs index 08de40fdb2..8b3d31f252 100644 --- a/Items/Placeables/FurnitureStratus/StratusBricks.cs +++ b/Items/Placeables/FurnitureStratus/StratusBricks.cs @@ -29,10 +29,25 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus public override void AddRecipes() { - CreateRecipe(50).AddRecipeGroup("AnyStoneBlock", 50).AddIngredient(ModContent.ItemType(), 3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ModContent.ItemType(), 1).AddTile(TileID.LunarCraftingStation).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 2).AddTile(TileID.LunarCraftingStation).Register(); + CreateRecipe(200). + AddRecipeGroup("AnyStoneBlock", 200). + AddIngredient(3). + AddIngredient(). + AddIngredient(). + AddTile(TileID.LunarCraftingStation). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + CreateRecipe(). + AddIngredient(2). + AddTile(TileID.LunarCraftingStation). + Register(); + CreateRecipe(). + AddIngredient(2). + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs new file mode 100644 index 0000000000..f81830e929 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumBathtub : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 24; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.png b/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.png new file mode 100644 index 0000000000..b049327e96 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs new file mode 100644 index 0000000000..79907c5888 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumBed : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 34; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBed.png b/Items/Placeables/FurnitureWulfrum/WulfrumBed.png new file mode 100644 index 0000000000..ac56c35cd9 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumBed.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs new file mode 100644 index 0000000000..049b6d71ef --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumBookcase : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 32; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.png b/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.png new file mode 100644 index 0000000000..0788ba7807 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs b/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs new file mode 100644 index 0000000000..f0e54b6bd0 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumCandelabra : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 30; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.png b/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.png new file mode 100644 index 0000000000..4450c0b0b3 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs b/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs new file mode 100644 index 0000000000..3ba6b969e3 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumCandle : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 20; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumCandle.png b/Items/Placeables/FurnitureWulfrum/WulfrumCandle.png new file mode 100644 index 0000000000..8bc7fd9a22 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumCandle.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs new file mode 100644 index 0000000000..bac5439774 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumChair : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 24; + Item.height = 30; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChair.png b/Items/Placeables/FurnitureWulfrum/WulfrumChair.png new file mode 100644 index 0000000000..fcb764c635 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumChair.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs new file mode 100644 index 0000000000..380b59e382 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumChandelier : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 46; + Item.height = 32; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.png b/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.png new file mode 100644 index 0000000000..9f15e42c53 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs new file mode 100644 index 0000000000..388caad905 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs @@ -0,0 +1,38 @@ +// There is no Wulfrum Chest placed sprite... +/* +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumChest : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 24; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +}*/ \ No newline at end of file diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChest.png b/Items/Placeables/FurnitureWulfrum/WulfrumChest.png new file mode 100644 index 0000000000..ae0fcefbf0 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumChest.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs b/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs new file mode 100644 index 0000000000..9bb58eca0f --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumClock : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 40; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumClock.png b/Items/Placeables/FurnitureWulfrum/WulfrumClock.png new file mode 100644 index 0000000000..8bf64b0036 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumClock.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs b/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs new file mode 100644 index 0000000000..9450ac400f --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumDresser : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 24; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumDresser.png b/Items/Placeables/FurnitureWulfrum/WulfrumDresser.png new file mode 100644 index 0000000000..2d81e1692c Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumDresser.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumGlobe.png b/Items/Placeables/FurnitureWulfrum/WulfrumGlobe.png new file mode 100644 index 0000000000..2fadde3137 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumGlobe.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs b/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs new file mode 100644 index 0000000000..3f4ae566ad --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumLamp : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 14; + Item.height = 34; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumLamp.png b/Items/Placeables/FurnitureWulfrum/WulfrumLamp.png new file mode 100644 index 0000000000..f61d74d857 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumLamp.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs b/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs new file mode 100644 index 0000000000..45de7df737 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumLantern : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 34; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumLantern.png b/Items/Placeables/FurnitureWulfrum/WulfrumLantern.png new file mode 100644 index 0000000000..18f73e66cd Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumLantern.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs new file mode 100644 index 0000000000..2b787bbfef --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumPiano : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPiano.png b/Items/Placeables/FurnitureWulfrum/WulfrumPiano.png new file mode 100644 index 0000000000..637af5cddf Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumPiano.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs new file mode 100644 index 0000000000..1aae788ffe --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumPlating : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(25). + AddIngredient(). + AddRecipeGroup("AnyStoneBlock", 25). + AddTile(TileID.Anvils). + Register(); + + //CreateRecipe(). + //AddIngredient(4). + //AddTile(TileID.WorkBenches). + //Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.png b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.png new file mode 100644 index 0000000000..748e05c686 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs new file mode 100644 index 0000000000..b097a4b8fa --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumSink : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 30; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSink.png b/Items/Placeables/FurnitureWulfrum/WulfrumSink.png new file mode 100644 index 0000000000..e85996b860 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumSink.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs new file mode 100644 index 0000000000..8671b9a830 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumSofa : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSofa.png b/Items/Placeables/FurnitureWulfrum/WulfrumSofa.png new file mode 100644 index 0000000000..1427f449c1 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumSofa.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs b/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs new file mode 100644 index 0000000000..6a8432d244 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumTable : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 26; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumTable.png b/Items/Placeables/FurnitureWulfrum/WulfrumTable.png new file mode 100644 index 0000000000..1e257c69f0 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumTable.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs b/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs new file mode 100644 index 0000000000..01fad54052 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumToilet : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 30; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumToilet.png b/Items/Placeables/FurnitureWulfrum/WulfrumToilet.png new file mode 100644 index 0000000000..826f513b2c Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumToilet.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWorkbench.cs b/Items/Placeables/FurnitureWulfrum/WulfrumWorkbench.cs new file mode 100644 index 0000000000..f10be7acef --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumWorkbench.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumWorkbench : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 18; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWorkbench.png b/Items/Placeables/FurnitureWulfrum/WulfrumWorkbench.png new file mode 100644 index 0000000000..ef1afc69b1 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumWorkbench.png differ diff --git a/Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.cs b/Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.cs index 12889d18c2..78ba816f5c 100644 --- a/Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.cs +++ b/Items/Placeables/MusicBoxes/DraedonsAmbienceMusicBox.cs @@ -1,5 +1,4 @@ -using CalamityMod.Tiles.MusicBoxes; -using Terraria.ID; +using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; @@ -11,6 +10,7 @@ namespace CalamityMod.Items.Placeables.MusicBoxes { SacrificeTotal = 1; DisplayName.SetDefault("Music Box (Draedon's Ambience)"); + Tooltip.SetDefault("Plays high tech ambience by PinpinNeon"); } public override void SetDefaults() @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Placeables.MusicBoxes Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.createTile = ModContent.TileType(); - Item.width = 24; - Item.height = 24; + Item.createTile = ModContent.TileType(); + Item.width = 32; + Item.height = 32; Item.rare = ItemRarityID.LightRed; Item.value = 100000; Item.accessory = true; diff --git a/Items/Placeables/Navystone.png b/Items/Placeables/Navystone.png index 12fccc4cfa..03a2f5e8b3 100644 Binary files a/Items/Placeables/Navystone.png and b/Items/Placeables/Navystone.png differ diff --git a/Items/Placeables/Ores/AerialiteOre.png b/Items/Placeables/Ores/AerialiteOre.png index 427137cf84..d933ed66ea 100644 Binary files a/Items/Placeables/Ores/AerialiteOre.png and b/Items/Placeables/Ores/AerialiteOre.png differ diff --git a/Items/Placeables/Ores/AerialiteOreDisenchanted.cs b/Items/Placeables/Ores/AerialiteOreDisenchanted.cs new file mode 100644 index 0000000000..0eaf0e192f --- /dev/null +++ b/Items/Placeables/Ores/AerialiteOreDisenchanted.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Ores +{ + public class AerialiteOreDisenchanted : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + DisplayName.SetDefault("Disenchanted Aerialite Ore"); + ItemID.Sets.SortingPriorityMaterials[Type] = 69; // Hellstone + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 6); + Item.rare = ItemRarityID.Orange; + } + } +} diff --git a/Items/Placeables/Ores/AerialiteOreDisenchanted.png b/Items/Placeables/Ores/AerialiteOreDisenchanted.png new file mode 100644 index 0000000000..d6c1756e4a Binary files /dev/null and b/Items/Placeables/Ores/AerialiteOreDisenchanted.png differ diff --git a/Items/Placeables/Ores/AstralOre.cs b/Items/Placeables/Ores/AstralOre.cs index b275f533e8..02067398d3 100644 --- a/Items/Placeables/Ores/AstralOre.cs +++ b/Items/Placeables/Ores/AstralOre.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Placeables.Ores Item.useTime = 10; Item.autoReuse = true; Item.consumable = true; - Item.width = 20; - Item.height = 20; + Item.width = 22; + Item.height = 22; Item.maxStack = 999; Item.value = Item.sellPrice(silver: 36); Item.rare = ItemRarityID.Cyan; diff --git a/Items/Placeables/Ores/AstralOre.png b/Items/Placeables/Ores/AstralOre.png index 04505d6b67..f9696766e8 100644 Binary files a/Items/Placeables/Ores/AstralOre.png and b/Items/Placeables/Ores/AstralOre.png differ diff --git a/Items/Placeables/Ores/AuricOre.cs b/Items/Placeables/Ores/AuricOre.cs index feeae0abce..bdd32ebfe9 100644 --- a/Items/Placeables/Ores/AuricOre.cs +++ b/Items/Placeables/Ores/AuricOre.cs @@ -1,4 +1,4 @@ -using CalamityMod.Rarities; +using CalamityMod.Rarities; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Placeables.Ores { SacrificeTotal = 100; DisplayName.SetDefault("Auric Ore"); - Tooltip.SetDefault("Laced with the dormant power of a deity"); + Tooltip.SetDefault("Infused with long lost draconic energies"); ItemID.Sets.SortingPriorityMaterials[Type] = 119; } diff --git a/Items/Placeables/Ores/AuricOre.png b/Items/Placeables/Ores/AuricOre.png index 88f5fba817..cb9e278c2f 100644 Binary files a/Items/Placeables/Ores/AuricOre.png and b/Items/Placeables/Ores/AuricOre.png differ diff --git a/Items/Placeables/Ores/ExodiumCluster.cs b/Items/Placeables/Ores/ExodiumCluster.cs index f74e568803..0133f36923 100644 --- a/Items/Placeables/Ores/ExodiumCluster.cs +++ b/Items/Placeables/Ores/ExodiumCluster.cs @@ -32,9 +32,12 @@ namespace CalamityMod.Items.Placeables.Ores Item.rare = ItemRarityID.Red; } + // removed recipe for exodium because it shouldn't be necessary + /* public override void AddRecipes() { CreateRecipe(1).AddIngredient(ItemID.LunarOre, 3).AddIngredient(ItemID.FragmentStardust).AddIngredient(ItemID.FragmentSolar).AddIngredient(ItemID.FragmentVortex).AddIngredient(ItemID.FragmentNebula).AddTile(TileID.LunarCraftingStation).Register(); } + */ } } diff --git a/Items/Placeables/Ores/CharredOre.cs b/Items/Placeables/Ores/InfernalSuevite.cs similarity index 78% rename from Items/Placeables/Ores/CharredOre.cs rename to Items/Placeables/Ores/InfernalSuevite.cs index 3f137708b7..40bc519480 100644 --- a/Items/Placeables/Ores/CharredOre.cs +++ b/Items/Placeables/Ores/InfernalSuevite.cs @@ -4,18 +4,19 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Ores { - public class CharredOre : ModItem + [LegacyName("CharredOre")] + public class InfernalSuevite : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 100; - DisplayName.SetDefault("Charred Ore"); + DisplayName.SetDefault("Infernal Suevite"); ItemID.Sets.SortingPriorityMaterials[Type] = 90; // Chlorophyte Ore } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.useAnimation = 15; diff --git a/Items/Placeables/Ores/CharredOre.png b/Items/Placeables/Ores/InfernalSuevite.png similarity index 100% rename from Items/Placeables/Ores/CharredOre.png rename to Items/Placeables/Ores/InfernalSuevite.png diff --git a/Items/Placeables/Ores/ScoriaOre.cs b/Items/Placeables/Ores/ScoriaOre.cs index cfb27ea9d5..89648dc3b3 100644 --- a/Items/Placeables/Ores/ScoriaOre.cs +++ b/Items/Placeables/Ores/ScoriaOre.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.useAnimation = 15; diff --git a/Items/Placeables/Ores/UelibloomOre.png b/Items/Placeables/Ores/UelibloomOre.png index 56293cede8..d19d3b0b44 100644 Binary files a/Items/Placeables/Ores/UelibloomOre.png and b/Items/Placeables/Ores/UelibloomOre.png differ diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs index 6b2146a491..ddf0752da3 100644 --- a/Items/Placeables/PerennialBrick.cs +++ b/Items/Placeables/PerennialBrick.cs @@ -27,17 +27,15 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { - CreateRecipe(10). + CreateRecipe(50). + AddRecipeGroup("AnyStoneBlock", 50). AddIngredient(). - AddRecipeGroup("AnyStoneBlock"). AddTile(TileID.Furnaces). Register(); - CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). Register(); - CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). diff --git a/Items/Placeables/PlantyMush.png b/Items/Placeables/PlantyMush.png index 7c7ed2d2b5..9f6543b7b2 100644 Binary files a/Items/Placeables/PlantyMush.png and b/Items/Placeables/PlantyMush.png differ diff --git a/Items/Placeables/Plates/Cinderplate.cs b/Items/Placeables/Plates/Cinderplate.cs index aa3a38522c..2f22ae9bcd 100644 --- a/Items/Placeables/Plates/Cinderplate.cs +++ b/Items/Placeables/Plates/Cinderplate.cs @@ -33,8 +33,15 @@ namespace CalamityMod.Items.Placeables.Plates public override void AddRecipes() { - CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(25). + AddIngredient(ItemID.Obsidian, 25). + AddIngredient(). + AddTile(TileID.Hellforge). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Plates/Elumplate.cs b/Items/Placeables/Plates/Elumplate.cs index 84949a31e6..acf97bcce0 100644 --- a/Items/Placeables/Plates/Elumplate.cs +++ b/Items/Placeables/Plates/Elumplate.cs @@ -33,8 +33,15 @@ namespace CalamityMod.Items.Placeables.Plates public override void AddRecipes() { - CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(25). + AddIngredient(ItemID.Obsidian, 25). + AddIngredient(). + AddTile(TileID.Hellforge). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Plates/Havocplate.cs b/Items/Placeables/Plates/Havocplate.cs new file mode 100644 index 0000000000..8baa7a1449 --- /dev/null +++ b/Items/Placeables/Plates/Havocplate.cs @@ -0,0 +1,48 @@ +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Plates +{ + [LegacyName("Chaosplate")] + public class Havocplate : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Havocplate"); + Tooltip.SetDefault("It resonates with otherworldly energy."); + SacrificeTotal = 100; + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = Item.sellPrice(silver: 3); + Item.rare = ItemRarityID.Orange; + } + + public override void AddRecipes() + { + CreateRecipe(25). + AddIngredient(ItemID.Obsidian, 25). + AddIngredient(). + AddTile(TileID.Hellforge). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Plates/Chaosplate.png b/Items/Placeables/Plates/Havocplate.png similarity index 100% rename from Items/Placeables/Plates/Chaosplate.png rename to Items/Placeables/Plates/Havocplate.png diff --git a/Items/Placeables/Plates/Navyplate.cs b/Items/Placeables/Plates/Navyplate.cs index ff16cc5cbb..addfb89798 100644 --- a/Items/Placeables/Plates/Navyplate.cs +++ b/Items/Placeables/Plates/Navyplate.cs @@ -32,8 +32,15 @@ namespace CalamityMod.Items.Placeables.Plates public override void AddRecipes() { - CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(25). + AddIngredient(ItemID.Obsidian, 25). + AddIngredient(). + AddTile(TileID.Hellforge). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Plates/Chaosplate.cs b/Items/Placeables/Plates/Onyxplate.cs similarity index 63% rename from Items/Placeables/Plates/Chaosplate.cs rename to Items/Placeables/Plates/Onyxplate.cs index d2748eb600..be00ab10f2 100644 --- a/Items/Placeables/Plates/Chaosplate.cs +++ b/Items/Placeables/Plates/Onyxplate.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.Walls; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -6,18 +6,18 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Plates { - public class Chaosplate : ModItem + public class Onyxplate : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Chaosplate"); + DisplayName.SetDefault("Onyxplate"); Tooltip.SetDefault("It resonates with otherworldly energy."); SacrificeTotal = 100; } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.useAnimation = 15; @@ -33,8 +33,14 @@ namespace CalamityMod.Items.Placeables.Plates public override void AddRecipes() { - CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(25). + AddIngredient(ItemID.Obsidian, 50). + AddTile(TileID.Hellforge). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Plates/Onyxplate.png b/Items/Placeables/Plates/Onyxplate.png new file mode 100644 index 0000000000..3ed48d47bd Binary files /dev/null and b/Items/Placeables/Plates/Onyxplate.png differ diff --git a/Items/Placeables/Plates/Plagueplate.cs b/Items/Placeables/Plates/Plagueplate.cs index d233289498..05b1367311 100644 --- a/Items/Placeables/Plates/Plagueplate.cs +++ b/Items/Placeables/Plates/Plagueplate.cs @@ -34,8 +34,15 @@ namespace CalamityMod.Items.Placeables.Plates public override void AddRecipes() { - CreateRecipe(3).AddIngredient(ModContent.ItemType(), 1).AddIngredient(ItemID.Obsidian, 3).AddTile(TileID.Hellforge).Register(); - CreateRecipe(1).AddIngredient(ModContent.ItemType(), 4).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(25). + AddIngredient(ItemID.Obsidian, 25). + AddIngredient(). + AddTile(TileID.Hellforge). + Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/PrismShard.cs b/Items/Placeables/PrismShard.cs index 4d4fa8f99a..d771dfe256 100644 --- a/Items/Placeables/PrismShard.cs +++ b/Items/Placeables/PrismShard.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Placeables { SacrificeTotal = 100; DisplayName.SetDefault("Prism Shard"); + Tooltip.SetDefault("Glows brighter underwater"); } public override void SetDefaults() diff --git a/Items/Placeables/PrismShard.png b/Items/Placeables/PrismShard.png index 4c93ed9a69..33d68d8d48 100644 Binary files a/Items/Placeables/PrismShard.png and b/Items/Placeables/PrismShard.png differ diff --git a/Items/Placeables/Pylons/SunkenPylon.png b/Items/Placeables/Pylons/SunkenPylon.png index 240a444d52..71f2154735 100644 Binary files a/Items/Placeables/Pylons/SunkenPylon.png and b/Items/Placeables/Pylons/SunkenPylon.png differ diff --git a/Items/Placeables/PyreMantle.cs b/Items/Placeables/PyreMantle.cs new file mode 100644 index 0000000000..8d8482f4b6 --- /dev/null +++ b/Items/Placeables/PyreMantle.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; // If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" + +namespace CalamityMod.Items.Placeables +{ + public class PyreMantle : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + DisplayName.SetDefault("Pyre Mantle"); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.LavaBucket). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/PyreMantle.png b/Items/Placeables/PyreMantle.png new file mode 100644 index 0000000000..ac2f0a4bc9 Binary files /dev/null and b/Items/Placeables/PyreMantle.png differ diff --git a/Items/Placeables/PyreMantleMolten.cs b/Items/Placeables/PyreMantleMolten.cs new file mode 100644 index 0000000000..70ffd95069 --- /dev/null +++ b/Items/Placeables/PyreMantleMolten.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; // If you are using c# 6, you can use: "using static Terraria.Localization.GameCulture;" which would mean you could just write "DisplayName.AddTranslation(German, "");" + +namespace CalamityMod.Items.Placeables +{ + public class PyreMantleMolten : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + DisplayName.SetDefault("Molten Pyre Mantle"); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.LavaBucket). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/PyreMantleMolten.png b/Items/Placeables/PyreMantleMolten.png new file mode 100644 index 0000000000..117c400ab0 Binary files /dev/null and b/Items/Placeables/PyreMantleMolten.png differ diff --git a/Items/Placeables/ScorchedBone.cs b/Items/Placeables/ScorchedBone.cs new file mode 100644 index 0000000000..3a49e41753 --- /dev/null +++ b/Items/Placeables/ScorchedBone.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Tiles.Crags; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ScorchedBone : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + DisplayName.SetDefault("Scorched Bone"); + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 22; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Orange; + Item.createTile = ModContent.TileType(); + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Wood; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ModContent.ItemType(), 4). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/ScorchedBone.png b/Items/Placeables/ScorchedBone.png new file mode 100644 index 0000000000..267520bcd5 Binary files /dev/null and b/Items/Placeables/ScorchedBone.png differ diff --git a/Items/Placeables/ScorchedRemains.cs b/Items/Placeables/ScorchedRemains.cs new file mode 100644 index 0000000000..695c409951 --- /dev/null +++ b/Items/Placeables/ScorchedRemains.cs @@ -0,0 +1,31 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class ScorchedRemains : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + DisplayName.SetDefault("Scorched Remains"); + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 13; + Item.height = 10; + Item.maxStack = 999; + Item.value = 1000; + Item.rare = ItemRarityID.Orange; + } + } +} diff --git a/Items/Placeables/ScorchedRemains.png b/Items/Placeables/ScorchedRemains.png new file mode 100644 index 0000000000..09c4f40f34 Binary files /dev/null and b/Items/Placeables/ScorchedRemains.png differ diff --git a/Items/Placeables/ScoriaBrick.cs b/Items/Placeables/ScoriaBrick.cs index 8e0a87fb51..5fcee81572 100644 --- a/Items/Placeables/ScoriaBrick.cs +++ b/Items/Placeables/ScoriaBrick.cs @@ -27,12 +27,11 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { - CreateRecipe(10). - AddRecipeGroup("AnyStoneBlock"). + CreateRecipe(50). + AddRecipeGroup("AnyStoneBlock", 50). AddIngredient(). AddTile(TileID.Furnaces). Register(); - CreateRecipe(). AddIngredient(4). AddTile(TileID.WorkBenches). diff --git a/Items/Placeables/SeaPrism.png b/Items/Placeables/SeaPrism.png index f9ca3762ce..9d7833e531 100644 Binary files a/Items/Placeables/SeaPrism.png and b/Items/Placeables/SeaPrism.png differ diff --git a/Items/Placeables/SeaPrismBrick.cs b/Items/Placeables/SeaPrismBrick.cs new file mode 100644 index 0000000000..6f6f10905c --- /dev/null +++ b/Items/Placeables/SeaPrismBrick.cs @@ -0,0 +1,39 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SeaPrismBrick : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + DisplayName.SetDefault("Sea Prism Brick"); + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + } + + public override void AddRecipes() + { + CreateRecipe(25). + AddRecipeGroup("AnyStoneBlock", 25). + AddIngredient(). + AddTile(TileID.Furnaces). + Register(); + } + } +} diff --git a/Items/Placeables/SeaPrismBrick.png b/Items/Placeables/SeaPrismBrick.png new file mode 100644 index 0000000000..c95aecad83 Binary files /dev/null and b/Items/Placeables/SeaPrismBrick.png differ diff --git a/Items/Placeables/Tenebris.cs b/Items/Placeables/SpineSapling.cs similarity index 70% rename from Items/Placeables/Tenebris.cs rename to Items/Placeables/SpineSapling.cs index 0fbba3abe8..0e29baa64e 100644 --- a/Items/Placeables/Tenebris.cs +++ b/Items/Placeables/SpineSapling.cs @@ -4,17 +4,18 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables { - public class Tenebris : ModItem + public class SpineSapling : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 100; - DisplayName.SetDefault("Tenebris"); + DisplayName.SetDefault("Small Spine"); + Tooltip.SetDefault("Plants Giant Spine saplings on Brimstone Slag"); } public override void SetDefaults() { - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.useAnimation = 15; @@ -24,8 +25,6 @@ namespace CalamityMod.Items.Placeables Item.width = 13; Item.height = 10; Item.maxStack = 999; - Item.value = Item.sellPrice(silver: 8); - Item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Placeables/SpineSapling.png b/Items/Placeables/SpineSapling.png new file mode 100644 index 0000000000..d2ae0e0dc7 Binary files /dev/null and b/Items/Placeables/SpineSapling.png differ diff --git a/Items/Placeables/SulphurousSand.png b/Items/Placeables/SulphurousSand.png index a82d997ffc..3f107b1beb 100644 Binary files a/Items/Placeables/SulphurousSand.png and b/Items/Placeables/SulphurousSand.png differ diff --git a/Items/Placeables/SulphurousSandstone.png b/Items/Placeables/SulphurousSandstone.png index 26581b34dc..4c0d67f7be 100644 Binary files a/Items/Placeables/SulphurousSandstone.png and b/Items/Placeables/SulphurousSandstone.png differ diff --git a/Items/Placeables/SulphurousShale.cs b/Items/Placeables/SulphurousShale.cs new file mode 100644 index 0000000000..d108dd5845 --- /dev/null +++ b/Items/Placeables/SulphurousShale.cs @@ -0,0 +1,35 @@ +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables +{ + public class SulphurousShale : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + DisplayName.SetDefault("Sulphurous Shale"); + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/SulphurousShale.png b/Items/Placeables/SulphurousShale.png new file mode 100644 index 0000000000..8d4e10c1c4 Binary files /dev/null and b/Items/Placeables/SulphurousShale.png differ diff --git a/Items/Placeables/Tenebris.png b/Items/Placeables/Tenebris.png deleted file mode 100644 index b4540cb2d3..0000000000 Binary files a/Items/Placeables/Tenebris.png and /dev/null differ diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs index 3b4d09714a..d7039affc2 100644 --- a/Items/Placeables/UelibloomBrick.cs +++ b/Items/Placeables/UelibloomBrick.cs @@ -29,17 +29,15 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { - CreateRecipe(10). + CreateRecipe(50). + AddRecipeGroup("AnyStoneBlock", 50). AddIngredient(). - AddRecipeGroup("AnyStoneBlock"). - AddTile(TileID.AdamantiteForge). + AddTile(TileID.LunarCraftingStation). Register(); - CreateRecipe(). AddIngredient(4). AddTile(). Register(); - CreateRecipe(). AddIngredient(2). AddTile(). diff --git a/Items/Placeables/VernalSoil.cs b/Items/Placeables/VernalSoil.cs new file mode 100644 index 0000000000..38c41092d7 --- /dev/null +++ b/Items/Placeables/VernalSoil.cs @@ -0,0 +1,28 @@ +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class VernalSoil : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vernal Soil"); + SacrificeTotal = 10; + } + + public override void SetDefaults() + { + Item.createTile = ModContent.TileType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; + } + } +} diff --git a/Items/Placeables/VernalSoil.png b/Items/Placeables/VernalSoil.png new file mode 100644 index 0000000000..a0a8c2c4e1 Binary files /dev/null and b/Items/Placeables/VernalSoil.png differ diff --git a/Items/Placeables/Voidstone.png b/Items/Placeables/Voidstone.png index dcfd997f15..7ea8fb96df 100644 Binary files a/Items/Placeables/Voidstone.png and b/Items/Placeables/Voidstone.png differ diff --git a/Items/Placeables/Walls/BrimstoneSlabWall.cs b/Items/Placeables/Walls/BrimstoneSlabWall.cs new file mode 100644 index 0000000000..c5a3a6538f --- /dev/null +++ b/Items/Placeables/Walls/BrimstoneSlabWall.cs @@ -0,0 +1,33 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class BrimstoneSlabWall : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 400; + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + 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(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); + } + } +} diff --git a/Items/Placeables/Walls/BrimstoneSlabWall.png b/Items/Placeables/Walls/BrimstoneSlabWall.png new file mode 100644 index 0000000000..92a24a3b1a Binary files /dev/null and b/Items/Placeables/Walls/BrimstoneSlabWall.png differ diff --git a/Items/Placeables/Walls/EutrophicSandWall.png b/Items/Placeables/Walls/EutrophicSandWall.png index bf2954a265..04e425d8b5 100644 Binary files a/Items/Placeables/Walls/EutrophicSandWall.png and b/Items/Placeables/Walls/EutrophicSandWall.png differ diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.png b/Items/Placeables/Walls/EutrophicSandWallSafe.png index bf2954a265..04e425d8b5 100644 Binary files a/Items/Placeables/Walls/EutrophicSandWallSafe.png and b/Items/Placeables/Walls/EutrophicSandWallSafe.png differ diff --git a/Items/Placeables/Walls/ChaosplateWall.cs b/Items/Placeables/Walls/HavocplateWall.cs similarity index 74% rename from Items/Placeables/Walls/ChaosplateWall.cs rename to Items/Placeables/Walls/HavocplateWall.cs index e6bb8039f1..8c9e7115dd 100644 --- a/Items/Placeables/Walls/ChaosplateWall.cs +++ b/Items/Placeables/Walls/HavocplateWall.cs @@ -1,10 +1,11 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; using Terraria.ID; namespace CalamityMod.Items.Placeables.Walls { - public class ChaosplateWall : ModItem + [LegacyName("ChaosplateWall")] + public class HavocplateWall : ModItem { public override void SetStaticDefaults() { @@ -22,12 +23,12 @@ namespace CalamityMod.Items.Placeables.Walls Item.useTime = 7; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.createWall = ModContent.WallType(); + Item.createWall = ModContent.WallType(); } public override void AddRecipes() { - CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); + CreateRecipe(4).AddIngredient(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); } } } diff --git a/Items/Placeables/Walls/ChaosplateWall.png b/Items/Placeables/Walls/HavocplateWall.png similarity index 100% rename from Items/Placeables/Walls/ChaosplateWall.png rename to Items/Placeables/Walls/HavocplateWall.png diff --git a/Items/Placeables/Walls/NavystoneWall.png b/Items/Placeables/Walls/NavystoneWall.png index 8aa8a01f48..b2ba90b742 100644 Binary files a/Items/Placeables/Walls/NavystoneWall.png and b/Items/Placeables/Walls/NavystoneWall.png differ diff --git a/Items/Placeables/Walls/NavystoneWallSafe.png b/Items/Placeables/Walls/NavystoneWallSafe.png index 8aa8a01f48..b2ba90b742 100644 Binary files a/Items/Placeables/Walls/NavystoneWallSafe.png and b/Items/Placeables/Walls/NavystoneWallSafe.png differ diff --git a/Items/Placeables/Walls/OnyxplateWall.cs b/Items/Placeables/Walls/OnyxplateWall.cs new file mode 100644 index 0000000000..7d5abda420 --- /dev/null +++ b/Items/Placeables/Walls/OnyxplateWall.cs @@ -0,0 +1,34 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class OnyxplateWall : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 400; + DisplayName.SetDefault("Onyxplate Wall"); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + 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(ModContent.ItemType()).AddTile(TileID.WorkBenches).Register(); + } + } +} diff --git a/Items/Placeables/Walls/OnyxplateWall.png b/Items/Placeables/Walls/OnyxplateWall.png new file mode 100644 index 0000000000..f58c494058 Binary files /dev/null and b/Items/Placeables/Walls/OnyxplateWall.png differ diff --git a/Items/Placeables/Walls/ScorchedBoneWall.cs b/Items/Placeables/Walls/ScorchedBoneWall.cs new file mode 100644 index 0000000000..6152e0a486 --- /dev/null +++ b/Items/Placeables/Walls/ScorchedBoneWall.cs @@ -0,0 +1,37 @@ +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +using Terraria.ID; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ScorchedBoneWall : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scorched Bone Wall"); + SacrificeTotal = 400; + } + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.maxStack = 999; + 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(ModContent.ItemType()). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/ScorchedBoneWall.png b/Items/Placeables/Walls/ScorchedBoneWall.png new file mode 100644 index 0000000000..26945bd65b Binary files /dev/null and b/Items/Placeables/Walls/ScorchedBoneWall.png differ diff --git a/Items/Placeables/Walls/SulphurousSandWall.png b/Items/Placeables/Walls/SulphurousSandWall.png index b601fb2d9b..222fbcab01 100644 Binary files a/Items/Placeables/Walls/SulphurousSandWall.png and b/Items/Placeables/Walls/SulphurousSandWall.png differ diff --git a/Items/Placeables/Walls/SulphurousShaleWall.cs b/Items/Placeables/Walls/SulphurousShaleWall.cs new file mode 100644 index 0000000000..4354c63366 --- /dev/null +++ b/Items/Placeables/Walls/SulphurousShaleWall.cs @@ -0,0 +1,34 @@ +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; +namespace CalamityMod.Items.Placeables.Walls +{ + public class SulphurousShaleWall : ModItem + { + public override void SetStaticDefaults() + { + SacrificeTotal = 400; + DisplayName.SetDefault("Sulphurous Shale Wall"); + } + + public override void SetDefaults() + { + Item.createWall = ModContent.WallType(); + Item.useStyle = ItemUseStyleID.Swing; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.maxStack = 999; + } + + public override void AddRecipes() + { + CreateRecipe(4).AddTile( + TileID.WorkBenches).AddIngredient(ModContent.ItemType()).Register(); + } + } +} diff --git a/Items/Placeables/Walls/SulphurousShaleWall.png b/Items/Placeables/Walls/SulphurousShaleWall.png new file mode 100644 index 0000000000..22df2ddf22 Binary files /dev/null and b/Items/Placeables/Walls/SulphurousShaleWall.png differ diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index 54823ff571..78ceda1216 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -7,15 +7,13 @@ namespace CalamityMod.Items.Potions.Alcohol { public class BloodyMary : ModItem { - internal static readonly int CritBoost = 7; - public override void SetStaticDefaults() { SacrificeTotal = 5; DisplayName.SetDefault("Bloody Mary"); Tooltip.SetDefault(@"Extra spicy and bloody! -Boosts damage by 15%, movement speed by 10%, melee speed by 15% and crit chance by 7% during a Blood Moon -Reduces life regen by 2 and defense by 4%"); +Boosts damage and movement speed by 10% during a Blood Moon +Reduces life regen by 4 and defense by 4%"); } public override void SetDefaults() diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 66b78a7c5a..190e952997 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions.Alcohol SacrificeTotal = 5; DisplayName.SetDefault("Grape Beer"); Tooltip.SetDefault(@"This crap is abhorrent but you might like it -Reduces defense by 3% and movement speed by 5%"); +Reduces defense by 3%"); } public override void SetDefaults() diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index 16ceea8791..6bd79a2b02 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -23,7 +23,7 @@ Reduces defense by 6% and life regen by 1 public override void SetDefaults() { Item.width = 28; - Item.height = 18; + Item.height = 40; Item.useTurn = true; Item.maxStack = 30; Item.rare = ItemRarityID.Lime; diff --git a/Items/Potions/Alcohol/Margarita.png b/Items/Potions/Alcohol/Margarita.png index b440e0aebc..e147d8dfd4 100644 Binary files a/Items/Potions/Alcohol/Margarita.png and b/Items/Potions/Alcohol/Margarita.png differ diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index d78b8fb742..3c75eed13e 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -15,13 +15,13 @@ namespace CalamityMod.Items.Potions.Alcohol DisplayName.SetDefault("Moscow Mule"); Tooltip.SetDefault(@"I once heard the copper mug can be toxic and I told 'em 'listen dummy, I'm already poisoning myself' Boosts damage by 9%, knockback by 50% and critical strike chance by 3% -Reduces life regen by 2"); +Reduces life regen by 4"); } public override void SetDefaults() { - Item.width = 28; - Item.height = 18; + Item.width = 32; + Item.height = 34; Item.useTurn = true; Item.maxStack = 30; Item.rare = ItemRarityID.Yellow; diff --git a/Items/Potions/Alcohol/MoscowMule.png b/Items/Potions/Alcohol/MoscowMule.png index 98d2e9f48a..602654af71 100644 Binary files a/Items/Potions/Alcohol/MoscowMule.png and b/Items/Potions/Alcohol/MoscowMule.png differ diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index 6611f24241..a27a1a4e66 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Potions.Alcohol Tooltip.SetDefault(@"Made from some stuff I found near the Astral Meteor crash site, don't worry it's safe, trust me Boosts max mana by 50, magic damage by 8%, and reduces mana usage by 10% -Reduces defense by 6% and life regen by 1"); +Reduces defense by 6% and life regen by 2"); } public override void SetDefaults() diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index 47bdc44153..b030060aa0 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -7,14 +7,14 @@ namespace CalamityMod.Items.Potions.Alcohol { public class Tequila : ModItem { - internal static readonly int CritBoost = 2; + internal static readonly int CritBoost = 4; public override void SetStaticDefaults() { SacrificeTotal = 5; DisplayName.SetDefault("Tequila"); Tooltip.SetDefault(@"Great for mixing up daytime drinks -Boosts damage and damage reduction by 3%, knockback by 10%, crit chance by 2% and defense by 5 during daytime +Boosts knockback by 10%, crit chance by 4% and defense by 5 during daytime Reduces life regen by 1"); } diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 1238c2bbc7..0aac64449d 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -7,14 +7,14 @@ namespace CalamityMod.Items.Potions.Alcohol { public class TequilaSunrise : ModItem { - internal static readonly int CritBoost = 3; + internal static readonly int CritBoost = 8; public override void SetStaticDefaults() { SacrificeTotal = 5; DisplayName.SetDefault("Tequila Sunrise"); Tooltip.SetDefault(@"The greatest daytime drink I've ever had -Boosts damage by 7%, knockback by 20%, crit chance and damage reduction by 3% and defense by 10 during daytime -Reduces life regen by 1"); +Boosts knockback by 20%, crit chance by 8% and defense by 10 during daytime +Reduces life regen by 2"); } public override void SetDefaults() diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 9e869c5ece..b661b77616 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Potions.Alcohol SacrificeTotal = 5; DisplayName.SetDefault("White Wine"); Tooltip.SetDefault(@"I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day -Boosts magic damage by 10% +Boosts magic damage by 8% Reduces defense by 6% and life regen by 1"); } @@ -29,7 +29,7 @@ Reduces defense by 6% and life regen by 1"); Item.useStyle = ItemUseStyleID.DrinkLiquid; Item.UseSound = SoundID.Item3; Item.consumable = true; - Item.healMana = 400; + Item.healMana = 300; Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(300f); Item.value = Item.buyPrice(0, 4, 0, 0); diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index 158eb77ac4..5f22e38ff0 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -50,16 +50,16 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - CreateRecipe(4). - AddIngredient(ItemID.BottledWater, 4). + CreateRecipe(15). + AddIngredient(ItemID.BottledWater, 15). AddIngredient(4). AddIngredient(). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); - CreateRecipe(8). - AddIngredient(ItemID.BottledWater, 4). + CreateRecipe(15). + AddIngredient(ItemID.BottledWater, 15). AddIngredient(5). AddIngredient(). AddTile(TileID.AlchemyTable). diff --git a/Items/Potions/Baguette.cs b/Items/Potions/Baguette.cs index 9a5ed0fe08..37989bc7cc 100644 --- a/Items/Potions/Baguette.cs +++ b/Items/Potions/Baguette.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Hay, 10). + AddIngredient(ItemID.Hay, 20). AddTile(TileID.Furnaces). Register(); } diff --git a/Items/Potions/BlasphemousDonut.cs b/Items/Potions/BlasphemousDonut.cs new file mode 100644 index 0000000000..6813c0bbbb --- /dev/null +++ b/Items/Potions/BlasphemousDonut.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class BlasphemousDonut : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blasphemous Donut"); + Tooltip.SetDefault("{$CommonItemTooltip.MediumStats}\n'Donut worry, it's perfectly edible'"); + SacrificeTotal = 5; + } + public override void SetDefaults() + { + Item.width = 40; + Item.height = 26; + Item.value = Item.buyPrice(0, 2, 0, 0); + Item.rare = ItemRarityID.Purple; + Item.maxStack = 30; + Item.consumable = true; + Item.useAnimation = 17; + Item.useTime = 17; + Item.UseSound = SoundID.Item2; + Item.useStyle = ItemUseStyleID.EatFood; + Item.useTurn = true; + Item.buffType = BuffID.WellFed2; + Item.buffTime = CalamityUtils.SecondsToFrames(3600f); + } + } +} diff --git a/Items/Potions/BlasphemousDonut.png b/Items/Potions/BlasphemousDonut.png new file mode 100644 index 0000000000..07e7f0f8fb Binary files /dev/null and b/Items/Potions/BlasphemousDonut.png differ diff --git a/Items/Potions/CadancePotion.cs b/Items/Potions/CadancePotion.cs deleted file mode 100644 index aa32e66370..0000000000 --- a/Items/Potions/CadancePotion.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - [LegacyName("CadencePotion")] - public class CadancePotion : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Cadance Potion"); - Tooltip.SetDefault("Grants Cadance's Grace, which increases life regeneration and heart pickup range\n" + - "Increases max life by 25%\n" + - "While this potion's buff is active, Regeneration Potion and Lifeforce Potion buffs are disabled"); - } - - public override void SetDefaults() - { - Item.width = 28; - Item.height = 38; - Item.useTurn = true; - Item.maxStack = 30; - Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.rare = ItemRarityID.LightRed; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.LovePotion). - AddIngredient(ItemID.HeartreachPotion). - AddIngredient(ItemID.LifeforcePotion). - AddIngredient(ItemID.RegenerationPotion). - AddTile(TileID.AlchemyTable). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(40). - AddTile(TileID.AlchemyTable). - Register(); - } - } -} diff --git a/Items/Potions/CadancePotion.png b/Items/Potions/CadancePotion.png deleted file mode 100644 index 1cc6566f97..0000000000 Binary files a/Items/Potions/CadancePotion.png and /dev/null differ diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs deleted file mode 100644 index 6facfe39ed..0000000000 --- a/Items/Potions/DraconicElixir.cs +++ /dev/null @@ -1,78 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class DraconicElixir : ModItem - { - public int frameCounter = 0; - public int frame = 0; - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Draconic Elixir"); - Tooltip.SetDefault("Greatly increases wing flight time and speed and increases defense by 16\n" + - "Silva invincibility heals you to half HP when triggered\n" + - "If you trigger the above heal you cannot drink this potion again for 60 seconds and you gain 30 seconds of potion sickness"); - } - - public override void SetDefaults() - { - Item.width = 50; - Item.height = 44; - Item.useTurn = true; - Item.maxStack = 30; - Item.rare = ModContent.RarityType(); - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override bool CanUseItem(Player player) => !player.HasCooldown(Cooldowns.DraconicElixir.ID); - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture = ModContent.Request("CalamityMod/Items/Potions/DraconicElixir_Animated").Value; - spriteBatch.Draw(texture, position, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), Color.White, 0f, origin, scale, SpriteEffects.None, 0); - return false; - } - - public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) - { - Texture2D texture = ModContent.Request("CalamityMod/Items/Potions/DraconicElixir_Animated").Value; - spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(). - AddIngredient(ItemID.Daybloom). - AddIngredient(ItemID.Moonglow). - AddIngredient(ItemID.Fireblossom). - AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(50). - AddIngredient(). - AddTile(TileID.AlchemyTable). - Register(); - } - } -} diff --git a/Items/Potions/DraconicElixir.png b/Items/Potions/DraconicElixir.png deleted file mode 100644 index 86797c6f8e..0000000000 Binary files a/Items/Potions/DraconicElixir.png and /dev/null differ diff --git a/Items/Potions/DraconicElixir_Animated.png b/Items/Potions/DraconicElixir_Animated.png deleted file mode 100644 index 0556f22556..0000000000 Binary files a/Items/Potions/DraconicElixir_Animated.png and /dev/null differ diff --git a/Items/Potions/Fabsoup.cs b/Items/Potions/Fabsoup.cs new file mode 100644 index 0000000000..d23df2b8c6 --- /dev/null +++ b/Items/Potions/Fabsoup.cs @@ -0,0 +1,58 @@ +/*using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Rarities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class Fabsoup : ModItem + { + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/SoupConsumption"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pot of Pain"); + Tooltip.SetDefault("{$CommonItemTooltip.MajorStats}\n'hrngh, soup'"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 56; + Item.height = 50; + Item.value = 0; + Item.rare = ModContent.RarityType(); + Item.maxStack = 1; + Item.consumable = false; + Item.useAnimation = 901; + Item.useTime = 901; + Item.UseSound = UseSound; + Item.useStyle = ItemUseStyleID.DrinkLiquid; + Item.useTurn = true; + } + + public override void UseItemFrame(Player player) + { + int time = CalamityUtils.SecondsToFrames(1800f); + if (player.itemAnimation == 180) + { + player.AddBuff(BuffID.WellFed3, time); + } + // ow hot + if (player.itemAnimation == 60) + { + player.AddBuff(BuffID.WellFed3, time); + player.AddBuff(BuffID.OnFire, time); + player.AddBuff(BuffID.Frostburn, time); + player.AddBuff(BuffID.CursedInferno, time); + player.AddBuff(ModContent.BuffType(), time); + player.AddBuff(ModContent.BuffType(), time); + player.AddBuff(ModContent.BuffType(), time); + player.AddBuff(ModContent.BuffType(), time); + player.AddBuff(ModContent.BuffType(), time); + player.AddBuff(ModContent.BuffType(), time); + } + } + } +}*/ diff --git a/Items/Potions/Fabsoup.png b/Items/Potions/Fabsoup.png new file mode 100644 index 0000000000..0a576efee3 Binary files /dev/null and b/Items/Potions/Fabsoup.png differ diff --git a/Items/Potions/FlaskOfBrimstone.cs b/Items/Potions/FlaskOfBrimstone.cs index 69635e50d0..7de0c5191d 100644 --- a/Items/Potions/FlaskOfBrimstone.cs +++ b/Items/Potions/FlaskOfBrimstone.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Potions { SacrificeTotal = 20; DisplayName.SetDefault("Flask of Brimstone"); - Tooltip.SetDefault("Melee, Whip, and Rogue attacks inflict Brimstone Flames on enemies"); + Tooltip.SetDefault("Melee, Whip, and Rogue attacks inflict Brimstone Flames"); } public override void SetDefaults() @@ -29,23 +29,15 @@ namespace CalamityMod.Items.Potions Item.useStyle = ItemUseStyleID.DrinkLiquid; Item.UseSound = SoundID.Item3; Item.consumable = true; - Item.buffType = ModContent.BuffType(); + Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(1200f); Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - CreateRecipe(3). - AddIngredient(ItemID.BottledWater, 3). - AddIngredient(). - AddIngredient(3). - AddTile(TileID.ImbuingStation). - Register(); - CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(20). AddIngredient(). AddTile(TileID.ImbuingStation). Register(); diff --git a/Items/Potions/CrumblingPotion.cs b/Items/Potions/FlaskOfCrumbling.cs similarity index 72% rename from Items/Potions/CrumblingPotion.cs rename to Items/Potions/FlaskOfCrumbling.cs index 1bb65b389d..3eab771305 100644 --- a/Items/Potions/CrumblingPotion.cs +++ b/Items/Potions/FlaskOfCrumbling.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class CrumblingPotion : ModItem + [LegacyName("CrumblingPotion")] + public class FlaskOfCrumbling : ModItem { public override void SetStaticDefaults() { @@ -28,23 +29,15 @@ namespace CalamityMod.Items.Potions Item.value = Item.buyPrice(0, 2, 0, 0); Item.rare = ItemRarityID.LightRed; Item.consumable = true; - Item.buffType = ModContent.BuffType(); + Item.buffType = ModContent.BuffType(); Item.buffTime = CalamityUtils.SecondsToFrames(1200f); } public override void AddRecipes() { - CreateRecipe(5). - AddIngredient(ItemID.BottledWater, 5). - AddIngredient(). - AddIngredient(). - AddTile(TileID.ImbuingStation). - Register(); - CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(20). - AddIngredient(). + AddIngredient(2). AddTile(TileID.ImbuingStation). Register(); } diff --git a/Items/Potions/CrumblingPotion.png b/Items/Potions/FlaskOfCrumbling.png similarity index 100% rename from Items/Potions/CrumblingPotion.png rename to Items/Potions/FlaskOfCrumbling.png diff --git a/Items/Potions/HolyWrathPotion.cs b/Items/Potions/FlaskOfHolyFlames.cs similarity index 54% rename from Items/Potions/HolyWrathPotion.cs rename to Items/Potions/FlaskOfHolyFlames.cs index c40691fc4e..d86043623f 100644 --- a/Items/Potions/HolyWrathPotion.cs +++ b/Items/Potions/FlaskOfHolyFlames.cs @@ -6,14 +6,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class HolyWrathPotion : ModItem + [LegacyName("HolyWrathPotion", "ProfanedRagePotion")] + public class FlaskOfHolyFlames : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 20; - DisplayName.SetDefault("Holy Wrath Potion"); - Tooltip.SetDefault("Increases damage by 12% and your attacks inflict holy fire\n" + - "While this potion's buff is active the Wrath Potion's buff is disabled"); + DisplayName.SetDefault("Flask of Holy Flames"); + Tooltip.SetDefault("Melee, Whip, and Rogue attacks inflict Holy Flames"); } public override void SetDefaults() @@ -28,26 +28,17 @@ namespace CalamityMod.Items.Potions Item.useStyle = ItemUseStyleID.DrinkLiquid; Item.UseSound = SoundID.Item3; Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(300f); + Item.buffType = ModContent.BuffType(); + Item.buffTime = CalamityUtils.SecondsToFrames(1200f); Item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { - CreateRecipe(). - AddIngredient(ItemID.WrathPotion). - AddIngredient(). - AddIngredient(). - AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). - Register(); - CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(40). AddIngredient(). - AddTile(TileID.AlchemyTable). + AddTile(TileID.ImbuingStation). Register(); } } diff --git a/Items/Potions/HolyWrathPotion.png b/Items/Potions/FlaskOfHolyFlames.png similarity index 100% rename from Items/Potions/HolyWrathPotion.png rename to Items/Potions/FlaskOfHolyFlames.png diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index 3b652e5a45..0c04e5a4d3 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.GravitationPotion). - AddIngredient(). + AddIngredient(ItemID.BottledWater). AddIngredient(). + AddIngredient(). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index 0edeefbea6..4faa08abd5 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - CreateRecipe(). - AddIngredient(). - AddIngredient(10). - AddTile(). + CreateRecipe(20). + AddIngredient(20). + AddIngredient(). + AddTile(TileID.Bottles). Register(); } } diff --git a/Items/Potions/PenumbraPotion.cs b/Items/Potions/PenumbraPotion.cs deleted file mode 100644 index a8fb73be1b..0000000000 --- a/Items/Potions/PenumbraPotion.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class PenumbraPotion : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Penumbra Potion"); - Tooltip.SetDefault("Rogue stealth generates 10% faster while moving and 15% faster while standing still"); - } - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 30; - Item.useTurn = true; - Item.maxStack = 30; - Item.rare = ItemRarityID.Lime; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(3). - AddIngredient(ItemID.LunarTabletFragment). - AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(30). - AddIngredient(). - AddTile(TileID.AlchemyTable). - Register(); - } - } -} diff --git a/Items/Potions/PenumbraPotion.png b/Items/Potions/PenumbraPotion.png deleted file mode 100644 index d1b3f12f68..0000000000 Binary files a/Items/Potions/PenumbraPotion.png and /dev/null differ diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index ef5b44b081..e82f9270e5 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Potions { CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(). AddIngredient(). AddIngredient(). AddTile(TileID.AlchemyTable). diff --git a/Items/Potions/ProfanedRagePotion.cs b/Items/Potions/ProfanedRagePotion.cs deleted file mode 100644 index 1ab1d1546b..0000000000 --- a/Items/Potions/ProfanedRagePotion.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class ProfanedRagePotion : ModItem - { - internal static readonly int CritBoost = 12; - - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Profaned Rage Potion"); - Tooltip.SetDefault("Increases critical strike chance by 12%\n" + - "While this potion's buff is active the Rage Potion's buff is disabled"); - } - - public override void SetDefaults() - { - Item.width = 34; - Item.height = 42; - Item.useTurn = true; - Item.maxStack = 30; - Item.rare = ItemRarityID.Purple; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(300f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.RagePotion). - AddIngredient(). - AddIngredient(). - AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(40). - AddIngredient(). - AddTile(TileID.AlchemyTable). - Register(); - } - } -} diff --git a/Items/Potions/ProfanedRagePotion.png b/Items/Potions/ProfanedRagePotion.png deleted file mode 100644 index 3e9d7340d3..0000000000 Binary files a/Items/Potions/ProfanedRagePotion.png and /dev/null differ diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs index a4783b208e..aee26b09f9 100644 --- a/Items/Potions/ShadowPotion.cs +++ b/Items/Potions/ShadowPotion.cs @@ -38,15 +38,16 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(ItemID.InvisibilityPotion). + CreateRecipe(). + AddIngredient(ItemID.BottledWater). AddIngredient(). + AddIngredient(ItemID.Blinkroot). AddTile(TileID.Bottles). Register(); CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(20). + AddIngredient(10). AddTile(TileID.AlchemyTable). Register(); } diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index e32d66dfc9..d6f7e9eceb 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Items.Potions { CreateRecipe(). AddIngredient(ItemID.BottledWater). - AddIngredient(ItemID.SoulofFlight). AddIngredient(). + AddIngredient(ItemID.SoulofFlight). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); diff --git a/Items/Potions/SulphurskinPotion.cs b/Items/Potions/SulphurskinPotion.cs index 76ab657864..2ec5176076 100644 --- a/Items/Potions/SulphurskinPotion.cs +++ b/Items/Potions/SulphurskinPotion.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). AddIngredient(15). - AddIngredient(15). AddTile(TileID.Bottles). Register(); diff --git a/Items/Potions/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs index fd2bb1f03d..6ca8ae9432 100644 --- a/Items/Potions/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -32,10 +32,10 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - CreateRecipe(). - AddIngredient(ItemID.SuperHealingPotion). - AddIngredient(). - AddTile(TileID.LunarCraftingStation). + CreateRecipe(4). + AddIngredient(ItemID.SuperHealingPotion, 4). + AddIngredient(3). + AddTile(TileID.Bottles). Register(); } } diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index a037341a79..566daee6aa 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -31,10 +31,10 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - CreateRecipe(). - AddIngredient(ItemID.SuperManaPotion). + CreateRecipe(15). + AddIngredient(ItemID.SuperManaPotion, 15). AddIngredient(). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.Bottles). Register(); } } diff --git a/Items/Potions/TitanScalePotion.cs b/Items/Potions/TitanScalePotion.cs deleted file mode 100644 index 1414cd13ce..0000000000 --- a/Items/Potions/TitanScalePotion.cs +++ /dev/null @@ -1,55 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Fishing.SunkenSeaCatches; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class TitanScalePotion : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Titan Scale Potion"); - Tooltip.SetDefault("Increases knockback, defense by 5 and damage reduction by 5%\n" + - "Increases defense by an additional 20 and damage reduction by an additional 5% for 10 seconds after a true melee strike"); - } - - public override void SetDefaults() - { - Item.width = 24; - Item.height = 34; - Item.useTurn = true; - Item.maxStack = 30; - Item.rare = ItemRarityID.Yellow; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - CreateRecipe(4). - AddIngredient(ItemID.TitanPotion, 4). - AddIngredient(ItemID.BeetleHusk). - AddIngredient(). - AddTile(TileID.AlchemyTable). - AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). - Register(); - - CreateRecipe(4). - AddIngredient(ItemID.BottledWater, 4). - AddIngredient(40). - AddIngredient(ItemID.BeetleHusk). - AddTile(TileID.AlchemyTable). - Register(); - } - } -} diff --git a/Items/Potions/TitanScalePotion.png b/Items/Potions/TitanScalePotion.png deleted file mode 100644 index e03b18f14b..0000000000 Binary files a/Items/Potions/TitanScalePotion.png and /dev/null differ diff --git a/Items/Potions/TriumphPotion.cs b/Items/Potions/TriumphPotion.cs deleted file mode 100644 index d77ef7f465..0000000000 --- a/Items/Potions/TriumphPotion.cs +++ /dev/null @@ -1,50 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class TriumphPotion : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Triumph Potion"); - Tooltip.SetDefault("Enemy contact damage is reduced, the lower their health the more it is reduced"); - } - - public override void SetDefaults() - { - Item.width = 28; - Item.height = 18; - Item.useTurn = true; - Item.maxStack = 30; - Item.value = Item.buyPrice(0, 2, 0, 0); - Item.rare = ItemRarityID.Green; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(240f); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(3). - AddTile(TileID.Bottles). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(30). - AddTile(TileID.AlchemyTable). - Register(); - } - } -} diff --git a/Items/Potions/TriumphPotion.png b/Items/Potions/TriumphPotion.png deleted file mode 100644 index 17ad97826b..0000000000 Binary files a/Items/Potions/TriumphPotion.png and /dev/null differ diff --git a/Items/Potions/YharimsStimulants.cs b/Items/Potions/YharimsStimulants.cs deleted file mode 100644 index 7c822990a9..0000000000 --- a/Items/Potions/YharimsStimulants.cs +++ /dev/null @@ -1,57 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class YharimsStimulants : ModItem - { - internal static readonly int CritBoost = 2; - - public override void SetStaticDefaults() - { - SacrificeTotal = 20; - DisplayName.SetDefault("Yharim's Stimulants"); - Tooltip.SetDefault("Increases defense by 10, knockback by 25%, damage reduction by 4%,\n" + - "mining speed by 10%, damage by 5%, critical strike chance by 2%, minion knockback by 100%,\n" + - "movement and melee speed by 7.5%"); - } - - public override void SetDefaults() - { - Item.width = 40; - Item.height = 40; - Item.useTurn = true; - Item.maxStack = 30; - Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(1800f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("AnyFood"). - AddIngredient(ItemID.EndurancePotion). - AddIngredient(ItemID.IronskinPotion). - AddIngredient(ItemID.SwiftnessPotion). - AddIngredient(ItemID.TitanPotion). - AddTile(TileID.AlchemyTable). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(50). - AddTile(TileID.AlchemyTable). - Register(); - } - } -} diff --git a/Items/Potions/YharimsStimulants.png b/Items/Potions/YharimsStimulants.png deleted file mode 100644 index 4a1571b5d2..0000000000 Binary files a/Items/Potions/YharimsStimulants.png and /dev/null differ diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index 61905e7ba1..27fde92215 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -38,9 +38,7 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). AddIngredient(2). - AddIngredient(2). - AddIngredient(ItemID.PinkGel). - AddIngredient(ItemID.Daybloom). + AddIngredient(ItemID.Daybloom, 3). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). Register(); diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index a181ddba50..d4e314ad16 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Items.Potions CreateRecipe(). AddIngredient(ItemID.BottledWater). AddIngredient(2). - AddIngredient(4). AddIngredient(). AddTile(TileID.AlchemyTable). AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy). diff --git a/Items/SirenproofEarMuffs.cs b/Items/SirenproofEarMuffs.cs index de302528a7..3938277f1f 100644 --- a/Items/SirenproofEarMuffs.cs +++ b/Items/SirenproofEarMuffs.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items public override void AddRecipes() { CreateRecipe(). - AddIngredient(2). + AddIngredient(ItemID.FlinxFur, 2). AddIngredient(ItemID.Silk, 5). AddTile(TileID.Anvils). Register(); diff --git a/Items/SulphurousSeaWorldSideChanger.cs b/Items/SulphurousSeaWorldSideChanger.cs new file mode 100644 index 0000000000..6d79c7766a --- /dev/null +++ b/Items/SulphurousSeaWorldSideChanger.cs @@ -0,0 +1,50 @@ +using CalamityMod.Events; +using CalamityMod.Rarities; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Microsoft.Xna.Framework; +using System; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class SulphurousSeaWorldSideChanger : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphurous Sea World Side Changer"); + Tooltip.SetDefault("Spawn and use this if your regular ocean counts as a Sulphurous Sea\n"+"This will also fix the Abyss if it is broken"); + } + + public override void SetDefaults() + { + Item.width = 54; + Item.height = 46; + Item.useTime = 16; + Item.useAnimation = 16; + Item.rare = ModContent.RarityType(); + Item.value = 0; + Item.autoReuse = false; + Item.useStyle = 4; + Item.UseSound = SoundID.Item111; + } + + public override bool? UseItem(Player player) + { + CalamityNetcode.SyncWorld(); + string key = "Mods.CalamityMod.SulphurSwitchLeft"; + if (Abyss.AtLeftSideOfWorld) + { + Abyss.AtLeftSideOfWorld = false; + key = "Mods.CalamityMod.SulphurSwitchRight"; + } + else + { + Abyss.AtLeftSideOfWorld = true; + } + CalamityUtils.DisplayLocalizedText(key, AcidRainEvent.TextColor); + return true; + } + } +} diff --git a/Items/SulphurousSeaWorldSideChanger.png b/Items/SulphurousSeaWorldSideChanger.png new file mode 100644 index 0000000000..0d4e42abe3 Binary files /dev/null and b/Items/SulphurousSeaWorldSideChanger.png differ diff --git a/Items/SummonItems/Abombination.cs b/Items/SummonItems/Abombination.cs index 7791f10f42..6845652d3d 100644 --- a/Items/SummonItems/Abombination.cs +++ b/Items/SummonItems/Abombination.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(UseSound, player.position); + SoundEngine.PlaySound(UseSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -60,7 +60,6 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(20). AddRecipeGroup("IronBar", 8). - AddIngredient(ItemID.Stinger, 5). AddIngredient(ItemID.Obsidian, 3). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index 628ac72639..b8a5fc4775 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType(), 1); diff --git a/Items/SummonItems/BloodyWormFood.cs b/Items/SummonItems/BloodyWormFood.cs index 0e4dd99738..6157764e7c 100644 --- a/Items/SummonItems/BloodyWormFood.cs +++ b/Items/SummonItems/BloodyWormFood.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -55,9 +55,9 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Vertebrae, 13). - AddIngredient(7). AddIngredient(ItemID.CrimtaneBar, 3). + AddIngredient(7). + AddIngredient(ItemID.Vertebrae, 13). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/SummonItems/CeremonialUrn.cs b/Items/SummonItems/CeremonialUrn.cs index 346c80f17c..e947b58d2b 100644 --- a/Items/SummonItems/CeremonialUrn.cs +++ b/Items/SummonItems/CeremonialUrn.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.SummonItems { SacrificeTotal = 1; DisplayName.SetDefault("Ceremonial Urn"); - Tooltip.SetDefault("Use at the Altar of the Accursed to summon Supreme Calamitas\n" + "Not consumable"); + Tooltip.SetDefault("Use at the Altar of the Accursed to summon the Supreme Witch, Calamitas\n" + "Not consumable"); ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index e4045a64d5..c0dded0210 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -59,7 +59,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe(). AddIngredient(ItemID.SoulofNight, 5). - AddIngredient(7). + AddIngredient(7). AddIngredient(2). AddTile(TileID.Hellforge). Register(); diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index a8a28fd954..8c2d8bb384 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.SummonItems Color messageColor = Color.Cyan; CalamityUtils.DisplayLocalizedText(key, messageColor); - SoundEngine.PlaySound(DevourerofGodsHead.SpawnSound, player.position); + SoundEngine.PlaySound(DevourerofGodsHead.SpawnSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -66,13 +66,11 @@ namespace CalamityMod.Items.SummonItems AddTile(TileID.LunarCraftingStation). Register(); + // sequence breaking recipe CreateRecipe(). - AddRecipeGroup("IronBar", 30). - AddIngredient(ItemID.LunarBar, 10). - AddIngredient(20). - AddIngredient(ItemID.SoulofLight, 20). - AddIngredient(ItemID.SoulofNight, 20). - AddIngredient(30). + AddIngredient(ItemID.LunarBar, 40). + AddIngredient(10). + AddIngredient(40). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/SummonItems/CryoKey.cs b/Items/SummonItems/CryoKey.cs index ccdd787153..93e3c1578f 100644 --- a/Items/SummonItems/CryoKey.cs +++ b/Items/SummonItems/CryoKey.cs @@ -1,10 +1,15 @@ -using CalamityMod.Events; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Cryogen; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -22,8 +27,8 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - Item.width = 28; - Item.height = 18; + Item.width = 26; + Item.height = 48; Item.rare = ItemRarityID.Pink; Item.useAnimation = 10; Item.useTime = 10; @@ -42,7 +47,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -51,12 +56,46 @@ namespace CalamityMod.Items.SummonItems return true; } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/CryoKey").Value; + Color overlay = CalamityWorld.getFixedBoi ? Color.Red : Color.White; + spriteBatch.Draw(texture, position, null, overlay, 0f, origin, scale, 0, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/CryoKey").Value; + Color overlay = CalamityWorld.getFixedBoi ? Color.Red : lightColor; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, overlay, 0f, Vector2.Zero, 1f, 0, 0); + return false; + } + + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine name = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "ItemName"); + TooltipLine line0 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + + if (CalamityWorld.getFixedBoi) + { + name.Text = "Pyro Key"; + line0.Text = "Summons Cryogen when used in the tundra...?"; + } + else + { + name.Text = "Cryo Key"; + line0.Text = "Summons Cryogen when used in the tundra"; + } + } + public override void AddRecipes() { CreateRecipe(). AddRecipeGroup("AnyIceBlock", 50). - AddIngredient(ItemID.SoulofNight, 5). AddIngredient(ItemID.SoulofLight, 5). + AddIngredient(ItemID.SoulofNight, 5). AddIngredient(8). AddTile(TileID.Anvils). Register(); diff --git a/Items/SummonItems/DeathWhistle.cs b/Items/SummonItems/DeathWhistle.cs index 1629eecae4..50b6446d3c 100644 --- a/Items/SummonItems/DeathWhistle.cs +++ b/Items/SummonItems/DeathWhistle.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.ScaryScream, player.position); + SoundEngine.PlaySound(SoundID.ScaryScream, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType(), 1); diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index 185945a200..d9d3a1a84d 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType(), 1); diff --git a/Items/SummonItems/DesertMedallion.cs b/Items/SummonItems/DesertMedallion.cs index 6dbe19f88b..49ada60293 100644 --- a/Items/SummonItems/DesertMedallion.cs +++ b/Items/SummonItems/DesertMedallion.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -70,8 +70,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SandBlock, 25). - AddIngredient(ItemID.Cactus, 15). + AddIngredient(ItemID.SandBlock, 40). AddIngredient(ItemID.AntlionMandible, 4). AddIngredient(2). AddTile(TileID.DemonAltar). diff --git a/Items/SummonItems/ExoticPheromones.cs b/Items/SummonItems/ExoticPheromones.cs index 11bbddf0d0..dd522346fc 100644 --- a/Items/SummonItems/ExoticPheromones.cs +++ b/Items/SummonItems/ExoticPheromones.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/EyeofDesolation.cs b/Items/SummonItems/EyeofDesolation.cs index 3704ad307b..81c1c9010d 100644 --- a/Items/SummonItems/EyeofDesolation.cs +++ b/Items/SummonItems/EyeofDesolation.cs @@ -1,22 +1,35 @@ -using CalamityMod.Events; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Events; using CalamityMod.Items.Materials; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { [LegacyName("BlightedEyeball")] public class EyeofDesolation : ModItem { + public Rectangle safeBox = default; + public int spawnX = 0; + public int spawnX2 = 0; + public int spawnXReset = 0; + public int spawnXReset2 = 0; + public int spawnXAdd = 200; + public int spawnY = 0; + public int spawnYReset = 0; + public int spawnYAdd = 0; public override void SetStaticDefaults() { SacrificeTotal = 1; DisplayName.SetDefault("Eye of Desolation"); Tooltip.SetDefault("Tonight is going to be a horrific night...\n" + - "Summons Calamitas when used during nighttime\n" + + "Summons the Calamitas Clone when used during nighttime\n" + "Enrages during the day\n" + "Not consumable"); ItemID.Sets.SortingPriorityBossSpawns[Type] = 10; // Pirate Map @@ -45,20 +58,69 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + safeBox.X = spawnX = spawnXReset = (int)(player.Center.X - 1250f); + spawnX2 = spawnXReset2 = (int)(player.Center.X + 1250f); + safeBox.Y = spawnY = spawnYReset = (int)(player.Center.Y - 1250f); + safeBox.Width = 2500; + safeBox.Height = 2500; + spawnYAdd = 125; + + int num52 = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; + int num53 = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; + int num54 = safeBox.Width / 2 / 16 + 1; + for (int num55 = num52 - num54; num55 <= num52 + num54; num55++) + { + for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) + { + if (!WorldGen.InWorld(num55, num56, 2)) + continue; + + int xoffset = 0; + int yoffset = 0; + + if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55 + xoffset, num56 + yoffset].HasTile) + { + Main.tile[num55 + xoffset, num56 + yoffset].TileType = (ushort)ModContent.TileType(); + Main.tile[num55 + xoffset, num56 + yoffset].Get().HasTile = true; + } + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, num55 + xoffset, num56 + yoffset, 1, TileChangeType.None); + } + else + { + WorldGen.SquareTileFrame(num55 + xoffset, num56 + yoffset, true); + } + } + } + } return true; } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine line3 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (CalamityWorld.getFixedBoi) + { + line3.Text = "Creates a square arena of blocks, with you at its center\nEnrages during the day"; + } + } + public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(7). + AddIngredient(7). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index f5d72285ff..e2d0d672b2 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(Polterghast.SpawnSound, player.position); + SoundEngine.PlaySound(Polterghast.SpawnSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/OldPowerCell.cs b/Items/SummonItems/OldPowerCell.cs index 516577e96e..d79555e2ed 100644 --- a/Items/SummonItems/OldPowerCell.cs +++ b/Items/SummonItems/OldPowerCell.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, NPCID.Golem); else diff --git a/Items/SummonItems/OverloadedSludge.cs b/Items/SummonItems/OverloadedSludge.cs index 41c70af15c..a609825571 100644 --- a/Items/SummonItems/OverloadedSludge.cs +++ b/Items/SummonItems/OverloadedSludge.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/Portabulb.cs b/Items/SummonItems/Portabulb.cs index f0d15dc612..43a5efa314 100644 --- a/Items/SummonItems/Portabulb.cs +++ b/Items/SummonItems/Portabulb.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, NPCID.Plantera); else @@ -57,10 +57,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe(). AddIngredient(ItemID.JungleSpores, 15). - AddIngredient(ItemID.SoulofNight, 10). - AddIngredient(ItemID.SoulofLight, 10). AddIngredient(3). - AddIngredient(ItemID.Vine). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index 8767f039a9..10cd8707a6 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(Providence.SpawnSound, player.position); + SoundEngine.PlaySound(Providence.SpawnSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 1); diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index 3dd5abfa42..10d57d4ffb 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -1,10 +1,13 @@ -using CalamityMod.Events; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.World; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -39,12 +42,12 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && Main.dayTime && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; + return !NPC.AnyNPCs(ModContent.NPCType()) && (Main.dayTime || CalamityWorld.getFixedBoi) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -52,12 +55,26 @@ namespace CalamityMod.Items.SummonItems return true; } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine line1 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); + + if (CalamityWorld.getFixedBoi) + { + line1.Text = "Summons the Profaned Guardians when used in the Hallow or Underworld"; + } + else + { + line1.Text = "Summons the Profaned Guardians when used in the Hallow or Underworld during daytime"; + } + } public override void AddRecipes() { CreateRecipe(). - AddIngredient(25). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(25). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/SummonItems/RuneofKos.cs b/Items/SummonItems/RuneofKos.cs index 586961a830..3b1ffd85b0 100644 --- a/Items/SummonItems/RuneofKos.cs +++ b/Items/SummonItems/RuneofKos.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.SummonItems { if (player.ZoneDungeon) { - SoundEngine.PlaySound(CVSound, player.position); + SoundEngine.PlaySound(CVSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -65,7 +65,7 @@ namespace CalamityMod.Items.SummonItems } else if (player.ZoneUnderworldHeight) { - SoundEngine.PlaySound(SignutSound, player.position); + SoundEngine.PlaySound(SignutSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -73,7 +73,7 @@ namespace CalamityMod.Items.SummonItems } else if (player.ZoneSkyHeight) { - SoundEngine.PlaySound(StormSound, player.position); + SoundEngine.PlaySound(StormSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -104,9 +104,9 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.LunarBar, 3). AddIngredient(40). AddIngredient(ItemID.FragmentSolar, 5). - AddIngredient(ItemID.LunarBar, 3). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index cd8ab0f804..1ac7984186 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -1,8 +1,12 @@ -using CalamityMod.NPCs.GreatSandShark; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.World; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.SummonItems { @@ -35,12 +39,12 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneDesert && !(CalamityWorld.getFixedBoi && !player.Calamity().ZoneAstral) && !NPC.AnyNPCs(ModContent.NPCType()); } public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -49,12 +53,26 @@ namespace CalamityMod.Items.SummonItems return true; } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine line0 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + + if (CalamityWorld.getFixedBoi) + { + line0.Text = "Summons the Great Sand Shark when used in the astral desert"; + } + else + { + line0.Text = "Summons the Great Sand Shark when used in the desert"; + } + } + public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Ectoplasm, 10). - AddIngredient(ItemID.HallowedBar, 5). AddIngredient(ItemID.AncientBattleArmorMaterial, 3). + AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/SummonItems/Seafood.cs b/Items/SummonItems/Seafood.cs index 7be26c0ca7..4788e039f8 100644 --- a/Items/SummonItems/Seafood.cs +++ b/Items/SummonItems/Seafood.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index 21859a039b..fa40cc0476 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - SoundEngine.PlaySound(SoundID.Roar, player.position); + SoundEngine.PlaySound(SoundID.Roar, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -55,9 +55,9 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.RottenChunk, 13). - AddIngredient(7). AddIngredient(ItemID.DemoniteBar, 3). + AddIngredient(7). + AddIngredient(ItemID.RottenChunk, 13). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/SummonItems/Terminus.cs b/Items/SummonItems/Terminus.cs index d2babf5322..c71d6b2cc4 100644 --- a/Items/SummonItems/Terminus.cs +++ b/Items/SummonItems/Terminus.cs @@ -1,4 +1,10 @@ -using CalamityMod.Projectiles.Typeless; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,17 +17,15 @@ namespace CalamityMod.Items.SummonItems { SacrificeTotal = 1; DisplayName.SetDefault("Terminus"); - Tooltip.SetDefault("A ritualistic artifact, thought to have brought upon The End many millennia ago\n" + - "Sealed away in the abyss, far from those that would seek to misuse it\n" + - "Activates Boss Rush Mode, using it again will deactivate Boss Rush Mode\n" + + Tooltip.SetDefault("Activates Boss Rush Mode, using it again will deactivate Boss Rush Mode\n" + "During the Boss Rush, all wires and wired devices will be disabled"); } public override void SetDefaults() { Item.rare = ItemRarityID.Blue; - Item.width = 28; - Item.height = 28; + Item.width = CalamityWorld.getFixedBoi ? 54 : 28; + Item.height = CalamityWorld.getFixedBoi ? 78 : 28; Item.useAnimation = 45; Item.useTime = 45; Item.channel = true; @@ -31,6 +35,46 @@ namespace CalamityMod.Items.SummonItems Item.consumable = false; } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (CalamityWorld.getFixedBoi) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value; + Color overlay = Color.White; + spriteBatch.Draw(texture, position, null, overlay, 0f, origin, scale, 0, 0); + return false; + } + else + return true; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + if (CalamityWorld.getFixedBoi) + { + Texture2D texture = ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, 1f, 0, 0); + return false; + } + else + return true; + } + + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine name = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "ItemName"); + + if (CalamityWorld.getFixedBoi) + { + name.Text = "Ogscule"; + } + else + { + name.Text = "Terminus"; + } + } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { // The wiki classifies Boss Rush as an event diff --git a/Items/SummonItems/Terminus_GFB.png b/Items/SummonItems/Terminus_GFB.png new file mode 100644 index 0000000000..3bb7740f0a Binary files /dev/null and b/Items/SummonItems/Terminus_GFB.png differ diff --git a/Items/SummonItems/JungleDragonEgg.cs b/Items/SummonItems/YharonEgg.cs similarity index 64% rename from Items/SummonItems/JungleDragonEgg.cs rename to Items/SummonItems/YharonEgg.cs index a228a3f624..0e014251b5 100644 --- a/Items/SummonItems/JungleDragonEgg.cs +++ b/Items/SummonItems/YharonEgg.cs @@ -9,18 +9,18 @@ using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems { - [LegacyName("ChickenEgg")] - public class JungleDragonEgg : ModItem + [LegacyName("ChickenEgg", "JungleDragonEgg")] + public class YharonEgg : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Jungle Dragon Egg"); - Tooltip.SetDefault("An imitation of the egg that bore the loyal guardian of the tyrant king\n" + - "Summons Jungle Dragon, Yharon when used in the Jungle\n" + + DisplayName.SetDefault("Blessed Phoenix Egg"); + Tooltip.SetDefault("An effigy of a Phoenix Dragon egg, used in worship\n" + + "Summons Yharon, Dragon of Rebirth\n" + "Enrages outside the fire walls\n" + "Not consumable"); - ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil + ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Celestial Sigil } public override void SetDefaults() @@ -34,19 +34,19 @@ namespace CalamityMod.Items.SummonItems Item.rare = ModContent.RarityType(); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; + } public override bool CanUseItem(Player player) { - return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; + return !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { - SoundEngine.PlaySound(Yharon.FireSound, player.position); + SoundEngine.PlaySound(Yharon.FireSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else @@ -59,7 +59,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe(). AddIngredient(15). - AddIngredient(15). + AddIngredient(10). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/SummonItems/JungleDragonEgg.png b/Items/SummonItems/YharonEgg.png similarity index 100% rename from Items/SummonItems/JungleDragonEgg.png rename to Items/SummonItems/YharonEgg.png diff --git a/Items/Tools/AbyssalWarhammer.cs b/Items/Tools/AbyssalWarhammer.cs index 8eb56084a1..a1bbbb1331 100644 --- a/Items/Tools/AbyssalWarhammer.cs +++ b/Items/Tools/AbyssalWarhammer.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Tools Item.height = 70; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Tools public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Frostburn2, 300); } } } diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index 9e5e4a6b5f..175b92e94f 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Tools Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/AstralHamaxe.cs b/Items/Tools/AstralHamaxe.cs index eb962c58f8..a21a1c7188 100644 --- a/Items/Tools/AstralHamaxe.cs +++ b/Items/Tools/AstralHamaxe.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Tools Item.height = 70; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/AstralPickaxe.cs b/Items/Tools/AstralPickaxe.cs index 82d1943edc..5335ce52aa 100644 --- a/Items/Tools/AstralPickaxe.cs +++ b/Items/Tools/AstralPickaxe.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools Item.height = 60; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 95, 0, 0); + Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/AxeofPurity.cs b/Items/Tools/AxeofPurity.cs index dc0ea0ae47..31ab7c0118 100644 --- a/Items/Tools/AxeofPurity.cs +++ b/Items/Tools/AxeofPurity.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - Item.damage = 75; + Item.damage = 55; Item.knockBack = 5f; Item.useTime = 15; Item.useAnimation = 15; @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Tools public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int powderDamage = (int)(0.85f * damage); - int idx = Projectile.NewProjectile(source, position, velocity, type, powderDamage, knockback, player.whoAmI, 0f, 0f); + int idx = Projectile.NewProjectile(source, position, velocity, type, powderDamage, knockback, player.whoAmI); Main.projectile[idx].DamageType = DamageClass.Melee; return false; } diff --git a/Items/Tools/BeastialPickaxe.cs b/Items/Tools/BeastialPickaxe.cs index 83a51d1a7d..c9ba18d1d3 100644 --- a/Items/Tools/BeastialPickaxe.cs +++ b/Items/Tools/BeastialPickaxe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools Item.height = 46; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/BerserkerWaraxe.cs b/Items/Tools/BerserkerWaraxe.cs index ee11174a99..76e93141fe 100644 --- a/Items/Tools/BerserkerWaraxe.cs +++ b/Items/Tools/BerserkerWaraxe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools Item.height = 56; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 60, 0, 0); + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index 646068e015..6c54fef9df 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -27,7 +27,7 @@ Pull Velocity: {BobbitHead.PullSpeed}"); Item.CloneDefaults(ItemID.AmethystHook); Item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. Item.shoot = ProjectileType(); - Item.value = Item.buyPrice(1, 40, 0, 0); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.rare = ModContent.RarityType(); Item.width = 30; Item.height = 32; diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 138e69c32e..1bff16ef08 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools Item.scale = 1.5f; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -35,16 +35,8 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.TungstenAxe). - AddIngredient(ItemID.TungstenBar, 10). - AddIngredient(ItemID.Wood, 15). - AddTile(TileID.Anvils). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.SilverAxe). - AddIngredient(ItemID.SilverBar, 10). - AddIngredient(ItemID.Wood, 15). + AddRecipeGroup("AnySilverBar", 18). + AddIngredient(ItemID.Wood, 18). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index 9247aa096d..8bdaa55c44 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Tools Item.width = 46; Item.height = 46; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 12, 0, 0); + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -38,9 +38,8 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). - AddIngredient(ItemID.Gel, 30). - AddIngredient(ItemID.HellstoneBar, 5). + AddIngredient(12). + AddIngredient(12). AddTile(). Register(); } diff --git a/Items/Tools/GenesisPickaxe.cs b/Items/Tools/GenesisPickaxe.cs index 40b718615c..fc12b46632 100644 --- a/Items/Tools/GenesisPickaxe.cs +++ b/Items/Tools/GenesisPickaxe.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Tools Item.height = 80; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(1, 0, 0, 0); + Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe() - .AddIngredient(2) + .AddIngredient(12) .AddIngredient(ItemID.LunarBar, 10) .AddTile(TileID.LunarCraftingStation) .Register(); diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index 7ad528da60..dc77e399b9 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -66,8 +66,6 @@ namespace CalamityMod.Items.Tools CreateRecipe(). AddIngredient(). AddRecipeGroup("LunarHamaxe"). - AddIngredient(10). - AddIngredient(5). AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Tools/GreatbayPickaxe.cs b/Items/Tools/GreatbayPickaxe.cs index d58d84a232..a7fe77800a 100644 --- a/Items/Tools/GreatbayPickaxe.cs +++ b/Items/Tools/GreatbayPickaxe.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Tools { SacrificeTotal = 1; DisplayName.SetDefault("Greatbay Pickaxe"); - Tooltip.SetDefault("Can mine Demonite, Crimtane and Meteorite"); + Tooltip.SetDefault("Can mine Demonite, Crimtane, Meteorite, Sea Prisms and Sea Prism Crystals"); } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index 3f1ce709db..9438b9f5de 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools Item.height = 66; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Tools CreateRecipe(). AddIngredient(). AddIngredient(ItemID.SoulofFright, 8). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } @@ -144,8 +144,7 @@ namespace CalamityMod.Items.Tools if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].DamageType = DamageClass.Melee; } - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(BuffID.OnFire3, 300); } } } diff --git a/Items/Tools/ReefclawHamaxe.cs b/Items/Tools/ReefclawHamaxe.cs index edca6a89e2..79347378cb 100644 --- a/Items/Tools/ReefclawHamaxe.cs +++ b/Items/Tools/ReefclawHamaxe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 2, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/SeismicHampick.cs b/Items/Tools/SeismicHampick.cs index 3cf87c773a..355d9114be 100644 --- a/Items/Tools/SeismicHampick.cs +++ b/Items/Tools/SeismicHampick.cs @@ -38,7 +38,7 @@ Right click to use as a hammer"); Item.height = 50; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -87,7 +87,7 @@ Right click to use as a hammer"); public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } } } diff --git a/Items/Tools/ShardlightPickaxe.cs b/Items/Tools/ShardlightPickaxe.cs index 3bad5b68ca..e6ba5b582b 100644 --- a/Items/Tools/ShardlightPickaxe.cs +++ b/Items/Tools/ShardlightPickaxe.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Tools Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 36, 0, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Tools public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Frostburn2, 300); } } } diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index 17090de8e6..5ab7dbacf7 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Tools Item.height = 44; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 4, 0, 0); + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Tools/TectonicTruncator.cs b/Items/Tools/TectonicTruncator.cs index b5fc61df97..527b91ca7e 100644 --- a/Items/Tools/TectonicTruncator.cs +++ b/Items/Tools/TectonicTruncator.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Tools Item.height = 50; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; - Item.value = Item.buyPrice(0, 80, 0, 0); + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Tools public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } } } diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index c9a662177b..2a4f8dfba5 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools Item.DamageType = DamageClass.Melee; Item.width = 46; Item.height = 38; - Item.value = Item.buyPrice(0, 1, 0, 0); + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item23; Item.autoReuse = true; diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneWaifuBag.cs index 4f41e696ad..4645443380 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneWaifuBag.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 5, 9); + itemLoot.Add(ModContent.ItemType(), 1, 5, 9); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] diff --git a/Items/TreasureBags/CalamitasBag.cs b/Items/TreasureBags/CalamitasCloneBag.cs similarity index 76% rename from Items/TreasureBags/CalamitasBag.cs rename to Items/TreasureBags/CalamitasCloneBag.cs index 55b7db282c..380dc37e3d 100644 --- a/Items/TreasureBags/CalamitasBag.cs +++ b/Items/TreasureBags/CalamitasCloneBag.cs @@ -6,7 +6,7 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -16,14 +16,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { - public class CalamitasBag : ModItem + [LegacyName("CalamitasBag")] + public class CalamitasCloneBag : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 3; - DisplayName.SetDefault("Treasure Bag (Calamitas)"); + DisplayName.SetDefault("Treasure Bag (Calamitas Clone)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -36,14 +37,14 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -54,12 +55,12 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 30, 35); - itemLoot.Add(ModContent.ItemType(), 1, 10, 15); + itemLoot.Add(ModContent.ItemType(), 1, 10, 15); // Weapons itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] @@ -77,7 +78,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.AddRevBagAccessories(); // Vanity - itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); var calamityRobes = ItemDropRule.Common(ModContent.ItemType(), 10); calamityRobes.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); itemLoot.Add(calamityRobes); diff --git a/Items/TreasureBags/CalamitasBag.png b/Items/TreasureBags/CalamitasCloneBag.png similarity index 100% rename from Items/TreasureBags/CalamitasBag.png rename to Items/TreasureBags/CalamitasCloneBag.png diff --git a/Items/TreasureBags/SupremeCalamitasCoffer.cs b/Items/TreasureBags/CalamitasCoffer.cs similarity index 82% rename from Items/TreasureBags/SupremeCalamitasCoffer.cs rename to Items/TreasureBags/CalamitasCoffer.cs index 10b61598e1..56575b1b18 100644 --- a/Items/TreasureBags/SupremeCalamitasCoffer.cs +++ b/Items/TreasureBags/CalamitasCoffer.cs @@ -18,15 +18,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { - [LegacyName("SCalBag")] - public class SupremeCalamitasCoffer : ModItem + [LegacyName("SCalBag", "SupremeCalamitasCoffer")] + public class CalamitasCoffer : ModItem { public override void SetStaticDefaults() { SacrificeTotal = 3; - DisplayName.SetDefault("Treasure Coffer (Supreme Calamitas)"); + DisplayName.SetDefault("Treasure Coffer (Calamitas)"); Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); - ItemID.Sets.BossBag[Item.type] = true; + ItemID.Sets.BossBag[Item.type] = true; } public override void SetDefaults() @@ -39,14 +39,14 @@ namespace CalamityMod.Items.TreasureBags Item.expert = true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossBags; + } public override bool CanRightClick() => true; - public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(lightColor, Color.White, 0.4f); public override void PostUpdate() => Item.TreasureBagLightAndDust(); @@ -57,8 +57,8 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { - // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + // Money + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 30, 40); diff --git a/Items/TreasureBags/SupremeCalamitasCoffer.png b/Items/TreasureBags/CalamitasCoffer.png similarity index 100% rename from Items/TreasureBags/SupremeCalamitasCoffer.png rename to Items/TreasureBags/CalamitasCoffer.png diff --git a/Items/TreasureBags/CryogenBag.cs b/Items/TreasureBags/CryogenBag.cs index 10b8ee4134..1d5275e68c 100644 --- a/Items/TreasureBags/CryogenBag.cs +++ b/Items/TreasureBags/CryogenBag.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.TreasureBags { ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), })); itemLoot.Add(ModContent.ItemType(), 10); diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index de11cbbbc7..64c6ac2ceb 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 30, 40); + itemLoot.Add(ModContent.ItemType(), 1, 55, 65); itemLoot.Add(ModContent.ItemType(), 1, 200, 320); // Weapons diff --git a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs index f774495c49..4603299658 100644 --- a/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs +++ b/Items/TreasureBags/MiscGrabBags/AbyssalTreasure.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags ItemID.WaterWalkingPotion, ItemID.GravitationPotion, ItemID.RegenerationPotion, - ModContent.ItemType(), ModContent.ItemType(), ItemID.GillsPotion, ItemID.EndurancePotion, diff --git a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs index 53e0d86e5b..ba49a2884c 100644 --- a/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs +++ b/Items/TreasureBags/MiscGrabBags/BleachedAnglingKit.cs @@ -35,36 +35,38 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { // Different drop rates on Normal and Expert, so define normal first, then expert var normalOnly = itemLoot.DefineNormalOnlyDropSet(); - normalOnly.Add(ItemID.AnglerTackleBag, 18); - normalOnly.Add(ItemID.HighTestFishingLine, 12); - normalOnly.Add(ItemID.TackleBox, 12); - normalOnly.Add(ItemID.AnglerEarring, 12); - normalOnly.Add(ItemID.FishermansGuide, 9); - normalOnly.Add(ItemID.WeatherRadio, 9); - normalOnly.Add(ItemID.Sextant, 9); - normalOnly.Add(ItemID.AnglerHat, 4); - normalOnly.Add(ItemID.AnglerVest, 4); - normalOnly.Add(ItemID.AnglerPants, 4); - normalOnly.Add(ItemID.FishingPotion, 4, 2, 3); - normalOnly.Add(ItemID.SonarPotion, 4, 2, 3); - normalOnly.Add(ItemID.CratePotion, 4, 2, 3); - normalOnly.Add(ItemID.GoldenBugNet, 15); + normalOnly.Add(ItemID.AnglerTackleBag, 72); + normalOnly.Add(ItemID.HighTestFishingLine, 48); + normalOnly.Add(ItemID.TackleBox, 48); + normalOnly.Add(ItemID.AnglerEarring, 48); + normalOnly.Add(ItemID.FishermansGuide, 36); + normalOnly.Add(ItemID.WeatherRadio, 36); + normalOnly.Add(ItemID.Sextant, 36); + normalOnly.Add(ItemID.AnglerHat, 16); + normalOnly.Add(ItemID.AnglerVest, 16); + normalOnly.Add(ItemID.AnglerPants, 16); + normalOnly.Add(ItemID.FishingPotion, 3, 2, 3); + normalOnly.Add(ItemID.SonarPotion, 3, 2, 3); + normalOnly.Add(ItemID.CratePotion, 3, 2, 3); + normalOnly.Add(ItemID.GoldenBugNet, 60); + normalOnly.Add(ItemID.GoldCoin, 1, 3, 4); var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); - expertPlus.Add(ItemID.AnglerTackleBag, 15); - expertPlus.Add(ItemID.HighTestFishingLine, 10); - expertPlus.Add(ItemID.TackleBox, 10); - expertPlus.Add(ItemID.AnglerEarring, 10); - expertPlus.Add(ItemID.FishermansGuide, 8); - expertPlus.Add(ItemID.WeatherRadio, 8); - expertPlus.Add(ItemID.Sextant, 8); - expertPlus.Add(ItemID.AnglerHat, 2); - expertPlus.Add(ItemID.AnglerVest, 2); - expertPlus.Add(ItemID.AnglerPants, 2); + expertPlus.Add(ItemID.AnglerTackleBag, 58); + expertPlus.Add(ItemID.HighTestFishingLine, 38); + expertPlus.Add(ItemID.TackleBox, 38); + expertPlus.Add(ItemID.AnglerEarring, 38); + expertPlus.Add(ItemID.FishermansGuide, 28); + expertPlus.Add(ItemID.WeatherRadio, 28); + expertPlus.Add(ItemID.Sextant, 28); + expertPlus.Add(ItemID.AnglerHat, 12); + expertPlus.Add(ItemID.AnglerVest, 12); + expertPlus.Add(ItemID.AnglerPants, 12); expertPlus.Add(ItemID.FishingPotion, 2, 2, 3); expertPlus.Add(ItemID.SonarPotion, 2, 2, 3); expertPlus.Add(ItemID.CratePotion, 2, 2, 3); - expertPlus.Add(ItemID.GoldenBugNet, 12); + expertPlus.Add(ItemID.GoldenBugNet, 48); + expertPlus.Add(ItemID.GoldCoin, 1, 4, 5); } } } diff --git a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs index 25ee21cd45..94eda798b8 100644 --- a/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs +++ b/Items/TreasureBags/MiscGrabBags/FleshyGeode.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags normalOnly.Add(ModContent.ItemType(), 1, 1, 3); normalOnly.Add(ModContent.ItemType(), 1, 1, 2); normalOnly.Add(ModContent.ItemType(), 1, 1, 2); - normalOnly.Add(ModContent.ItemType(), 1, 1, 2); + normalOnly.Add(ModContent.ItemType(), 1, 1, 2); var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); expertPlus.Add(ModContent.ItemType(), 1, 2, 3); @@ -51,7 +51,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags expertPlus.Add(ModContent.ItemType(), 1, 2, 3); expertPlus.Add(ModContent.ItemType(), 1, 1, 3); expertPlus.Add(ModContent.ItemType(), 1, 1, 3); - expertPlus.Add(ModContent.ItemType(), 1, 1, 3); + expertPlus.Add(ModContent.ItemType(), 1, 1, 3); } } } diff --git a/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs index 528913fc18..3b86317598 100644 --- a/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs +++ b/Items/TreasureBags/MiscGrabBags/NecromanticGeode.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags normalOnly.Add(ModContent.ItemType(), 1, 5, 10); normalOnly.Add(ModContent.ItemType(), 1, 1, 3); normalOnly.Add(ModContent.ItemType(), 1, 1, 3); - normalOnly.Add(ModContent.ItemType(), 1, 1, 3); + normalOnly.Add(ModContent.ItemType(), 1, 1, 3); normalOnly.Add(ModContent.ItemType(), 2); normalOnly.Add(ModContent.ItemType(), 3); normalOnly.Add(ModContent.ItemType(), 1, 100, 120); @@ -58,7 +58,7 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags expertPlus.Add(ModContent.ItemType(), 1, 7, 12); expertPlus.Add(ModContent.ItemType(), 1, 2, 4); expertPlus.Add(ModContent.ItemType(), 1, 2, 4); - expertPlus.Add(ModContent.ItemType(), 1, 2, 4); + expertPlus.Add(ModContent.ItemType(), 1, 2, 4); expertPlus.Add(ModContent.ItemType()); expertPlus.Add(ModContent.ItemType(), 2); expertPlus.Add(ModContent.ItemType(), 1, 120, 140); diff --git a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs index 80dbd4e322..5d6d65bbd4 100644 --- a/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs +++ b/Items/TreasureBags/MiscGrabBags/SandyAnglingKit.cs @@ -35,34 +35,36 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags { // Different drop rates on Normal and Expert, so define normal first, then expert var normalOnly = itemLoot.DefineNormalOnlyDropSet(); - normalOnly.Add(ItemID.HighTestFishingLine, 15); - normalOnly.Add(ItemID.TackleBox, 15); - normalOnly.Add(ItemID.AnglerEarring, 15); - normalOnly.Add(ItemID.FishermansGuide, 10); - normalOnly.Add(ItemID.WeatherRadio, 10); - normalOnly.Add(ItemID.Sextant, 10); - normalOnly.Add(ItemID.AnglerHat, 5); - normalOnly.Add(ItemID.AnglerVest, 5); - normalOnly.Add(ItemID.AnglerPants, 5); - normalOnly.Add(ItemID.FishingPotion, 5, 2, 3); - normalOnly.Add(ItemID.SonarPotion, 5, 2, 3); - normalOnly.Add(ItemID.CratePotion, 5, 2, 3); - normalOnly.AddIf(() => NPC.downedBoss3, ItemID.GoldenBugNet, 20); + normalOnly.Add(ItemID.HighTestFishingLine, 60); + normalOnly.Add(ItemID.TackleBox, 60); + normalOnly.Add(ItemID.AnglerEarring, 60); + normalOnly.Add(ItemID.FishermansGuide, 40); + normalOnly.Add(ItemID.WeatherRadio, 40); + normalOnly.Add(ItemID.Sextant, 40); + normalOnly.Add(ItemID.AnglerHat, 20); + normalOnly.Add(ItemID.AnglerVest, 20); + normalOnly.Add(ItemID.AnglerPants, 20); + normalOnly.Add(ItemID.FishingPotion, 3, 2, 3); + normalOnly.Add(ItemID.SonarPotion, 3, 2, 3); + normalOnly.Add(ItemID.CratePotion, 3, 2, 3); + normalOnly.AddIf(() => NPC.downedBoss3, ItemID.GoldenBugNet, 80); + normalOnly.Add(ItemID.GoldCoin, 1, 1, 2); var expertPlus = itemLoot.DefineConditionalDropSet(new Conditions.IsExpert()); - expertPlus.Add(ItemID.HighTestFishingLine, 12); - expertPlus.Add(ItemID.TackleBox, 12); - expertPlus.Add(ItemID.AnglerEarring, 12); - expertPlus.Add(ItemID.FishermansGuide, 9); - expertPlus.Add(ItemID.WeatherRadio, 9); - expertPlus.Add(ItemID.Sextant, 9); - expertPlus.Add(ItemID.AnglerHat, 4); - expertPlus.Add(ItemID.AnglerVest, 4); - expertPlus.Add(ItemID.AnglerPants, 4); - expertPlus.Add(ItemID.FishingPotion, 4, 2, 3); - expertPlus.Add(ItemID.SonarPotion, 4, 2, 3); - expertPlus.Add(ItemID.CratePotion, 4, 2, 3); - expertPlus.AddIf(() => NPC.downedBoss3, ItemID.GoldenBugNet, 18); + expertPlus.Add(ItemID.HighTestFishingLine, 48); + expertPlus.Add(ItemID.TackleBox, 48); + expertPlus.Add(ItemID.AnglerEarring, 48); + expertPlus.Add(ItemID.FishermansGuide, 32); + expertPlus.Add(ItemID.WeatherRadio, 32); + expertPlus.Add(ItemID.Sextant, 32); + expertPlus.Add(ItemID.AnglerHat, 16); + expertPlus.Add(ItemID.AnglerVest, 16); + expertPlus.Add(ItemID.AnglerPants, 16); + expertPlus.Add(ItemID.FishingPotion, 2, 2, 3); + expertPlus.Add(ItemID.SonarPotion, 2, 2, 3); + expertPlus.Add(ItemID.CratePotion, 2, 2, 3); + expertPlus.AddIf(() => NPC.downedBoss3, ItemID.GoldenBugNet, 64); + expertPlus.Add(ItemID.GoldCoin, 1, 2, 3); } } } diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index c88cb14537..3515a8b442 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Pets; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Pets; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using Terraria; @@ -67,6 +68,9 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags if (musicMod is not null) itemLoot.Add(musicMod.Find("CalamityMusicbox").Type); + // Awakening lore item + itemLoot.Add(ModContent.ItemType()); + // Aleksh donator item // Name specific: "Aleksh" or "Shark Lad" static bool getsLadPet(DropAttemptInfo info) diff --git a/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs index 3fd13d87f9..97d94b1cac 100644 --- a/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs +++ b/Items/TreasureBags/MiscGrabBags/SulphuricTreasure.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags ItemID.WaterWalkingPotion, ItemID.GravitationPotion, ItemID.RegenerationPotion, - ModContent.ItemType(), ModContent.ItemType(), ItemID.GillsPotion, ItemID.EndurancePotion, diff --git a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs index ed6f00a5d0..cd726e457a 100644 --- a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Adamantite"; public const int MaxManaBoost = 20; - public const int DefenseBoostMax = 30; + public const int DefenseBoostMax = 15; public const int TimeUntilDecayBeginsAfterAttacking = 60; public const int TimeUntilBoostCompletelyDecays = 210; diff --git a/Items/VanillaArmorChanges/CobaltArmorSetChange.cs b/Items/VanillaArmorChanges/CobaltArmorSetChange.cs index b1b450c1b0..87bf0c8f78 100644 --- a/Items/VanillaArmorChanges/CobaltArmorSetChange.cs +++ b/Items/VanillaArmorChanges/CobaltArmorSetChange.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public const int SpeedBoostSetBonusPercentage = 10; public const int MaxManaBoost = 20; public const int MovementSpeedBoostPercentageMax = 10; - public const int MovementSpeedBoostMphThreshold = 60; + public const int MovementSpeedBoostMphThreshold = 80; public override void ApplyHeadPieceEffect(Player player) { diff --git a/Items/VanillaArmorChanges/CopperArmorSetChange.cs b/Items/VanillaArmorChanges/CopperArmorSetChange.cs index f94f75dd20..fa2f673f9b 100644 --- a/Items/VanillaArmorChanges/CopperArmorSetChange.cs +++ b/Items/VanillaArmorChanges/CopperArmorSetChange.cs @@ -19,8 +19,6 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float ChestCrit = 3f; public const float LegsMoveSpeed = 0.05f; public const float SetBonusFlatDamage = 2.0f; - public const float SetBonusMoveSpeed = 0.1f; - public const int SetBonusMiningSpeedPercent = 25; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; @@ -31,16 +29,13 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void UpdateSetBonusText(ref string setBonusText) { StringBuilder sb = new StringBuilder(256); - sb.Append("\nIncreases all damage by 2\n10% increased movement speed"); - sb.Append(CalamityGlobalItem.MiningSpeedString(SetBonusMiningSpeedPercent)); + sb.Append("\nIncreases all damage by 2"); setBonusText += sb.ToString(); } public override void ApplyArmorSetBonus(Player player) { player.GetDamage().Flat += SetBonusFlatDamage; - player.moveSpeed += SetBonusMoveSpeed; - player.pickSpeed -= SetBonusMiningSpeedPercent * 0.01f; } } } diff --git a/Items/VanillaArmorChanges/CrimsonArmorSetChange.cs b/Items/VanillaArmorChanges/CrimsonArmorSetChange.cs index d5480c7be8..4ca629769a 100644 --- a/Items/VanillaArmorChanges/CrimsonArmorSetChange.cs +++ b/Items/VanillaArmorChanges/CrimsonArmorSetChange.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.VanillaArmorChanges private void ApplyAnyPieceEffect(Player player) { + // TODO -- CHANGE THIS TO 3% IN THE 1.4.4 PORT // Remove the vanilla +2% damage and add the new damage value at the same time player.GetDamage() += ArmorPieceDamage - 0.02f; diff --git a/Items/VanillaArmorChanges/EskimoArmorSetChange.cs b/Items/VanillaArmorChanges/EskimoArmorSetChange.cs index d4117a6918..198ea5aa23 100644 --- a/Items/VanillaArmorChanges/EskimoArmorSetChange.cs +++ b/Items/VanillaArmorChanges/EskimoArmorSetChange.cs @@ -26,15 +26,20 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void UpdateSetBonusText(ref string setBonusText) { - // Not sure why it doesn't say Set bonus automatically + // Not sure why it doesn't say Set bonus automatically setBonusText = "Set bonus: Multiplies all cold-based debuff damage by 1.25\n" + "Cold enemies will deal reduced contact damage to the player\n" + - "Provides immunity to the Frostburn and Glacial State debuffs"; + "Provides immunity to the Chilled, Frozen, Frostburn and Glacial State debuffs"; } public override void ApplyArmorSetBonus(Player player) { player.Calamity().eskimoSet = true; + + // TODO -- DELETE THE FOLLOWING 2 LINES IN THE 1.4.4 PORT + player.buffImmune[BuffID.Chilled] = true; + player.buffImmune[BuffID.Frozen] = true; + player.buffImmune[BuffID.Frostburn] = true; player.buffImmune[ModContent.BuffType()] = true; } diff --git a/Items/VanillaArmorChanges/GoldArmorSetChange.cs b/Items/VanillaArmorChanges/GoldArmorSetChange.cs index e67222f0f1..de69a79da7 100644 --- a/Items/VanillaArmorChanges/GoldArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GoldArmorSetChange.cs @@ -19,11 +19,10 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float HeadDamage = 0.06f; public const float ChestDR = 0.05f; - public const float LegsMoveSpeed = 0.12f; + public const float LegsMoveSpeed = 0.1f; public const float GoldDropChanceFromEnemies = 0.04f; public const int GoldFromBosses = 3; public const float SetBonusCritPerGoldCoin = 0.2f; // 5 gold coins = +1% crit chance - public const int SetBonusMiningSpeedPercent = 25; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; @@ -35,7 +34,6 @@ namespace CalamityMod.Items.VanillaArmorChanges { StringBuilder sb = new StringBuilder(256); sb.Append("\nAll enemies have a 4% chance to drop 1 gold. All bosses killed drop 3 gold\nYou gain 1% critical strike chance for every 5 gold in your inventory, capped at 10%"); - sb.Append(CalamityGlobalItem.MiningSpeedString(SetBonusMiningSpeedPercent)); setBonusText += sb.ToString(); } @@ -55,7 +53,6 @@ namespace CalamityMod.Items.VanillaArmorChanges } player.GetCritChance() += critFromGold; - player.pickSpeed -= SetBonusMiningSpeedPercent * 0.01f; } } } diff --git a/Items/VanillaArmorChanges/IronArmorSetChange.cs b/Items/VanillaArmorChanges/IronArmorSetChange.cs index f64cc53475..5a16cb1d9d 100644 --- a/Items/VanillaArmorChanges/IronArmorSetChange.cs +++ b/Items/VanillaArmorChanges/IronArmorSetChange.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float ArmorPieceDR = 0.03f; public const float SetBonusDR = 0.06f; public const int SetBonusLifeRegen = 2; - public const int SetBonusMiningSpeedPercent = 25; public override void ApplyHeadPieceEffect(Player player) => player.endurance += ArmorPieceDR; @@ -31,7 +30,6 @@ namespace CalamityMod.Items.VanillaArmorChanges { StringBuilder sb = new StringBuilder(256); sb.Append("\nReduces damage taken by 6%\n+2 life regen"); - sb.Append(CalamityGlobalItem.MiningSpeedString(SetBonusMiningSpeedPercent)); setBonusText += sb.ToString(); } @@ -39,7 +37,6 @@ namespace CalamityMod.Items.VanillaArmorChanges { player.endurance += SetBonusDR; player.lifeRegen += SetBonusLifeRegen; - player.pickSpeed -= SetBonusMiningSpeedPercent * 0.01f; } } } diff --git a/Items/VanillaArmorChanges/LeadArmorSetChange.cs b/Items/VanillaArmorChanges/LeadArmorSetChange.cs index 46efe04d53..03f649fc89 100644 --- a/Items/VanillaArmorChanges/LeadArmorSetChange.cs +++ b/Items/VanillaArmorChanges/LeadArmorSetChange.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float ArmorPieceDR = 0.03f; public const float SetBonusDR = 0.03f; public const int SetBonusLifeRegen = 1; - public const int SetBonusMiningSpeedPercent = 25; public override void ApplyHeadPieceEffect(Player player) => player.endurance += ArmorPieceDR; @@ -29,7 +28,6 @@ namespace CalamityMod.Items.VanillaArmorChanges { StringBuilder sb = new StringBuilder(256); sb.Append("\nReduces damage taken by 3%\n+1 life regen\nGrants immunity to knockback"); - sb.Append(CalamityGlobalItem.MiningSpeedString(SetBonusMiningSpeedPercent)); setBonusText += sb.ToString(); } @@ -38,7 +36,6 @@ namespace CalamityMod.Items.VanillaArmorChanges player.endurance += SetBonusDR; player.lifeRegen += SetBonusLifeRegen; player.noKnockback = true; - player.pickSpeed -= SetBonusMiningSpeedPercent * 0.01f; } } } diff --git a/Items/VanillaArmorChanges/MiningArmorSetChange.cs b/Items/VanillaArmorChanges/MiningArmorSetChange.cs index 4d1cb47a71..ba6bafc054 100644 --- a/Items/VanillaArmorChanges/MiningArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MiningArmorSetChange.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,22 +15,18 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Mining"; - public const float MiningSpeed = 0.4f; public const int BonusOreChance = 4; public const int CooldownMin = 180; public const int CooldownMax = 360; public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText = setBonusText.Replace("30%", "40%"); - setBonusText += "\nMining ore will sometimes have additional yield"; + setBonusText += "\nMining ore will sometimes have additional yield"; } public override void ApplyArmorSetBonus(Player player) { - // Remove the vanilla +30% pick speed and add (subtract?) the new pick speed value at the same time - player.pickSpeed -= MiningSpeed + 0.3f; - player.Calamity().miningSet = true; + player.Calamity().miningSet = true; } } } diff --git a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs index 359a72a64a..f9da6d3217 100644 --- a/Items/VanillaArmorChanges/MythrilArmorSetChange.cs +++ b/Items/VanillaArmorChanges/MythrilArmorSetChange.cs @@ -19,10 +19,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Mythril"; public const int MaxManaBoost = 20; - public const int ChestplateDamagePercentageBoost = 5; - public const int LeggingsCritChanceBoost = 4; - public const int FlareFrameSpawnDelay = 9; - public const int FlareDamageSoftcap = 105; + public const int FlareFrameSpawnDelay = 12; + public const int FlareDamageSoftcap = 50; public override void UpdateSetBonusText(ref string setBonusText) { @@ -36,13 +34,6 @@ namespace CalamityMod.Items.VanillaArmorChanges player.statManaMax2 += MaxManaBoost; } - public override void ApplyBodyPieceEffect(Player player) - { - player.GetDamage() += ChestplateDamagePercentageBoost * 0.01f; - } - - public override void ApplyLegPieceEffect(Player player) => player.GetCritChance() += LeggingsCritChanceBoost; - public override void ApplyArmorSetBonus(Player player) { player.Calamity().MythrilSet = true; diff --git a/Items/VanillaArmorChanges/PalladiumArmorSetChange.cs b/Items/VanillaArmorChanges/PalladiumArmorSetChange.cs index 0a1537e259..7d0756257c 100644 --- a/Items/VanillaArmorChanges/PalladiumArmorSetChange.cs +++ b/Items/VanillaArmorChanges/PalladiumArmorSetChange.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Palladium"; - public const int ChestplateDamagePercentageBoost = 4; - public const int LeggingsDamagePercentageBoost = 5; + public const int ChestplateDamagePercentageBoost = 2; + public const int LeggingsDamagePercentageBoost = 3; public override void ApplyBodyPieceEffect(Player player) { diff --git a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs index 4fc64c48bf..19b239eb06 100644 --- a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs +++ b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs @@ -17,11 +17,10 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float HeadDamage = 0.06f; public const float ChestCrit = 5f; - public const float LegsMoveSpeed = 0.12f; + public const float LegsMoveSpeed = 0.1f; public const float SetBonusLifeRegenPerDefense = 0.0666667f; // 15 defense = +1 life regen public const float SetBonusCritPerDefense = 0.0666667f; // 15 defense = +1% crit chance public const int SetBonusDefenseCap = 45; - public const int SetBonusMiningSpeedPercent = 25; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; @@ -32,8 +31,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void UpdateSetBonusText(ref string setBonusText) { StringBuilder sb = new StringBuilder(256); - sb.Append("\nEvery 15 defense gives you +1 life regen\nEvery 15 defense gives you 1% increased critical strike chance\nThese effects both cap at 45 defense"); - sb.Append(CalamityGlobalItem.MiningSpeedString(SetBonusMiningSpeedPercent)); + sb.Append("\nEvery 15 defense gives you +1 life regen and 1% increased critical strike chance\nThese effects both cap at 45 defense"); setBonusText += sb.ToString(); } @@ -44,7 +42,6 @@ namespace CalamityMod.Items.VanillaArmorChanges defense = SetBonusDefenseCap; player.lifeRegen += (int)(defense * SetBonusLifeRegenPerDefense); player.GetCritChance() += defense * SetBonusCritPerDefense; - player.pickSpeed -= SetBonusMiningSpeedPercent * 0.01f; } } } diff --git a/Items/VanillaArmorChanges/SilverArmorSetChange.cs b/Items/VanillaArmorChanges/SilverArmorSetChange.cs index 0c3fbe50a3..e7fa03d65f 100644 --- a/Items/VanillaArmorChanges/SilverArmorSetChange.cs +++ b/Items/VanillaArmorChanges/SilverArmorSetChange.cs @@ -16,11 +16,10 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Silver"; - public const float HeadCrit = 6f; + public const float HeadCrit = 5f; public const int ChestLifeRegen = 2; - public const float LegsMoveSpeed = 0.1f; + public const float LegsMoveSpeed = 0.08f; public const int SetBonusLifeRegen = 1; - public const int SetBonusMiningSpeedPercent = 25; public const double SetBonusMinimumDamageToHeal = 20.0; public const int SetBonusHealTime = 120; @@ -36,7 +35,6 @@ namespace CalamityMod.Items.VanillaArmorChanges { StringBuilder sb = new StringBuilder(256); sb.Append("\n+1 life regen\nTwo seconds after getting hit for 20 or more damage, you heal for 10\nGetting hit again resets the timer, delaying the heal"); - sb.Append(CalamityGlobalItem.MiningSpeedString(SetBonusMiningSpeedPercent)); setBonusText += sb.ToString(); } @@ -44,7 +42,6 @@ namespace CalamityMod.Items.VanillaArmorChanges { player.lifeRegen += SetBonusLifeRegen; player.Calamity().silverMedkit = true; - player.pickSpeed -= SetBonusMiningSpeedPercent * 0.01f; } internal static void OnHealEffects(Entity entity) diff --git a/Items/VanillaArmorChanges/TinArmorSetChange.cs b/Items/VanillaArmorChanges/TinArmorSetChange.cs index e0dce48987..2d7c838e2b 100644 --- a/Items/VanillaArmorChanges/TinArmorSetChange.cs +++ b/Items/VanillaArmorChanges/TinArmorSetChange.cs @@ -17,10 +17,8 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float HeadCrit = 4f; public const int ChestLifeRegen = 1; - public const float LegsMoveSpeed = 0.1f; + public const float LegsMoveSpeed = 0.05f; public const float SetBonusArmorPen = 5.0f; - public const int SetBonusLifeRegen = 1; - public const int SetBonusMiningSpeedPercent = 25; public override void ApplyHeadPieceEffect(Player player) => player.GetCritChance() += HeadCrit; @@ -31,16 +29,13 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void UpdateSetBonusText(ref string setBonusText) { StringBuilder sb = new StringBuilder(256); - sb.Append("\nIncreases armor penetration by 5\n+1 life regen"); - sb.Append(CalamityGlobalItem.MiningSpeedString(SetBonusMiningSpeedPercent)); + sb.Append("\nIncreases armor penetration by 5"); setBonusText += sb.ToString(); } public override void ApplyArmorSetBonus(Player player) { player.GetArmorPenetration() += SetBonusArmorPen; - player.lifeRegen += SetBonusLifeRegen; - player.pickSpeed -= SetBonusMiningSpeedPercent * 0.01f; } } } diff --git a/Items/VanillaArmorChanges/TungstenArmorSetChange.cs b/Items/VanillaArmorChanges/TungstenArmorSetChange.cs index 1c5a2b392a..597efa2bfa 100644 --- a/Items/VanillaArmorChanges/TungstenArmorSetChange.cs +++ b/Items/VanillaArmorChanges/TungstenArmorSetChange.cs @@ -18,10 +18,9 @@ namespace CalamityMod.Items.VanillaArmorChanges public const float HeadDamage = 0.07f; public const int ChestLifeRegen = 1; - public const float LegsMoveSpeed = 0.1f; + public const float LegsMoveSpeed = 0.08f; public const float KnockbackMultiplier = 1.33f; public const float MaxKnockbackCritConversion = 10f; - public const int SetBonusMiningSpeedPercent = 25; public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; @@ -44,7 +43,6 @@ namespace CalamityMod.Items.VanillaArmorChanges sb.Append("% critical strike chance from "); sb.Append(kb.ToString("n2")); sb.Append(" knockback"); - sb.Append(CalamityGlobalItem.MiningSpeedString(SetBonusMiningSpeedPercent)); setBonusText += sb.ToString(); } @@ -56,8 +54,6 @@ namespace CalamityMod.Items.VanillaArmorChanges // Give the player crit chance equal to the (now boosted) knockback of their held weapon. float kbToUse = player.GetWeaponKnockback(player.ActiveItem()); player.GetCritChance() += MathHelper.Clamp(kbToUse, 0f, MaxKnockbackCritConversion); - - player.pickSpeed -= SetBonusMiningSpeedPercent * 0.01f; } } } diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index d2c70c925b..9943c07297 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -31,13 +31,12 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 56; Item.height = 52; - Item.damage = 100; + Item.damage = 130; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 21; - Item.useTime = 21; + Item.useAnimation = Item.useTime = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 9f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs b/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs index d0277a0c70..63134c0205 100644 --- a/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/HeavyLaserRifle.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 84; Item.height = 28; Item.DamageType = DamageClass.Ranged; - Item.damage = 185; + Item.damage = 210; Item.knockBack = 4f; Item.useTime = 25; Item.useAnimation = 25; diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs index 2f381d55db..c41e1c0ee5 100644 --- a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -106,10 +106,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void AddRecipes() { CreateRecipe() - .AddIngredient() + .AddIngredient(20) + .AddIngredient(20) .AddIngredient(8) - .AddIngredient(16) - .AddIngredient(16) .AddIngredient(2) .AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(5, out Predicate condition), condition) .AddTile() diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index fe38891302..8e6145e363 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -1,5 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Projectiles.Magic; @@ -38,6 +40,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 14f; } + 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 * 4.5f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + + return false; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask").Value); diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 1ac36ecd0f..9abfc83033 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -72,8 +72,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). AddIngredient(35). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index 38c1e51562..76c3fe58dd 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item9; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index 9023df999c..5fff530b31 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ArchAmaryllis.cs b/Items/Weapons/Magic/ArchAmaryllis.cs index 4480ad2115..8948a6ca5e 100644 --- a/Items/Weapons/Magic/ArchAmaryllis.cs +++ b/Items/Weapons/Magic/ArchAmaryllis.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.FragmentNebula, 10). + AddIngredient(ItemID.FragmentNebula, 12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/ArcticBearPaw.cs b/Items/Weapons/Magic/ArcticBearPaw.cs index d022b5f7b0..70cd43533c 100644 --- a/Items/Weapons/Magic/ArcticBearPaw.cs +++ b/Items/Weapons/Magic/ArcticBearPaw.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Arctic Bear Paw"); Tooltip.SetDefault(@"The savage mauling that fits in your pocket -Fires spiritual claws that ignore walls and confuse enemies"); +Fires spiritual claws that ignore walls"); SacrificeTotal = 1; } public override void SetDefaults() @@ -27,7 +27,7 @@ Fires spiritual claws that ignore walls and confuse enemies"); Item.useTurn = false; Item.noMelee = true; Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ArtAttack.cs b/Items/Weapons/Magic/ArtAttack.cs index e57451a97c..51aa97cb70 100644 --- a/Items/Weapons/Magic/ArtAttack.cs +++ b/Items/Weapons/Magic/ArtAttack.cs @@ -8,8 +8,8 @@ namespace CalamityMod.Items.Weapons.Magic { public class ArtAttack : ModItem { - public const int MaxDamageBoostTime = 270; - public const float MaxDamageBoostFactor = 2.3f; + public const int MaxDamageBoostTime = 300; + public const float MaxDamageBoostFactor = 25f; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/ArtAttackCast"); public override void SetStaticDefaults() { @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 470; + Item.damage = 80; Item.DamageType = DamageClass.Magic; Item.mana = 10; Item.width = 70; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; - Item.UseSound = UseSound; + Item.UseSound = null; Item.autoReuse = true; Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index 78566748c9..84f7c6b274 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item34; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/AuguroftheElements.cs b/Items/Weapons/Magic/AuguroftheElements.cs index 223dc1d919..3e33086f30 100644 --- a/Items/Weapons/Magic/AuguroftheElements.cs +++ b/Items/Weapons/Magic/AuguroftheElements.cs @@ -67,11 +67,12 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). AddIngredient(). AddIngredient(ItemID.ShadowFlameHexDoll). - AddIngredient(5). + AddIngredient(). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index 9481aecf0d..c795981a36 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index 5edc645fc6..c1aafa4bac 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -100,9 +100,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.CrimtaneBar, 2). AddIngredient(8). AddIngredient(ItemID.Vertebrae, 3). - AddIngredient(ItemID.CrimtaneBar, 2). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index 071bea7217..bde42ffe85 100644 --- a/Items/Weapons/Magic/BrimroseStaff.cs +++ b/Items/Weapons/Magic/BrimroseStaff.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,24 +18,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 15; - Item.DamageType = DamageClass.Magic; - Item.mana = 6; Item.width = 36; Item.height = 34; + Item.damage = 45; + Item.DamageType = DamageClass.Magic; + Item.mana = 6; Item.useTime = 16; Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item43; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; } - public override void AddRecipes() { diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 9817be5dba..7698837490 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 72; + Item.damage = 75; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.width = 28; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/CarnageRay.cs b/Items/Weapons/Magic/CarnageRay.cs index 2621cd3935..d4f2587c66 100644 --- a/Items/Weapons/Magic/CarnageRay.cs +++ b/Items/Weapons/Magic/CarnageRay.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.MagicMissile). AddIngredient(ItemID.WandofSparking). AddIngredient(ItemID.AmberStaff). - AddIngredient(15). AddIngredient(10). AddTile(TileID.DemonAltar). Register(); diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index 64e898c3b4..4c99dba5e1 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -34,7 +34,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.2f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item105; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/CoralSpout.cs b/Items/Weapons/Magic/CoralSpout.cs index 63d3ceb286..06631e2c58 100644 --- a/Items/Weapons/Magic/CoralSpout.cs +++ b/Items/Weapons/Magic/CoralSpout.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic "Grabbing the chunk of coral after it falls from the enemy replenishes 150 mana\n" + "The mana-charged coral also provides a buff that increases the coral's damage and the convergence speed\n" + //Lore tooltip time. Sekiro. - "[c/5C95A1:Knowledge is important, and the Old Sea Kingdom’s many scribes knew it had to be preserved at any cost.]\n" + + "[c/5C95A1:Knowledge is important, and the Old Sea Kingdom's many scribes knew it had to be preserved at any cost.]\n" + "[c/5C95A1:Their libraries were much larger than most, because of the water-proof stone tablets occupying them.]" ); SacrificeTotal = 1; diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index 64dfe24294..257cb464d4 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -111,9 +111,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.RainbowGun). AddIngredient(ItemID.PearlwoodBow). - AddIngredient(5). - AddIngredient(). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index 9861f2bb5e..7cff5d3e82 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item117; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index 805eaf2635..96d5f5c850 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item20; Item.autoReuse = true; @@ -39,11 +38,10 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(ItemID.SpellTome). AddRecipeGroup("AnyAdamantiteBar", 5). AddIngredient(ItemID.AncientBattleArmorMaterial). AddIngredient(ItemID.FossilOre, 25). - AddIngredient(5). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs index 5e1f41bf5b..d77d2be6c0 100644 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ b/Items/Weapons/Magic/DivineRetribution.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 39; + Item.damage = 48; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.width = 66; diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index 519d4f9b56..c3dc4e665d 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 9d79b61d54..95de721902 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 49; + Item.damage = 64; Item.DamageType = DamageClass.Magic; Item.mana = 17; Item.width = 56; @@ -54,7 +54,6 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.BubbleGun). - AddIngredient(ItemID.Xenopopper). AddIngredient(ItemID.LunarBar, 5). AddIngredient(15). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 5ec40d9260..f3d266b112 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.UseSound = CommonCalamitySounds.WyrmScreamSound; Item.autoReuse = true; Item.shootSpeed = 8f; diff --git a/Items/Weapons/Magic/EidolonStaff.cs b/Items/Weapons/Magic/EidolonStaff.cs index 2db6595b2f..28a822293c 100644 --- a/Items/Weapons/Magic/EidolonStaff.cs +++ b/Items/Weapons/Magic/EidolonStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Eidolon Staff"); Tooltip.SetDefault("The power of an ancient cultist resonates within this staff\n" + - "Fires a spread of ancient light and has a chance to fire a spinning ice cluster"); + "Fires a spread of ancient light and a spinning ice cluster"); Item.staff[Item.type] = true; SacrificeTotal = 1; } @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item43; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ElementalRay.cs b/Items/Weapons/Magic/ElementalRay.cs index 0a3536f412..b89347c114 100644 --- a/Items/Weapons/Magic/ElementalRay.cs +++ b/Items/Weapons/Magic/ElementalRay.cs @@ -84,8 +84,9 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 5e26fed61f..ae0e8d81fc 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -64,10 +64,6 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(). - AddIngredient(). - AddIngredient(). AddIngredient(). AddIngredient(20). AddIngredient(ItemID.UnicornHorn, 5). diff --git a/Items/Weapons/Magic/EvergladeSpray.cs b/Items/Weapons/Magic/EvergladeSpray.cs index fc3f6d0ec6..c2c9cac031 100644 --- a/Items/Weapons/Magic/EvergladeSpray.cs +++ b/Items/Weapons/Magic/EvergladeSpray.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 590421cfe5..c956c4649c 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.HellstoneBar, 6). AddIngredient(ItemID.Obsidian, 9). AddIngredient(ItemID.Fireblossom, 2). - AddIngredient(ItemID.LavaBucket). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index bbac47b400..5d50c90c25 100644 --- a/Items/Weapons/Magic/ForbiddenSun.cs +++ b/Items/Weapons/Magic/ForbiddenSun.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index 470dc7fbf3..b5e9cb1404 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(). AddIngredient(). AddIngredient(2). - AddIngredient(2). + AddIngredient(2). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index 325543e753..5d24d4aaee 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -38,9 +38,8 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddRecipeGroup("AnyIceBlock", 20). - AddIngredient(ItemID.Shiverthorn, 2). AddRecipeGroup("AnySnowBlock", 10). - AddIngredient(ItemID.WaterBucket). + AddIngredient(ItemID.Shiverthorn, 2). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/Genisis.cs b/Items/Weapons/Magic/Genisis.cs index f3ed60c9d7..32224cc565 100644 --- a/Items/Weapons/Magic/Genisis.cs +++ b/Items/Weapons/Magic/Genisis.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 56; + Item.damage = 70; Item.DamageType = DamageClass.Magic; Item.mana = 4; Item.width = 74; diff --git a/Items/Weapons/Magic/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index a48652f61c..e1ad8c72fc 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -39,6 +39,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ModContent.RarityType(); } + public override void OnConsumeMana(Player player, int manaConsumed) => player.statMana += manaConsumed; + // This weapon uses a holdout projectile. public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index d3d18c45f6..beae570f42 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item109; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/GrandStaffoftheNebulaMage.cs b/Items/Weapons/Magic/GrandStaffoftheNebulaMage.cs new file mode 100644 index 0000000000..13bdf5fcb6 --- /dev/null +++ b/Items/Weapons/Magic/GrandStaffoftheNebulaMage.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class GrandStaffoftheNebulaMage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grand Staff of the Nebula Mage"); + Tooltip.SetDefault("The true power of the Nebula Mage rests in your hands..."); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.damage = 100; + Item.DamageType = DamageClass.Magic; + Item.mana = 30; + Item.width = 120; + Item.height = 124; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 6f; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; + } + + public override void OnConsumeMana(Player player, int manaConsumed) => player.statMana += manaConsumed; + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.NebulaArcanum). + AddIngredient(ItemID.NebulaBlaze). + AddIngredient(8). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Magic/GrandStaffoftheNebulaMage.png b/Items/Weapons/Magic/GrandStaffoftheNebulaMage.png new file mode 100644 index 0000000000..1464c7709f Binary files /dev/null and b/Items/Weapons/Magic/GrandStaffoftheNebulaMage.png differ diff --git a/Items/Weapons/Magic/HadalUrn.cs b/Items/Weapons/Magic/HadalUrn.cs index f28e821887..8c517db2df 100644 --- a/Items/Weapons/Magic/HadalUrn.cs +++ b/Items/Weapons/Magic/HadalUrn.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.Calamity().donorItem = true; Item.UseSound = ShootSound; @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - SoundEngine.PlaySound(SoundID.Item103 with { Volume = SoundID.Item103.Volume }, player.position); + SoundEngine.PlaySound(SoundID.Item103 with { Volume = SoundID.Item103.Volume }, player.Center); Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 12); return false; } diff --git a/Items/Weapons/Magic/HarvestStaff.cs b/Items/Weapons/Magic/HarvestStaff.cs index af419bc951..646b3605ba 100644 --- a/Items/Weapons/Magic/HarvestStaff.cs +++ b/Items/Weapons/Magic/HarvestStaff.cs @@ -41,8 +41,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). + AddRecipeGroup("Wood", 20). AddIngredient(ItemID.Pumpkin, 20). - AddIngredient(ItemID.FallenStar, 5). + AddIngredient(ItemID.PumpkinSeed, 5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 7ad879e712..1a3d62fd3b 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -2,7 +2,10 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = 112; Item.height = 112; Item.DamageType = DamageClass.Magic; - Item.damage = 2727; + Item.damage = 1800; Item.knockBack = 9.5f; Item.mana = 26; Item.useAnimation = 40; @@ -44,15 +47,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 15f; } - // TODO -- Fancy visual flare doesn't work with resprited Helium Flash, adjust dust positions - /* // Creates dust at the tip of the staff when used. public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 dir = velocity; double angle = Math.Atan2(velocity.Y, velocity.X) + MathHelper.PiOver4; dir = dir.SafeNormalize(Vector2.Zero); - dir *= 64f * 1.4142f; // distance to gleaming point on staff + dir *= 80f * (float)Math.Sqrt(2); // distance to gleaming point on staff Vector2 dustPos = position + dir; int dustType = 162; @@ -93,7 +94,7 @@ namespace CalamityMod.Items.Weapons.Magic } return true; } - */ + public override void AddRecipes() { diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 04044f7b1a..c961e7273e 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -91,8 +91,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.HellstoneBar, 7). - AddIngredient(ItemID.LavaBucket, 2). + AddIngredient(ItemID.HellstoneBar, 10). + //AddIngredient(ItemID.AshWood, 7). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index d62ecb73e5..c4e8ee102e 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.UseSound = SoundID.Item21; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/IcicleTrident.cs b/Items/Weapons/Magic/IcicleTrident.cs index 6b2326d441..809923c380 100644 --- a/Items/Weapons/Magic/IcicleTrident.cs +++ b/Items/Weapons/Magic/IcicleTrident.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useTurn = false; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index fac765f344..9191efa5e1 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 40; + Item.damage = 50; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.width = 16; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item9; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = 28f; } // Terraria seems to really dislike high crit values in SetDefaults @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic float num72 = Item.shootSpeed; float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float f = Main.rand.NextFloat() * 6.28318548f; + float f = Main.rand.NextFloat() * MathHelper.TwoPi; float value12 = 20f; float value13 = 60f; Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat()); @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Magic { break; } - f = Main.rand.NextFloat() * 6.28318548f; + f = Main.rand.NextFloat() * MathHelper.TwoPi; } Vector2 mouseWorld = Main.MouseWorld; Vector2 vector14 = mouseWorld - vector13; @@ -75,7 +75,6 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.SkyFracture). - AddIngredient(3). AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Magic/IonBlaster.cs b/Items/Weapons/Magic/IonBlaster.cs index 5fbe02315c..2a48f409c5 100644 --- a/Items/Weapons/Magic/IonBlaster.cs +++ b/Items/Weapons/Magic/IonBlaster.cs @@ -68,8 +68,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SoulofFright, 10). AddRecipeGroup("AnyAdamantiteBar", 7). + AddIngredient(ItemID.SoulofFright, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index d6f6ee8ea4..a1e7baa8d2 100644 --- a/Items/Weapons/Magic/LashesofChaos.cs +++ b/Items/Weapons/Magic/LashesofChaos.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs index 6006d44b79..38f6d02e5f 100644 --- a/Items/Weapons/Magic/Lazhar.cs +++ b/Items/Weapons/Magic/Lazhar.cs @@ -11,13 +11,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Lazhar"); - Tooltip.SetDefault("Fires a bouncing laser that explodes on enemy hits"); + Tooltip.SetDefault("Fires a highly volatile concentrated solar beam"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 100; + Item.damage = 80; Item.DamageType = DamageClass.Magic; Item.mana = 4; Item.width = 42; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item12; Item.autoReuse = true; Item.shootSpeed = 15f; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -45,11 +45,10 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { - CreateRecipe(1). + CreateRecipe(). AddIngredient(ItemID.SpaceGun). AddIngredient(ItemID.HeatRay). - AddIngredient(ItemID.FragmentSolar, 10). - AddIngredient(ItemID.ChlorophyteBar, 6). + AddIngredient(ItemID.FragmentSolar, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs index 296457b8eb..a5851c91f1 100644 --- a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs +++ b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.BottledWater, 15). AddIngredient(ItemID.Leather, 5). AddIngredient(5). - AddIngredient(2). + AddIngredient(). AddTile(TileID.AlchemyTable). Register(); } diff --git a/Items/Weapons/Magic/MagnaCannon.cs b/Items/Weapons/Magic/MagnaCannon.cs index 56a8b816d6..22987394a9 100644 --- a/Items/Weapons/Magic/MagnaCannon.cs +++ b/Items/Weapons/Magic/MagnaCannon.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpaceGun). AddIngredient(ItemID.Granite, 25). AddIngredient(ItemID.Obsidian, 15). AddIngredient(ItemID.Amber, 5). diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index 41dc9bd437..e31124bb00 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -41,7 +41,13 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.NaturesGift). + AddIngredient(ItemID.ManaCrystal). + AddIngredient(ItemID.Moonglow, 5). + AddTile(TileID.Anvils). + Register(); + CreateRecipe(). AddIngredient(ItemID.JungleRose). + AddIngredient(ItemID.ManaCrystal). AddIngredient(ItemID.Moonglow, 5). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index f0e54d67dc..fbc5def1d3 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/NanoPurge.cs b/Items/Weapons/Magic/NanoPurge.cs index a4a12d3535..36f1f9b3e9 100644 --- a/Items/Weapons/Magic/NanoPurge.cs +++ b/Items/Weapons/Magic/NanoPurge.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.LaserMachinegun). - AddIngredient(ItemID.FragmentVortex, 20). + AddIngredient(ItemID.FragmentVortex, 6). AddIngredient(ItemID.Nanites, 100). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index 22f758a3f4..f36fd13ada 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -46,7 +46,6 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.MagicMissile). AddIngredient(ItemID.WandofSparking). AddIngredient(ItemID.AmberStaff). - AddIngredient(15). AddIngredient(10). AddTile(TileID.DemonAltar). Register(); diff --git a/Items/Weapons/Magic/NuclearFury.cs b/Items/Weapons/Magic/NuclearFury.cs index f4e8784ff0..5fb8e889ca 100644 --- a/Items/Weapons/Magic/NuclearFury.cs +++ b/Items/Weapons/Magic/NuclearFury.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using System; using Terraria; @@ -60,9 +59,6 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.RazorbladeTyphoon). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(ItemID.SoulofSight, 10). - AddIngredient(ItemID.UnicornHorn, 5). - AddIngredient(15). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index a6175d8821..b577101ebc 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -97,8 +97,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddIngredient(35). + AddIngredient(15). + AddIngredient(18). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index 3dac4d9dc0..f07d4cd353 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.UseSound = SoundID.Item43; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/PlagueStaff.cs b/Items/Weapons/Magic/PlagueStaff.cs index 748406fe74..c1e0e521ef 100644 --- a/Items/Weapons/Magic/PlagueStaff.cs +++ b/Items/Weapons/Magic/PlagueStaff.cs @@ -1,6 +1,5 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -13,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Staff"); - Tooltip.SetDefault("Fires a spread of plague fangs"); + Tooltip.SetDefault("Fires a tight spread of 4 plague fangs"); Item.staff[Item.type] = true; SacrificeTotal = 1; } @@ -30,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item43; Item.autoReuse = true; @@ -41,40 +40,12 @@ 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) { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num72 = Item.shootSpeed; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - int num130 = 6; - if (Main.rand.NextBool(3)) + for (int i = 0; i < 3; i++) { - num130++; + Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * Main.rand.NextFloat(0.8f, 1.2f); + Projectile.NewProjectile(source, position, spreadVelocity, type, damage, knockback, Main.myPlayer); } - if (Main.rand.NextBool(4)) - { - num130++; - } - if (Main.rand.NextBool(5)) - { - num130++; - } - for (int num131 = 0; num131 < num130; num131++) - { - float num132 = num78; - float num133 = num79; - float num134 = 0.05f * (float)num131; - num132 += (float)Main.rand.Next(-120, 121) * num134; - num133 += (float)Main.rand.Next(-120, 121) * num134; - num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); - num80 = num72 / num80; - num132 *= num80; - num133 *= num80; - float x2 = vector2.X; - float y2 = vector2.Y; - Projectile.NewProjectile(source, x2, y2, num132, num133, ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); - } - return false; + return true; // Fires one directly with no randomness, totaling 4 projectiles } } } diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index affec9151e..f1a65be4d1 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -87,13 +87,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.ToxicFlask). - AddIngredient(ItemID.Musket). - AddIngredient(7). - AddTile(TileID.LunarCraftingStation). - Register(); - CreateRecipe(). - AddIngredient(ItemID.ToxicFlask). - AddIngredient(ItemID.TheUndertaker). + AddIngredient(ItemID.LaserRifle). AddIngredient(7). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Magic/PlasmaRod.cs b/Items/Weapons/Magic/PlasmaRod.cs index 2378ee1770..dfa783c984 100644 --- a/Items/Weapons/Magic/PlasmaRod.cs +++ b/Items/Weapons/Magic/PlasmaRod.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic DisplayName.SetDefault("Plasma Rod"); Tooltip.SetDefault("Casts a low-damage plasma bolt\n" + "Shooting a tile will cause several bolts with increased damage to fire\n" + - "Shooting an enemy will inflict shadowflame for a long duration"); + "Shooting an enemy will inflict shadowflame"); Item.staff[Item.type] = true; SacrificeTotal = 1; } diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index 7a42900988..88cb3cabc6 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.UseSound = SoundID.Item84; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index 6cfa37c1ea..0a7bd65407 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item20; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index dfe4e44228..0af8ec3095 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.DemonScythe). - AddIngredient(12). + AddIngredient(12). AddIngredient(8). AddIngredient(20). AddTile(TileID.Bookcases). diff --git a/Items/Weapons/Magic/RelicofRuin.cs b/Items/Weapons/Magic/RelicofRuin.cs index f072cc4b3a..98d391bcf4 100644 --- a/Items/Weapons/Magic/RelicofRuin.cs +++ b/Items/Weapons/Magic/RelicofRuin.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.25f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item84; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index 92c66b8e97..29b43e2d31 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 6.75f; Item.UseSound = CommonCalamitySounds.FlareSound; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ShadecrystalTome.cs b/Items/Weapons/Magic/ShadecrystalTome.cs index 9c0f228396..2ee4e4e8d3 100644 --- a/Items/Weapons/Magic/ShadecrystalTome.cs +++ b/Items/Weapons/Magic/ShadecrystalTome.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item9; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 5b58f19479..391440ceb6 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Shaderain Staff"); - Tooltip.SetDefault("Fires a shade storm cloud that inflicts shadowflame"); + Tooltip.SetDefault("Fires a shade storm cloud"); SacrificeTotal = 1; } @@ -69,9 +69,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.RottenChunk, 2). AddIngredient(ItemID.DemoniteBar, 3). AddIngredient(12). + AddIngredient(ItemID.RottenChunk, 2). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index 93eb407558..8e734198dd 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.UseSound = SoundID.Item72; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index d5aba9f974..3d41433bf8 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 61; + Item.damage = 92; Item.knockBack = 5f; Item.useTime = Item.useAnimation = 30; Item.mana = 20; @@ -31,23 +31,11 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.Item20; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; } - public override bool CanUseItem(Player player) - { - int projCount = 0; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile proj = Main.projectile[x]; - if (proj.active && proj.owner == player.whoAmI && proj.type == Item.shoot && proj.ai[0] <= 0f) - { - projCount++; - } - } - return projCount <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void AddRecipes() { diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index 290e901a9e..1456d5f1e5 100644 --- a/Items/Weapons/Magic/SlitheringEels.cs +++ b/Items/Weapons/Magic/SlitheringEels.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.NPCHit13; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 9c2037df0d..2ba62e7040 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item46; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 7d898b8a98..4a36e0e062 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 64; + Item.damage = 54; Item.DamageType = DamageClass.Magic; Item.mana = 18; Item.width = 28; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item8; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/TerraRay.cs index bca657b2a4..9bfc1da1f6 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/TerraRay.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item60; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/TheSwarmer.cs b/Items/Weapons/Magic/TheSwarmer.cs index efadfcb933..2842094b8a 100644 --- a/Items/Weapons/Magic/TheSwarmer.cs +++ b/Items/Weapons/Magic/TheSwarmer.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.BeeGun). AddIngredient(ItemID.WaspGun). - AddIngredient(ItemID.FragmentVortex, 20). + AddIngredient(ItemID.FragmentStardust, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/TomeofFates.cs b/Items/Weapons/Magic/TomeofFates.cs index 5d82bf8f10..5ab3e16251 100644 --- a/Items/Weapons/Magic/TomeofFates.cs +++ b/Items/Weapons/Magic/TomeofFates.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Tome of Fates"); Tooltip.SetDefault("Casts cosmic tentacles to spear your enemies\n" + - "Can randomly fire a brimstone tentacle for immense damage"); + "Can randomly fire a red tentacle for immense damage"); SacrificeTotal = 1; } diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index e28966b968..593853adb7 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.SunplateBlock, 5). - AddIngredient(ItemID.Feather, 3). AddTile(TileID.Bookcases). Register(); } diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 8d4c11d40f..91eb65599e 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -75,10 +74,8 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(). AddIngredient(ItemID.AquaScepter). - AddRecipeGroup("CursedFlameIchor", 20). - AddIngredient(10). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index 48b83e3d08..55d60e044e 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item66; Item.autoReuse = true; @@ -89,9 +89,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). + AddIngredient(30). AddIngredient(30). - AddIngredient(10). - AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 30aa22b0b5..c74e9f9080 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -53,9 +53,9 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(ItemID.HallowedBar, 12). AddIngredient(6). AddIngredient(ItemID.Ruby). - AddIngredient(ItemID.SoulofSight). - AddIngredient(ItemID.SoulofMight). AddIngredient(ItemID.SoulofFright). + AddIngredient(ItemID.SoulofMight). + AddIngredient(ItemID.SoulofSight). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index 1c9b0e2e37..dd599d8440 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.UseSound = SoundID.Item45; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index 951faa0768..126884df97 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -13,8 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Vesuvius"); - Tooltip.SetDefault("Asteroids give the Molten buff on enemy hits\n" + - "Calls down a swarm of molten asteroids\n" + + Tooltip.SetDefault("Calls down a swarm of molten asteroids\n" + "Right click to fire a spread of molten asteroids from the staff"); Item.staff[Item.type] = true; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index f36ece57b9..fb36d0f915 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -76,21 +76,9 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(). - AddIngredient(). - AddIngredient(). - AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(). - AddTile(). - Register(); - CreateRecipe(). - AddIngredient(). - AddIngredient(). - AddIngredient(). AddIngredient(). - AddIngredient(). - AddIngredient(). AddIngredient(). AddTile(). Register(); diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index 9624e3e4bf..abde25bed0 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item33; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index f6b46ccf5f..5b102bcb15 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useTurn = false; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item9; Item.scale = 0.9f; diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs index ad964033eb..c4dfde41bf 100644 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ b/Items/Weapons/Magic/WrathoftheAncients.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/WulfrumProsthesis.cs b/Items/Weapons/Magic/WulfrumProsthesis.cs index ee7d3ddb2b..3a137c5305 100644 --- a/Items/Weapons/Magic/WulfrumProsthesis.cs +++ b/Items/Weapons/Magic/WulfrumProsthesis.cs @@ -39,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 13; + Item.damage = 18; Item.DamageType = DamageClass.Magic; - Item.mana = 2; + Item.mana = 5; Item.width = 34; Item.height = 42; Item.useTime = 24; diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index eb3fa6053d..4b174d8ebb 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -31,7 +31,7 @@ Fires wyverns and colored feathers from the sky that stick to enemies and tiles Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.75f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item102; Item.autoReuse = true; @@ -116,8 +116,8 @@ Fires wyverns and colored feathers from the sky that stick to enemies and tiles { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.SoulofFlight, 15). AddRecipeGroup("AnyMythrilBar", 5). + AddIngredient(ItemID.SoulofFlight, 15). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index 2372628920..5fd507bbc6 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -1,6 +1,11 @@ -using CalamityMod.Projectiles.Magic; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - Item.damage = 75; + Item.damage = 85; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.width = 16; @@ -39,5 +44,26 @@ namespace CalamityMod.Items.Weapons.Magic } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override void ModifyTooltips(List list) + { + TooltipLine name = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "ItemName"); + if (name != null && CalamityWorld.getFixedBoi) + name.Text = "yermes christal"; + + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + if (line != null && CalamityWorld.getFixedBoi) + line.Text = "...throughs a pice of dnimite"; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (CalamityWorld.getFixedBoi) + { + Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileID.Dynamite, 250, 0, player.whoAmI); + return false; + } + return true; + } } } diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index 37ba654575..38a651da61 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = false; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Frostburn2, 300); target.AddBuff(ModContent.BuffType(), 60); if (crit) @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Frostburn2, 300); target.AddBuff(ModContent.BuffType(), 60); if (crit) diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index c4ef4fb816..27a3cc6e0c 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; @@ -68,10 +68,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(15). - AddIngredient(10). - AddIngredient(5). + AddIngredient(20). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/Aftershock.cs b/Items/Weapons/Melee/Aftershock.cs index cdd473121c..30b8406ba6 100644 --- a/Items/Weapons/Melee/Aftershock.cs +++ b/Items/Weapons/Melee/Aftershock.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index 0b6d941c3f..9d4f252d25 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(6). + AddIngredient(ItemID.SunplateBlock, 3). AddTile(TileID.SkyMill). Register(); } diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index 94648c6cbd..80c19a6e46 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 94; + Item.width = 114; Item.damage = BaseDamage; Item.DamageType = DamageClass.Melee; Item.useAnimation = 19; @@ -36,8 +36,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 100; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.height = 122; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; } @@ -88,9 +88,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.BrokenHeroSword). + AddIngredient(ItemID.BreakerBlade). AddIngredient(5). - AddIngredient(3). + AddIngredient(3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/AnarchyBlade.png b/Items/Weapons/Melee/AnarchyBlade.png index 5bde00ae89..c844da5476 100644 Binary files a/Items/Weapons/Melee/AnarchyBlade.png and b/Items/Weapons/Melee/AnarchyBlade.png differ diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index 83e4387a93..b4ba9ec844 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.CrimtaneBar, 3). AddIngredient(6). AddIngredient(ItemID.Vertebrae, 3). - AddIngredient(ItemID.CrimtaneBar, 3). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 3457e80527..0dda896488 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -39,26 +39,26 @@ namespace CalamityMod.Items.Weapons.Melee public static float SwirlBoltAmount = 6f; //The amount of cosmic bolts produced during hte swirl attack public static float SwirlBoltDamageMultiplier = 0.7f; //This is the damage multiplier for ALL THE BOLTS: Aka, said damage multiplier is divided by the amount of bolts in a swirl and the full damage multiplier is gotten if you hit all the bolts - const string ComboTooltip = "Performs a combo of swings, alternating between narrow and wide swings and throwing the blade out every 5 swings\n" + - "The thrown blade is held in place by constellations and will follow your cursor\n" + - "Releasing the mouse while the blade is out will throw the second half towards it, making the scissors snap and explode into stars"; + const string ComboTooltip = "Using left click performs a 5-swing combo that ends by throwing the blade\n" + + "The thrown blade will follow your cursor\n" + + "Releasing left click while the blade is out will cause an exploding snap"; - const string ParryTooltip = "Using RMB will snip out the scissor blades in front of you.\n" + - "Hitting an enemy with it will parry them, granting you a small window of invulnerability\n" + - "You can also parry projectiles and temporarily make them deal 200 less damage\n" + - "Parrying will empower the next 10 swings of the sword, letting you use both blades at once"; + const string ParryTooltip = "Using right click will snip out the scissor blades in front of you\n" + + "Hitting an enemy with it will parry them, granting you brief invulnerability\n" + + "You can parry projectiles to make them deal 200 less damage for a short period\n" + + "Parrying anything will empower the next 10 swings of the sword"; - const string BlastTooltip = "Using RMB and pressing up while the Ark is empowered will throw the blades in front of you to provoke a Big Rip in spacetime, using up all your charges in the process\n" + - "If more than half the charges were used up, you can dash across the rip by keeping the up key pressed down"; + const string BlastTooltip = "Using right click while pressing UP with empowered charges will provoke a Big Rip in spacetime and use all charges\n" + + "If more than 5 charges were used, you can dash across the rip by holding UP"; public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Cosmos"); Tooltip.SetDefault("This line gets set in ModifyTooltips\n" + - "This line also gets set in ModifyTooltips\n" + - "This line also gets set in ModifyTooltips\n" + - "The physical culmination of your journey, capable of rending gods asunder"); + "This line also gets set in ModifyTooltips\n" + + "This line also gets set in ModifyTooltips\n" + + "The physical culmination of your journey, capable of rending gods asunder"); SacrificeTotal = 1; } @@ -96,7 +96,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 136; - Item.damage = 1670; + Item.damage = 1770; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index 12cb95cd78..a85ef0f5e5 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -31,16 +31,16 @@ namespace CalamityMod.Items.Weapons.Melee public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder - const string ComboTooltip = "Performs a combo of swings, throwing the blade out every 5 swings\n" + - "Releasing the mouse while the blade is out will throw the second half towards it, making the scissors snap\n" + - "Snapping the scissors together increase their damage and empower your next two swings"; + const string ComboTooltip = "Using left click performs a 5-swing combo that ends by throwing the blade\n" + + "Releasing left click while the blade is out will deal extra damage and give 2 charges"; - const string ParryTooltip = "Using RMB will snip out the scissor blades in front of you\n" + - "Hitting an enemy with it will parry them, granting you a small window of invulnerability\n" + - "You can also parry projectiles and temporarily make them deal 200 less damage\n" + - "Parrying will empower the next 10 swings of the sword, letting you use both blades at once"; + const string ParryTooltip = "Using right click will snip out the scissor blades in front of you\n" + + "Hitting an enemy with it will parry them, granting you brief invulnerability\n" + + "You can also parry projectiles to make them deal 200 less damage for a short period\n" + + "Parrying will empower the next 10 swings of the sword, letting you use both blades at once"; - const string BlastTooltip = "Using RMB and pressing up while the Ark is empowered will throw the blades in front of you to provoke a Big Rip in spacetime, using up all your charges in the process"; + const string BlastTooltip = "Using right click while pressing UP with empowered charges will provoke a Big Rip in spacetime and use all charges\n" + + "If more than 5 charges were used, you can dash across the rip by holding UP"; public override void SetStaticDefaults() { @@ -249,10 +249,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(5). - AddIngredient(5). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/AstralBlade.cs b/Items/Weapons/Melee/AstralBlade.cs index 0b25259124..0e59a056fd 100644 --- a/Items/Weapons/Melee/AstralBlade.cs +++ b/Items/Weapons/Melee/AstralBlade.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Melee if (multiplier > 1.5f) { - SoundEngine.PlaySound(SoundID.Item105, player.position); + SoundEngine.PlaySound(SoundID.Item105, player.Center); bool blue = Main.rand.NextBool(); float angleStart = Main.rand.NextFloat(0f, MathHelper.TwoPi); float var = 0.05f + (2f - multiplier); diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index 5a141ca35d..582a2b78c6 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index 6cf865c7d6..136793080a 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index baf36ddeda..035554ea33 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.Terrarian). - AddIngredient(3). + AddIngredient(2). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index 1558ab13b9..00749ec64f 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, (int)(damage * 1.5f), knockback, 0, type); - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) @@ -50,15 +50,14 @@ namespace CalamityMod.Items.Weapons.Melee int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; CalamityPlayer.HorsemansBladeOnHit(player, -1, (int)(damage * 1.5f), Item.knockBack, 0, type); - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.TheHorsemansBlade). - AddIngredient(ItemID.BookofSkulls). - AddIngredient(ItemID.FragmentSolar, 20). + AddIngredient(ItemID.FragmentStardust, 12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index bb9897519f..67550d6604 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(1). - AddIngredient(12). AddIngredient(30). + AddIngredient(12). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index 2b00baf428..2719abdd0d 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bladecrest Oathsword"); - Tooltip.SetDefault("Fires bursts of demonic blades that exponentially decelerate and explode\n" + - "Sword of an ancient demon lord"); + Tooltip.SetDefault("Fires bursts of demonic blades that exponentially decelerate and explode"); SacrificeTotal = 1; } diff --git a/Items/Weapons/Melee/BloodyEdge.cs b/Items/Weapons/Melee/BloodyEdge.cs deleted file mode 100644 index f09e27bee3..0000000000 --- a/Items/Weapons/Melee/BloodyEdge.cs +++ /dev/null @@ -1,88 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items.Materials; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class BloodyEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Edge"); - Tooltip.SetDefault("Chance to heal the player on enemy hits\n" + - "Inflicts Burning Blood"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.width = 46; - Item.damage = 70; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 23; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 23; - Item.knockBack = 5.25f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.useTurn = true; - Item.height = 60; - Item.scale = 1.25f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - - if (!target.canGhostHeal || player.moonLeech) - return; - - int healAmount = Main.rand.Next(2) + 2; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - - int healAmount = Main.rand.Next(2) + 2; - if (!player.moonLeech) - { - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.LightsBane). - AddIngredient(ItemID.Muramasa). - AddIngredient(ItemID.BladeofGrass). - AddIngredient(ItemID.FieryGreatsword). - AddIngredient(5). - AddTile(TileID.DemonAltar). - Register(); - CreateRecipe(). - AddIngredient(ItemID.BloodButcherer). - AddIngredient(ItemID.Muramasa). - AddIngredient(ItemID.BladeofGrass). - AddIngredient(ItemID.FieryGreatsword). - AddIngredient(5). - AddTile(TileID.DemonAltar). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/BloodyEdge.png b/Items/Weapons/Melee/BloodyEdge.png deleted file mode 100644 index 0d1b712d56..0000000000 Binary files a/Items/Weapons/Melee/BloodyEdge.png and /dev/null differ diff --git a/Items/Weapons/Melee/Bonebreaker.cs b/Items/Weapons/Melee/Bonebreaker.cs index ddd0245fb5..e8a7fed77f 100644 --- a/Items/Weapons/Melee/Bonebreaker.cs +++ b/Items/Weapons/Melee/Bonebreaker.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.useTurn = true; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index 37f1be2241..cec7014aa7 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 56; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index b783b63166..f9c82d05c4 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -57,9 +57,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). - AddIngredient(3). AddIngredient(12). + AddIngredient(4). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/BrimstoneSword.cs b/Items/Weapons/Melee/BrimstoneSword.cs index e40541c5fd..ed738cb7b8 100644 --- a/Items/Weapons/Melee/BrimstoneSword.cs +++ b/Items/Weapons/Melee/BrimstoneSword.cs @@ -26,18 +26,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = 100; + Item.damage = 70; Item.DamageType = DamageClass.Melee; Item.width = Item.height = 52; Item.scale = 1.5f; - Item.useTime = 23; - Item.useAnimation = 23; + Item.useAnimation = Item.useTime = 28; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.shootSpeed = 20f; @@ -63,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - type = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); } else { diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index 103ad74099..057b495ca7 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.damage = 124; Item.knockBack = 4f; - Item.useAnimation = Item.useTime = 15; + Item.useAnimation = Item.useTime = 30; Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.autoReuse = true; @@ -32,7 +32,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 100; Item.height = 102; - Item.scale = 1.5f; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; @@ -56,18 +55,11 @@ namespace CalamityMod.Items.Weapons.Melee return base.UseItem(player); } - public override float UseSpeedMultiplier(Player player) - { - if (player.altFunctionUse == 2) - return 1f; - return 1.33f; - } - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { if (player.altFunctionUse == 2) { - damage = (int)(damage * 0.43); + damage = (int)(damage * 0.3); type = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Melee/BurntSienna.cs b/Items/Weapons/Melee/BurntSienna.cs index 1e907a3ec6..a2e5762aad 100644 --- a/Items/Weapons/Melee/BurntSienna.cs +++ b/Items/Weapons/Melee/BurntSienna.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 42; - Item.damage = 28; + Item.damage = 32; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 21; Item.useTurn = true; diff --git a/Items/Weapons/Melee/CatastropheClaymore.cs b/Items/Weapons/Melee/CatastropheClaymore.cs index 5ec3fdce36..2cd074f081 100644 --- a/Items/Weapons/Melee/CatastropheClaymore.cs +++ b/Items/Weapons/Melee/CatastropheClaymore.cs @@ -12,39 +12,31 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Catastrophe Claymore"); - Tooltip.SetDefault("Fires explosive energy bolts"); + Tooltip.SetDefault("Fires sparkles which inflicts Frostbite, Hellfire, or Ichor"); SacrificeTotal = 1; } public override void SetDefaults() { Item.width = 56; - Item.damage = 98; + Item.damage = 85; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 23; - Item.useTime = 23; + Item.useAnimation = Item.useTime = 23; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 56; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.LightPurple; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - type = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, Main.myPlayer); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, Main.myPlayer, Main.rand.Next(3)); return false; } @@ -61,8 +53,8 @@ namespace CalamityMod.Items.Weapons.Melee if (Main.rand.NextBool(3)) { target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire3, 180); + target.AddBuff(BuffID.Frostburn2, 120); } } @@ -71,8 +63,8 @@ namespace CalamityMod.Items.Weapons.Melee if (Main.rand.NextBool(3)) { target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire3, 180); + target.AddBuff(BuffID.Frostburn2, 120); } } @@ -80,12 +72,10 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.HallowedBar, 10). - AddIngredient(ItemID.CrystalShard, 7). - AddIngredient(ItemID.SoulofNight, 5). AddRecipeGroup("CursedFlameIchor", 5). + AddIngredient(ItemID.SoulofFright, 3). AddIngredient(ItemID.SoulofMight, 3). AddIngredient(ItemID.SoulofSight, 3). - AddIngredient(ItemID.SoulofFright, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/CausticEdge.cs b/Items/Weapons/Melee/CausticEdge.cs index 7c5cdf25f9..a4ef3acb1d 100644 --- a/Items/Weapons/Melee/CausticEdge.cs +++ b/Items/Weapons/Melee/CausticEdge.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 46; + Item.height = 46; Item.damage = 70; Item.scale = 1.4f; Item.DamageType = DamageClass.Melee; @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 48; Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } @@ -44,13 +44,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 240); - target.AddBuff(BuffID.Venom, 120); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(BuffID.Poisoned, 240); - target.AddBuff(BuffID.Venom, 120); } public override void AddRecipes() @@ -59,7 +57,6 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(10). AddRecipeGroup("Boss2Material", 8). AddIngredient(ItemID.Deathweed, 2). - AddIngredient(ItemID.LavaBucket). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Melee/CausticEdge.png b/Items/Weapons/Melee/CausticEdge.png index c134ebe6ff..f91c47c715 100644 Binary files a/Items/Weapons/Melee/CausticEdge.png and b/Items/Weapons/Melee/CausticEdge.png differ diff --git a/Items/Weapons/Melee/CelestialClaymore.cs b/Items/Weapons/Melee/CelestialClaymore.cs index d55020b668..298a74a334 100644 --- a/Items/Weapons/Melee/CelestialClaymore.cs +++ b/Items/Weapons/Melee/CelestialClaymore.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = Item.height = 54; + Item.width = 80; + Item.height = 82; Item.damage = 70; Item.DamageType = DamageClass.Melee; Item.useAnimation = 19; diff --git a/Items/Weapons/Melee/CelestialClaymore.png b/Items/Weapons/Melee/CelestialClaymore.png index 1790b44e60..87c0e78ce1 100644 Binary files a/Items/Weapons/Melee/CelestialClaymore.png and b/Items/Weapons/Melee/CelestialClaymore.png differ diff --git a/Items/Weapons/Melee/ClamCrusher.cs b/Items/Weapons/Melee/ClamCrusher.cs index a344c3121a..e22ee15c45 100644 --- a/Items/Weapons/Melee/ClamCrusher.cs +++ b/Items/Weapons/Melee/ClamCrusher.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index b802be9f9e..324ac8aeb4 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shootSpeed = 9f; } diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index ddec72c748..08572cfdd5 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 4f; Item.UseSound = SoundID.Item82; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.rare = ModContent.RarityType(); Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 14c74c7473..67e5d16281 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -20,18 +20,16 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 92; - Item.damage = 123; + Item.height = 100; + Item.damage = 96; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 36; Item.useTurn = true; Item.knockBack = 5; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 100; - Item.scale = 1.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 25f; @@ -64,9 +62,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(12). - AddIngredient(ItemID.FallenStar, 5). - AddIngredient(ItemID.SoulofNight). AddIngredient(ItemID.SoulofLight). + AddIngredient(ItemID.SoulofNight). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs index 6d85ec7240..f254579471 100644 --- a/Items/Weapons/Melee/DeathsAscension.cs +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -21,10 +21,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = 1350; + Item.damage = 1200; Item.knockBack = 9f; - Item.useTime = 30; - Item.useAnimation = 30; + Item.useTime = Item.useAnimation = 18; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.channel = true; @@ -57,9 +56,6 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2f) { - Item.damage = 290; - Item.shootSpeed = 18f; - Item.useTime = Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item71; Item.useTurn = true; @@ -70,9 +66,6 @@ namespace CalamityMod.Items.Weapons.Melee } else { - Item.damage = 1350; - Item.shootSpeed = 24f; - Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = null; Item.useTurn = false; @@ -93,7 +86,7 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = velocity.X + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); float SpeedY = velocity.Y + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.15f), knockback, player.whoAmI, 0f, 0f); } } else diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 1f10e02927..0db4f8e122 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Items.Weapons.Melee float scalar3 = 2f; Vector2 value3 = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); for (int i = 0; i < 40; i++) { int dustInt = Dust.NewDust(target.position, target.width, target.height, 173, 0f, 0f, 200, default, scalar1); @@ -169,7 +169,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 450); target.AddBuff(BuffID.OnFire, 900); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); } } @@ -177,7 +177,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(8). AddIngredient(20). AddTile(ModContent.TileType()). diff --git a/Items/Weapons/Melee/DiseasedPike.cs b/Items/Weapons/Melee/DiseasedPike.cs index c292fdd675..6c03edd1a3 100644 --- a/Items/Weapons/Melee/DiseasedPike.cs +++ b/Items/Weapons/Melee/DiseasedPike.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 58; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/EarthenPike.cs b/Items/Weapons/Melee/EarthenPike.cs index 0196a033c3..1ec3bbed8d 100644 --- a/Items/Weapons/Melee/EarthenPike.cs +++ b/Items/Weapons/Melee/EarthenPike.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 60; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Melee/ElementalExcalibur.cs b/Items/Weapons/Melee/ElementalExcalibur.cs index 47f08e6bbd..1fb614dc15 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -177,14 +177,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.TrueExcalibur). - AddIngredient(ItemID.LargeDiamond). - AddIngredient(ItemID.LightShard, 3). - AddIngredient(ItemID.DarkShard, 3). - AddIngredient(10). - AddIngredient(10). - AddIngredient(ItemID.SoulofLight, 20). - AddIngredient(ItemID.SoulofNight, 20). AddIngredient(5). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/ElementalLance.cs b/Items/Weapons/Melee/ElementalLance.cs index d1d1d36713..d0539b51b6 100644 --- a/Items/Weapons/Melee/ElementalLance.cs +++ b/Items/Weapons/Melee/ElementalLance.cs @@ -45,9 +45,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.NorthPole). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/ElementalShiv.cs b/Items/Weapons/Melee/ElementalShiv.cs index 9f37e0cd70..941aa75123 100644 --- a/Items/Weapons/Melee/ElementalShiv.cs +++ b/Items/Weapons/Melee/ElementalShiv.cs @@ -45,8 +45,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.PiercingStarlight). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs similarity index 95% rename from Items/Weapons/Melee/TrueForbiddenOathblade.cs rename to Items/Weapons/Melee/ExaltedOathblade.cs index 13944ba37a..2408f16e06 100644 --- a/Items/Weapons/Melee/TrueForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -11,11 +11,12 @@ using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { - public class TrueForbiddenOathblade : ModItem + [LegacyName("TrueForbiddenOathblade")] + public class ExaltedOathblade : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("True Forbidden Oathblade"); + DisplayName.SetDefault("Exalted Oathblade"); Tooltip.SetDefault("Fires a spread of demonic scythes and critical hits cause shadowflame explosions"); SacrificeTotal = 1; } @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; @@ -110,7 +111,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 450); target.AddBuff(BuffID.OnFire, 900); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); } } diff --git a/Items/Weapons/Melee/TrueForbiddenOathblade.png b/Items/Weapons/Melee/ExaltedOathblade.png similarity index 100% rename from Items/Weapons/Melee/TrueForbiddenOathblade.png rename to Items/Weapons/Melee/ExaltedOathblade.png diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index 6d24f15b7b..2baf6d7e59 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -54,8 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Exoblade"); - Tooltip.SetDefault("Ancient blade of Yharim's weapons and armors expert, Draedon\n" + - "Left clicks release multiple energy beams that home in on enemies and slice them on hit\n" + + Tooltip.SetDefault("Left clicks release multiple energy beams that home in on enemies and slice them on hit\n" + "Right clicks make you dash in the direction of the cursor with the blade\n" + "Enemy hits from the blade during the dash result in massive damage and a rebound\n" + "Left clicks briefly after a rebound are far stronger and create explosions on enemy hits"); @@ -79,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.Rarity15BuyPrice; Item.shoot = ProjectileType(); Item.shootSpeed = 9f; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); } public override bool CanShoot(Player player) @@ -141,9 +140,9 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(). AddTile(TileType()). Register(); diff --git a/Items/Weapons/Melee/FallenPaladinsHammer.cs b/Items/Weapons/Melee/FallenPaladinsHammer.cs index 5c25f41927..1228254c53 100644 --- a/Items/Weapons/Melee/FallenPaladinsHammer.cs +++ b/Items/Weapons/Melee/FallenPaladinsHammer.cs @@ -41,9 +41,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.PaladinsHammer). AddIngredient(). - AddIngredient(5). - AddIngredient(5). AddIngredient(5). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index 8870607b02..b0c822f2b0 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 66; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; } diff --git a/Items/Weapons/Melee/FlarefrostBlade.cs b/Items/Weapons/Melee/FlarefrostBlade.cs index 564cd2a6ec..2e38d3bb35 100644 --- a/Items/Weapons/Melee/FlarefrostBlade.cs +++ b/Items/Weapons/Melee/FlarefrostBlade.cs @@ -21,20 +21,21 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 64; Item.damage = 95; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 24; - Item.useTime = 24; + Item.useAnimation = Item.useTime = 36; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 66; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => damage = (int)(damage * 0.6); + public override void MeleeEffects(Player player, Rectangle hitbox) { int dustChoice = Main.rand.Next(2); diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index fbb43767f6..38b217e03e 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -66,12 +66,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SharkFin, 2). - AddRecipeGroup("AnyAdamantiteBar", 5). + AddIngredient(12). AddIngredient(10). - AddIngredient(10). - AddIngredient(5). + AddIngredient(ItemID.SharkFin, 2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 96d6655267..b96b5dcacd 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -24,14 +24,13 @@ namespace CalamityMod.Items.Weapons.Melee Item.scale = 1.5f; Item.damage = 110; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 25; - Item.useTime = 25; + Item.useAnimation = Item.useTime = 55; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -58,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Melee float num52 = 2f; Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { @@ -101,7 +100,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 360); target.AddBuff(BuffID.OnFire, 720); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); } } @@ -109,7 +108,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(ItemID.SoulofFright, 5). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Melee/ForsakenSaber.cs b/Items/Weapons/Melee/ForsakenSaber.cs index dd03f41ef1..1ea301115b 100644 --- a/Items/Weapons/Melee/ForsakenSaber.cs +++ b/Items/Weapons/Melee/ForsakenSaber.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Forsaken Saber"); - Tooltip.SetDefault("Shoots three sand blades that alter their velocity as they travel"); + Tooltip.SetDefault("Shoots two sand blades that alter their velocity as they travel"); SacrificeTotal = 1; } @@ -21,15 +21,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 46; Item.damage = 65; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; + Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; Item.useTurn = true; Item.knockBack = 6; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 56; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; @@ -37,12 +36,12 @@ 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) { - for (int projectiles = 0; projectiles < 3; projectiles++) - { - float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.8), knockback, player.whoAmI); - } + // One randomly spread + Vector2 spreadVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.8f, 1.2f); + Projectile.NewProjectile(source, position, spreadVelocity, type, damage / 2, knockback * 0.5f, player.whoAmI); + + // One at the cursor + Projectile.NewProjectile(source, position, velocity, type, damage / 2, knockback * 0.5f, player.whoAmI); return false; } diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index 19ab84fc73..3bc118c7dd 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -75,11 +75,12 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Galaxia"); Tooltip.SetDefault("FUNCTION_DESC\n" + - "FUNCTION_PASSIVE\n" + - "Upgrading the sword let it break free from its earthly boundaries. You now have access to every single attunement at all times!\n" + - "Use RMB to cycle the sword's attunement forward or backwards depending on the position of your cursor\n" + - "Active Attunement : None\n" + - "Passive Blessing : None\n"); ; + "FUNCTION_PASSIVE\n" + + "Freed from earthly shackles and coursing with cosmic power\n" + + "Has access to all of the attunements at all times\n" + + "Use right click to cycle the sword's attunement depending on the cursor's position\n" + + "Active Attunement : None\n" + + "Passive Blessing : None\n"); SacrificeTotal = 1; } @@ -299,12 +300,12 @@ namespace CalamityMod.Items.Weapons.Melee Rectangle animFrame = new Rectangle(0, 128 * currentFrame, 126, 126); spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, Main.UIScaleMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, null, null, null, Main.Transform); spriteBatch.Draw(outlineTexture, Item.Center - Main.screenPosition, animFrame, lightColor, rotation, Item.Size * 0.5f, scale, SpriteEffects.None, 0f); spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.Transform); spriteBatch.Draw(itemTexture, Item.Center - Main.screenPosition, animFrame, lightColor, rotation, Item.Size * 0.5f, scale, SpriteEffects.None, 0f); diff --git a/Items/Weapons/Melee/FracturedArk.cs b/Items/Weapons/Melee/FracturedArk.cs index d9979dd415..621c0e2384 100644 --- a/Items/Weapons/Melee/FracturedArk.cs +++ b/Items/Weapons/Melee/FracturedArk.cs @@ -23,9 +23,10 @@ namespace CalamityMod.Items.Weapons.Melee public static float beamDamageMultiplier = 0.8f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied - const string ParryTooltip = "Using RMB will extend the Ark out in front of you. Hitting an enemy with it will parry them, granting you a small window of invulnerability\n" + - "You can also parry projectiles and temporarily make them deal 100 less damage\n" + - "Parrying will empower the next 10 swings of the sword, boosting their damage and letting them throw projectiles out"; + const string ParryTooltip = "Using RMB will extend the Ark out in front of you\n" + + "Hitting an enemy with it will parry them, granting you a small window of invulnerability\n" + + "You can also parry projectiles and temporarily make them deal 100 less damage\n" + + "Parrying will empower the next 10 swings of the sword, boosting their damage and letting them throw projectiles out"; public override void SetStaticDefaults() { @@ -149,14 +150,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Starfury). AddIngredient(ItemID.EnchantedSword). AddIngredient(5). AddRecipeGroup("AnyCopperBar", 10). AddTile(TileID.Anvils). Register(); CreateRecipe(). - AddIngredient(ItemID.Starfury). AddIngredient(ItemID.Terragrim). AddIngredient(5). AddRecipeGroup("AnyCopperBar", 10). diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index 05f78cf517..26f62d84c0 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -114,12 +114,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.StarWrath). - AddIngredient(ItemID.SoulofMight, 20). AddIngredient(10). AddIngredient(5). - AddIngredient(ItemID.LunarBar, 5). - AddIngredient(ItemID.DarkShard). - AddIngredient(ItemID.LightShard). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index ac332eec26..b214158f46 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -57,9 +57,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(30). - AddIngredient(ItemID.Gel, 35). - AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(18). + AddIngredient(18). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 894270ad5b..4c5f33d679 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -101,8 +101,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(10). - AddIngredient(ItemID.FragmentSolar, 10). + AddIngredient(). + AddIngredient(ItemID.FragmentNebula, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/GreatswordofBlah.cs b/Items/Weapons/Melee/GreatswordofBlah.cs index c25bf19ebc..94ef930884 100644 --- a/Items/Weapons/Melee/GreatswordofBlah.cs +++ b/Items/Weapons/Melee/GreatswordofBlah.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = Item.height = 102; + Item.width = Item.height = 108; Item.damage = 138; Item.DamageType = DamageClass.Melee; Item.useAnimation = 18; diff --git a/Items/Weapons/Melee/GreatswordofBlah.png b/Items/Weapons/Melee/GreatswordofBlah.png index 03444ed9d3..ade13f44bf 100644 Binary files a/Items/Weapons/Melee/GreatswordofBlah.png and b/Items/Weapons/Melee/GreatswordofBlah.png differ diff --git a/Items/Weapons/Melee/GreatswordofJudgement.png b/Items/Weapons/Melee/GreatswordofJudgement.png index 048e93359c..a02c7423c1 100644 Binary files a/Items/Weapons/Melee/GreatswordofJudgement.png and b/Items/Weapons/Melee/GreatswordofJudgement.png differ diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 9a35205b68..6b72ac8ead 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index d28aaeb143..e03b5b4c92 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 60; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - SoundEngine.PlaySound(SoundID.Item20, player.position); + SoundEngine.PlaySound(SoundID.Item20, player.Center); for (int index = 0; index < 3; ++index) { float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; @@ -78,12 +78,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index 2a282402fe..d79c208c5b 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 64; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 620af39f48..862e373c7c 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 84; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; } @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); int onHitDamage = player.CalcIntDamage(Item.damage); player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); float num50 = 1.7f; @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee float num52 = 2f; Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { @@ -86,8 +86,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 300); - SoundEngine.PlaySound(SoundID.Item14, target.position); + target.AddBuff(BuffID.OnFire3, 300); + SoundEngine.PlaySound(SoundID.Item14, target.Center); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index 6be7e811a3..512c98b066 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(Item.shootSpeed, Item.shootSpeed) - spread / 2; double deltaAngle = spread / 8f; @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(Item.shootSpeed, Item.shootSpeed) - spread / 2; double deltaAngle = spread / 8f; diff --git a/Items/Weapons/Melee/IllustriousKnives.cs b/Items/Weapons/Melee/IllustriousKnives.cs index 5295614fec..c6da7e4391 100644 --- a/Items/Weapons/Melee/IllustriousKnives.cs +++ b/Items/Weapons/Melee/IllustriousKnives.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(3). + AddIngredient(2). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index 49b68da302..377db8c890 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -1,6 +1,10 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; +using CalamityMod.World; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -44,6 +48,21 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ModContent.RarityType(); } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + TooltipLine line3 = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + + if (CalamityWorld.getFixedBoi) + { + line3.Text = "May be viable weapon against DoG..."; + } + else + { + line3.Text = "Someone thought this was a viable weapon against DoG at one point lol"; + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index ed7e9b7654..2078faaeef 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index 35cc7a0b0d..bbce49a55c 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; } diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index e50b931e56..77940c0e20 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 20; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; } @@ -46,6 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee //does no damage. Explosion is visual Projectile.NewProjectile(source, target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + target.AddBuff(BuffID.OnFire3, 300); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) @@ -53,7 +54,8 @@ namespace CalamityMod.Items.Weapons.Melee var source = player.GetSource_ItemUse(Item); //does no damage. Explosion is visual - int boom = Projectile.NewProjectile(source, target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Projectile.NewProjectile(source, target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + target.AddBuff(BuffID.OnFire3, 300); } } } diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 6a6a9a8083..81873704e2 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class MirrorBlade : ModItem { - private int baseDamage = 180; + private int baseDamage = 100; public override void SetStaticDefaults() { @@ -22,7 +22,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 52; + Item.width = 72; + Item.height = 72; Item.damage = baseDamage; Item.DamageType = DamageClass.Melee; Item.useAnimation = 12; @@ -32,7 +33,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 62; Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.rare = ModContent.RarityType(); Item.shootSpeed = 9f; @@ -52,9 +52,9 @@ namespace CalamityMod.Items.Weapons.Melee { conDamage = baseDamage; } - if (conDamage > 750) + if (conDamage > 400) { - conDamage = 750; + conDamage = 400; } Item.damage = conDamage; } diff --git a/Items/Weapons/Melee/MirrorBlade.png b/Items/Weapons/Melee/MirrorBlade.png index 3724a948ab..5247456d75 100644 Binary files a/Items/Weapons/Melee/MirrorBlade.png and b/Items/Weapons/Melee/MirrorBlade.png differ diff --git a/Items/Weapons/Melee/MonstrousKnives.cs b/Items/Weapons/Melee/MonstrousKnives.cs index 836fef92c5..1b94b18331 100644 --- a/Items/Weapons/Melee/MonstrousKnives.cs +++ b/Items/Weapons/Melee/MonstrousKnives.cs @@ -1,5 +1,4 @@ using Terraria.DataStructures; -using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -20,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 18; - Item.damage = 4; + Item.damage = 9; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; @@ -105,7 +104,6 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.ThrowingKnife, 200). AddIngredient(ItemID.LifeCrystal). AddIngredient(ItemID.LesserHealingPotion, 5). - AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index 5557064fed..acd1235301 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.SolarEruption). - AddIngredient(6). + AddIngredient(6). AddIngredient(6). AddIngredient(6). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index 229bba9103..0033a17370 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2f; Item.UseSound = SoundID.Item117; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.shootSpeed = 24f; Item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index e817f99ec1..eea2f5d638 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -63,11 +63,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). + AddIngredient(6). AddIngredient(5). - AddIngredient(5). - AddIngredient(15). - AddIngredient(15). - AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/OldLordOathsword.cs b/Items/Weapons/Melee/OldLordClaymore.cs similarity index 72% rename from Items/Weapons/Melee/OldLordOathsword.cs rename to Items/Weapons/Melee/OldLordClaymore.cs index 92b0df6dbe..b15620cddf 100644 --- a/Items/Weapons/Melee/OldLordOathsword.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -4,17 +4,18 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class OldLordOathsword : ModItem + [LegacyName("OldLordOathsword")] + public class OldLordClaymore : ModItem { public bool RMBchannel = false; public override void SetStaticDefaults() { - DisplayName.SetDefault("Old Lord Oathsword"); + DisplayName.SetDefault("Old Lord Claymore"); Tooltip.SetDefault("A relic of the ancient underworld\n" + - "Holding right click rapidly absorbs energy into the blade until it is sufficiently charged\n" + - "Left clicking will either swing the blade as usual or cause you to fly in the direction of the cursor, depending on if the blade was fully charged\n" + - "After flying the amount of charge the blade has is reduced to zero again"); + "Holding right click rapidly absorbs energy into the blade until it is charged\n" + + "Pressing left click while charged causes you to fly in the direction of the cursor\n" + + "After flying, the amount of charge the blade has is reduced to zero"); SacrificeTotal = 1; } diff --git a/Items/Weapons/Melee/OldLordOathsword.png b/Items/Weapons/Melee/OldLordClaymore.png similarity index 100% rename from Items/Weapons/Melee/OldLordOathsword.png rename to Items/Weapons/Melee/OldLordClaymore.png diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index beeb6c6e37..066ca7fb9b 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 146; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; @@ -46,8 +46,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.Katana). - AddIngredient(20). - AddIngredient(10). + AddIngredient(5). + AddIngredient(2). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 27952cd245..0a34eee28d 100644 --- a/Items/Weapons/Melee/PerfectDark.cs +++ b/Items/Weapons/Melee/PerfectDark.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.RottenChunk, 5). AddIngredient(ItemID.DemoniteBar, 5). AddIngredient(15). + AddIngredient(ItemID.RottenChunk, 5). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Melee/PlagueKeeper.cs b/Items/Weapons/Melee/PlagueKeeper.cs index 4438d5d633..e9dd6fe00a 100644 --- a/Items/Weapons/Melee/PlagueKeeper.cs +++ b/Items/Weapons/Melee/PlagueKeeper.cs @@ -1,5 +1,4 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -79,8 +78,6 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(ItemID.BeeKeeper). - AddIngredient(ItemID.FragmentSolar, 10). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Melee/Pwnagehammer.cs b/Items/Weapons/Melee/Pwnagehammer.cs index 69306c0f78..f3e40cf1bb 100644 --- a/Items/Weapons/Melee/Pwnagehammer.cs +++ b/Items/Weapons/Melee/Pwnagehammer.cs @@ -57,9 +57,9 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.Pwnhammer). AddIngredient(ItemID.HallowedBar, 7). + AddIngredient(ItemID.SoulofFright, 3). AddIngredient(ItemID.SoulofMight, 3). AddIngredient(ItemID.SoulofSight, 3). - AddIngredient(ItemID.SoulofFright, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/Riptide.cs b/Items/Weapons/Melee/Riptide.cs index c587d5e1d2..644e690b63 100644 --- a/Items/Weapons/Melee/Riptide.cs +++ b/Items/Weapons/Melee/Riptide.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Riptide"); - Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions\n" + + Tooltip.SetDefault("Sprays a spiral of aqua streams\n" + "A very agile yoyo"); ItemID.Sets.Yoyo[Item.type] = true; ItemID.Sets.GamepadExtraRange[Item.type] = 15; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 30; Item.height = 44; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 16; + Item.damage = 12; Item.knockBack = 1f; Item.useTime = 25; Item.useAnimation = 25; diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index e7ba3c045a..4da22b6c95 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Roxcalibur"); - Tooltip.SetDefault("You couldn’t get it out of the rock, so you just brought the rock instead\n" + - "A hellish entity of flesh holds the key to this weapon’s power\n" + + Tooltip.SetDefault("You couldn't get it out of the rock, so you just brought the rock instead\n" + + "A hellish entity of flesh holds the key to this weapon's power\n" + "Left click to shoot several rock shards\n" + "Right click to dive downwards and bounce off enemies\n" + "Diving into blocks creates a shockwave"); @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.damage = 200; + Item.damage = 150; Item.knockBack = 13; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; @@ -42,8 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 100; Item.height = 100; Item.autoReuse = true; - Item.useAnimation = 45; - Item.useTime = 45; + Item.useAnimation = Item.useTime = 72; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -70,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee Main.dust[d].noGravity = true; Main.dust[d].position = player.Center; } - SoundEngine.PlaySound(SoundID.Item70, player.position); + SoundEngine.PlaySound(SoundID.Item70, player.Center); } // Resets the weapon usage if the alt fire collides with the ground if (RoxAlt && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) @@ -237,11 +236,9 @@ namespace CalamityMod.Items.Weapons.Melee } else { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) { - //Else shoot the spread of rock shards - int rotation = Main.rand.Next(-10, 11); - Vector2 pertubedspeed = new Vector2(velocity.X / 2, -10f * player.gravDir).RotatedBy(MathHelper.ToRadians(rotation)); + Vector2 pertubedspeed = new Vector2(velocity.X / 2, -10f * player.gravDir).RotatedByRandom(MathHelper.ToRadians(10f)); Projectile.NewProjectile(source, position.X, position.Y, pertubedspeed.X, pertubedspeed.Y, ModContent.ProjectileType(), (int)(damage * 0.5), 1f, player.whoAmI, Main.rand.Next(3)); } RoxCanAlt = 0; @@ -309,7 +306,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.HellstoneBar, 25). AddIngredient(ItemID.SoulofNight, 10). - AddIngredient(5). + AddIngredient(5). AddIngredient(ItemID.Obsidian, 10). AddIngredient(ItemID.StoneBlock, 100). AddIngredient(ItemID.Amethyst, 2). diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index 0173dd3cda..d082bfa611 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.CrimtaneBar, 5). AddIngredient(8). AddIngredient(ItemID.Vertebrae, 4). - AddIngredient(ItemID.CrimtaneBar, 5). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index 39b296d852..76e7dd60cb 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.PossessedHatchet). AddIngredient(5). - AddIngredient(9). AddIngredient(8). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Melee/SmokingComet.cs b/Items/Weapons/Melee/SmokingComet.cs new file mode 100644 index 0000000000..05e4ec9c0e --- /dev/null +++ b/Items/Weapons/Melee/SmokingComet.cs @@ -0,0 +1,57 @@ +using CalamityMod.Projectiles.Melee.Yoyos; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class SmokingComet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Smoking Comet"); + Tooltip.SetDefault("Rains stars from the sky\n" + + "A very agile yoyo"); + ItemID.Sets.Yoyo[Item.type] = true; + ItemID.Sets.GamepadExtraRange[Item.type] = 15; + ItemID.Sets.GamepadSmartQuickReach[Item.type] = true; + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.width = 36; + Item.height = 40; + Item.DamageType = DamageClass.MeleeNoSpeed; + Item.damage = 14; + Item.knockBack = 1.5f; + Item.useTime = 25; + Item.useAnimation = 25; + Item.autoReuse = true; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item1; + Item.channel = true; + Item.noUseGraphic = true; + Item.noMelee = true; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + + Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; + Item.Calamity().donorItem = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Diamond, 5). + AddIngredient(ItemID.Amethyst, 5). + AddIngredient(ItemID.PinkGel, 10). + AddIngredient(ItemID.FallenStar, 15). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/SmokingComet.png b/Items/Weapons/Melee/SmokingComet.png new file mode 100644 index 0000000000..c6e0676b2e Binary files /dev/null and b/Items/Weapons/Melee/SmokingComet.png differ diff --git a/Items/Weapons/Melee/SolsticeClaymore.cs b/Items/Weapons/Melee/SolsticeClaymore.cs index 1714fb7243..843e53c80b 100644 --- a/Items/Weapons/Melee/SolsticeClaymore.cs +++ b/Items/Weapons/Melee/SolsticeClaymore.cs @@ -85,8 +85,8 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(ItemID.BeamSword). AddIngredient(20). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/SoulHarvester.cs b/Items/Weapons/Melee/SoulHarvester.cs index 5f231b72d5..46ea67a8ae 100644 --- a/Items/Weapons/Melee/SoulHarvester.cs +++ b/Items/Weapons/Melee/SoulHarvester.cs @@ -22,17 +22,16 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 62; - Item.damage = 98; + Item.damage = 85; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; Item.useTurn = true; Item.knockBack = 7.5f; Item.UseSound = SoundID.Item71; Item.autoReuse = true; Item.height = 64; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; @@ -52,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.CursedInferno, 120); if (target.life <= (target.lifeMax * 0.15f)) { - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); int onHitDamage = player.CalcIntDamage(Item.damage); player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); for (int num621 = 0; num621 < 10; num621++) @@ -82,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.CursedInferno, 120); if (target.statLife <= (target.statLifeMax * 0.15f)) { - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); diff --git a/Items/Weapons/Melee/StarnightLance.cs b/Items/Weapons/Melee/StarnightLance.cs index 4770df2ed3..9ffb312aad 100644 --- a/Items/Weapons/Melee/StarnightLance.cs +++ b/Items/Weapons/Melee/StarnightLance.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 72; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 39df5d21b8..0a4777805a 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee private void SpawnFlares(Player player, float knockback, int damage, bool crit) { var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item88, player.position); + SoundEngine.PlaySound(SoundID.Item88, player.Center); int i = Main.myPlayer; float num72 = Item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Melee/StormRuler.cs b/Items/Weapons/Melee/StormRuler.cs index 00bb84eef2..ca2d02307f 100644 --- a/Items/Weapons/Melee/StormRuler.cs +++ b/Items/Weapons/Melee/StormRuler.cs @@ -51,8 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(3). - AddIngredient(ItemID.FragmentSolar, 10). + AddIngredient(ItemID.FragmentVortex, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index 0756a55634..bbdabc8713 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 64; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index 5047569e64..c29a3e8e30 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Weapons/Melee/Swordsplosion.cs b/Items/Weapons/Melee/Swordsplosion.cs index b0379dc4cb..57861efd6a 100644 --- a/Items/Weapons/Melee/Swordsplosion.cs +++ b/Items/Weapons/Melee/Swordsplosion.cs @@ -1,5 +1,4 @@ using Terraria.DataStructures; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using System; @@ -104,19 +103,5 @@ namespace CalamityMod.Items.Weapons.Melee Main.dust[num250].noGravity = true; } } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - } } } diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index d594e9042c..3a4f7926ab 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(). AddIngredient(ItemID.InfluxWaver). AddIngredient(20). - AddIngredient(25). + AddIngredient(25). AddIngredient(50). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Melee/TerraEdge.cs b/Items/Weapons/Melee/TerraEdge.cs deleted file mode 100644 index 67343748fe..0000000000 --- a/Items/Weapons/Melee/TerraEdge.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class TerraEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Edge"); - Tooltip.SetDefault("Heals the player on enemy hits\n" + - "Fires a beam that inflicts ichor for a short time"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.width = 58; - Item.height = 58; - Item.scale = 1.5f; - Item.damage = 112; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 17; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 17; - Item.useTurn = true; - Item.knockBack = 6.25f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - 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.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * 0.75), knockback, player.whoAmI, 0f, 0f); - return false; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 90); - - if (!target.canGhostHeal || player.moonLeech) - return; - - int healAmount = Main.rand.Next(2) + 2; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Ichor, 90); - - if (player.moonLeech) - return; - - int healAmount = Main.rand.Next(2) + 2; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.TrueExcalibur). - AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(12). - AddTile(TileID.MythrilAnvil). - Register(); - CreateRecipe(). - AddIngredient(ItemID.TrueNightsEdge). - AddIngredient(ItemID.TrueExcalibur). - AddIngredient(ItemID.BrokenHeroSword). - AddIngredient(12). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/TerraEdge.png b/Items/Weapons/Melee/TerraEdge.png deleted file mode 100644 index faef3af67d..0000000000 Binary files a/Items/Weapons/Melee/TerraEdge.png and /dev/null differ diff --git a/Items/Weapons/Melee/TerraLance.cs b/Items/Weapons/Melee/TerraLance.cs index 98fed94c19..672d9337da 100644 --- a/Items/Weapons/Melee/TerraLance.cs +++ b/Items/Weapons/Melee/TerraLance.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 44; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 2d536c3cec..3c6b1ee454 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -1,10 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -12,86 +11,61 @@ namespace CalamityMod.Items.Weapons.Melee { public class Terratomere : ModItem { + public const int SwingTime = 83; + + public const int SlashLifetime = 27; + + public const int SmallSlashCreationRate = 9; + + public const int TrueMeleeHitHeal = 4; + + public const int TrueMeleeGlacialStateTime = 30; + + public const float SmallSlashDamageFactor = 0.4f; + + public const float ExplosionExpandFactor = 1.013f; + + public const float TrailOffsetCompletionRatio = 0.2f; + + public static readonly Color TerraColor1 = new(141, 203, 50); + + public static readonly Color TerraColor2 = new(83, 163, 136); + + public static readonly SoundStyle SwingSound = new("CalamityMod/Sounds/Item/TerratomereSwing"); + public override void SetStaticDefaults() { DisplayName.SetDefault("Terratomere"); Tooltip.SetDefault("Linked to the essence of Terraria\n" + "Heals the player on true melee hits\n" + - "Fires a barrage of 4 homing beams that freeze enemies"); + "Fires a piercing energy bolt that causes hit targets to explode and be slashed"); SacrificeTotal = 1; } public override void SetDefaults() { Item.width = 60; - Item.damage = 260; + Item.height = 66; + Item.damage = 303; Item.DamageType = DamageClass.Melee; Item.useAnimation = 21; - Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 21; + Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 66; + Item.noUseGraphic = true; + Item.noMelee = true; Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 20f; - } - - 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 < 4; ++index) - { - float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.5), knockback, player.whoAmI, 0f, 0f); - } - - return false; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 30); - - if (!target.canGhostHeal || player.moonLeech) - return; - - int healAmount = Main.rand.Next(3) + 2; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 30); - - if (player.moonLeech) - return; - - int healAmount = Main.rand.Next(3) + 2; - player.statLife += healAmount; - player.HealEffect(healAmount); + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 60f; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override void AddRecipes() { - CreateRecipe(). - AddIngredient(). - AddIngredient(). - AddIngredient(). - AddIngredient(7). - AddTile(TileID.LunarCraftingStation). - Register(); - CreateRecipe(). AddIngredient(). AddIngredient(). diff --git a/Items/Weapons/Melee/TerrorBlade.cs b/Items/Weapons/Melee/TerrorBlade.cs index 988229a051..56661a6a55 100644 --- a/Items/Weapons/Melee/TerrorBlade.cs +++ b/Items/Weapons/Melee/TerrorBlade.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 88; - Item.damage = 630; + Item.damage = 500; Item.DamageType = DamageClass.Melee; Item.useAnimation = 18; Item.useTime = 18; diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs index f6584c15e1..a2811e36d3 100644 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ b/Items/Weapons/Melee/TheEnforcer.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item73, player.position); + SoundEngine.PlaySound(SoundID.Item73, player.Center); int i = Main.myPlayer; float num72 = 3f; player.itemTime = Item.useTime; @@ -96,7 +96,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { var source = player.GetSource_ItemUse(Item); - SoundEngine.PlaySound(SoundID.Item73, player.position); + SoundEngine.PlaySound(SoundID.Item73, player.Center); int i = Main.myPlayer; float num72 = 3f; player.itemTime = Item.useTime; diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index b2ed4bb9cf..84fa78fd07 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -47,7 +47,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(30). + AddIngredient(18). + AddIngredient(18). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index 48e5895050..c78477b821 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 34; Item.height = 34; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 65; + Item.damage = 111; Item.knockBack = 3f; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index c47e82ffa8..e1193f4051 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.NewItem(player.GetSource_OnHit(target), (int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); } } - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); target.position.X += target.width / 2; target.position.Y += target.height / 2; target.position.X -= target.width / 2; diff --git a/Items/Weapons/Melee/TitanArm.cs b/Items/Weapons/Melee/TitanArm.cs index 5868d02fbd..c3130cf0dd 100644 --- a/Items/Weapons/Melee/TitanArm.cs +++ b/Items/Weapons/Melee/TitanArm.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 58; Item.damage = 69; Item.scale = 1.75f; - Item.knockBack = 20f; //This number doesn't mean anything, but it's not 9001f because that caused bugs. + Item.knockBack = 80f; //This number doesn't mean anything, but it's not 9001f because that caused bugs. Item.useAnimation = Item.useTime = 12; Item.DamageType = DamageClass.Melee; Item.useTurn = true; @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee // This is modified vanilla code from StrikeNPC method in NPC.cs // Extra Note: Will cause an out of bounds error on enemies that don't despawn and are affected. See Blue Cultist Archer. // Extra (extra) Note: Fails in ModifyHitNPC if the enemy has too much health due to velocity clamping if you don't do enough damage. - float kbAmt = player.GetWeaponKnockback(Item, Item.knockBack) * 9001f * target.knockBackResist; //That obligatory over 9000 reference + float kbAmt = player.GetWeaponKnockback(Item, Item.knockBack) * target.knockBackResist; //That obligatory over 9000 reference if (crit) kbAmt *= 1.4f; float kbAmtY = target.noGravity ? kbAmt * -0.5f : kbAmt * -0.75f; diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 7f68595106..fb028ab79d 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -1,5 +1,4 @@ using Terraria.DataStructures; -using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -27,16 +26,17 @@ namespace CalamityMod.Items.Weapons.Melee public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder - const string ParryTooltip = "Using RMB will extend the Ark out in front of you. Hitting an enemy with it will parry them, granting you a small window of invulnerability\n" + - "You can also parry projectiles and temporarily make them deal 160 less damage\n" + - "Parrying will empower the next 10 swings of the sword, boosting their damage and letting them throw stronger projectiles\n" + - "Using RMB and pressing up while the Ark is empowered will release all the charges in a powerful burst of energy"; + const string ParryTooltip = "Using right click will extend the Ark out in front of you." + + "Hitting an enemy with it will parry them, granting you brief invulnerability\n" + + "You can also parry projectiles to make them deal 160 less damage for a short period\n" + + "Parrying empowers the next 10 swings of the sword, letting them throw stronger projectiles\n" + + "Using right click and pressing UP will release all empowered charges in a powerful burst of energy"; public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Ancients"); Tooltip.SetDefault("This line gets set in ModifyTooltips\n" + - "A heavenly blade forged to vanquish all evil"); + "A heavenly blade forged to vanquish all evil"); SacrificeTotal = 1; } @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 6.5f; Item.UseSound = null; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 12f; @@ -182,9 +182,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.TrueExcalibur). - AddIngredient(). - AddIngredient(15). + AddIngredient(ItemID.Starfury). + AddIngredient(ItemID.BrokenHeroSword). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/TrueBloodyEdge.cs b/Items/Weapons/Melee/TrueBloodyEdge.cs deleted file mode 100644 index 41d58ad2f1..0000000000 --- a/Items/Weapons/Melee/TrueBloodyEdge.cs +++ /dev/null @@ -1,84 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class TrueBloodyEdge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("True Bloody Edge"); - Tooltip.SetDefault("Chance to heal the player on enemy hits\n" + - "Inflicts Burning Blood\n" + - "Fires a bloody blade"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.width = 48; - Item.damage = 75; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; - Item.knockBack = 6f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.height = 64; - Item.scale = 1.5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 11f; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(5)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(ModContent.BuffType(), 60); - OnHitEffects(player); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(ModContent.BuffType(), 60); - OnHitEffects(player); - } - - private void OnHitEffects(Player player) - { - if (player.moonLeech) - return; - - int healAmount = Main.rand.Next(3) + 3; - if (Main.rand.NextBool(2)) - { - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.SoulofFright, 3). - AddIngredient(ItemID.SoulofMight, 3). - AddIngredient(ItemID.SoulofSight, 3). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/TrueBloodyEdge.png b/Items/Weapons/Melee/TrueBloodyEdge.png deleted file mode 100644 index f52b227e5a..0000000000 Binary files a/Items/Weapons/Melee/TrueBloodyEdge.png and /dev/null differ diff --git a/Items/Weapons/Melee/TrueCausticEdge.cs b/Items/Weapons/Melee/TrueCausticEdge.cs index f1fe7affeb..3362716a0a 100644 --- a/Items/Weapons/Melee/TrueCausticEdge.cs +++ b/Items/Weapons/Melee/TrueCausticEdge.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = 64; - Item.damage = 150; + Item.damage = 120; Item.DamageType = DamageClass.Melee; Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Swing; @@ -36,11 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * 0.75), knockback, player.whoAmI, 0f, 0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => damage = (int)(damage * 0.75); public override void MeleeEffects(Player player, Rectangle hitbox) { diff --git a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs index 2b3ae35df0..20ef82cd01 100644 --- a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs @@ -72,14 +72,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { player.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Poisoned, 300); target.AddBuff(BuffID.Venom, 150); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Poisoned, 300); target.AddBuff(BuffID.Venom, 150); } diff --git a/Items/Weapons/Melee/Tumbleweed.cs b/Items/Weapons/Melee/Tumbleweed.cs index 0cbbf56695..b944c1c746 100644 --- a/Items/Weapons/Melee/Tumbleweed.cs +++ b/Items/Weapons/Melee/Tumbleweed.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index 032b67a6c6..2affc4e25d 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noMelee = true; Item.noUseGraphic = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; Item.autoReuse = true; @@ -40,9 +40,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). + AddIngredient(30). AddIngredient(30). - AddIngredient(10). - AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Melee/TyrantYharimsUltisword.cs b/Items/Weapons/Melee/TyrantYharimsUltisword.cs index 99254501a8..78253d7c18 100644 --- a/Items/Weapons/Melee/TyrantYharimsUltisword.cs +++ b/Items/Weapons/Melee/TyrantYharimsUltisword.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 88; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; @@ -48,14 +48,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { player.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.Poisoned, 300); target.AddBuff(BuffID.Venom, 150); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.Poisoned, 300); target.AddBuff(BuffID.Venom, 150); } diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index b9f082ed7a..360799d387 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Items.Weapons.Melee Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.autoReuse = true; Item.UseSound = SoundID.Item1; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.OnFire3, 360); int onHitDamage = player.CalcIntDamage(Item.damage); player.ApplyDamageToNPC(target, onHitDamage, 0f, 0, false); float num50 = 1.7f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee float num52 = 2f; Vector2 value3 = (target.rotation - 1.57079637f).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { diff --git a/Items/Weapons/Melee/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index ade4afab29..2df6df4ce6 100644 --- a/Items/Weapons/Melee/VeinBurster.cs +++ b/Items/Weapons/Melee/VeinBurster.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Vertebrae, 5). AddIngredient(ItemID.CrimtaneBar, 5). AddIngredient(15). + AddIngredient(ItemID.Vertebrae, 5). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Melee/Virulence.cs b/Items/Weapons/Melee/Virulence.cs index b845aae321..5aabd462d4 100644 --- a/Items/Weapons/Melee/Virulence.cs +++ b/Items/Weapons/Melee/Virulence.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 62; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Weapons/Melee/VulcaniteLance.cs b/Items/Weapons/Melee/VulcaniteLance.cs index cb91ef6ab4..4b69942ac6 100644 --- a/Items/Weapons/Melee/VulcaniteLance.cs +++ b/Items/Weapons/Melee/VulcaniteLance.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 44; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index fb9465da20..7952175583 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -54,11 +54,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Screwdriver"); - Tooltip.SetDefault("Can be used to rapidly and royally screw over any foe, provided they're weak enough\n" + - "Striking an enemy has a chance to give you a wulfrum screw, that you can throw back at them by right clicking\n" + - "Hitting a flung screw with the screwdriver will boost its damage and speed, sending it hurling forwards at high speeds\n" + - "[c/83B87E:\"Who makes flatheads this large?? The hell am I supposed to use it for, the thing could take an eye out!\"]\n" + - "[c/83B87E:\"…Ah.\"]"); + Tooltip.SetDefault("Can be used to rapidly and royally screw over foes\n" + + "Striking an enemy sometimes gives you a wulfrum screw that you can throw with RMB\n" + + "Hit a thrown screw with the screwdriver to launch it forward at high speed\n" + + "[c/83B87E:\"Who makes flatheads this large?? The hell am I supposed to use it for?!\"]\n" + + "[c/83B87E:\"This thing could take an eye out!\"]\n" + + "[c/83B87E:\"…Ah.\"]"); SacrificeTotal = 1; } @@ -75,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 14; Item.height = 50; - Item.damage = 9; + Item.damage = 12; Item.DamageType = DamageClass.Melee; Item.useAnimation = DefaultTime + WulfrumScrewdriverProj.MaxTime; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs index 578af81dd7..d6998f9589 100644 --- a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs +++ b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 3f; Item.channel = true; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shootSpeed = 6f; @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.AdamantiteBar, 10). - AddIngredient(ItemID.SoulofNight, 3). AddIngredient(ItemID.SoulofLight, 3). + AddIngredient(ItemID.SoulofNight, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 5094bbefd8..7ce5e81c2c 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -96,10 +96,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(1). AddIngredient(). - AddIngredient(20). - AddIngredient(10). AddIngredient(20). - AddIngredient(5). AddIngredient(8). AddIngredient(20). AddTile(). diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 9f319d5446..96ec4ddd3d 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -20,7 +20,7 @@ Right click to fire a burst of bullets"); public override void SetDefaults() { - Item.damage = 33; // was 25 + Item.damage = 33; Item.DamageType = DamageClass.Ranged; Item.width = 70; Item.height = 18; @@ -30,7 +30,7 @@ Right click to fire a burst of bullets"); Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item31; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/AntiMaterielRifle.cs b/Items/Weapons/Ranged/AntiMaterielRifle.cs index 947bc9e367..4533e4b489 100644 --- a/Items/Weapons/Ranged/AntiMaterielRifle.cs +++ b/Items/Weapons/Ranged/AntiMaterielRifle.cs @@ -5,7 +5,6 @@ using CalamityMod.Sounds; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -57,14 +56,10 @@ namespace CalamityMod.Items.Weapons.Ranged Register(); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - else - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - - return false; + type = ModContent.ProjectileType(); } } } diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index 213a4420c4..f15d5fc4cb 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -69,8 +69,6 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.Boomstick). AddIngredient(2). AddIngredient(10). - AddIngredient(15). - AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 5a8189bfc1..b2609e0292 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 9; + Item.damage = 16; Item.DamageType = DamageClass.Ranged; Item.width = 78; Item.height = 36; @@ -45,9 +45,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index e5276cf1e7..9c54d8c636 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -13,10 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Astreal Defeat"); - Tooltip.SetDefault("Ethereal bow of the tyrant king's mother\n" + - "The mother strongly discouraged acts of violence throughout her life\n" + - "Though she kept this bow close, to protect her family in times of great disaster\n" + - "All arrows are converted to Astreal Arrows that emit flames as they travel"); + Tooltip.SetDefault("All arrows are converted to Astreal Arrows that emit flames as they travel"); SacrificeTotal = 1; } @@ -62,11 +59,8 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.SpiritFlame). AddIngredient(ItemID.ShadowFlameBow). - AddIngredient(). - AddIngredient(). - AddIngredient(). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index 868b866d5d..6599c74763 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 502ec38d89..fb443831ce 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item10; Item.autoReuse = true; @@ -59,9 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.PiranhaGun). - AddIngredient(2). - AddIngredient(). - AddIngredient(5). + AddIngredient(3). AddIngredient(ItemID.SharkFin, 2). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.cs b/Items/Weapons/Ranged/BladedgeGreatbow.cs index ae9920d745..f773a5332b 100644 --- a/Items/Weapons/Ranged/BladedgeGreatbow.cs +++ b/Items/Weapons/Ranged/BladedgeGreatbow.cs @@ -12,14 +12,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bladedge Railbow"); - Tooltip.SetDefault("Fires 4 arrows at once\n" + - "Fires 2 additional leaves"); + Tooltip.SetDefault("Fires a spread of 4 arrows and 2 leaves at once"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 28; + Item.damage = 35; Item.DamageType = DamageClass.Ranged; Item.width = 74; Item.height = 24; @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item5; Item.autoReuse = true; @@ -53,21 +52,20 @@ namespace CalamityMod.Items.Weapons.Ranged Main.projectile[index].noDropItem = true; } Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 2; + float PiOver10 = MathHelper.Pi * 0.1f; Vector2 vector7 = velocity; vector7.Normalize(); vector7 *= 10f; bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) + for (int num119 = 0; num119 < 2; num119++) { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); + float num120 = (float)num119 - 1f / 2f; + Vector2 value9 = vector7.RotatedBy((double)(PiOver10 * num120), default); if (!flag11) { value9 -= vector7; } - int projectile = Projectile.NewProjectile(source, vector2.X + value9.X, vector2.Y + value9.Y, velocity.X, velocity.Y, ProjectileID.Leaf, damage / 2, 0f, player.whoAmI); + int projectile = Projectile.NewProjectile(source, vector2.X + value9.X, vector2.Y + value9.Y, velocity.X, velocity.Y, ProjectileID.Leaf, damage, 0f, player.whoAmI); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].DamageType = DamageClass.Ranged; } diff --git a/Items/Weapons/Ranged/BlightSpewer.cs b/Items/Weapons/Ranged/BlightSpewer.cs index 87186b48e1..d244a6de80 100644 --- a/Items/Weapons/Ranged/BlightSpewer.cs +++ b/Items/Weapons/Ranged/BlightSpewer.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 2f; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index 92f5f0e3d5..6eb82b0c60 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 20; + Item.damage = 25; Item.DamageType = DamageClass.Ranged; Item.width = 30; Item.height = 58; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Butcher.cs b/Items/Weapons/Ranged/Butcher.cs index cdb25d677c..a7f7fc6127 100644 --- a/Items/Weapons/Ranged/Butcher.cs +++ b/Items/Weapons/Ranged/Butcher.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.Shotgun). AddIngredient(ItemID.IllegalGunParts). AddRecipeGroup("AnyCobaltBar", 5). - AddIngredient(4). + AddIngredient(4). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 1a72063047..dcf21014ea 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 32; + Item.damage = 36; Item.DamageType = DamageClass.Ranged; Item.width = 64; Item.height = 30; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.UseSound = CommonCalamitySounds.PlasmaBoltSound; Item.autoReuse = true; Item.rare = ItemRarityID.Pink; diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index f8fdbaa4fe..b3bd74c3e0 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.75f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item31; Item.autoReuse = true; @@ -64,11 +64,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.ClockworkAssaultRifle). AddIngredient(ItemID.Gatligator). AddIngredient(ItemID.VenusMagnum). - AddIngredient(ItemID.ClockworkAssaultRifle). AddIngredient(3). - AddIngredient(ItemID.Ectoplasm, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/ConferenceCall.cs b/Items/Weapons/Ranged/ConferenceCall.cs index 19fdf10467..0832fa9415 100644 --- a/Items/Weapons/Ranged/ConferenceCall.cs +++ b/Items/Weapons/Ranged/ConferenceCall.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.TacticalShotgun). - AddIngredient(ItemID.FragmentVortex, 7). + AddIngredient(ItemID.FragmentVortex, 12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/ContinentalGreatbow.cs b/Items/Weapons/Ranged/ContinentalGreatbow.cs index e5ff8fd60f..ec8abc553e 100644 --- a/Items/Weapons/Ranged/ContinentalGreatbow.cs +++ b/Items/Weapons/Ranged/ContinentalGreatbow.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/CoralCannon.cs b/Items/Weapons/Ranged/CoralCannon.cs index f86b50ddc6..b2c13ca807 100644 --- a/Items/Weapons/Ranged/CoralCannon.cs +++ b/Items/Weapons/Ranged/CoralCannon.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -12,13 +12,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Coral Cannon"); - Tooltip.SetDefault("Has a chance to shoot a big coral that stuns enemies"); + Tooltip.SetDefault("Has a 20% chance to shoot a big coral that stuns enemies\n" + + "Does not consume ammo"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 20; + Item.damage = 24; Item.DamageType = DamageClass.Ranged; Item.width = 52; Item.height = 40; @@ -45,13 +46,10 @@ namespace CalamityMod.Items.Weapons.Ranged { if (Main.rand.NextBool(5)) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)((double)damage * 2.0), knockback * 2f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback * 1.5f, player.whoAmI); + return false; } - else - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - } - return false; + return true; } } } diff --git a/Items/Weapons/Ranged/CorinthPrime.cs b/Items/Weapons/Ranged/CorinthPrime.cs new file mode 100644 index 0000000000..a225a758ae --- /dev/null +++ b/Items/Weapons/Ranged/CorinthPrime.cs @@ -0,0 +1,104 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class CorinthPrime : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corinth Prime"); + Tooltip.SetDefault(@"Shoots a tight burst of 6 high velocity bullets +Converts musket balls into high velocity explosive bullets +Right click to fire a grenade +The grenade emits a massive explosion if it doesn't touch anything for 2 seconds +Otherwise, the grenade emits an extremely weak explosion"); + SacrificeTotal = 1; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; + Item.width = 106; + Item.height = 42; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 8f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + Item.UseSound = SoundID.Item38; + Item.autoReuse = true; + Item.shoot = ProjectileID.PurificationPowder; + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.shoot = ModContent.ProjectileType(); + Item.Calamity().canFirePointBlankShots = true; + } + + public override Vector2? HoldoutOffset() => new Vector2(-20, 5); + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + Item.useTime = 90; + Item.useAnimation = 90; + Item.UseSound = SoundID.Item66; + Item.shootSpeed = 8f; + } + else + { + Item.useTime = 30; + Item.useAnimation = 30; + Item.UseSound = SoundID.Item38; + Item.shootSpeed = 12f; + } + 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) + { + Projectile.NewProjectile(source, position + Vector2.Normalize(velocity) * 60f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + } + else + { + int numBullets = 6; + for (int index = 0; index < numBullets; index++) + { + float SpeedX = velocity.X + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-30, 31) * 0.05f; + int proj = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type == ProjectileID.Bullet ? ModContent.ProjectileType() : type, damage, knockback, player.whoAmI); + Main.projectile[proj].extraUpdates += 1; + } + } + + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.VortexBeater). + AddIngredient(ItemID.IllegalGunParts). + AddIngredient(2). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/CorinthPrime.png b/Items/Weapons/Ranged/CorinthPrime.png new file mode 100644 index 0000000000..08692aafa9 Binary files /dev/null and b/Items/Weapons/Ranged/CorinthPrime.png differ diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 5f2539094a..14cb93eeed 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index e3790160b9..c70f979674 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -13,14 +13,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Bolter"); - Tooltip.SetDefault("Fires three arrows at once\n" + + Tooltip.SetDefault("Fires a tight column of three arrows\n" + "Converts wooden arrows into sliding energy bolts"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 39; + Item.damage = 48; Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 76; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item75; Item.autoReuse = true; @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Ranged offset -= velocity; if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(spawnSource, source + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + 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); @@ -70,9 +70,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). + AddIngredient(ItemID.HallowedRepeater). AddIngredient(12). - AddIngredient(ItemID.HallowedBar, 5). - AddIngredient(ItemID.SoulofSight, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index e6a6486215..8196b00d85 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ElementalBlaster.cs b/Items/Weapons/Ranged/ElementalBlaster.cs index d6b7e831cd..c3f2783250 100644 --- a/Items/Weapons/Ranged/ElementalBlaster.cs +++ b/Items/Weapons/Ranged/ElementalBlaster.cs @@ -44,11 +44,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(). AddIngredient(). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/ElementalEruption.cs b/Items/Weapons/Ranged/ElementalEruption.cs index 950a23f580..f15172a03c 100644 --- a/Items/Weapons/Ranged/ElementalEruption.cs +++ b/Items/Weapons/Ranged/ElementalEruption.cs @@ -58,11 +58,11 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index 69bb88219c..ed4583835f 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -19,15 +19,15 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.damage = 80; Item.DamageType = DamageClass.Ranged; - Item.width = 38; - Item.height = 62; + Item.width = 72; + Item.height = 36; Item.useTime = 18; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.useAmmo = AmmoID.Arrow; Item.UseSound = SoundID.Item5; diff --git a/Items/Weapons/Ranged/EternalBlizzard.png b/Items/Weapons/Ranged/EternalBlizzard.png index 8d0fcc4925..459f2c51aa 100644 Binary files a/Items/Weapons/Ranged/EternalBlizzard.png and b/Items/Weapons/Ranged/EternalBlizzard.png differ diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index f5c749ed7e..61751954af 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -56,9 +56,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). + AddIngredient(ItemID.CrimtaneBar, 4). AddIngredient(8). AddIngredient(ItemID.Vertebrae, 4). - AddIngredient(ItemID.CrimtaneBar, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index d91c7ebf20..9ca9c0e480 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -1,5 +1,4 @@ using Terraria.DataStructures; -using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 10; + Item.damage = 14; Item.DamageType = DamageClass.Ranged; Item.width = 56; Item.height = 28; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useTime = 12; + Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -62,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; - int flare = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 1.4), knockback, player.whoAmI); + int flare = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); if (flare.WithinBounds(Main.maxProjectiles)) { Main.projectile[flare].penetrate = 1; @@ -95,9 +94,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.FlareGun). - AddIngredient(ItemID.Boomstick). - AddRecipeGroup("AnyGoldBar", 10). - AddIngredient(10). + AddIngredient(ItemID.HellstoneBar, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index b6a77b8ca0..84b1e7708a 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -21,19 +21,18 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 45; + Item.damage = 88; Item.DamageType = DamageClass.Ranged; Item.width = 152; Item.height = 58; Item.useTime = 10; Item.useAnimation = 10; - Item.reuseDelay = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; Item.knockBack = 0f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = CommonCalamitySounds.LaserCannonSound; Item.shoot = ModContent.ProjectileType(); @@ -42,19 +41,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). + AddIngredient(20). AddIngredient(20). - AddIngredient(10). - AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index 665ced9a74..e890719d10 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item109; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/FreedomStar.cs b/Items/Weapons/Ranged/FreedomStar.cs new file mode 100644 index 0000000000..06063d2ce0 --- /dev/null +++ b/Items/Weapons/Ranged/FreedomStar.cs @@ -0,0 +1,77 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class FreedomStar : ModItem + { + // This is the amount of charge consumed every time the holdout projectile fires various projectiles. + public const float HoldoutChargeUse_Orb = 0.004f; + public const float HoldoutChargeUse_OrbLarge = 0.005f; + public const float HoldoutChargeUse_Laser = 0.006f; + public const float HoldoutChargeUse_LaserLarge = 0.01f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Freedom Star"); + Tooltip.SetDefault(@"Tap to fire energy orbs +Hold to charge and fire a beam that explodes on hit"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + CalamityGlobalItem modItem = Item.Calamity(); + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; + Item.width = 54; + Item.height = 28; + Item.useTime = 10; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + Item.knockBack = 3f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ModContent.RarityType(); + modItem.donorItem = true; + Item.UseSound = SoundID.Item75; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + modItem.UsesCharge = true; + modItem.MaxCharge = 150f; + modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. + } + + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Vector2 shootVelocity = velocity; + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + // Charge-up. Done via a holdout projectile. + Projectile.NewProjectile(source, position, shootDirection, type, damage, knockback, player.whoAmI); + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.LunarBar, 4). + AddIngredient(8). + AddIngredient(12). + AddIngredient(18). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/FreedomStar.png b/Items/Weapons/Ranged/FreedomStar.png new file mode 100644 index 0000000000..16f764e3bf Binary files /dev/null and b/Items/Weapons/Ranged/FreedomStar.png differ diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.cs b/Items/Weapons/Ranged/FrostbiteBlaster.cs index 0ed5298763..3bc7084d49 100644 --- a/Items/Weapons/Ranged/FrostbiteBlaster.cs +++ b/Items/Weapons/Ranged/FrostbiteBlaster.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.useAmmo = AmmoID.Bullet; Item.UseSound = SoundID.Item36; diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index c98b0589fc..5d80501b44 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -1,5 +1,6 @@ using Terraria.DataStructures; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -55,13 +56,9 @@ namespace CalamityMod.Items.Weapons.Ranged { offset -= velocity; } - int index = Projectile.NewProjectile(spawnSource, source + offset, velocity * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI); + int index = Projectile.NewProjectile(spawnSource, source + offset, velocity * 0.6f, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI, i); if (index.WithinBounds(Main.maxProjectiles)) - { Main.projectile[index].DamageType = DamageClass.Ranged; - Main.projectile[index].usesLocalNPCImmunity = true; - Main.projectile[index].localNPCHitCooldown = 10; - } } return true; } @@ -70,8 +67,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(18). - AddIngredient(ItemID.Gel, 30). - AddIngredient(ItemID.HellstoneBar, 5). + AddIngredient(18). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index e1e6867cf2..8350e474b1 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -59,8 +59,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(18). - AddIngredient(ItemID.Gel, 15). - AddIngredient(ItemID.HellstoneBar, 5). + AddIngredient(18). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index be663b758b..f2c01a7dd5 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -1,4 +1,7 @@ -using CalamityMod.Rarities; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Rarities; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -40,9 +43,21 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-15, 0); + public override void ModifyTooltips(List list) + { + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip0"); + + if (line != null && CalamityWorld.getFixedBoi) + line.Text = "No, it sucks"; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - SoundEngine.PlaySound(SoundID.Item38, player.position); + SoundEngine.PlaySound(SoundID.Item38, player.Center); + + // Really jammed in GFB + if (CalamityWorld.getFixedBoi) + return Main.rand.NextBool(5); int bulletAmt = Main.rand.Next(25, 36); for (int index = 0; index < bulletAmt; ++index) diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index ac885b79b6..1a38851bc9 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Ranged/HavocsBreath.cs b/Items/Weapons/Ranged/HavocsBreath.cs index 0e356e5aed..aa5a073ce6 100644 --- a/Items/Weapons/Ranged/HavocsBreath.cs +++ b/Items/Weapons/Ranged/HavocsBreath.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1.5f; Item.UseSound = SoundID.Item34; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 696c35557b..65ad982b4c 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -72,9 +72,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(). - AddIngredient(). //Why is this here AddIngredient(). AddIngredient(). AddTile(). diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 0f8bfaf4ff..8e190b21d1 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Hellborn : ModItem { - public const float ExplosionDamageMultiplier = 5f; + public const float ExplosionDamageMultiplier = 3f; public override void SetStaticDefaults() { @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 7; + Item.damage = 20; Item.DamageType = DamageClass.Ranged; Item.width = 66; Item.height = 34; @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Ranged float num52 = 4f; Vector2 value3 = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 value4 = value3 * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.position); + SoundEngine.PlaySound(SoundID.Item14, target.Center); for (int num53 = 0; num53 < 80; num53++) { int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default, num50); @@ -129,12 +129,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.OnFire3, 360); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.OnFire3, 360); } } } diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 5f97e0f3e5..759a1283eb 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAnimation = 7; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item11; Item.autoReuse = true; @@ -75,12 +75,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.OnFire3, 360); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.OnFire3, 360); } } } diff --git a/Items/Weapons/Ranged/EffluviumBow.cs b/Items/Weapons/Ranged/HoarfrostBow.cs similarity index 91% rename from Items/Weapons/Ranged/EffluviumBow.cs rename to Items/Weapons/Ranged/HoarfrostBow.cs index 4a16683c9d..635287dbda 100644 --- a/Items/Weapons/Ranged/EffluviumBow.cs +++ b/Items/Weapons/Ranged/HoarfrostBow.cs @@ -7,11 +7,12 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class EffluviumBow : ModItem + [LegacyName("EffluviumBow")] + public class HoarfrostBow : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Effluvium Bow"); + DisplayName.SetDefault("Hoarfrost Bow"); Tooltip.SetDefault("Fires two arrows at once\n" + "Converts wooden arrows into mist arrows"); SacrificeTotal = 1; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/EffluviumBow.png b/Items/Weapons/Ranged/HoarfrostBow.png similarity index 100% rename from Items/Weapons/Ranged/EffluviumBow.png rename to Items/Weapons/Ranged/HoarfrostBow.png diff --git a/Items/Weapons/Ranged/Hydra.cs b/Items/Weapons/Ranged/Hydra.cs new file mode 100644 index 0000000000..52ceb73351 --- /dev/null +++ b/Items/Weapons/Ranged/Hydra.cs @@ -0,0 +1,164 @@ +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Hydra : ModItem + { + //Editable stats: + public const int BulletsPerShot = 4; + public const float ShotSpread = 10f; //in degrees + public const int TimeToSpawnHead = 3; //in seconds + public const int MaximumHeadCount = 3; + + public int HeadID = ModContent.ProjectileType(); + public int HeadSpawnTimer = 0; + + //There could be new sounds for these. Vanilla sounds for now. + public static readonly SoundStyle SpawnSound = SoundID.Item60; + public static readonly SoundStyle LaunchSound = SoundID.Item1; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydra"); + Tooltip.SetDefault("Fires a spread of " + BulletsPerShot + " toxic bullets\n"+ + "Grows a gun-head every " + TimeToSpawnHead + " seconds, up to a maximum of " + MaximumHeadCount + " heads\n" + + "Left-click to command any existing heads to fire\n" + + "Right-click to launch the heads for powerful explosive damage\n" + + "[c/9D80B0:Fusion of heavy machinery and Lernaean blood]"); + SacrificeTotal = 1; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 66; + Item.height = 30; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.damage = 44; + Item.DamageType = DamageClass.Ranged; + Item.useAnimation = Item.useTime = 66; + Item.useAmmo = AmmoID.Bullet; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + Item.knockBack = 10f; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.rare = ItemRarityID.Yellow; + Item.UseSound = null; //does so in Shoot + Item.Calamity().canFirePointBlankShots = true; + } + + public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true; + + public override void UpdateInventory(Player player) + { + //Spawn heads while holding + if (player.ActiveItem().type == Item.type && player.ownedProjectileCounts[HeadID] < MaximumHeadCount) + { + HeadSpawnTimer++; + if (HeadSpawnTimer >= TimeToSpawnHead * 60) + { + HeadSpawnTimer = 0; + SoundEngine.PlaySound(SpawnSound, player.Center); + Projectile.NewProjectile(Item.GetSource_FromThis(), player.Top + Vector2.UnitY * 8f, Vector2.Zero, HeadID, 0, 0, player.whoAmI); + } + } + else if (player.ActiveItem().type != Item.type || player.dead || !player.active) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + //Destroy all heads + if (Main.projectile[i].type == HeadID && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].active) + Main.projectile[i].Kill(); + } + HeadSpawnTimer = 0; + } + } + + public override bool AltFunctionUse(Player player) + { + //Does nothing if there's no heads + if (player.ownedProjectileCounts[HeadID] <= 0) + return false; + + //Otherwise, launch the guns + for (int i = 0; i < Main.maxProjectiles; i++) + { + SoundEngine.PlaySound(LaunchSound, player.Center); + if (Main.projectile[i].type == HeadID && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].active) + Main.projectile[i].ai[1] = -1f; + } + return false; + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Vector2 shootDirection = velocity.SafeNormalize(Vector2.Zero); + for (int i = 0; i < 4; i++) + { + int CurrentHeadCount = player.ownedProjectileCounts[HeadID]; + //Exponentially louder the more heads, slightly + SoundStyle FireSound = new("CalamityMod/Sounds/Item/Hydra") { Volume = 0.3f + (float)(Math.Pow(CurrentHeadCount, 1.5D) * 0.2f) }; + SoundEngine.PlaySound(FireSound, player.Center); + + Vector2 spreadDirection = shootDirection.RotatedByRandom(MathHelper.ToRadians(ShotSpread / 2f)); + float spreadVelocity = Item.shootSpeed * Main.rand.NextFloat(1f, 1.4f); + Vector2 newPos = player.MountedCenter + shootDirection * 50f; + + Projectile.NewProjectile(source, newPos, spreadVelocity * spreadDirection, Item.shoot, damage, knockback, player.whoAmI); + } + + for (int i = 0; i < Main.maxProjectiles; i++) + { + //Force all heads to shoot + if (Main.projectile[i].type == HeadID && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].active) + Main.projectile[i].ai[1] = 1f; + } + return false; + } + + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.direction = Math.Sign((player.Calamity().mouseWorld - player.Center).X); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(-17, 3); + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.direction = 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.4f) + rotation += -0.45f * (float)Math.Pow((0.4f - animProgress) / 0.4f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.QuadBarrelShotgun). + AddIngredient(ItemID.Nanites, 25). + AddIngredient(ItemID.VialofVenom, 25). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/Typeless/FiniteUse/Hydra.png b/Items/Weapons/Ranged/Hydra.png similarity index 100% rename from Items/Weapons/Typeless/FiniteUse/Hydra.png rename to Items/Weapons/Ranged/Hydra.png diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index 0c34b42f02..dbb9a67b5e 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item92; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/MagnaStriker.cs b/Items/Weapons/Ranged/MagnaStriker.cs index f91b5c844c..655c05e861 100644 --- a/Items/Weapons/Ranged/MagnaStriker.cs +++ b/Items/Weapons/Ranged/MagnaStriker.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 35; + Item.damage = 50; Item.DamageType = DamageClass.Ranged; Item.width = 72; Item.height = 38; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = OpalStriker.FireSound; Item.autoReuse = true; @@ -46,16 +46,12 @@ 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) { - int randomProj = Main.rand.Next(2); - if (randomProj == 0) + if (Main.rand.NextBool()) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 0.75), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + return false; } - else - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - } - return false; + return true; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index 9ab4284993..ba5e7ecdd3 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item97; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index ea624c2947..2eaefc0ed4 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item11; Item.autoReuse = true; @@ -77,9 +77,8 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.Megashark). AddIngredient(). + AddIngredient(10). AddIngredient(10). - AddIngredient(10). - AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Ranged/MidasPrime.cs b/Items/Weapons/Ranged/MidasPrime.cs index 9b194ca6dc..c80412aef5 100644 --- a/Items/Weapons/Ranged/MidasPrime.cs +++ b/Items/Weapons/Ranged/MidasPrime.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = Item.sellPrice(0, 7, 20, 0); + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = CrackshotColt.ShootSound; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index 8597a50824..271804e845 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index f98668efa8..cc2cbb7d3b 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(2). - AddIngredient(3). + AddIngredient(). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 6e031c5830..e4270078b2 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -94,10 +94,7 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.Tsunami). AddIngredient(). AddIngredient(6). - AddIngredient(ItemID.SharkFin, 2). AddIngredient(10). - AddIngredient(10). - AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/NullificationRifle.cs b/Items/Weapons/Ranged/NullificationRifle.cs index 7e56de0cb5..8e18b78ca3 100644 --- a/Items/Weapons/Ranged/NullificationRifle.cs +++ b/Items/Weapons/Ranged/NullificationRifle.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item33; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index b5e7b784cd..63fd5a0dfd 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.FlintlockPistol). AddIngredient(ItemID.Marble, 20). AddIngredient(ItemID.Amber, 5). AddIngredient(ItemID.Diamond, 3). diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index 4892411e3e..929d0d0fdf 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 32; + Item.damage = 40; Item.DamageType = DamageClass.Ranged; Item.width = 80; Item.height = 46; diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index 7abdc855e3..2143cea9b3 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9.5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item40; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 824376a1cc..ef0a20859b 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -110,8 +110,9 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(ItemID.DaedalusStormbow). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs index 7e99329a28..00c6756b20 100644 --- a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs @@ -77,8 +77,8 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(ItemID.LunarBar, 5). AddIngredient(ItemID.FragmentVortex, 10). AddIngredient(6). //This should be removed - AddIngredient(3). - AddIngredient(ModContent.ItemType(), 25). + AddIngredient(). // This should be removed + AddIngredient(ModContent.ItemType(), 25). // This should be removed AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 8a759a84c5..4ae4ba99be 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -20,11 +20,11 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 18; + Item.damage = 24; Item.DamageType = DamageClass.Ranged; Item.width = 72; Item.height = 34; - Item.useTime = 60; + Item.useTime = 30; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index eafb00ee1f..08282e431b 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item38; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/ReedBlowgun.cs b/Items/Weapons/Ranged/ReedBlowgun.cs index f9051fd38f..f998eb2040 100644 --- a/Items/Weapons/Ranged/ReedBlowgun.cs +++ b/Items/Weapons/Ranged/ReedBlowgun.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 14; + Item.damage = 21; Item.DamageType = DamageClass.Ranged; Item.width = 22; Item.height = 46; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.holdStyle = 16; Item.noMelee = true; - Item.knockBack = 13.5f; + Item.knockBack = 4.5f; Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = null; diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 6198cb8543..a18d00a956 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -71,10 +71,6 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.SDMG). AddIngredient(). - AddIngredient(10). - AddIngredient(10). - AddIngredient(10). - AddIngredient(5). AddIngredient(8). AddIngredient(20). AddTile(). diff --git a/Items/Weapons/Ranged/SandstormGun.cs b/Items/Weapons/Ranged/SandstormGun.cs index d2a684a0e7..94f275965c 100644 --- a/Items/Weapons/Ranged/SandstormGun.cs +++ b/Items/Weapons/Ranged/SandstormGun.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item11; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Scorpio.cs b/Items/Weapons/Ranged/Scorpio.cs index d88f0de65e..d1191a054e 100644 --- a/Items/Weapons/Ranged/Scorpio.cs +++ b/Items/Weapons/Ranged/Scorpio.cs @@ -80,9 +80,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.SnowmanCannon). - AddIngredient(ItemID.GrenadeLauncher). - AddIngredient(ItemID.RocketLauncher). - AddIngredient(ItemID.FragmentVortex, 20). + AddIngredient(ItemID.FragmentNebula, 6). + AddIngredient(ItemID.Nanites, 100). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 7dce68c15a..1480da31e7 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -93,9 +93,6 @@ namespace CalamityMod.Items.Weapons.Ranged AddIngredient(9). AddIngredient(3). AddIngredient(10). - AddIngredient(15). - AddIngredient(15). - AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Shadethrower.cs b/Items/Weapons/Ranged/Shadethrower.cs index 5b572fd44e..91532bfeac 100644 --- a/Items/Weapons/Ranged/Shadethrower.cs +++ b/Items/Weapons/Ranged/Shadethrower.cs @@ -51,9 +51,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.RottenChunk, 3). AddIngredient(ItemID.DemoniteBar, 7). AddIngredient(10). + AddIngredient(ItemID.RottenChunk, 3). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index 626f92d13a..d2af730069 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Shellshooter"); - Tooltip.SetDefault("Converts wooden arrows into slow, powerful shells"); + Tooltip.SetDefault("Fires slow but powerful arrows\n" + + "Converts wooden arrows into heavy piercing seashells"); SacrificeTotal = 1; } @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item5; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 1.5f; + Item.shootSpeed = 2.5f; Item.useAmmo = AmmoID.Arrow; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index 78bd843e64..4927fedd09 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -74,15 +74,11 @@ namespace CalamityMod.Items.Weapons.Ranged } } - // TODO -- Shredder used to use Charged Dart Blaster. The item has been deleted. public override void AddRecipes() { CreateRecipe(). - // AddIngredient(). AddIngredient(). - AddIngredient(ItemID.Shotgun). - AddIngredient(5). - AddIngredient(5). + AddIngredient(). AddIngredient(ItemID.LunarBar, 5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Ranged/Shroomer.cs b/Items/Weapons/Ranged/Shroomer.cs index 34d80d0622..c8ba495c00 100644 --- a/Items/Weapons/Ranged/Shroomer.cs +++ b/Items/Weapons/Ranged/Shroomer.cs @@ -52,8 +52,8 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.SniperRifle). - AddIngredient(ItemID.ShroomiteBar, 11). - AddIngredient(ItemID.FragmentVortex, 15). + AddIngredient(). + AddIngredient(ItemID.FragmentStardust, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index 5cdff65ae7..0563816199 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item41; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/SparkSpreader.cs b/Items/Weapons/Ranged/SparkSpreader.cs index 7452177386..d27ce990d6 100644 --- a/Items/Weapons/Ranged/SparkSpreader.cs +++ b/Items/Weapons/Ranged/SparkSpreader.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.FlareGun). + AddRecipeGroup("AnyGoldBar", 10). AddIngredient(ItemID.Ruby). AddIngredient(ItemID.Gel, 12). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index b6f7e2e6ab..a0e7dcd883 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.FragmentVortex, 20). + AddIngredient(ItemID.FragmentSolar, 6). AddIngredient(ItemID.Ectoplasm, 10). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Ranged/SpeedBlaster.cs b/Items/Weapons/Ranged/SpeedBlaster.cs index 28a0ed4d61..e8dbe3474f 100644 --- a/Items/Weapons/Ranged/SpeedBlaster.cs +++ b/Items/Weapons/Ranged/SpeedBlaster.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = null; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index 4976764f24..e43d700655 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -56,8 +56,9 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.SuperStarCannon). - AddIngredient(ItemID.ElectrosphereLauncher). + AddIngredient(). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(ItemID.FragmentStardust, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/Starmada.cs b/Items/Weapons/Ranged/Starmada.cs index e4dcb27588..8fbaaafa0d 100644 --- a/Items/Weapons/Ranged/Starmada.cs +++ b/Items/Weapons/Ranged/Starmada.cs @@ -61,7 +61,6 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(15). diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index e992b514b1..647b51771f 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item92; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 007f257080..359e42e7c1 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -86,6 +86,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Snipe blast. Done via a held projectile. else Projectile.NewProjectile(source, gunTip, shootVelocity, ModContent.ProjectileType(), 0, knockback, player.whoAmI); + return false; } } diff --git a/Items/Weapons/Ranged/TerraFlameburster.cs b/Items/Weapons/Ranged/TerraFlameburster.cs index c7eda410d6..2231d14aa5 100644 --- a/Items/Weapons/Ranged/TerraFlameburster.cs +++ b/Items/Weapons/Ranged/TerraFlameburster.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.Flamethrower). + AddIngredient(). AddIngredient(7). AddIngredient(5). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index 732429e673..b2ad1db295 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 99; + Item.damage = 120; Item.DamageType = DamageClass.Ranged; Item.width = 40; Item.height = 70; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item5; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index 8348d2e83b..090a61dc35 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item61; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index 412a6aedb8..eefab1773d 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.channel = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item77 with { Volume = SoundID.Item77.Volume * 0.7f }; Item.autoReuse = true; diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index dcbf2bfc56..426c1e3d1a 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -51,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). AddIngredient(20). + AddIngredient(15). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index c3e83ca955..4196eccab0 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -5,7 +5,6 @@ using CalamityMod.Sounds; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Tyranny's End"); Tooltip.SetDefault("Pierce the heart of even the most heavily-armored foe\n" + - "Fires a .70 caliber sniper round that bypasses enemy defense and DR\n" + + "Converts musket balls into .70 caliber sniper rounds that bypass enemy defense and DR\n" + "Rounds mark enemies for death and summon a swarm of additional bullets on crits"); SacrificeTotal = 1; } @@ -61,10 +60,10 @@ namespace CalamityMod.Items.Weapons.Ranged Register(); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + type = ModContent.ProjectileType(); } } } diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index 66e81f06fb..2282323cf7 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -104,18 +104,8 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(). AddIngredient(ItemID.StarCloak, 3). - AddIngredient(2). - AddIngredient(8). - AddIngredient(5). - AddTile(). - Register(); - - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.StarCloak, 3). - AddIngredient(2). - AddIngredient(). - AddIngredient(5). + AddIngredient(5). + AddIngredient(4). AddTile(). Register(); } diff --git a/Items/Weapons/Ranged/Vortexpopper.cs b/Items/Weapons/Ranged/Vortexpopper.cs index 2d5aec6788..89b4a4d1c4 100644 --- a/Items/Weapons/Ranged/Vortexpopper.cs +++ b/Items/Weapons/Ranged/Vortexpopper.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Items.Weapons.Ranged { CreateRecipe(). AddIngredient(ItemID.Xenopopper). - AddIngredient(ItemID.FragmentVortex, 20). + AddIngredient(ItemID.FragmentVortex, 12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs index 33b0df3b41..38eaf88a45 100644 --- a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.damage = 8; + Item.damage = 11; Item.ArmorPenetration = 3; Item.DamageType = DamageClass.Ranged; Item.width = 23; diff --git a/Items/Weapons/Rogue/AcidicRainBarrel.cs b/Items/Weapons/Rogue/AcidicRainBarrel.cs index e5aa6ee7f4..0cb11a6d25 100644 --- a/Items/Weapons/Rogue/AcidicRainBarrel.cs +++ b/Items/Weapons/Rogue/AcidicRainBarrel.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index c98dc683ab..4f9805deb3 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -17,18 +17,17 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.width = 26; - Item.damage = 44; + Item.width = 30; + Item.damage = 64; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 12; + Item.useAnimation = Item.useTime = 12; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; Item.knockBack = 3.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 30; + Item.height = 40; Item.maxStack = 999; Item.value = 1600; Item.rare = ItemRarityID.LightRed; @@ -54,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(ItemID.AdamantiteBar). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.png b/Items/Weapons/Rogue/AdamantiteThrowingAxe.png index 3eef4bdc0b..075574b0a2 100644 Binary files a/Items/Weapons/Rogue/AdamantiteThrowingAxe.png and b/Items/Weapons/Rogue/AdamantiteThrowingAxe.png differ diff --git a/Items/Weapons/Rogue/AlphaVirus.cs b/Items/Weapons/Rogue/AlphaVirus.cs index 0190e5ea0b..40c639a1bb 100644 --- a/Items/Weapons/Rogue/AlphaVirus.cs +++ b/Items/Weapons/Rogue/AlphaVirus.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(5). - AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index e3499e5f96..3b062a381a 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -23,13 +23,13 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.damage = 120; - Item.shootSpeed = 15f; + Item.damage = 220; + Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); Item.width = 66; Item.height = 64; - Item.useTime = 24; - Item.useAnimation = 24; + Item.useTime = 30; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; Item.value = CalamityGlobalItem.Rarity7BuyPrice; @@ -68,9 +68,8 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(100). - AddIngredient(20). - AddIngredient(15). - AddIngredient(8). + AddIngredient(50). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs index f39fd9e33a..069b00ce9d 100644 --- a/Items/Weapons/Rogue/AuroradicalThrow.cs +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -24,24 +24,21 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 34; Item.height = 58; - Item.damage = 32; + Item.damage = 48; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 30; Item.knockBack = 6f; Item.UseSound = SoundID.Item117; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.2f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int star = Projectile.NewProjectile(source, player.Center, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index 6800f5c9a3..e8a1140781 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; @@ -23,25 +23,22 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 30; - Item.damage = 50; + Item.height = 38; + Item.damage = 72; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 26; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 26; Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 38; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.3333f; - 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 @@ -64,9 +61,9 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(10). - AddIngredient(20). - AddIngredient(10). + AddIngredient(10). + AddIngredient(10). + AddIngredient(20). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index e9f25e047d..7cd7b84d46 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Blazing Star"); - Tooltip.SetDefault("Stacks up to 3\n" + - "Stealth strikes release all stars at once with infinite piercing"); - SacrificeTotal = 3; + Tooltip.SetDefault("Tosses up to 3 red hot returning glaives\n" + + "Stealth strikes throw three glaives with infinite piercing"); + SacrificeTotal = 1; } public override void SetDefaults() @@ -31,10 +31,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.value = CalamityGlobalItem.Rarity4BuyPrice; Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item1; - Item.maxStack = 3; Item.shootSpeed = Speed; Item.shoot = ModContent.ProjectileType(); @@ -49,36 +48,32 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - if (Item.stack != 1) + for (int i = 0; i < 3; i++) { - for (int i = 0; i < Item.stack; i++) + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-MathHelper.ToRadians(8f), MathHelper.ToRadians(8f), i / 2f)); + Projectile proj = Projectile.NewProjectileDirect(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); + if (proj.whoAmI.WithinBounds(Main.maxProjectiles)) + proj.Calamity().stealthStrike = true; + + Projectile projectile = Projectile.NewProjectileDirect(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); + if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-MathHelper.ToRadians(8f), MathHelper.ToRadians(8f), i / (float)(Item.stack - 1))); - Projectile proj = Projectile.NewProjectileDirect(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); - if (proj.whoAmI.WithinBounds(Main.maxProjectiles)) - proj.Calamity().stealthStrike = true; - - Projectile projectile = Projectile.NewProjectileDirect(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); - if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) - { - projectile.penetrate = -1; - projectile.Calamity().stealthStrike = true; - } - + projectile.penetrate = -1; + projectile.Calamity().stealthStrike = true; } - return false; } + return false; } return true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < Item.stack; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 3; public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.HellstoneBar, 3). - AddIngredient(4). + AddIngredient(ItemID.HellstoneBar, 5). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs index 8abd0f4ae1..28aa8dbdeb 100644 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -62,8 +62,8 @@ Stealth strikes throw four at once"); public override void AddRecipes() { - CreateRecipe(20). - AddIngredient(ItemID.SpikyBall, 20). + CreateRecipe(100). + AddIngredient(ItemID.SpikyBall, 100). AddIngredient(ItemID.PinkGel). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/BrackishFlask.cs index 478f045115..9411f0ffcb 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/BrackishFlask.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.height = 30; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index 2a93c4d3e0..df138ba871 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6.5f; Item.UseSound = SoundID.Item1; Item.height = 26; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 2ad7c38847..682bf48a99 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 28; Item.UseSound = SoundID.Item1; Item.useStyle = ItemUseStyleID.Swing; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 5dea52ffa3..7ddb75bc2c 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -57,9 +57,8 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddTile(). diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index 0294996832..eb4dc100b0 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -17,18 +17,17 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.width = 18; + Item.width = 14; Item.damage = 50; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 12; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 40; + Item.height = 38; Item.maxStack = 999; Item.value = 900; Item.rare = ItemRarityID.LightRed; @@ -55,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(ItemID.CobaltBar). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Rogue/CobaltKunai.png b/Items/Weapons/Rogue/CobaltKunai.png index 554ff1471f..405319f25b 100644 Binary files a/Items/Weapons/Rogue/CobaltKunai.png and b/Items/Weapons/Rogue/CobaltKunai.png differ diff --git a/Items/Weapons/Rogue/ConsecratedWater.cs b/Items/Weapons/Rogue/ConsecratedWater.cs index c116bdd535..e73b462286 100644 --- a/Items/Weapons/Rogue/ConsecratedWater.cs +++ b/Items/Weapons/Rogue/ConsecratedWater.cs @@ -26,8 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = BaseDamage; Item.width = 22; Item.height = 24; - Item.useAnimation = 29; - Item.useTime = 29; + Item.useAnimation = Item.useTime = 29; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index 5ca22aeeda..e085cd7b12 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 10 && counter == 0 && stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - SoundEngine.PlaySound(SoundID.Item73, player.position); + SoundEngine.PlaySound(SoundID.Item73, player.Center); for (float i = 0; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i; diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index 1aa217b545..18091fe880 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 15; Item.knockBack = 4f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; diff --git a/Items/Weapons/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index b8537c627d..e167d27d9e 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 22; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13.5f; diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index 3dd373c484..cb8917d784 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -21,13 +21,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 62; - Item.damage = 52; + Item.damage = 92; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 17; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 17; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -59,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/CursedDagger.cs b/Items/Weapons/Rogue/CursedDagger.cs index 4ab5ef7025..f92ded5841 100644 --- a/Items/Weapons/Rogue/CursedDagger.cs +++ b/Items/Weapons/Rogue/CursedDagger.cs @@ -23,14 +23,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 34; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 16; + Item.useAnimation = Item.useTime = 8; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 16; Item.knockBack = 4.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 34; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index c63e837b54..88fef27b6c 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -12,15 +12,15 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Deep Wounder"); - Tooltip.SetDefault("Throws an abyssal hatchet that inflicts Armor Crunch and Marked for Death to the enemies it hits\n" + - "Stealth strikes cause the hatchet to be thrown faster and trail water, inflicting Crush Depth in addition to the other debuffs"); + Tooltip.SetDefault("Throws an abyssal hatchet that inflicts Armor Crunch and Crush Depth to the enemies it hits\n" + + "Stealth strikes cause the hatchet to be thrown faster and trail water, inflicting Marked for Death in addition to the other debuffs"); SacrificeTotal = 1; } public override void SetDefaults() { Item.width = 52; - Item.damage = 106; + Item.damage = 136; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 23; @@ -32,13 +32,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 48; Item.maxStack = 1; Item.rare = ItemRarityID.Lime; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthVelocityMultiplier => 1.5f; + public override float StealthVelocityMultiplier => 1.1f; + public override float StealthDamageMultiplier => 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/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 2041a3b7c4..bb8c0e3899 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Defective Sphere"); Tooltip.SetDefault(@"Fires a variety of deadly spheres with different effects -Stacks up to 5 +Up to five spheres can be thrown at a time Stealth strikes launch all 4 sphere types at once"); - SacrificeTotal = 5; + SacrificeTotal = 1; } public override void SetDefaults() @@ -33,12 +33,11 @@ Stealth strikes launch all 4 sphere types at once"); Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.maxStack = 5; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item15; //phaseblade sound effect - Item.value = CalamityGlobalItem.RarityYellowBuyPrice / 5; // Stacks up to 5 + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.DamageType = RogueDamageClass.Instance; @@ -48,13 +47,11 @@ Stealth strikes launch all 4 sphere types at once"); public override bool CanUseItem(Player player) { - int UseMax = Item.stack; - if (player.Calamity().StealthStrikeAvailable()) { return true; } - else if ((player.ownedProjectileCounts[Item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()]) >= UseMax) + else if ((player.ownedProjectileCounts[Item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()]) >= 5) { return false; } @@ -102,6 +99,7 @@ Stealth strikes launch all 4 sphere types at once"); } else { + //Does this even need to exist? Can't you just return true for this? Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); } return false; diff --git a/Items/Weapons/Rogue/DukesDecapitator.cs b/Items/Weapons/Rogue/DukesDecapitator.cs index 3c9e93444e..0fddfb8033 100644 --- a/Items/Weapons/Rogue/DukesDecapitator.cs +++ b/Items/Weapons/Rogue/DukesDecapitator.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 30; Item.knockBack = 2f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index a76b3373c2..6aaec7a358 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.height = 24; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index 8513fab7e4..68aad0209a 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 3100; + Item.damage = 2550; Item.DamageType = RogueDamageClass.Instance; Item.width = 30; @@ -49,14 +49,14 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 25f; + Item.shootSpeed = 28f; modItem.UsesCharge = true; - modItem.MaxCharge = 320f; // Tesla Cannon = 250f + modItem.MaxCharge = 300f; // Tesla Cannon = 250f modItem.ChargePerUse = 0.5f; // Tesla Cannon = 0.9f } - public override float StealthDamageMultiplier => 0.15f; + public override float StealthDamageMultiplier => 0.3f; public override float StealthVelocityMultiplier => 1.2f; 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/ElementalDisk.cs b/Items/Weapons/Rogue/ElementalDisk.cs index 7c0fd31458..cdb5eb01d5 100644 --- a/Items/Weapons/Rogue/ElementalDisk.cs +++ b/Items/Weapons/Rogue/ElementalDisk.cs @@ -60,12 +60,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(). AddIngredient(). - AddIngredient(5). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/EpidemicShredder.cs b/Items/Weapons/Rogue/EpidemicShredder.cs index 339fabf5d3..3a9bf04ad2 100644 --- a/Items/Weapons/Rogue/EpidemicShredder.cs +++ b/Items/Weapons/Rogue/EpidemicShredder.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.5f; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index 79a8b4be30..696e106cba 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -24,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 40; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -56,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(ItemID.Flamarang). AddIngredient(ItemID.IceBoomerang). - AddIngredient(ItemID.LightShard). AddIngredient(ItemID.DarkShard). + AddIngredient(ItemID.LightShard). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index dbe283e6e4..59d36c8ca1 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 64; - Item.damage = 200; + Item.damage = 188; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = 3; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 64; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 26f; + Item.shootSpeed = 24f; Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); } @@ -48,8 +48,6 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow").Value); } - - public override float StealthDamageMultiplier => 3.61f; public override bool AdditionalStealthCheck() => counter == 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/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 3a928b8e85..84deb9d06a 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -24,9 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 55; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -39,8 +38,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.15f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) @@ -51,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue } else { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); } return false; } @@ -61,9 +58,9 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(ItemID.HolyWater, 10). AddIngredient(ItemID.HallowedBar, 12). + AddIngredient(ItemID.SoulofFright, 6). AddIngredient(ItemID.SoulofMight, 6). AddIngredient(ItemID.SoulofSight, 6). - AddIngredient(ItemID.SoulofFright, 6). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 02d766bf24..298340d197 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -22,7 +22,7 @@ Stealth strikes release more souls and leave behind souls as they travel"); public override void SetDefaults() { Item.width = 30; - Item.damage = 93; + Item.damage = 82; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; @@ -37,7 +37,7 @@ Stealth strikes release more souls and leave behind souls as they travel"); Item.value = Item.buyPrice(0, 0, 60, 0); Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 18f; + Item.shootSpeed = 16.5f; Item.DamageType = RogueDamageClass.Instance; } @@ -57,8 +57,8 @@ Stealth strikes release more souls and leave behind souls as they travel"); public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(2). + CreateRecipe(150). + AddIngredient(3). AddIngredient(ItemID.Silk). AddIngredient(ItemID.Ectoplasm). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index 6f7fc3fef1..ba1deba921 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -51,10 +51,8 @@ Stealth strike throws a volley of knives"); Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) - { Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].noDropItem = true; - } + spread -= Main.rand.Next(2, 6); } return false; diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index ff98311335..97b44a1c32 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -13,24 +13,24 @@ namespace CalamityMod.Items.Weapons.Rogue { public class FrostcrushValari : RogueWeapon { - public static float Speed = 15f; + public static float Speed = 14f; public override void SetStaticDefaults() { DisplayName.SetDefault("Frostcrush Valari"); Tooltip.SetDefault(@"Fires a long ranged boomerang that explodes into icicles on hit -Stealth strikes throw three short ranged boomerangs along with a spread of icicles"); +Stealth strikes throw three shorter ranged boomerangs that freeze along with a spread of icicles"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 100; + Item.damage = 89; Item.knockBack = 12; Item.DamageType = DamageClass.Throwing; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; - Item.useTime = 19; - Item.useAnimation = 19; + Item.useTime = 21; + Item.useAnimation = 21; Item.width = 32; Item.height = 46; Item.useStyle = ItemUseStyleID.Swing; @@ -46,7 +46,7 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - public override float StealthDamageMultiplier => 0.3667f; + public override float StealthDamageMultiplier => 0.35f; public override float StealthKnockbackMultiplier => 0.3333f; 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/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index fda751a6f8..cfc277f10b 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -21,13 +21,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { + Item.width = 10; + Item.height = 22; Item.damage = 32; Item.noUseGraphic = true; Item.noMelee = true; - Item.width = 10; - Item.height = 22; - Item.useTime = 16; - Item.useAnimation = 16; + Item.useAnimation = Item.useTime = 13; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = false; Item.UseSound = SoundID.Item1; @@ -42,8 +41,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - 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) { if (player.Calamity().StealthStrikeAvailable()) diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index d89011e5d3..382fbbe8b5 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -61,10 +61,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(333). + CreateRecipe(100). AddIngredient(2). - AddIngredient(ItemID.Gel, 6). - AddIngredient(ItemID.HellstoneBar, 1). + AddIngredient(2). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index 70010da38f..d745c9830a 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Glaive"); - Tooltip.SetDefault(@"Stacks up to 3 + Tooltip.SetDefault(@"Tosses up to 3 sharp returning glaives Stealth strikes are super fast and pierce infinitely"); - SacrificeTotal = 3; + SacrificeTotal = 1; } public override void SetDefaults() @@ -28,16 +28,15 @@ Stealth strikes are super fast and pierce infinitely"); Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 1; - Item.height = 1; + Item.width = 34; + Item.height = 32; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = Knockback; - Item.value = CalamityGlobalItem.Rarity3BuyPrice / 3; // Stacks up to 3 + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; - Item.maxStack = 3; Item.shootSpeed = Speed; Item.shoot = ModContent.ProjectileType(); @@ -62,10 +61,6 @@ Stealth strikes are super fast and pierce infinitely"); return false; } - public override bool CanUseItem(Player player) - { - return player.ownedProjectileCounts[Item.shoot] < Item.stack; - } - + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 3; } } diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 6cbc801f85..6d33717169 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -19,11 +19,11 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("God's Paranoia"); - Tooltip.SetDefault(@"Shoots a speedy homing spiky ball. Stacks up to 10. + Tooltip.SetDefault(@"Hurls up to 10 speedy homing spiky balls Attaches to enemies and summons a localized storm of god slayer kunai Stealth strikes home in faster and summon kunai at a faster rate Right click to delete all existing spiky balls"); - SacrificeTotal = 10; + SacrificeTotal = 1; } public override void SetDefaults() @@ -32,17 +32,16 @@ Right click to delete all existing spiky balls"); Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 1; - Item.height = 1; + Item.width = 20; + Item.height = 18; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = knockBack; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice / 10; // Stacks up to 10 + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 10; Item.shootSpeed = 5f; Item.shoot = ModContent.ProjectileType(); @@ -54,19 +53,16 @@ Right click to delete all existing spiky balls"); if (player.altFunctionUse == 2) { Item.shoot = ProjectileID.None; - Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - int UseMax = Item.stack; - return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < 10; } } - public override float StealthDamageMultiplier => 1.345f; + 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) { @@ -92,8 +88,7 @@ Right click to delete all existing spiky balls"); public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpikyBall, 200). - AddIngredient(). + AddIngredient(12). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/GraveGrimreaver.cs b/Items/Weapons/Rogue/GraveGrimreaver.cs index e41152612b..5e6c87d0b1 100644 --- a/Items/Weapons/Rogue/GraveGrimreaver.cs +++ b/Items/Weapons/Rogue/GraveGrimreaver.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue DisplayName.SetDefault("Grave Grimreaver"); Tooltip.SetDefault("Hurls a cursed scythe which homes in\n"+ "The scythe summons skulls as it flies and explodes into bats on hit\n"+ - "Stealth strikes spawn a flood of bats and falling skulls\n"+ + "Stealth strikes spawn a flood of bats and falling skulls when destroyed\n"+ "Inflicts cursed flames and confusion\n"+ "'A dapper skeleton's weapon of choice'"); SacrificeTotal = 1; @@ -23,26 +23,26 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 80; - Item.damage = 25; + Item.damage = 31; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 50; - Item.useTime = 50; + Item.useAnimation = 48; + Item.useTime = 48; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 68; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = 16.5f; Item.DamageType = RogueDamageClass.Instance; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; - Item.rare = ItemRarityID.LightPurple; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; + Item.rare = ItemRarityID.Pink; Item.Calamity().donorItem = true; } - public override float StealthDamageMultiplier => 1.55f; - public override float StealthVelocityMultiplier => 1.1f; + public override float StealthDamageMultiplier => 0.45f; + public override float StealthVelocityMultiplier => 1f; 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/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index f6d6283d88..f10359dd3c 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -21,12 +21,11 @@ Stealth strikes can bounce off walls and enemies"); public override void SetDefaults() { Item.width = 30; - Item.damage = 25; + Item.damage = 20; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 21; - Item.useTime = 21; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; @@ -57,7 +56,7 @@ Stealth strikes can bounce off walls and enemies"); public override void AddRecipes() { - CreateRecipe(20). + CreateRecipe(100). AddIngredient(ItemID.Hive). AddIngredient(ItemID.CrispyHoneyBlock). AddIngredient(ItemID.BeeWax). diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index f2ff5a05ee..d52fd67705 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Heavenfallen Stardisk"); - Tooltip.SetDefault("Throws a stardisk upwards which then launches itself towards your mouse cursor,\n" + - "explodes into several astral energy bolts if the thrower is moving vertically when throwing it and during its impact\n" + + Tooltip.SetDefault("Throws a stardisk upwards which then launches itself towards your mouse cursor\n" + + "Explodes into 5 astral energy bolts if the thrower is moving vertically when throwing it\n" + "Stealth strikes rain astral energy bolts from the sky"); SacrificeTotal = 1; } @@ -22,16 +22,15 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 44; Item.height = 48; - Item.damage = 115; + Item.damage = 90; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 25; Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -41,20 +40,12 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; - public override float StealthDamageMultiplier => 1.25f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) - { - int proj = Projectile.NewProjectile(source, position.X, position.Y, 0f, -10f, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = true; - } - else - { - Projectile.NewProjectile(source, position.X, position.Y, 0f, -10f, type, damage, knockback, player.whoAmI); - } + int proj = Projectile.NewProjectile(source, position, velocity.Length() * -Vector2.UnitY, type, damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; } } diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index f2e2ac0a7b..ee8db765d2 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -18,12 +18,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Hell's Sun"); - Tooltip.SetDefault("The Subterranean Sun in the palm of your hand.\n" + - "Shoots a gravity-defying spiky ball. Stacks up to 10.\n" + - "Once stationary, periodically emits small suns that explode on hit\n" + + Tooltip.SetDefault("The Subterranean Sun in the palm of your hand\n" + + "Hurls up to 10 gravity-defying spiky balls\n" + + "Once stationary, periodically emit small suns that explode on hit\n" + "Stealth strikes emit suns at a faster rate and last for a longer amount of time\n" + "Right click to delete all existing spiky balls"); - SacrificeTotal = 10; + SacrificeTotal = 1; } public override void SetDefaults() @@ -32,17 +32,16 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 1; - Item.height = 1; + Item.width = 22; + Item.height = 18; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = knockBack; - Item.value = Item.sellPrice(0, 2, 40, 0); + Item.value = CalamityGlobalItem.Rarity11BuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 10; Item.shootSpeed = 5f; Item.shoot = ModContent.ProjectileType(); @@ -53,15 +52,12 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.altFunctionUse == 2) { Item.shoot = ProjectileID.None; - Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - int UseMax = Item.stack; - return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < 10; } } @@ -95,8 +91,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpikyBall, 100). - AddIngredient(10). + AddIngredient(ItemID.LunarBar, 10). + AddIngredient(20). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index 560f30e084..f81b3572a8 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -12,9 +12,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Star"); - Tooltip.SetDefault("Throws homing ice stars\n" + - "Stealth strikes pierce infinitely and spawn ice shards on hit\n" + - "Ice Stars are too brittle to be recovered after being thrown"); + Tooltip.SetDefault("Throws fast but brittle homing ice stars\n" + + "Stealth strikes last longer and spawn smaller homing stars on first hits"); SacrificeTotal = 99; } diff --git a/Items/Weapons/Rogue/Icebreaker.cs b/Items/Weapons/Rogue/Icebreaker.cs index 0c5f089ec1..e6e9838022 100644 --- a/Items/Weapons/Rogue/Icebreaker.cs +++ b/Items/Weapons/Rogue/Icebreaker.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.DamageType = DamageClass.Melee; Item.height = 60; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index ffab54b31a..46531dafe1 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -20,12 +20,11 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 52; - Item.damage = 76; + Item.damage = 84; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -37,8 +36,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.6f; - 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 diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index e3f9564a1b..56044a4d8d 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -24,16 +24,15 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 20; + Item.height = 20; Item.damage = 60; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 30; Item.knockBack = 4f; Item.UseSound = SoundID.Item1; - Item.height = 20; Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.Calamity().donorItem = true; @@ -44,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; @@ -55,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(100). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(10). diff --git a/Items/Weapons/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index 2cbc563157..53fbd61570 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Kylie : RogueWeapon { - public static float Speed = 11f; + public static float Speed = 14f; public override void SetStaticDefaults() { DisplayName.SetDefault("Kylie"); - Tooltip.SetDefault("Stealth strikes throws three short ranged kylies instead of a single long range one\n" + "'Also known as Dowak'"); + Tooltip.SetDefault("Stealth strikes throws three shorter ranged kylies instead of a single long range one\n" + "'Also known as Dowak'"); SacrificeTotal = 1; } @@ -43,7 +43,6 @@ namespace CalamityMod.Items.Weapons.Rogue public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; public override float StealthDamageMultiplier => 0.3333f; - public override float StealthVelocityMultiplier => 0.3333f; 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/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index cc4ca0f30c..5b17ec1cb1 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -13,45 +13,42 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Leviathan Teeth"); Tooltip.SetDefault("Rapidly throws a variety of poisonous fangs that stick to enemies\n" + - "Stealth strikes cause 3 very fast teeth to be thrown, ignoring gravity and inflicting extreme knockback"); + "Stealth strikes cause 6 very fast teeth to be thrown, ignoring gravity and inflicting extreme knockback"); SacrificeTotal = 1; } public override void SetDefaults() { Item.width = 36; - Item.damage = 50; + Item.height = 38; + Item.damage = 66; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 10; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 38; Item.maxStack = 1; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - 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) { bool stealthStrike = false; int teethCount; if (player.Calamity().StealthStrikeAvailable()) { - teethCount = 3; + teethCount = 6; stealthStrike = true; } else { - teethCount = Main.rand.Next(1, 4); + teethCount = Main.rand.Next(1, 3); } float spreadAngle = MathHelper.ToRadians(10); diff --git a/Items/Weapons/Rogue/LuminousStriker.cs b/Items/Weapons/Rogue/LuminousStriker.cs index 2e306c9c97..62040538ed 100644 --- a/Items/Weapons/Rogue/LuminousStriker.cs +++ b/Items/Weapons/Rogue/LuminousStriker.cs @@ -52,10 +52,8 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(). - AddIngredient(10). - AddIngredient(ItemID.FragmentStardust, 10). + AddIngredient(ItemID.FragmentStardust, 6). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index dadafe60a3..ded265a7a9 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 7.5f; Item.UseSound = SoundID.Item1; Item.height = 38; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/MonkeyDarts.cs b/Items/Weapons/Rogue/MonkeyDarts.cs index cabbfbb717..8899c3152d 100644 --- a/Items/Weapons/Rogue/MonkeyDarts.cs +++ b/Items/Weapons/Rogue/MonkeyDarts.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 20; Item.value = Item.buyPrice(0, 0, 4, 0); Item.rare = ItemRarityID.Lime; - Item.shootSpeed = 8f; + Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.autoReuse = true; Item.DamageType = RogueDamageClass.Instance; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 18; - public override float StealthDamageMultiplier => 0.3333f; + public override float StealthDamageMultiplier => 0.8f; 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/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index f871e52f24..ab264cb971 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 12; - Item.damage = 40; + Item.damage = 80; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1.75f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 30; + Item.height = 40; Item.maxStack = 999; Item.value = 1100; Item.rare = ItemRarityID.LightRed; @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(ItemID.MythrilBar). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/MythrilKnife.png b/Items/Weapons/Rogue/MythrilKnife.png index 628e080fa1..b3d3b8dc78 100644 Binary files a/Items/Weapons/Rogue/MythrilKnife.png and b/Items/Weapons/Rogue/MythrilKnife.png differ diff --git a/Items/Weapons/Rogue/NanoblackReaper.png b/Items/Weapons/Rogue/NanoblackReaper.png index a4de09bee1..2ed773f411 100644 Binary files a/Items/Weapons/Rogue/NanoblackReaper.png and b/Items/Weapons/Rogue/NanoblackReaper.png differ diff --git a/Items/Weapons/Rogue/NastyCholla.cs b/Items/Weapons/Rogue/NastyCholla.cs index 3c08b732a2..353e2e48e6 100644 --- a/Items/Weapons/Rogue/NastyCholla.cs +++ b/Items/Weapons/Rogue/NastyCholla.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue Tooltip.SetDefault(@"Throws a spiky ball that sticks to everything Explodes into cactus spikes after roughly 3 seconds Can hurt town NPCs -Stealth strikes throw five at once"); +Stealth strikes throw four at once"); SacrificeTotal = 99; } @@ -42,19 +42,20 @@ Stealth strikes throw five at once"); Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.4f; - 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 spread = 3; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 4; i++) { Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3,4), velocity.Y + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].originalDamage = damage; Main.projectile[proj].Calamity().stealthStrike = true; + } spread -= Main.rand.Next(1,4); } return false; @@ -64,8 +65,8 @@ Stealth strikes throw five at once"); public override void AddRecipes() { - CreateRecipe(15). - AddIngredient(ItemID.Cactus, 3). + CreateRecipe(10). + AddIngredient(ItemID.Cactus). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index e6f6d16f06..c3b0a6da7d 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons.Rogue DisplayName.SetDefault("Nychthemeron"); Tooltip.SetDefault("Throws a spiky ball that ignores gravity and summons a pair of dark and light orbs that orbit the player\n" + "Once the spiky ball disappears the orbs will home in on the nearest target\n" + - "Stacks up to 10\n" + + "Up to 10 spiky balls can exist at a time\n" + "Stealth strikes cause all spiky balls and orbs to be thrown at once\n" + "Right click to recall all existing spiky balls"); - SacrificeTotal = 10; + SacrificeTotal = 1; } public override void SetDefaults() @@ -34,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 18; - Item.maxStack = 10; - Item.value = CalamityGlobalItem.Rarity6BuyPrice / 10; // Stacks up to 10 + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; @@ -63,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { - for (int j = 0; j < Item.stack - player.ownedProjectileCounts[ModContent.ProjectileType()]; j++) + for (int j = 0; j < 10 - player.ownedProjectileCounts[ModContent.ProjectileType()]; j++) { float spread = 2; int pIndex = Projectile.NewProjectile(source, position.X, position.Y, velocity.X + Main.rand.NextFloat(-spread, spread), velocity.Y + Main.rand.NextFloat(-spread, spread), type, damage, knockback, player.whoAmI, 0f, 1f); @@ -90,15 +89,12 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.altFunctionUse == 2) { Item.shoot = ProjectileID.None; - Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; - int UseMax = Item.stack; - return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < 10; } } @@ -168,10 +164,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpikyBall, 30). - AddIngredient(ItemID.LightShard). + AddRecipeGroup("AnyMythrilBar", 10). AddIngredient(ItemID.DarkShard). - AddRecipeGroup("AnyMythrilBar", 2). + AddIngredient(ItemID.LightShard). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index be727d5988..80bdc1f0ce 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -18,18 +18,16 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 14; - Item.damage = 37; + Item.height = 34; + Item.damage = 40; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 13; + Item.useAnimation = Item.useTime = 13; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 13; Item.knockBack = 2f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 24; - Item.shoot = ProjectileID.StarAnise; Item.maxStack = 999; Item.value = 1200; Item.rare = ItemRarityID.LightRed; @@ -46,9 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (gemstone.WithinBounds(Main.maxProjectiles)) { Main.projectile[gemstone].Calamity().stealthStrike = true; - Main.projectile[gemstone].usesLocalNPCImmunity = true; - Main.projectile[gemstone].timeLeft = 900; - Main.projectile[gemstone].penetrate = 4; + Main.projectile[gemstone].timeLeft = 600; } return false; } @@ -57,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(ItemID.OrichalcumBar). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.png b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.png index 22503b2728..3158bc8975 100644 Binary files a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.png and b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.png differ diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index 5c9455c486..55db18e5d2 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -11,25 +11,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Palladium Javelin"); - Tooltip.SetDefault("Stealth strikes split into more javelins"); + Tooltip.SetDefault("Stealth strikes split into more javelins and boost life regeneration on hits"); SacrificeTotal = 99; } public override void SetDefaults() { - Item.width = 44; - Item.damage = 68; + Item.width = 54; + Item.damage = 88; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 19; + Item.useAnimation = Item.useTime = 26; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 19; Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 44; - Item.shoot = ProjectileID.StarAnise; + Item.height = 54; Item.maxStack = 999; Item.value = 1200; Item.rare = ItemRarityID.LightRed; @@ -38,23 +36,18 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.425f; - 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); if (javelin.WithinBounds(Main.maxProjectiles)) - { Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - if (!player.Calamity().StealthStrikeAvailable()) - Main.projectile[javelin].usesLocalNPCImmunity = false; - } + return false; } public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(ItemID.PalladiumBar). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Rogue/PalladiumJavelin.png b/Items/Weapons/Rogue/PalladiumJavelin.png index 1eded3636f..a21271f95f 100644 Binary files a/Items/Weapons/Rogue/PalladiumJavelin.png and b/Items/Weapons/Rogue/PalladiumJavelin.png differ diff --git a/Items/Weapons/Rogue/PhantomLance.cs b/Items/Weapons/Rogue/PhantomLance.cs index 4dd1565e36..f39cb0ce45 100644 --- a/Items/Weapons/Rogue/PhantomLance.cs +++ b/Items/Weapons/Rogue/PhantomLance.cs @@ -1,5 +1,4 @@ using Terraria.DataStructures; -using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ID; @@ -61,10 +60,8 @@ Stealth strikes don't slow down and souls always deal full damage"); public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(ItemID.SpectreBar). - AddIngredient(). - AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index 88faa2b065..4c64b8be02 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.Beenade, 20). + CreateRecipe(150). + AddIngredient(ItemID.Beenade, 30). AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs index cb5ab022c5..3de6629eca 100644 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ b/Items/Weapons/Rogue/PoisonPack.cs @@ -16,10 +16,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Poison Pack"); - Tooltip.SetDefault("Throws a poisonous spiky ball. Stacks up to 3.\n" + + Tooltip.SetDefault("Throws up to 3 poisonous spiky balls\n" + "Stealth strikes cause the balls to release spore clouds\n" + "Right click to delete all existing spiky balls"); - SacrificeTotal = 3; + SacrificeTotal = 1; } public override void SetDefaults() @@ -34,10 +34,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = baseKnockback; - Item.value = CalamityGlobalItem.Rarity1BuyPrice / 3; // Stacks up to 3 + Item.value = CalamityGlobalItem.Rarity1BuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item1; - Item.maxStack = 3; Item.shootSpeed = 7f; Item.shoot = ModContent.ProjectileType(); @@ -51,15 +50,12 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.altFunctionUse == 2) { Item.shoot = ProjectileID.None; - Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 7f; - int UseMax = Item.stack; - return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < 3; } } @@ -87,8 +83,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpikyBall, 50). AddIngredient(ItemID.JungleSpores, 10). + AddIngredient(ItemID.Stinger, 8). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 04a5b290ec..ccf6acf8a0 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -22,17 +22,16 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 46; - Item.damage = 24; + Item.damage = 36; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 16; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 16; Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 46; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; @@ -42,8 +41,6 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - public override float StealthDamageMultiplier => 1.15f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 04aaebe0c1..d2ef5c33da 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -61,10 +61,10 @@ Stealth strikes spawn smaller spears to fly along side it"); { CreateRecipe(). AddIngredient(500). - AddIngredient(6). AddIngredient(4). AddIngredient(25). - AddTile(TileID.LunarCraftingStation).Register(); + AddTile(TileID.LunarCraftingStation). + Register(); } } } diff --git a/Items/Weapons/Rogue/RadiantStar.cs b/Items/Weapons/Rogue/RadiantStar.cs index f4282fe01d..3bcd63f5cb 100644 --- a/Items/Weapons/Rogue/RadiantStar.cs +++ b/Items/Weapons/Rogue/RadiantStar.cs @@ -22,16 +22,15 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 52; + Item.height = 48; Item.damage = 55; //33 Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 12; + Item.useAnimation = Item.useTime = 12; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 12; Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 48; Item.value = CalamityGlobalItem.Rarity9BuyPrice; Item.rare = ItemRarityID.Cyan; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index 295e17fe93..7a2eb87d28 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -24,7 +24,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.width = Item.height = 120; Item.damage = 616; Item.knockBack = 8.5f; - Item.useAnimation = Item.useTime = 17; + Item.useAnimation = 16; //Has to be different than UseTime to prevent clockwork + Item.useTime = 17; Item.DamageType = RogueDamageClass.Instance; Item.autoReuse = true; Item.shootSpeed = 18f; diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 57ee8fdfae..651ab46917 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -60,9 +60,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(100). + AddIngredient(ItemID.DemoniteBar). AddIngredient(). AddIngredient(ItemID.RottenChunk). - AddIngredient(ItemID.DemoniteBar). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index ce46989ca0..8661e86e81 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -17,13 +17,13 @@ namespace CalamityMod.Items.Weapons.Rogue Tooltip.SetDefault("Throws sacrificial daggers that lodge themselves in enemies\n" + "Right click causes all stuck daggers to fly back at you and give you life\n" + "Daggers stuck to enemies release bloodsplosions over time\n" + - "Stealth strikes provide much more life when returning to you"); + "Stealth strikes lodge for longer and provide much more life when returning to you"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 290; + Item.damage = 345; Item.width = Item.height = 68; Item.useAnimation = Item.useTime = 9; Item.noMelee = true; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); @@ -42,6 +42,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[Item.shoot] > 0; + public override float StealthDamageMultiplier => 1.6f; + public override float StealthVelocityMultiplier => 1.2f; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2) diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index 7dcd2993dd..0c65b4789c 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Dollar"); - Tooltip.SetDefault("Stacks up to 2\n" + + Tooltip.SetDefault("Throws up to 2 returning sand dollars\n" + "Stealth strikes throw 2 long ranged sand dollars that explode into coral shards on enemy hits"); - SacrificeTotal = 2; + SacrificeTotal = 1; } public override void SetDefaults() @@ -29,11 +29,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.maxStack = 2; Item.knockBack = 3.5f; Item.autoReuse = true; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.Rarity2BuyPrice / 2; // Stacks to 2 + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; @@ -41,9 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool CanUseItem(Player player) { - int UseMax = Item.stack - 1; - - if (player.ownedProjectileCounts[Item.shoot] > UseMax && !player.Calamity().StealthStrikeAvailable()) + if (player.ownedProjectileCounts[Item.shoot] >= 2 && !player.Calamity().StealthStrikeAvailable()) { return false; } diff --git a/Items/Weapons/Rogue/Sandslasher.cs b/Items/Weapons/Rogue/Sandslasher.cs index c497629e31..63ebab8eaa 100644 --- a/Items/Weapons/Rogue/Sandslasher.cs +++ b/Items/Weapons/Rogue/Sandslasher.cs @@ -32,10 +32,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 7f; + Item.shootSpeed = 8f; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/ScourgeoftheSeas.cs b/Items/Weapons/Rogue/ScourgeoftheSeas.cs index 5589b801b1..3106ec7a6a 100644 --- a/Items/Weapons/Rogue/ScourgeoftheSeas.cs +++ b/Items/Weapons/Rogue/ScourgeoftheSeas.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.damage = 45; + Item.damage = 56; Item.knockBack = 3.5f; - Item.useAnimation = Item.useTime = 20; + Item.useAnimation = Item.useTime = 24; Item.autoReuse = true; Item.DamageType = RogueDamageClass.Instance; - Item.shootSpeed = 8f; + Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); Item.width = 64; @@ -34,9 +34,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; Item.rare = ItemRarityID.Pink; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; } + public override float StealthDamageMultiplier => 1.4f; + public override float StealthVelocityMultiplier => 1.2f; + 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 diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index a2c6dfad58..102d43134e 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -80,10 +80,9 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(). AddIngredient(5). - AddIngredient(ItemID.Bacon, 4). AddIngredient(ItemID.LifeCrystal). - AddIngredient(ItemID.ManaCrystal). AddIngredient(ItemID.Bone, 92). + // AddIngredient(ItemID.Steak). AddTile(). Register(); } diff --git a/Items/Weapons/Rogue/ShardofAntumbra.cs b/Items/Weapons/Rogue/ShardofAntumbra.cs index 321caa7188..ae22b9e0f3 100644 --- a/Items/Weapons/Rogue/ShardofAntumbra.cs +++ b/Items/Weapons/Rogue/ShardofAntumbra.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Rogue/ShinobiBlade.cs b/Items/Weapons/Rogue/ShinobiBlade.cs index 0abf32a92b..31b0ca866e 100644 --- a/Items/Weapons/Rogue/ShinobiBlade.cs +++ b/Items/Weapons/Rogue/ShinobiBlade.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Shinobi Blade"); Tooltip.SetDefault("Throws a fast blade that spawns healing orbs when it kills an enemy\n" + - "Stealth strikes cause 3 blades to be thrown at once"); + "Stealth strikes repeatedly stab the struck enemy from random directions"); SacrificeTotal = 1; } @@ -21,12 +21,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 16; Item.height = 42; - Item.damage = 15; + Item.damage = 24; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -34,29 +33,17 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 20f; + Item.shootSpeed = 10f; 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()) - { - float spreadAngle = MathHelper.ToRadians(7.5f); - Vector2 direction = velocity; - Vector2 baseDirection = direction.RotatedBy(-spreadAngle); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - for (int i = 0; i < 3; i++) - { - Vector2 currentDirection = baseDirection.RotatedBy(spreadAngle * i); - - int p = Projectile.NewProjectile(source, position, currentDirection, type, damage, knockback, player.whoAmI); - if (p.WithinBounds(Main.maxProjectiles)) - Main.projectile[p].Calamity().stealthStrike = true; - } - return false; - } - return true; + return false; } } } diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index 2eb5f7dab5..b461e69558 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -21,13 +21,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 14; - Item.damage = 90; + Item.damage = 108; Item.noMelee = true; Item.noUseGraphic = true; Item.consumable = true; - Item.useAnimation = 18; + Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; Item.knockBack = 1f; Item.autoReuse = true; Item.height = 30; @@ -43,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; @@ -58,8 +57,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). - AddIngredient(ItemID.Grenade, 20). + CreateRecipe(150). + AddIngredient(ItemID.Grenade, 30). AddIngredient(ItemID.MartianConduitPlating, 5). AddIngredient(ItemID.Nanites, 5). AddTile(TileID.WorkBenches). diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index ebf8aeb7ac..72a0dd0869 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Sky Stabber"); - Tooltip.SetDefault("Shoots a gravity-defying spiky ball. Stacks up to 4.\n" + + Tooltip.SetDefault("Throws up to 4 gravity-defying spiky balls\n" + "Stealth strikes make the balls rain feathers onto enemies when they hit\n" + "Right click to delete all existing spiky balls"); - SacrificeTotal = 4; + SacrificeTotal = 1; } public override void SetDefaults() @@ -29,16 +29,15 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; - Item.width = 1; - Item.height = 1; + Item.width = 16; + Item.height = 16; Item.useTime = 15; Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = knockBack; - Item.value = CalamityGlobalItem.Rarity3BuyPrice / 4; // stacks up to 4 + Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; - Item.maxStack = 4; Item.shootSpeed = 2f; Item.shoot = ModContent.ProjectileType(); @@ -52,15 +51,12 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.altFunctionUse == 2) { Item.shoot = ProjectileID.None; - Item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } else { Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 2f; - int UseMax = Item.stack; - return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < 4; } } @@ -88,9 +84,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SpikyBall, 100). - AddIngredient(ItemID.Cloud, 10). AddIngredient(4). + AddIngredient(ItemID.SunplateBlock, 8). AddTile(TileID.SkyMill). Register(); } diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs index b96eacf2a1..e8b4612537 100644 --- a/Items/Weapons/Rogue/SkyfinBombers.cs +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item11; Item.autoReuse = true; Item.height = 30; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index c03b5d87cb..0f69ae14b5 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -14,15 +14,14 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Sludge Splotch"); - Tooltip.SetDefault("Slows non-boss enemies slightly\n" + - "Stealth strikes cause the main ball of sludge to split on hit, inflicting more damage"); + Tooltip.SetDefault("Stealth strikes cause the main ball of sludge to split on hit, inflicting more damage"); SacrificeTotal = 99; } public override void SetDefaults() { Item.width = 32; - Item.damage = 30; + Item.damage = 48; Item.noMelee = true; Item.noUseGraphic = true; Item.consumable = true; @@ -45,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - SoundEngine.PlaySound(SoundID.NPCDeath9 with { Volume = SoundID.NPCDeath9.Volume * 2f }, player.position); + SoundEngine.PlaySound(SoundID.NPCDeath9 with { Volume = SoundID.NPCDeath9.Volume * 2f }, player.Center); if (player.Calamity().StealthStrikeAvailable()) { diff --git a/Items/Weapons/Rogue/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index f4cc535cbf..3d8b477fb3 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.height = 54; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 35f; diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index c8b8c343ab..05d0670316 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 150; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 38; + Item.useAnimation = 37; //Has to be different than UseTime to prevent clockwork Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 38; Item.knockBack = 10f; diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index 96ddb566f0..b6fa16ed57 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs index 3954fe5f25..9dfe633b21 100644 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ b/Items/Weapons/Rogue/StickySpikyBall.cs @@ -62,8 +62,8 @@ Stealth strikes throw four at once and last a lot longer"); public override void AddRecipes() { - CreateRecipe(20). - AddIngredient(ItemID.SpikyBall, 20). + CreateRecipe(100). + AddIngredient(ItemID.SpikyBall, 100). AddIngredient(ItemID.Gel). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index 94e2ffe950..84bb128363 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -1,21 +1,27 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using Terraria.DataStructures; namespace CalamityMod.Items.Weapons.Rogue { public class StormfrontRazor : RogueWeapon { + + public static readonly SoundStyle LightningStrikeSound = new("CalamityMod/Sounds/Custom/LightningStrike"); + public const float LightningDamageFactor = 1.5f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Stormfront Razor"); - Tooltip.SetDefault("Throws a throwing knife that leaves sparks as it travels.\n" + - "Stealth strikes cause the knife to be faster and leave a huge shower of sparks as it travels"); + Tooltip.SetDefault("Throws a knife that summons lightning on hit.\n" + + "Stealth strikes cause the knife to be faster and summon multiple lightning bolts on hit\n" + + "[c/24c7f0:Strike and stem the flow]"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; SacrificeTotal = 1; @@ -32,20 +38,20 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; - Item.useAnimation = 15; - Item.useTime = 15; - Item.damage = 50; + Item.useAnimation = 20; + Item.useTime = 20; + Item.damage = 38; Item.knockBack = 7f; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 7f; + Item.shootSpeed = 8.2f; Item.DamageType = RogueDamageClass.Instance; } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 8; - public override float StealthDamageMultiplier => 1.1f; - public override float StealthVelocityMultiplier => 1.6f; + public override float StealthDamageMultiplier => 1.2f; + public override float StealthVelocityMultiplier => 1.5f; 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/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index ea0db127eb..499c315355 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -58,12 +59,10 @@ Stealth strikes release energy as they fly"); public override void AddRecipes() { CreateRecipe(). + AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(200). - AddIngredient(). - AddIngredient(). - AddIngredient(). AddIngredient(). AddTile(). Register(); diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index f6795961be..fd8b67a893 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -36,7 +36,7 @@ Stealth strikes erupt into thorns on enemy hits"); Item.maxStack = 999; Item.value = Item.sellPrice(copper: 30); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 15f; Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Rogue/TerraDisk.cs b/Items/Weapons/Rogue/TerraDisk.cs index 69bf178f88..e933509f83 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/TerraDisk.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Terra Disk"); Tooltip.SetDefault(@"Throws a disk that has a chance to generate several disks if enemies are near it -A max of three disks can be active at a time Stealth strikes travel slower and are rapidly orbited by the smaller disks"); SacrificeTotal = 1; } @@ -28,8 +27,7 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); Item.height = 46; Item.damage = BaseDamage; Item.knockBack = 4f; - Item.useAnimation = 16; - Item.useTime = 16; + Item.useAnimation = Item.useTime = 30; Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; @@ -44,27 +42,7 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; } - - public override bool CanUseItem(Player player) - { - //Stealth strikes ignore the proj cap - int terraDiskCount = 0; - for (int p = 0; p < Main.maxProjectiles; p++) - { - Projectile proj = Main.projectile[p]; - if (!proj.active || proj.owner != player.whoAmI) - continue; - if (proj.type == Item.shoot && !proj.Calamity().stealthStrike) - { - terraDiskCount++; - } - if (terraDiskCount >= 3) - break; - } - return terraDiskCount < 3; - } - - public override float StealthDamageMultiplier => 0.9f; + public override float StealthVelocityMultiplier => 0.75f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -80,9 +58,8 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks"); public override void AddRecipes() { CreateRecipe(). - AddIngredient(). AddIngredient(). - AddIngredient(ItemID.ThornChakram). + AddIngredient(). AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index bcfbf53223..bb2c260385 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -22,24 +22,23 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 40; - Item.damage = 47; + Item.damage = 52; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 7; - Item.useAnimation = 7; + Item.useAnimation = Item.useTime = 7; Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; Item.height = 24; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10.5f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 4.875f; + public override float StealthDamageMultiplier => 9f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -61,9 +60,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.FeralClaws). AddIngredient(ItemID.ChlorophyteBar, 5). - AddIngredient(ItemID.SoulofFright, 10). + AddIngredient(ItemID.Leather, 10). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/TheSyringe.cs b/Items/Weapons/Rogue/TheSyringe.cs index 065fae1d39..060f0154da 100644 --- a/Items/Weapons/Rogue/TheSyringe.cs +++ b/Items/Weapons/Rogue/TheSyringe.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index 752bc17693..65e28f2f96 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -39,8 +39,6 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; - public override float StealthDamageMultiplier => 1.2f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //Check if stealth is full @@ -55,9 +53,9 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void AddRecipes() { - CreateRecipe(20). - AddIngredient(ItemID.RedBrick, 5). - AddTile(TileID.Anvils). + CreateRecipe(10). + AddIngredient(ItemID.RedBrick). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index d6ac51147c..bbc402ef44 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.width = 38; - Item.damage = 37; + Item.width = 34; + Item.damage = 56; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.height = 38; + Item.height = 34; Item.maxStack = 999; Item.value = 2000; Item.rare = ItemRarityID.LightRed; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { - CreateRecipe(100). + CreateRecipe(150). AddIngredient(ItemID.TitaniumBar). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/TitaniumShuriken.png b/Items/Weapons/Rogue/TitaniumShuriken.png index 3949871d04..a18b9a129e 100644 Binary files a/Items/Weapons/Rogue/TitaniumShuriken.png and b/Items/Weapons/Rogue/TitaniumShuriken.png differ diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 31b10ebe31..4465c9a09d 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -60,9 +60,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(100). + AddIngredient(ItemID.CrimtaneBar). AddIngredient(). AddIngredient(ItemID.Vertebrae). - AddIngredient(ItemID.CrimtaneBar). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Rogue/TotalityBreakers.cs b/Items/Weapons/Rogue/TotalityBreakers.cs index 83873eb758..0a2f678ad1 100644 --- a/Items/Weapons/Rogue/TotalityBreakers.cs +++ b/Items/Weapons/Rogue/TotalityBreakers.cs @@ -22,7 +22,7 @@ Stealth strikes leak tar as they fly"); public override void SetDefaults() { Item.width = 32; - Item.damage = 55; + Item.damage = 50; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 28; @@ -32,14 +32,14 @@ Stealth strikes leak tar as they fly"); Item.UseSound = SoundID.Item106; Item.autoReuse = true; Item.height = 42; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.15f; + 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) { @@ -56,10 +56,7 @@ Stealth strikes leak tar as they fly"); public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.MolotovCocktail, 50). - AddIngredient(). - AddIngredient(). - AddIngredient(). + AddIngredient(ItemID.MolotovCocktail, 50). AddIngredient(10). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index 44fab4f7a7..ec02bed683 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -54,9 +54,8 @@ Stealth strikes are trailed by homing wind slashes"); public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(7). AddIngredient(ItemID.SunplateBlock, 3). - AddIngredient(ItemID.Cloud, 4). AddTile(TileID.SkyMill). Register(); } diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index 59248e8b2b..a339abfcaf 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Weapons.Rogue DisplayName.SetDefault("Utensil Poker"); Tooltip.SetDefault("Space chickens, that is all.\n" + "Fires random utensils in bursts of three\n" + - "Grants Well Fed on enemy hits\n" + "Stealth strikes replace any utensil with a powerful butcher knife"); SacrificeTotal = 1; } diff --git a/Items/Weapons/Rogue/WaveSkipper.cs b/Items/Weapons/Rogue/WaveSkipper.cs index 30280e76ce..083c6973c5 100644 --- a/Items/Weapons/Rogue/WaveSkipper.cs +++ b/Items/Weapons/Rogue/WaveSkipper.cs @@ -24,12 +24,11 @@ Stealth strikes throw three high speed spears"); public override void SetDefaults() { Item.width = 44; - Item.damage = 50; + Item.damage = 80; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 22; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 22; Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -41,8 +40,6 @@ Stealth strikes throw three high speed spears"); Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.3333f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index 782df70cc1..50da297ef8 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -52,8 +52,8 @@ Stealth strikes slow enemies down longer"); public override void AddRecipes() { - CreateRecipe(20). - AddIngredient(ItemID.Cobweb, 5). + CreateRecipe(50). + AddIngredient(ItemID.Cobweb, 10). Register(); } } diff --git a/Items/Weapons/Summon/AquasScepter.cs b/Items/Weapons/Summon/AquasScepter.cs new file mode 100644 index 0000000000..4bdb544fa0 --- /dev/null +++ b/Items/Weapons/Summon/AquasScepter.cs @@ -0,0 +1,65 @@ +using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Materials; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Creative; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class AquasScepter : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aqua's Scepter"); + Tooltip.SetDefault("Summons a giant storm cloud sentry to rain down on your foes, and strike nearby enemies with overloading tesla energy\n" + + "'Captain! I think- we've got a risk of rain!'"); //Yes, it's cheesy, I know. It's a joke. + + CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1; + ItemID.Sets.GamepadWholeScreenUseRange[Item.type] = true; + ItemID.Sets.LockOnIgnoresCollision[Item.type] = true; + } + + public override void SetDefaults() + { + Item.damage = 65; + Item.mana = 50; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; + Item.width = 48; + Item.height = 48; + Item.useTime = 30; + Item.useAnimation = 30; + Item.useStyle = 1; + Item.knockBack = 6; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().devItem = true; + Item.UseSound = SoundID.Item66; + Item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + position = Main.MouseWorld; + var projectile = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI); + projectile.originalDamage = Item.damage; + player.UpdateMaxTurrets(); + return false; + } + + public override void AddRecipes() + { + Recipe recipe = Recipe.Create(ModContent.ItemType()); + recipe.AddIngredient(ItemID.NimbusRod); + recipe.AddIngredient(ItemID.AquaScepter); + recipe.AddIngredient(3); + recipe.AddTile(TileID.LunarCraftingStation); //LunarCraftingStation = Ancient Manipulator + recipe.Register(); + } + } +} diff --git a/Items/Weapons/Summon/AquasScepter.png b/Items/Weapons/Summon/AquasScepter.png new file mode 100644 index 0000000000..8c62607bb7 Binary files /dev/null and b/Items/Weapons/Summon/AquasScepter.png differ diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index 1427f25b87..28e03fdd87 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -69,9 +69,9 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Ares' Exoskeleton"); Tooltip.SetDefault("Creates a panel with four slots and four choices above it: Plasma, Tesla, Laser, and Gauss\n" + - "Clicking one of the choices and then clicking one of the slots allows you to summon a cannon that stays close to you and attacks nearby enemies\n" + - "Clicking on a slot that's already occupied destroys its associated cannon and clears the slot\n" + - $"Cannons take {MinionSlotsPerCannon} minion slots each"); + "Clicking one of the choices and then clicking one of the slots summons a cannon of that type\n" + + "Clicking on a slot that's already occupied destroys its associated cannon and clears the slot\n" + + $"Cannons take {MinionSlotsPerCannon} minion slots each"); SacrificeTotal = 1; } diff --git a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs index 9e3b702f09..3070ca37f0 100644 --- a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs +++ b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs @@ -44,14 +44,17 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Atlas Munitions Beacon"); - Tooltip.SetDefault("Drops down a crate from the sky that opens up to reveal a mounted, stationary cannon\n" + - "The cannon will fire at any potential enemies within its range, and enter overdrive mode if said enemy is close to the cannon\n" + - "When in overdrive mode the cannon uses three barrels that each collectively fire. The cannon also heats up the more it fires in overdrive mode\n" + - "Players may right click to pick up the cannon and use it for themselves, if they are selecting an Atlas Munitions Beacon.\n" + - "When players fire the cannon, it automatically enters overdrive mode\n" + - "If the held cannon becomes hot due to overdrive mode, you are forced to drop it. Otherwise, right clicking allows you to drop it manually\n" + - "If the held cannon is dropped back onto the mount, it is attached again\n" + - "It's surprisingly easy to pick up"); + Tooltip.SetDefault("Drops down a crate from the sky that houses a mounted, stationary cannon\n" + + "The cannon will fire at any enemies within its range\n" + + "If an enemy is in close proximity, it will enter Overdrive mode\n" + + "When in Overdrive mode the cannon uses three barrels that each collectively fire\n" + + "The cannon also heats up the more it fires in overdrive mode\n" + + "Press right click while holding this item to pick up the cannon and use it for yourself\n" + + "When held, the cannon will always be in Overdrive mode\n" + + "If the held cannon overheats due to Overdrive mode, you are forced to drop it\n" + + "Pressing right click allows you to drop it manually\n" + + "If the held cannon is dropped near the mount, it will re-attach automatically\n" + + "It's surprisingly easy to pick up"); SacrificeTotal = 1; } diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index bddd3cbd4e..5cc18a2d63 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -12,27 +12,29 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Belladonna Spirit Staff"); - Tooltip.SetDefault("Summons a cute forest spirit that scatters toxic petals"); + Tooltip.SetDefault("Summons a cute forest spirit that flings magical toxic petals"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 5; + Item.damage = 22; + Item.knockBack = 1f; Item.mana = 10; + + Item.shoot = ModContent.ProjectileType(); + Item.width = 40; Item.height = 42; Item.useTime = Item.useAnimation = 35; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity1BuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.DamageType = DamageClass.Summon; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item44; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.Rarity1BuyPrice; + Item.noMelee = true; + Item.autoReuse = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Summon/BloodClotStaff.cs b/Items/Weapons/Summon/BloodClotStaff.cs index b22d0b5b5b..fbc8cbbeac 100644 --- a/Items/Weapons/Summon/BloodClotStaff.cs +++ b/Items/Weapons/Summon/BloodClotStaff.cs @@ -53,9 +53,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Vertebrae, 4). AddIngredient(ItemID.CrimtaneBar, 5). AddIngredient(10). + AddIngredient(ItemID.Vertebrae, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index 5d8fbab902..748d6dddad 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -29,10 +29,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item44; - //item.autoReuse = true; + Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 70b2b5d7d0..2832434da0 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.UseSound = SoundID.Item83; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index d12dd3c7c5..1c000ee9c5 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -12,29 +12,33 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cinder Blossom Staff"); - Tooltip.SetDefault("Summons a really hot flower over your head\n" + + Tooltip.SetDefault("Summons scorching flower over your head\n" + "There can only be one flower"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 25; - Item.mana = 10; - Item.width = 46; - Item.height = 46; - Item.useTime = Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; + Item.damage = 16; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item34; + Item.mana = 10; + Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + + Item.width = 50; + Item.height = 56; + Item.useTime = Item.useAnimation = 30; + Item.DamageType = DamageClass.Summon; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item34; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.Rarity3BuyPrice; + Item.noMelee = true; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); @@ -43,12 +47,13 @@ namespace CalamityMod.Items.Weapons.Summon Main.projectile[p].originalDamage = Item.damage; return false; } + public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Fireblossom, 5). - AddIngredient(ItemID.LavaBucket, 2). AddIngredient(ItemID.HellstoneBar, 10). + //AddIngredient(ItemID.AshWood, 10). + AddIngredient(ItemID.Fireblossom, 5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs index 481f383928..1ad84f8b32 100644 --- a/Items/Weapons/Summon/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon Tooltip.SetDefault("Fishes up an electric jellyfish\n" + "Periodically sends out sparks to electrocute nearby enemies.\n" + //Lore tooltip time. Elden Ring. - "[c/5C95A1:From looking at their less sapient brethren, the Old Kingdom’s inhabitants adapted tools and weapons designed for underwater efficiency.]\n" + + "[c/5C95A1:From looking at their less sapient brethren, the Old Kingdom's inhabitants adapted tools and weapons designed for underwater efficiency.]\n" + "[c/5C95A1:The electric properties of ghost bells remain useful even after death, having been commonly used as conduits.]" ); SacrificeTotal = 1; diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index e70bd8985a..d2ed09f6c3 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -58,9 +58,9 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(). - AddIngredient(). - AddIngredient(). - AddIngredient(). + AddIngredient(). + AddIngredient(). + AddIngredient(). AddIngredient(). AddTile(). Register(); diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 4becae43e3..3fb05bb185 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -86,7 +86,6 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(). - AddIngredient(20). AddIngredient(10). AddTile(). Register(); diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index 90f8d3a99a..d0fdf12e7b 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -54,9 +54,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.RottenChunk, 3). AddIngredient(ItemID.DemoniteBar, 8). AddIngredient(7). + AddIngredient(ItemID.RottenChunk, 3). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index d92a490a6f..08f14fef19 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -18,20 +18,18 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 42; + Item.damage = 40; Item.mana = 10; - Item.width = 46; - Item.height = 46; + Item.width = Item.height = 44; Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -40,9 +38,8 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + velocity = Vector2.Zero; + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 9155676a1f..b94ea1b4d8 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index 4c8b801dd2..398fcdfc8c 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item113; Item.autoReuse = true; @@ -51,9 +51,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddIngredient(30). - AddIngredient(10). + AddIngredient(30). + AddIngredient(30). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/ElementalAxe.cs index a429aab9e4..5593924343 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/ElementalAxe.cs @@ -53,12 +53,11 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Smolstar). //Blade Staff + AddIngredient(ItemID.EmpressBlade). AddIngredient(). - AddIngredient(). - AddIngredient(5). - AddIngredient(5). AddIngredient(ItemID.LunarBar, 5). + AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Summon/MagicalConch.cs b/Items/Weapons/Summon/EnchantedConch.cs similarity index 95% rename from Items/Weapons/Summon/MagicalConch.cs rename to Items/Weapons/Summon/EnchantedConch.cs index 05bfe24002..11871521b0 100644 --- a/Items/Weapons/Summon/MagicalConch.cs +++ b/Items/Weapons/Summon/EnchantedConch.cs @@ -8,11 +8,12 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class MagicalConch : ModItem + [LegacyName("MagicalConch")] + public class EnchantedConch : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Magical Conch"); + DisplayName.SetDefault("Enchanted Conch"); Tooltip.SetDefault("Summons a hermit crab to fight for you"); SacrificeTotal = 1; } diff --git a/Items/Weapons/Summon/MagicalConch.png b/Items/Weapons/Summon/EnchantedConch.png similarity index 100% rename from Items/Weapons/Summon/MagicalConch.png rename to Items/Weapons/Summon/EnchantedConch.png diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index c6bc532540..fbf9804158 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item82; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index b039355a9c..49ec3e3d51 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -15,14 +15,13 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Ethereal Subjugator"); - Tooltip.SetDefault("Summons a phantom to protect you\n" + - "Each phantom takes only half of a minion slot"); + Tooltip.SetDefault("Summons a phantom to protect you"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 45; + Item.damage = 200; Item.mana = 10; Item.width = 66; Item.height = 70; @@ -30,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.UseSound = SoundID.Item82; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index 85fb570578..03954f9bbc 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -1,6 +1,7 @@ using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Terraria; using Microsoft.Xna.Framework; @@ -12,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Eye of Night"); - Tooltip.SetDefault("Summons a diseased eyeball that fires cells which attach to enemies and inflict cursed flames"); + Tooltip.SetDefault("Summons a diseased eyeball that fires cells which attach to enemies"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 24; + Item.damage = 28; Item.mana = 10; Item.width = Item.height = 36; Item.useTime = Item.useAnimation = 30; @@ -49,10 +50,11 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(). AddIngredient(). + AddIngredient(). + AddIngredient(). AddIngredient(ItemID.ImpStaff). + AddIngredient(10). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index 50ba6dcd08..666e19751d 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -1,5 +1,6 @@ using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.DataStructures; @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 23; + Item.damage = 27; Item.mana = 10; Item.width = Item.height = 48; Item.useTime = Item.useAnimation = 30; @@ -48,10 +49,11 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(). AddIngredient(). + AddIngredient(). + AddIngredient(). AddIngredient(ItemID.ImpStaff). + AddIngredient(10). AddTile(TileID.DemonAltar). Register(); } diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index d6741d9022..de3ca9919a 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -54,10 +54,9 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(ItemID.LunarBar, 5). - AddIngredient(5). AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index b4b04706a2..fc427d89f1 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item89; Item.noMelee = true; Item.rare = ItemRarityID.Pink; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.autoReuse = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 431d9bfea3..8cbe78d90f 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Shiverthorn, 5). - AddRecipeGroup("AnySnowBlock", 50). AddRecipeGroup("AnyIceBlock", 50). + AddIngredient(ItemID.BorealWood, 10). + AddIngredient(ItemID.Shiverthorn, 5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 687137e5a7..3bde296417 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useTime = Item.useAnimation = 20; Item.noMelee = true; Item.knockBack = 7f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item106; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs index d79ab19f8b..29fc4d9e75 100644 --- a/Items/Weapons/Summon/GodspawnHelixStaff.cs +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -18,30 +18,48 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 60; - Item.mana = 10; - Item.width = 50; - Item.height = 50; - Item.useTime = Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; + Item.damage = 75; Item.knockBack = 1.25f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Cyan; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; + Item.mana = 10; + Item.shoot = ModContent.ProjectileType(); + + Item.width = 54; + Item.height = 52; + Item.useTime = Item.useAnimation = 20; + Item.DamageType = DamageClass.Summon; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item44; + Item.rare = ItemRarityID.Cyan; + Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.noMelee = true; + Item.autoReuse = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + if (player.altFunctionUse != 2) + { + int p = Projectile.NewProjectile(source, Main.MouseWorld, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + { + Main.projectile[p].originalDamage = Item.damage; + Main.projectile[p].ModProjectile().ProbeIndex = player.ownedProjectileCounts[type]; + } + + int bladeIndex = 0; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI) + { + Main.projectile[i].ModProjectile().ProbeIndex = bladeIndex++; + Main.projectile[i].ModProjectile().AITimer = 0f; + Main.projectile[i].netUpdate = true; + } + } + } + return false; } } diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index a7e83b1b88..869db11aeb 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 20; + Item.damage = 17; Item.mana = 10; Item.width = Item.height = 48; Item.useTime = Item.useAnimation = 30; @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item21; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -40,9 +39,8 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + velocity = Vector2.Zero; + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index 8409ce711a..fb8b982927 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item78; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 998c6de7bb..457b81fed4 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item71; Item.autoReuse = true; @@ -95,7 +95,7 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(10). - AddIngredient(5). + AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index 2158b07a68..50b9484b7b 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item42; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index 72737e2776..e1d59e2a69 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item76; Item.shoot = ModContent.ProjectileType(); @@ -83,16 +83,14 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(). - AddIngredient(). - AddIngredient(ItemID.OpticStaff). + AddIngredient(ItemID.Smolstar). //Blade Staff AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); CreateRecipe(). AddIngredient(). - AddIngredient(). - AddIngredient(ItemID.OpticStaff). + AddIngredient(ItemID.Smolstar). AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs index 2f3172ad9c..9c1147acaf 100644 --- a/Items/Weapons/Summon/PolypLauncher.cs +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 12; Item.mana = 10; - Item.width = 10; - Item.height = 32; + Item.width = 32; + Item.height = 54; Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; + Item.sentry = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/PolypLauncher.png b/Items/Weapons/Summon/PolypLauncher.png index 09678f9271..40f07bf8d0 100644 Binary files a/Items/Weapons/Summon/PolypLauncher.png and b/Items/Weapons/Summon/PolypLauncher.png differ diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/SanctifiedSpark.cs similarity index 92% rename from Items/Weapons/Summon/EnergyStaff.cs rename to Items/Weapons/Summon/SanctifiedSpark.cs index c500c37a9f..4ea0efb49f 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/SanctifiedSpark.cs @@ -7,11 +7,12 @@ using Terraria.ID; namespace CalamityMod.Items.Weapons.Summon { - public class EnergyStaff : ModItem + [LegacyName("EnergyStaff")] + public class SanctifiedSpark : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Energy Staff"); + DisplayName.SetDefault("Sanctified Spark"); Tooltip.SetDefault("Summons a profaned energy turret to fight for you"); Item.staff[Item.type] = true; SacrificeTotal = 1; diff --git a/Items/Weapons/Summon/EnergyStaff.png b/Items/Weapons/Summon/SanctifiedSpark.png similarity index 100% rename from Items/Weapons/Summon/EnergyStaff.png rename to Items/Weapons/Summon/SanctifiedSpark.png diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 44e5df871b..249e94b807 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 35; + Item.damage = 47; Item.mana = 10; Item.width = 48; Item.height = 56; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity8BuyPrice; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index abe785bad7..d2d5a9e31d 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -12,61 +12,40 @@ namespace CalamityMod.Items.Weapons.Summon { public class SarosPossession : ModItem { - int radianceSlots; public override void SetStaticDefaults() { DisplayName.SetDefault("Saros Possession"); Tooltip.SetDefault("Gain absolute control over light itself\n" + - "Summons a radiant aura\n" + - "Consumes all of the remaining minion slots on use\n" + - "Must be used from the hotbar\n" + - "Increased power based on the number of minion slots used"); + "Can only be summoned once\n" + + "Uses 8 minion slots"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.width = 56; - Item.height = 56; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.UseSound = SoundID.DD2_BetsyFlameBreath; + Item.damage = 500; + Item.knockBack = 4f; + Item.mana = 10; + + Item.shoot = ModContent.ProjectileType(); + + Item.width = Item.height = 56; + Item.useTime = Item.useAnimation = 10; Item.DamageType = DamageClass.Summon; - Item.mana = 10; - Item.damage = 200; - Item.knockBack = 4f; - Item.useTime = Item.useAnimation = 10; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.DD2_BetsyFlameBreath; Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.noMelee = true; } - public override void HoldItem(Player player) - { - double minionCount = 0; - for (int j = 0; j < Main.projectile.Length; j++) - { - Projectile proj = Main.projectile[j]; - if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != Item.shoot) - { - minionCount += proj.minionSlots; - } - } - radianceSlots = (int)(player.maxMinions - minionCount); - } - - public override bool CanUseItem(Player player) - { - return radianceSlots >= 1; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, radianceSlots); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/SeaboundStaff.cs b/Items/Weapons/Summon/SeaboundStaff.cs index da3c63f379..95de31300f 100644 --- a/Items/Weapons/Summon/SeaboundStaff.cs +++ b/Items/Weapons/Summon/SeaboundStaff.cs @@ -20,10 +20,8 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 11; Item.mana = 10; - Item.width = 32; - Item.height = 32; + Item.width = Item.height = 44; Item.useTime = Item.useAnimation = 35; - Item.scale = 0.75f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -32,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item44; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -41,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; + velocity = Vector2.Zero; int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index 361875cc6a..9f9c7a1db7 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; + Item.value = CalamityGlobalItem.Rarity5BuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index d75680540e..52147ca9fd 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -12,60 +12,40 @@ namespace CalamityMod.Items.Weapons.Summon { public class Sirius : ModItem { - int siriusSlots; public override void SetStaticDefaults() { DisplayName.SetDefault("Sirius"); Tooltip.SetDefault("Summons the brightest star in the night sky to shine upon your foes\n" + - "Consumes all of the remaining minion slots on use\n" + - "Must be used from the hotbar\n" + - "Increased power based on the number of minion slots used"); + "Can only be summoned once\n" + + "Uses 6 minion slots"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.width = 62; - Item.height = 62; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.UseSound = SoundID.Item44; + Item.width = Item.height = 62; + + Item.damage = 600; + Item.useTime = Item.useAnimation = 10; + Item.mana = 10; + Item.knockBack = 10f; + + Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; - Item.mana = 10; - Item.damage = 175; - Item.knockBack = 3f; - Item.useTime = Item.useAnimation = 10; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - - Item.value = CalamityGlobalItem.Rarity14BuyPrice; + Item.useStyle = ItemUseStyleID.Swing; + Item.UseSound = SoundID.Item44; Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.Rarity13BuyPrice; + Item.noMelee = true; } - public override void HoldItem(Player player) - { - double minionCount = 0; - for (int j = 0; j < Main.projectile.Length; j++) - { - Projectile proj = Main.projectile[j]; - if (proj.active && proj.owner == player.whoAmI && proj.minion && proj.type != Item.shoot) - { - minionCount += proj.minionSlots; - } - } - siriusSlots = (int)(player.maxMinions - minionCount); - } - - public override bool CanUseItem(Player player) - { - return siriusSlots >= 1; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, siriusSlots, 30f); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 321093366c..707b96e9f0 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -57,9 +57,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(22). - AddIngredient(ItemID.Gel, 25). - AddIngredient(ItemID.HellstoneBar, 6). + AddIngredient(18). + AddIngredient(18). AddTile(). Register(); } diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index ed853e80ef..a290412b5d 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; + Item.value = CalamityGlobalItem.Rarity8BuyPrice; Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shootSpeed = 20f; diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index 136a7a3c9d..eaa2249b70 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.25f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.value = CalamityGlobalItem.Rarity6BuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item44; Item.shoot = ModContent.ProjectileType(); @@ -51,9 +51,9 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(). AddIngredient(). AddIngredient(5). + AddIngredient(ItemID.SoulofFright, 3). AddIngredient(ItemID.SoulofMight, 3). AddIngredient(ItemID.SoulofSight, 3). - AddIngredient(ItemID.SoulofFright, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 3ee001e8a4..f8160583d8 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,5 +1,4 @@ using Terraria.DataStructures; -using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 160; + Item.damage = 140; Item.mana = 10; Item.width = 28; Item.height = 20; @@ -57,10 +56,7 @@ namespace CalamityMod.Items.Weapons.Summon { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(). - AddIngredient(15). - AddIngredient(8). AddIngredient(ItemID.LunarBar, 5). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index 09331bb955..760bd3cef5 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon.Umbrella; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -17,9 +17,14 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Temporal Umbrella"); Tooltip.SetDefault("Surprisingly sturdy, I reckon this could defeat the Mafia in a single blow\n" + - "Summons a magic hat to hover above your head\n" + - "The hat will release a variety of objects to assault your foes\n" + - "Requires 5 minion slots to use and there can only be one hat"); + "Summons a variety of tools to assist you in battle:\n" + + " - A vermilion arrow to pierce your adversaries\n" + + " - A marmalade hammer to bonk enemies in style\n" + + " - A jade axe to cleave monsters and occasionally fell a tree\n" + + " - A cyan umbrella to beat down your foes with grace\n" + + " - A lavender rifle to snipe those who stand in your way\n" + + "Best of all, you get to wear a top hat\n" + + "Requires 5 minion slots to use and there can only be one set of tools"); SacrificeTotal = 1; } @@ -43,11 +48,11 @@ namespace CalamityMod.Items.Weapons.Summon Item.Calamity().devItem = true; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 5; + public override bool CanUseItem(Player player) => player.maxMinions >= 5; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - CalamityUtils.KillShootProjectiles(true, type, player); + CalamityUtils.KillShootProjectileMany(player, type, ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType()); int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; @@ -57,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(ItemID.Umbrella). AddIngredient(ItemID.TopHat). diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 42cfd36ac2..9b7a2f5813 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Tundra Flame Blossoms Staff"); - Tooltip.SetDefault("Summons three unusual flowers over your head\n" + - "Each flower consumes one minion slot"); + Tooltip.SetDefault("Summons three flarefrost orchids over your head\n" + + "Each flower consumes one minion slot"); SacrificeTotal = 1; } public override void SetDefaults() { - Item.damage = 45; + Item.damage = 40; Item.mana = 10; Item.width = 52; Item.height = 60; @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item46; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -44,7 +43,6 @@ namespace CalamityMod.Items.Weapons.Summon { Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); blossom.ai[1] = (int)(MathHelper.TwoPi / 3f * i * 32f); - blossom.rotation = blossom.ai[1] / 32f; blossom.originalDamage = Item.damage; } return false; @@ -54,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(). AddIngredient(). AddIngredient(). - AddIngredient(ItemID.SoulofLight, 5). + AddRecipeGroup("AnyMythrilBar", 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index a41e669cee..c5434c3906 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -81,9 +81,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.EmpressBlade). - AddIngredient(). - AddIngredient(8). + AddIngredient(15). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index 411646933c..d5efb22685 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -65,8 +65,8 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(). AddIngredient(ItemID.GolemFist). AddIngredient(10). - AddIngredient(5). AddIngredient(5). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index ea47618675..77ffb51f03 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -55,8 +55,6 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(). AddIngredient(). AddIngredient(15). - AddIngredient(5). - AddIngredient(5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index 746462710e..29f30a42d1 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -65,12 +65,8 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(ItemID.MeteoriteBar, 10). AddIngredient(5). AddIngredient(10). - AddIngredient(ItemID.Glass, 20). - AddIngredient(ItemID.Gel, 15). AddIngredient(ItemID.FallenStar, 5). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Typeless/EyeofMagnus.cs b/Items/Weapons/Typeless/EyeofMagnus.cs index 6e90590c03..da03384969 100644 --- a/Items/Weapons/Typeless/EyeofMagnus.cs +++ b/Items/Weapons/Typeless/EyeofMagnus.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Typeless { CreateRecipe(). AddIngredient(). - AddIngredient(ItemID.FragmentNebula, 10). + AddIngredient(ItemID.FragmentNebula, 12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Typeless/FiniteUse/Bazooka.cs b/Items/Weapons/Typeless/FiniteUse/Bazooka.cs deleted file mode 100644 index 94a7426ca5..0000000000 --- a/Items/Weapons/Typeless/FiniteUse/Bazooka.cs +++ /dev/null @@ -1,99 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Ammo.FiniteUse; -using CalamityMod.Projectiles.Typeless.FiniteUse; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Items.Weapons.Typeless.FiniteUse -{ - public class Bazooka : ModItem - { - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/BazookaFull"); - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bazooka"); - Tooltip.SetDefault("Uses Grenade Shells\n" + - "Can be used twice per boss battle"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.damage = 500; - Item.width = 66; - Item.height = 26; - Item.useTime = 30; - Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity6BuyPrice; - Item.rare = ItemRarityID.Pink; - Item.UseSound = FireSound; - Item.autoReuse = true; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = ModContent.ItemType(); - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 2; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 2; - - return true; - } - - public override bool CanUseItem(Player player) - { - return Item.Calamity().timesUsed < 2; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 0; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - player.HeldItem.Calamity().timesUsed++; - for (int i = 0; i < Main.InventorySlotsTotal; i++) - { - if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) - player.inventory[i].Calamity().timesUsed++; - } - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.IllegalGunParts). - AddRecipeGroup("IronBar", 20). - AddRecipeGroup("AnyAdamantiteBar", 15). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/FiniteUse/Bazooka.png b/Items/Weapons/Typeless/FiniteUse/Bazooka.png deleted file mode 100644 index 09952cbabf..0000000000 Binary files a/Items/Weapons/Typeless/FiniteUse/Bazooka.png and /dev/null differ diff --git a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs deleted file mode 100644 index 9b2a05fbac..0000000000 --- a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs +++ /dev/null @@ -1,93 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Ammo.FiniteUse; -using CalamityMod.Projectiles.Typeless.FiniteUse; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Typeless.FiniteUse -{ - public class ElephantKiller : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elephant Killer"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + - "Can be used thrice per boss battle"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.damage = 2000; - Item.width = 56; - Item.height = 26; - Item.useTime = 19; - Item.useAnimation = 19; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity10BuyPrice; - Item.rare = ItemRarityID.Red; - Item.UseSound = Magnum.FireSound; - Item.autoReuse = true; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = ModContent.ItemType(); - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 3; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 66; - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 3; - - return true; - } - - public override bool CanUseItem(Player player) => Item.Calamity().timesUsed < 3; - - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 0; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - player.HeldItem.Calamity().timesUsed++; - for (int i = 0; i < Main.InventorySlotsTotal; i++) - { - if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) - player.inventory[i].Calamity().timesUsed++; - } - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.IllegalGunParts). - AddIngredient(ItemID.LunarBar, 15). - AddTile(TileID.LunarCraftingStation). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.png b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.png deleted file mode 100644 index e5b2a62323..0000000000 Binary files a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.png and /dev/null differ diff --git a/Items/Weapons/Typeless/FiniteUse/Hydra.cs b/Items/Weapons/Typeless/FiniteUse/Hydra.cs deleted file mode 100644 index df3542f111..0000000000 --- a/Items/Weapons/Typeless/FiniteUse/Hydra.cs +++ /dev/null @@ -1,108 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Ammo.FiniteUse; -using CalamityMod.Projectiles.Typeless.FiniteUse; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Items.Weapons.Typeless.FiniteUse -{ - public class Hydra : ModItem - { - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/Hydra"); - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hydra"); - Tooltip.SetDefault("Uses Explosive Shotgun Shells\n" + - "Can be used once per boss battle"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.damage = 120; - Item.width = 66; - Item.height = 30; - Item.useTime = 33; - Item.useAnimation = 33; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 10f; - Item.value = CalamityGlobalItem.Rarity9BuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.UseSound = FireSound; - Item.autoReuse = true; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = ModContent.ItemType(); - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 1; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 1; - - return true; - } - - public override bool CanUseItem(Player player) - { - return Item.Calamity().timesUsed < 1; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 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 < 8; ++index) - { - float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - } - - if (CalamityPlayer.areThereAnyDamnBosses) - { - player.HeldItem.Calamity().timesUsed++; - for (int i = 0; i < Main.InventorySlotsTotal; i++) - { - if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) - player.inventory[i].Calamity().timesUsed++; - } - } - - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.Shotgun). - AddIngredient(ItemID.IllegalGunParts). - AddRecipeGroup("IronBar", 20). - AddIngredient(ItemID.Ectoplasm, 20). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs b/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs deleted file mode 100644 index 8bbae3b121..0000000000 --- a/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Ammo.FiniteUse; -using CalamityMod.Projectiles.Typeless.FiniteUse; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Typeless.FiniteUse -{ - public class LightningHawk : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lightning Hawk"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + - "Can be used thrice per boss battle"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.damage = 400; - Item.width = 50; - Item.height = 28; - Item.useTime = 21; - Item.useAnimation = 21; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity7BuyPrice; - Item.rare = ItemRarityID.LightPurple; - Item.UseSound = Magnum.FireSound; - Item.autoReuse = true; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = ModContent.ItemType(); - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 3; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 56; - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 3; - - return true; - } - - public override bool CanUseItem(Player player) => Item.Calamity().timesUsed < 3; - - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 0; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - player.HeldItem.Calamity().timesUsed++; - for (int i = 0; i < Main.InventorySlotsTotal; i++) - { - if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) - player.inventory[i].Calamity().timesUsed++; - } - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.IllegalGunParts). - AddIngredient(ItemID.SoulofMight, 20). - AddIngredient(ItemID.SoulofSight, 20). - AddIngredient(ItemID.SoulofFright, 20). - AddIngredient(ItemID.HallowedBar, 10). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/FiniteUse/LightningHawk.png b/Items/Weapons/Typeless/FiniteUse/LightningHawk.png deleted file mode 100644 index 38c191db97..0000000000 Binary files a/Items/Weapons/Typeless/FiniteUse/LightningHawk.png and /dev/null differ diff --git a/Items/Weapons/Typeless/FiniteUse/Magnum.cs b/Items/Weapons/Typeless/FiniteUse/Magnum.cs deleted file mode 100644 index 5f5348d35c..0000000000 --- a/Items/Weapons/Typeless/FiniteUse/Magnum.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Ammo.FiniteUse; -using CalamityMod.Projectiles.Typeless.FiniteUse; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Items.Weapons.Typeless.FiniteUse -{ - public class Magnum : ModItem - { - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/Magnum"); - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnum"); - Tooltip.SetDefault("Uses Magnum Rounds\n" + - "Can be used thrice per boss battle"); - SacrificeTotal = 1; - } - - public override void SetDefaults() - { - Item.damage = 80; - Item.width = 52; - Item.height = 28; - Item.useTime = 25; - Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 8f; - Item.value = CalamityGlobalItem.Rarity2BuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = FireSound; - Item.autoReuse = true; - Item.shootSpeed = 12f; - Item.shoot = ModContent.ProjectileType(); - Item.useAmmo = ModContent.ItemType(); - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 3; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 46; - - public override bool OnPickup(Player player) - { - if (CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 3; - - return true; - } - - public override bool CanUseItem(Player player) => Item.Calamity().timesUsed < 3; - - public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override void UpdateInventory(Player player) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - Item.Calamity().timesUsed = 0; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (CalamityPlayer.areThereAnyDamnBosses) - { - player.HeldItem.Calamity().timesUsed++; - for (int i = 0; i < Main.InventorySlotsTotal; i++) - { - if (player.inventory[i].type == Item.type && player.inventory[i] != player.HeldItem) - player.inventory[i].Calamity().timesUsed++; - } - } - return true; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.FlintlockPistol). - AddRecipeGroup("IronBar", 10). - AddIngredient(ItemID.Diamond, 5). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/FiniteUse/Magnum.png b/Items/Weapons/Typeless/FiniteUse/Magnum.png deleted file mode 100644 index 8e1aa0e9f4..0000000000 Binary files a/Items/Weapons/Typeless/FiniteUse/Magnum.png and /dev/null differ diff --git a/Items/Weapons/Typeless/GoldenGun.cs b/Items/Weapons/Typeless/GoldenGun.cs index 463102c246..b8a65b6c6e 100644 --- a/Items/Weapons/Typeless/GoldenGun.cs +++ b/Items/Weapons/Typeless/GoldenGun.cs @@ -53,8 +53,8 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Ichor, 15). AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.Ichor, 15). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Typeless/LunicEye.cs b/Items/Weapons/Typeless/LunicEye.cs index f5a638adde..ebdf5b8276 100644 --- a/Items/Weapons/Typeless/LunicEye.cs +++ b/Items/Weapons/Typeless/LunicEye.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -51,11 +50,8 @@ namespace CalamityMod.Items.Weapons.Typeless public override void AddRecipes() { CreateRecipe(). + AddRecipeGroup("AnyCobaltBar", 10). AddIngredient(20). - AddIngredient(15). - AddIngredient(15). - AddIngredient(ItemID.SunplateBlock, 15). - AddIngredient(2). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Typeless/Skynamite.cs b/Items/Weapons/Typeless/Skynamite.cs index de27a1f978..7e94c62d61 100644 --- a/Items/Weapons/Typeless/Skynamite.cs +++ b/Items/Weapons/Typeless/Skynamite.cs @@ -40,16 +40,16 @@ namespace CalamityMod.Items.Weapons.Typeless Item.rare = ItemRarityID.Orange; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Bombs; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Bombs; + } + // 1 dynamite at Sky Mill = cheap, available early game as an alt option to sticky dynamite, just requires floating islands public override void AddRecipes() { - CreateRecipe(10). - AddIngredient(ItemID.Dynamite, 10). - AddIngredient(). + CreateRecipe(). + AddIngredient(ItemID.Dynamite). AddTile(TileID.SkyMill). Register(); } diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 63ee09fbc0..01b1daea02 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -11,13 +11,15 @@ namespace CalamityMod.Localization { _localizations = new[] { - new [] { "SkyOreText", "The ground is glittering with cyan light." }, + new [] { "SkyOreText", "The sky is glittering with cyan light." }, new [] { "IceOreText", "The ice caves are crackling with frigid energy." }, new [] { "PlantOreText", "Energized plant matter has formed in the underground." }, new [] { "TreeOreText", "Fossilized tree bark is bursting through the jungle's mud." }, - new [] { "AuricOreText", "A godly aura has blessed the world's caverns." }, + new [] { "AuricOreText", "Ancient draconic power manifests in the caverns, lacing itself through the rock." }, new [] { "FutureOreText", "A cold and dark energy has materialized in space." }, + new [] { "SkeletronAbyssChestNotification", "The First Dryad's vines deem you worthy of their abyssal treasures." }, + new [] { "UglyBossText", "The Sunken Sea trembles..." }, new [] { "SteelSkullBossText", "A blood red inferno lingers in the night..." }, @@ -64,20 +66,20 @@ namespace CalamityMod.Localization // Some of these keys are incorrect in terms of their contents, but they remain as their bases + an addon at the end to make it // easier to define them. - new [] { "SCalSummonTextRematch", "If you’re looking for some fourth-degree burns, you’ve got the right person." }, + new [] { "SCalSummonTextRematch", "If you're looking for some fourth-degree burns, you've got the right person." }, new [] { "SCalStartTextRematch", "When the time comes, would you like to join my creation?" }, - new [] { "SCalBH2TextRematch", "You’ll still have to work hard for this victory." }, - new [] { "SCalBH3TextRematch", "I haven’t had such an interesting target dummy to test my magic on in a long time." }, + new [] { "SCalBH2TextRematch", "You'll still have to work hard for this victory." }, + new [] { "SCalBH3TextRematch", "I haven't had such an interesting target dummy to test my magic on in a long time." }, new [] { "SCalBrothersTextRematch", "Empty shells of their former selves. I doubt even a scrap of their spirits remain." }, new [] { "SCalPhase2TextRematch", "Here we go again." }, - new [] { "SCalBH4TextRematch", "I wonder if you’ve seen these in your nightmares since our first battle?" }, + new [] { "SCalBH4TextRematch", "I wonder if you've seen these in your nightmares since our first battle?" }, new [] { "SCalSeekerRingTextRematch", "Your skill hasn't faltered in the least." }, new [] { "SCalBH5TextRematch", "Isn't this exciting?" }, new [] { "SCalSepulcher2TextRematch", "Here comes the crawling tomb, one last time." }, new [] { "SCalDesparationText1Rematch", "A terrific display, I concede this match to you." }, new [] { "SCalDesparationText2Rematch", "No doubt you will face enemies stronger than I." }, new [] { "SCalDesparationText3Rematch", "I trust you will not make the same mistakes he did." }, - new [] { "SCalDesparationText4Rematch", "I can’t imagine what your future holds now." }, + new [] { "SCalDesparationText4Rematch", "I can't imagine what your future holds now." }, new [] { "EdgyBossText", "Don't get cocky!" }, new [] { "EdgyBossText2", "A fatal mistake!" }, @@ -105,6 +107,7 @@ namespace CalamityMod.Localization new [] { "SandSharkText3", "The desert sand shifts intensely!" }, new [] { "CryogenBossText", "Cryogen is derping out!" }, + new [] { "PyrogenBossText", "Pyrogen is derping out!" }, new [] { "DraedonIntroductionText1", "I have waited long for this moment." }, new [] { "DraedonIntroductionText2", "Your nature fascinates me, for I do not understand it." }, @@ -137,6 +140,9 @@ namespace CalamityMod.Localization new [] { "DraedonEndText8", "But you have managed before. You will find a way eventually." }, new [] { "DraedonEndText9", "I must acknowledge your triumph, but I will return now to my machinery." }, new [] { "DraedonEndKillAttemptText", "...Quite unnecessary." }, + new [] { "DraedonMechdusaBeginText", "...Die." }, + new [] { "DraedonMechdusaEndText1", "Wait what? How?" }, + new [] { "DraedonMechdusaEndText2", "No" }, new [] { "HardmodeOreTier1Text", "Your world has been blessed with Cobalt and Palladium!" }, new [] { "HardmodeOreTier2Text", "Your world has been blessed with Mythril and Orichalcum!" }, @@ -180,6 +186,7 @@ namespace CalamityMod.Localization new [] { "AprilFools", "The LORDE is approaching..." }, new [] { "AprilFools2", "A boomer awaits..." }, //possible alternative to GhostBossText4 + new [] { "AprilFoolsGFB", "La Ruga is approaching..." }, new [] { "AcidRainStart", "A toxic downpour falls over the wasteland seas!" }, new [] { "AcidRainEnd", "The sulphuric skies begin to clear..." }, @@ -208,6 +215,9 @@ namespace CalamityMod.Localization new [] { "PhantomHeartText", "You have already used a Phantom Heart. It's probably good that you can't use another." }, new [] { "SlimeGodRun", "The Slime God flees to fight another day..." }, + + new [] { "SulphurSwitchLeft", "The Sulphurous Sea is now on the left side of the world." }, + new [] { "SulphurSwitchRight", "The Sulphurous Sea is now on the right side of the world." }, }; } diff --git a/Localization/enUS.hjson b/Localization/en-US.hjson similarity index 83% rename from Localization/enUS.hjson rename to Localization/en-US.hjson index 753cd9e2d4..6122dcae23 100644 --- a/Localization/enUS.hjson +++ b/Localization/en-US.hjson @@ -7,7 +7,6 @@ Config: SectionTitle: { - "BossRushCurses": "Boss Rush Curses", "ExpertMaster": "Expert and Master Mode Changes", "Gameplay": "General Gameplay Changes", "Graphics": "Graphics Changes", @@ -21,11 +20,9 @@ Config: "AdrenalineMeterPosX": "Adrenaline Meter X Position", "AdrenalineMeterPosY": "Adrenaline Meter Y Position", "Afterimages": "Afterimages", + "BossesStopWeather": "Bosses Stop Weather", "BossHealthBarExtraInfo": "Boss Health Bar Extra Info", "BossHealthBoost": "Boss Health Boost Percentage", - "BossRushDashCurse": "Dashes", - "BossRushIFrameCurse": "Immunity Frames", - "BossRushRegenCurse": "Regeneration", "BossZen": "Bosses Drastically Reduce Spawn Rates", "ChargeMeter": "Display Charge Meter", "ChargeMeterPosX": "Charge Meter X Position", @@ -34,13 +31,13 @@ Config: "CooldownDisplay": "Cooldown Rack Display Mode", "DebuffDisplay": "Display Enemy Debuffs", "EarlyHardmodeProgressionRework": "Early Hardmode Progression Rework", + "FasterBaseSpeed": "Increase Base Movement Speed", + "FasterFallHotkey": "Enable Fast Falling", + "FasterJumpSpeed": "Increase Base Jump Speed", + "FasterTilePlacement": "Increase Base Building Speed", "ForceTownSafety": "Force Town Safety", + "HigherJumpHeight": "Increase Base Jump Height", "MeterPosLock": "Lock Meter Positions", - "FasterBaseSpeed": "Higher Base Speed", - "HigherJumpHeight": "Higher Jump Height", - "FasterJumpSpeed": "Higher Jump Speed", - "FasterFallHotkey": "Faster Fall Acceleration Hotkey", - "FasterTilePlacement": "Faster Base Tile Placement Speed", "NerfExpertDebuffs": "Remove Increased Debuff Duration", "ParticleLimit": "Max Particle Limit", "RageMeterPosX": "Rage Meter X Position", @@ -58,6 +55,7 @@ Config: "StealthMeterPosY": "Stealth Meter Y Position", "SulphuricWaterMeterPosX": "Sulphuric Water Poison Meter X Position", "SulphuricWaterMeterPosY": "Sulphuric Water Poison Meter Y Position", + "PotionSelling": "Town NPC Potion Selling", "TownNPCSpawnRateMultiplier": "Town NPC Spawn Rate Multiplier", "TownNPCsSpawnAtNight": "Town NPCs Spawn at Night", "VanillaCooldownDisplay": "Display Vanilla Cooldowns", @@ -69,11 +67,9 @@ Config: "AdrenalineMeterPosX": "The X position of the Adrenaline Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", "AdrenalineMeterPosY": "The Y position of the Adrenaline Meter, measured as a % of your screen height.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", "Afterimages": "Enables rendering afterimages for Calamity NPCs, projectiles, etc.\nDisable to improve performance.", + "BossesStopWeather": "When enabled, many late game bosses while stop all rain and related weather when spawned.\nEnable if you have performance issues during late game boss fights.", "BossHealthBarExtraInfo": "Adds extra info to Calamity's boss health bar.\nThis displays either the boss's exact health or number of remaining parts or segments.", "BossHealthBoost": "Globally boosts the health of all bosses by the specified percentage.\nThis stacks with multiplayer boss health boosts.\nDoes not affect bosses that are already spawned.", - "BossRushDashCurse": "Disables all dashes during the Boss Rush.", - "BossRushIFrameCurse": "During the Boss Rush, being hit twice within three seconds will cause instant death.\nThis effect ignores revives.", - "BossRushRegenCurse": "Disables all health regeneration during the Boss Rush.", "BossZen": "All living bosses will drastically reduce the spawn rates of regular enemies.\nThis also prevents Slime Rain from occurring while a boss is alive.", "ChargeMeter": "Enables the Charge Meter UI, which displays the current charge of the player's held weapon.\nThe Charge Meter is always hidden if not holding a weapon which requires charge.", "ChargeMeterPosX": "The X position of the Charge Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", @@ -82,13 +78,13 @@ Config: "CooldownDisplay": "Adds the Cooldown Rack which displays all important cooldowns right underneath buffs and debuffs.\nSet this to 1 to display the Cooldown Rack in compact mode, and to 0 to hide it entirely.", "DebuffDisplay": "Adds an array of debuff icons above all bosses and minibosses.", "EarlyHardmodeProgressionRework": "Demon Altars no longer spawn ores and crimson/corruption blocks when broken.\nWall of Flesh spawns Cobalt and Palladium ore on first kill.\nThe first mech boss you fight has 20% less HP and damage and spawns Mythril and Orichalcum ore on first kill.\nThe second mech boss you fight has 10% less HP and damage and spawns Adamantite and Titanium ore on first kill.\nThe third mech boss spawns Hallowed Ore on first kill", + "FasterBaseSpeed": "Increases the player's base movement speed substantially by always giving them +50% movement speed.\nThis setting does nothing if the mod Terraria Overhaul is loaded.\nCalamity is balanced around this setting being enabled.", + "FasterFallHotkey": "When enabled, you can hold the DOWN key while in the air to accelerate downwards faster.\nThis config does not increase your maximum falling speed, just how quickly you accelerate to it.\nCalamity is balanced around this setting being enabled.", + "FasterJumpSpeed": "Slightly increases the player's base jump speed.\nCalamity is balanced around this setting being enabled.", + "FasterTilePlacement": "Substantially increases how rapidly the player can place tiles and walls.\nThis config stacks with the Brick Layer, Portable Cement Mixer and other accessories.", "ForceTownSafety": "Counteracts Expert and Master Mode allowing enemies to spawn near towns by vastly decreasing spawn rates.\nThis can have unintended side effects such as making critters difficult to find.", + "HigherJumpHeight": "Increases the player's base jump height by 10% so that they can jump 7 tiles.\nCalamity is balanced around this setting being enabled.", "MeterPosLock": "Prevents clicking on the Stealth, Charge, Rage, and Adrenaline Meters.\nThis stops them from being dragged around with the mouse.", - "FasterBaseSpeed": "Increases the player's base movement speed", - "HigherJumpHeight": "Increases the player's base jump height", - "FasterJumpSpeed": "Increases the player's base jump speed", - "FasterFallHotkey": "Pressing down increases the speed at which the player reaches their maximum fall velocity", - "FasterTilePlacement": "Increases the player's base tile placement speed", "NerfExpertDebuffs": "Disables Expert Mode doubling (and Master Mode tripling) the duration of debuffs on the player.\nCalamity is balanced around this setting being enabled.", "ParticleLimit": "Sets the maximum of particle effects that can exist at once.\nParticles are separate from dust and gores.\nTurn down to improve performance.", "RageMeterPosX": "The X position of the Rage Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", @@ -106,9 +102,10 @@ Config: "StealthMeterPosY": "The Y position of the Stealth Meter, measured as a % of your screen height.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", "SulphuricWaterMeterPosX": "The X position of the Sulphuric Water Poison Meter, measured as a % of your screen width.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", "SulphuricWaterMeterPosY": "The Y position of the Sulphuric Water Poison Meter, measured as a % of your screen height.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.", + "PotionSelling": "Allows town NPCs to sell various potions.\nCertain potions are sold after specific bosses have been defeated.", "TownNPCSpawnRateMultiplier": "Directly multiply the rate at which town NPCs spawn and respawn.\nThis reduces waiting times if a boss or event wipes your whole town.", "TownNPCsSpawnAtNight": "When enabled, town NPCs can spawn and respawn at night.\nThis includes the Old Man.", - "VanillaCooldownDisplay": "Adds the vanilla debuffs Potion Sickness and Chaos State to the Cooldown Rack.\nThis doesn't remove them from your buff list, but can help with visibility nontheless", + "VanillaCooldownDisplay": "Adds the vanilla debuffs Potion Sickness and Chaos State to the Cooldown Rack.\nThis doesn't remove them from your buff list, but can help with visibility nonetheless", "WikiStatusMessage": "Enable or disable the status message promoting the Official Calamity Wiki that plays on world entry.", } } @@ -194,13 +191,13 @@ TownNPCMood: LoveSpace: "Too many people can disrupt the flow of mana. I much prefer the breathing room here.", FarFromHome: "My sense of direction is…subpar. I loathe to admit it, but I have a tendency to not venture outside too often.", DislikeCrowded: "My spells are precise, and cannot be interrupted. I would like some more room to practice with them.", - HateCrowded: "I’d hate for one of your associates to be caught up in my magic. Alas, there are too many here to mitigate that risk.", + HateCrowded: "I'd hate for one of your associates to be caught up in my magic. Alas, there are too many here to mitigate that risk.", LikeBiome: "The temperature here allows me to save my magic power, as my creations can sustain their shape without melting in the cold.", DislikeBiome: "The sun here is too unfriendly for my ice! Please, allow me lodgings elsewhere at once!", HateBiome: "Dark forces are strong here. This is not ideal.", LikeNPC: "{NPCName} is well learned, and quite a respectable mage himself!", - DislikeNPC: "I dislike {NPCName}’s blatant disregard of magic. I cannot blame his functions, but he is quite ignorant.", - LikeNPC_Princess: "{NPCName} has some very quaint spells. I’m quite impressed, for someone of her age.", + DislikeNPC: "I dislike {NPCName}'s blatant disregard of magic. I cannot blame his functions, but he is quite ignorant.", + LikeNPC_Princess: "{NPCName} has some very quaint spells. I'm quite impressed, for someone of her age.", }, FAP: @@ -209,12 +206,12 @@ TownNPCMood: NoHome: "I need a place to crash! My drinks need to be properly cooled before they can be served!", LoveSpace: "Finally, some peace and quiet. Large quantities of people tend to piss me off.", FarFromHome: "I'm used to running away from home, but this is a little ridculous.", - DislikeCrowded: "If one more person tells me ‘it’s happy hour somewhere’ to try and get a discount, I’m going to snap!", + DislikeCrowded: "If one more person tells me ‘it's happy hour somewhere' to try and get a discount, I'm going to snap!", HateCrowded: "No amount of alcohol can drown out the noise these people make!", - LoveBiome: "Other unicorns? Never thought I’d see the day! This place is incredible!", + LoveBiome: "Other unicorns? Never thought I'd see the day! This place is incredible!", LikeBiome: "A good breeze to cool some heads, that's the way to deal with customers who've had a few too many drinks!", - DislikeBiome: "This dry air and heat isn’t good for my hair, or my drinks.", - HateBiome: "This place is awful! The musty air spoils the taste and aroma of everything I’m selling!", + DislikeBiome: "This dry air and heat isn't good for my hair, or my drinks.", + HateBiome: "This place is awful! The musty air spoils the taste and aroma of everything I'm selling!", LoveNPC_Stylist: "{NPCName} works wonders for my hair... among other things, hehe.", LoveNPC_BestiaryGirl: "{NCPName} is so fluffy and squishy! She also says my alicorn form is 'mega rad'.", LikeNPC_Truffle: "{NCPName} makes me so hungry... I wonder how great of a trip he'd give...", @@ -223,7 +220,7 @@ TownNPCMood: DislikeNPC_TaxCollector: "{NCPName} had best keep his distance... he wouldn't want to wake up one morning with a pipe bomb in his mailbox.", HateNPC_GoblinTinkerer: "{NCPName} was so terrible that I had to FORCE him to have a better reforge system. Why would you house me next to him? Do you enjoy watching me relive the stress he gave me!?", HateNPC_Angler: "{NCPName} never stops blabbering about his inane fishing quests. Get me away from him before I stomp him into the ground!", - LikeNPC_Princess: "You think I’d dislike {NPCName} because we’re too different? Quite the contrary, there's a lot we like to talk about, over non-alcoholic drinks of course.", + LikeNPC_Princess: "You think I'd dislike {NPCName} because we're too different? Quite the contrary, there's a lot we like to talk about, over non-alcoholic drinks of course.", }, SEAHOE: @@ -238,40 +235,40 @@ TownNPCMood: DislikeBiome: "The sun is too harsh on me. I dislike the arid climate here.", HateBiome: "This is simply no place to live. Let us depart immediately.", LikeNPC: "The way {NPCName} acts is a bit too coarse for me, but his love of the ocean is something I can quite appreciate!", - DislikeNPC: "I’ve had quite enough carnage for one lifetime thank you! {NPCName}'s destructive tendencies are a bit insensitive.", + DislikeNPC: "I've had quite enough carnage for one lifetime thank you! {NPCName}'s destructive tendencies are a bit insensitive.", HateNPC: "{NPCName} is just a child, but his attitude towards marine life is unacceptable! Absolutely unacceptable!", LikeNPC_Princess: "That child, {NPCName}. She is an innocent soul. Let us hope the horrors of war never reach her.", }, THIEF: { - Content: "It’s been going well!", + Content: "It's been going well!", NoHome: "You have a place to bunk? Sleeping on the ground makes me stiff and sore.", LoveSpace: "Less people makes getting away with certain things easier.", FarFromHome: "I need to get back to my secret cache! What if someone got their hands on it while I was away!?", - DislikeCrowded: "I don’t like this, too many possible eyewitnesses.", - HateCrowded: "Being around this many people makes me think I’M going to be robbed.", + DislikeCrowded: "I don't like this, too many possible eyewitnesses.", + HateCrowded: "Being around this many people makes me think I'M going to be robbed.", LikeBiome: "I know that a lot of wealthy traders come through the desert at times. Makes it a great spot to nick their goods.", DislikeBiome: "Too stifling, too humid. I get sluggish in these conditions, no good.", HateBiome: "No one lives here, and why would they?! This place is a dump!", - LikeNPC: "{NPCName} doesn’t only keep spiky balls in his pockets, he keeps a ton of cash! He’s too absentminded to notice I’m stealing from him too! I like that a lot!", + LikeNPC: "{NPCName} doesn't only keep spiky balls in his pockets, he keeps a ton of cash! He's too absentminded to notice I'm stealing from him too! I like that a lot!", DislikeNPC: "What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods.", - LikeNPC_Princess: "I couldn’t bear to steal anything from {NPCName}, she’s so cute!", + LikeNPC_Princess: "I couldn't bear to steal anything from {NPCName}, she's so cute!", }, WITCH: { - Content: "I can’t complain really.", + Content: "I can't complain really.", NoHome: "Anywhere would be better than a cave with no bed or lighting.", LoveSpace: "The quieter, the better. This is good.", FarFromHome: "After being used to having people around for a bit, I miss it again.", - DislikeCrowded: "I really don’t like how familiar some of these people are getting with me.", - HateCrowded: "I’m getting a headache from the pressure of having so many people around.", - LikeBiome: "I’ve never had the chance to live somewhere like this before. The trees and the songbirds… I quite like it.", - DislikeBiome: "Is this a sick joke? I can’t bear to be here any longer, I’ve already tried to atone for my sins.", - HateBiome: "The spirits are unrestful here. It’s really not a good feeling.", - LikeNPC: "{NPCName} is someone who’s had a terrible experience being cursed. He’s put up with it quite well all that time, it’s quite impressive honestly.", - DislikeNPC: "Such a racket! All {NPCName} does is make noise, day in and day out! I can’t stand her!", + DislikeCrowded: "I really don't like how familiar some of these people are getting with me.", + HateCrowded: "I'm getting a headache from the pressure of having so many people around.", + LikeBiome: "I've never had the chance to live somewhere like this before. The trees and the songbirds… I quite like it.", + DislikeBiome: "Is this a sick joke? I can't bear to be here any longer, I've already tried to atone for my sins.", + HateBiome: "The spirits are unrestful here. It's really not a good feeling.", + LikeNPC: "{NPCName} is someone who's had a terrible experience being cursed. He's put up with it quite well all that time, it's quite impressive honestly.", + DislikeNPC: "Such a racket! All {NPCName} does is make noise, day in and day out! I can't stand her!", LikeNPC_Princess: "What a strangely pleasant kid, {NPCName} is to be around.", }, } diff --git a/MainMenu/CalamityMainMenu.cs b/MainMenu/CalamityMainMenu.cs index 3d9da6323d..5e83ed1a39 100644 --- a/MainMenu/CalamityMainMenu.cs +++ b/MainMenu/CalamityMainMenu.cs @@ -45,7 +45,7 @@ namespace CalamityMod.MainMenu 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("Calamity") ?? MusicID.Title; + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("CalamityTitle") ?? MusicID.Title; public override ModSurfaceBackgroundStyle MenuBackgroundStyle => ModContent.GetInstance(); diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 777eeca11e..407d2024af 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -9,6 +9,7 @@ using CalamityMod.Particles; using CalamityMod.Particles.Metaballs; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; +using CalamityMod.UI.DraedonSummoning; using CalamityMod.World; using Terraria; using Terraria.ModLoader; @@ -110,18 +111,23 @@ namespace CalamityMod case "aquatic scourge": return DownedBossSystem.downedAquaticScourge; + case "cragmaw": + case "cragmawmire": + case "cragmaw mire": + case "mire": + return DownedBossSystem.downedCragmawMire; + case "brimstoneelemental": case "brimstone elemental": return DownedBossSystem.downedBrimstoneElemental; - case "calamitas": case "clone": case "calamitasclone": case "calamitas clone": case "clonelamitas": case "calamitasdoppelganger": case "calamitas doppelganger": - return DownedBossSystem.downedCalamitas; + return DownedBossSystem.downedCalamitasClone; case "gss": case "greatsandshark": @@ -196,6 +202,13 @@ namespace CalamityMod case "necroplasm": return DownedBossSystem.downedPolterghast; + case "mauler": + return DownedBossSystem.downedMauler; + + case "nuclear terror": + case "nuclearterror": + return DownedBossSystem.downedNuclearTerror; + // Old Duke is also Acid Rain tier 3, so he gets those names too case "oldduke": case "old duke": @@ -273,10 +286,14 @@ namespace CalamityMod case "ares": return DownedBossSystem.downedExoMechs; + case "calamitas": case "scal": case "supremecalamitas": case "supreme calamitas": - return DownedBossSystem.downedSCal; + case "supremewitchcalamitas": + case "supreme witch calamitas": + case "supreme witch, calamitas": + return DownedBossSystem.downedCalamitas; case "adulteidolonwyrm": case "adult eidolon wyrm": @@ -285,6 +302,11 @@ namespace CalamityMod case "adulteidolon": case "adult eidolon": return DownedBossSystem.downedAdultEidolonWyrm; + + case "bossrush": + case "boss rush": + case "terminus": + return DownedBossSystem.downedBossRush; } } #endregion @@ -1945,6 +1967,12 @@ namespace CalamityMod return new ArgumentException("ERROR: Must specify a bool that determines whether the buff is persistent after death for the Amalgam to properly reset."); return SetPersistentBuffList(buffType4, isPersistent); + case "CreateCodebreakerDialogOption": + if (args.Length != 4 || args[1] is not string inquiry || args[2] is not string response || args[3] is not Func condition) + throw new ArgumentException("ERROR: Must specify a string that determines the inquiry, a string that determines the response, and a Func that determines the condition."); + DraedonDialogRegistry.DialogOptions.Add(new(inquiry, response, condition)); + return null; + default: return new ArgumentException("ERROR: Invalid method name."); } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 782747ca57..5fd6f90689 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -36,7 +36,7 @@ using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; @@ -68,6 +68,7 @@ using CalamityMod.NPCs.TownNPCs; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon.Umbrella; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -84,7 +85,7 @@ namespace CalamityMod { internal class Downed { - public static readonly Func NotDownedCalamitas = () => !DownedBossSystem.downedCalamitas; + public static readonly Func NotDownedCalClone = () => !DownedBossSystem.downedCalamitasClone; public static readonly Func DownedDesertScourge = () => DownedBossSystem.downedDesertScourge; public static readonly Func DownedGiantClam = () => DownedBossSystem.downedCLAM; public static readonly Func DownedCrabulon = () => DownedBossSystem.downedCrabulon; @@ -94,7 +95,8 @@ namespace CalamityMod public static readonly Func DownedCryogen = () => DownedBossSystem.downedCryogen; public static readonly Func DownedBrimstoneElemental = () => DownedBossSystem.downedBrimstoneElemental; public static readonly Func DownedAquaticScourge = () => DownedBossSystem.downedAquaticScourge; - public static readonly Func DownedCalamitas = () => DownedBossSystem.downedCalamitas; + public static readonly Func DownedCragmawMire = () => DownedBossSystem.downedCragmawMire; + public static readonly Func DownedCalClone = () => DownedBossSystem.downedCalamitasClone; public static readonly Func DownedGSS = () => DownedBossSystem.downedGSS; public static readonly Func DownedLeviathan = () => DownedBossSystem.downedLeviathan; public static readonly Func DownedAureus = () => DownedBossSystem.downedAstrumAureus; @@ -108,15 +110,18 @@ namespace CalamityMod public static readonly Func DownedStormWeaver = () => DownedBossSystem.downedStormWeaver; public static readonly Func DownedSignus = () => DownedBossSystem.downedSignus; public static readonly Func DownedPolterghast = () => DownedBossSystem.downedPolterghast; + public static readonly Func DownedMauler = () => DownedBossSystem.downedMauler; + public static readonly Func DownedNuclearTerror = () => DownedBossSystem.downedNuclearTerror; public static readonly Func DownedBoomerDuke = () => DownedBossSystem.downedBoomerDuke; public static readonly Func DownedDoG = () => DownedBossSystem.downedDoG; public static readonly Func DownedYharon = () => DownedBossSystem.downedYharon; public static readonly Func DownedExoMechs = () => DownedBossSystem.downedExoMechs; - public static readonly Func DownedSCal = () => DownedBossSystem.downedSCal; + public static readonly Func DownedSCal = () => DownedBossSystem.downedCalamitas; public static readonly Func DownedAdultEidolonWyrm = () => DownedBossSystem.downedAdultEidolonWyrm; public static readonly Func DownedAcidRainInitial = () => DownedBossSystem.downedEoCAcidRain; public static readonly Func DownedAcidRainHardmode = () => DownedBossSystem.downedAquaticScourgeAcidRain; + public static readonly Func DownedBossRush = () => DownedBossSystem.downedBossRush; } internal class WeakReferenceSupport @@ -134,8 +139,9 @@ namespace CalamityMod { "SlimeGod", 6.5f }, { "Cryogen", 8.5f }, { "AquaticScourge", 9.5f }, + { "CragmawMire", 9.52f }, { "BrimstoneElemental", 10.5f }, - { "Calamitas", 11.7f }, + { "CalamitasClone", 11.7f }, { "GreatSandShark", 12.09f }, { "Leviathan", 12.8f }, { "AstrumAureus", 12.81f }, @@ -149,11 +155,13 @@ namespace CalamityMod { "StormWeaver", 19.51f }, { "Signus", 19.52f }, { "Polterghast", 20f }, + { "Mauler", 20.491f }, + { "NuclearTerror", 20.492f }, { "OldDuke", 20.5f }, { "DevourerOfGods", 21f }, { "Yharon", 22f }, { "ExoMechs", 22.5f }, - { "SupremeCalamitas", 23f }, + { "Calamitas", 23f }, { "AdultEidolonWyrm", 23.5f }, // { "Yharim", 24f }, // { "Noxus", 25f }, @@ -164,7 +172,8 @@ namespace CalamityMod { { "Acid Rain Initial", 2.67f }, { "Acid Rain Aquatic Scourge", 9.51f }, - { "Acid Rain Polterghast", 20.49f } + { "Acid Rain Polterghast", 20.49f }, + { "Boss Rush", 23.75f } }; public static void Setup() @@ -178,7 +187,7 @@ namespace CalamityMod public static void WikiThisSupport() { - // Wikithis is a clientside mod + // Wikithis is a clientside mod if (Main.netMode == NetmodeID.Server) return; @@ -187,88 +196,93 @@ namespace CalamityMod if (wiki is null) return; - bool oldVersion = wiki.Version < new Version(2, 4, 7, 5); + bool oldVersion = wiki.Version < new Version(2, 4, 7, 5); - wiki.Call("AddModURL", calamity, oldVersion ? CalamityWikiURLOld : CalamityWikiURL); - wiki.Call(0, calamity, oldVersion ? CalamityWikiURLOld : CalamityWikiURL); - wiki.Call("AddWikiTexture", calamity, ModContent.Request("CalamityMod/ModSupport/WikiThisIcon")); - wiki.Call(3, calamity, ModContent.Request("CalamityMod/ModSupport/WikiThisIcon")); + wiki.Call("AddModURL", calamity, oldVersion ? CalamityWikiURLOld : CalamityWikiURL); + wiki.Call(0, calamity, oldVersion ? CalamityWikiURLOld : CalamityWikiURL); + wiki.Call("AddWikiTexture", calamity, ModContent.Request("CalamityMod/ModSupport/WikiThisIcon")); + wiki.Call(3, calamity, ModContent.Request("CalamityMod/ModSupport/WikiThisIcon")); - // Clear up name conflicts + // Clear up name conflicts void ItemRedirect(int item, string pageName) { - wiki.Call(1, item, pageName); + wiki.Call(1, item, pageName); } void EnemyRedirect(int item, string pageName) { - wiki.Call(2, item, pageName); + wiki.Call(2, item, pageName); } - // Items - ItemRedirect(ModContent.ItemType(), "Blood Orange (calamity)"); - ItemRedirect(ModContent.ItemType(), "Elderberry (calamity)"); - ItemRedirect(ModContent.ItemType(), "Pineapple (calamity)"); - ItemRedirect(ModContent.ItemType(), "Trash Can (pet)"); - ItemRedirect(ModContent.ItemType(), "Butcher (weapon)"); - ItemRedirect(ModContent.ItemType(), "Sandstorm (weapon)"); - ItemRedirect(ModContent.ItemType(), "Thunderstorm (weapon)"); - // Lore items - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + // Items + ItemRedirect(ModContent.ItemType(), "Blood Orange (calamity)"); + ItemRedirect(ModContent.ItemType(), "Elderberry (calamity)"); + ItemRedirect(ModContent.ItemType(), "Pineapple (calamity)"); + ItemRedirect(ModContent.ItemType(), "Trash Can (pet)"); + ItemRedirect(ModContent.ItemType(), "Butcher (weapon)"); + ItemRedirect(ModContent.ItemType(), "Sandstorm (weapon)"); + ItemRedirect(ModContent.ItemType(), "Thunderstorm (weapon)"); + // Lore items + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); + ItemRedirect(ModContent.ItemType(), "Lore#Lore_Items"); - // Enemies - EnemyRedirect(ModContent.NPCType(), "Catfish (enemy)"); - EnemyRedirect(ModContent.NPCType(), "Hive (enemy)"); - EnemyRedirect(ModContent.NPCType(), "Crown Jewel (enemy)"); - EnemyRedirect(ModContent.NPCType(), "Tooth Ball (Old Duke)"); - EnemyRedirect(ModContent.NPCType(), "Enchantment"); - EnemyRedirect(ModContent.NPCType(), "%3F%3F%3F"); + // Enemies + EnemyRedirect(ModContent.NPCType(), "Hive (enemy)"); + EnemyRedirect(ModContent.NPCType(), "Crown Jewel (enemy)"); + EnemyRedirect(ModContent.NPCType(), "Tooth Ball (Old Duke)"); + EnemyRedirect(ModContent.NPCType(), "Enchantment"); + EnemyRedirect(ModContent.NPCType(), "%3F%3F%3F"); } // Wrapper function to add bosses to Boss Checklist. @@ -381,7 +395,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("DesertScourge", out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Desert Biome"; string despawn = CalamityUtils.ColorMessage("The scourge of the desert delved back into the sand.", new Color(0xEE, 0xE8, 0xAA)); Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { @@ -407,7 +421,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Crabulon", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Mushroom Biome"; string despawn = CalamityUtils.ColorMessage("The mycleium crab has lost interest.", new Color(0x64, 0x95, 0xED)); AddBoss(bossChecklist, calamity, "Crabulon", order, type, DownedCrabulon, summon, collection, instructions, despawn, () => true); @@ -418,8 +432,8 @@ namespace CalamityMod BossDifficulty.TryGetValue("HiveMind", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - string instructions = $"Kill a Cyst in the Corruption or use a [i:{summon}] in the Corruption"; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Kill a Tumor in the Corruption or use a [i:{summon}] in the Corruption"; string despawn = CalamityUtils.ColorMessage("The corrupted colony began searching for a new breeding ground.", new Color(0x94, 0x00, 0xD3)); string bossHeadTex = "CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss"; AddBoss(bossChecklist, calamity, "The Hive Mind", order, type, DownedHiveMind, summon, collection, instructions, despawn, () => true, null, bossHeadTex); @@ -430,7 +444,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Perforators", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Kill a Cyst in the Crimson or use a [i:{summon}] in the Crimson"; string despawn = CalamityUtils.ColorMessage("The parasitic hive began searching for a new host.", new Color(0xDC, 0x14, 0x3C)); AddBoss(bossChecklist, calamity, "The Perforators", order, type, DownedPerfs, summon, collection, instructions, despawn, () => true); @@ -441,7 +455,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("SlimeGod", out float order); List bosses = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The gelatinous monstrosity achieved vengeance for its brethren.", new Color(0xBA, 0x55, 0x33)); AddBoss(bossChecklist, calamity, "Slime God", order, bosses, DownedSlimeGod, summon, collection, instructions, despawn, () => true); @@ -452,7 +466,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Cryogen", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Snow Biome"; string despawn = CalamityUtils.ColorMessage("Cryogen drifts away, carried on a freezing wind.", new Color(0x00, 0xFF, 0xFF)); string bossLogTex = "CalamityMod/NPCs/Cryogen/Cryogen_Phase1_Head_Boss"; @@ -464,7 +478,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("AquaticScourge", out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"; string despawn = CalamityUtils.ColorMessage("The Aquatic Scourge swam back into the open ocean.", new Color(0xF0, 0xE6, 0x8C)); string bossLogTex = "CalamityMod/NPCs/AquaticScourge/AquaticScourgeHead_Head_Boss"; @@ -476,28 +490,36 @@ namespace CalamityMod AddBoss(bossChecklist, calamity, "Aquatic Scourge", order, segments, DownedAquaticScourge, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } + // Cragmaw Mire + { + BossDifficulty.TryGetValue("CragmawMire", out float order); + int type = NPCType(); + int summon = ItemType(); + string instructions = $"Spawns during Acid Rain after the Aquatic Scourge has been defeated.\nStart Acid Rain with a [i:{summon}]"; + string despawn = CalamityUtils.ColorMessage("The Cragmaw Mire buries itself within the sand.", new Color(0xF0, 0xE6, 0x8C)); + AddMiniBoss(bossChecklist, calamity, "Cragmaw Mire", order, type, DownedCragmawMire, null, null, instructions, despawn, () => true); + } + // Brimstone Elemental { BossDifficulty.TryGetValue("BrimstoneElemental", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Brimstone Crag"; string despawn = CalamityUtils.ColorMessage("Brimstone Elemental withdraws to the ruins of her shrine.", new Color(0xDC, 0x14, 0x3C)); AddBoss(bossChecklist, calamity, "Brimstone Elemental", order, type, DownedBrimstoneElemental, summon, collection, instructions, despawn, () => true); } - // Calamitas + // Calamitas Clone { - BossDifficulty.TryGetValue("Calamitas", out float order); + BossDifficulty.TryGetValue("CalamitasClone", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] at Night"; string despawn = CalamityUtils.ColorMessage("If you wanted a fight, you should've came more prepared.", new Color(0xFF, 0xA5, 0x00)); - //Func available = () => !DownedBossSystem.downedCalamitas; - AddBoss(bossChecklist, calamity, "The Calamitas Clone", order, type, DownedCalamitas, summon, collection, instructions, despawn, () => true); - //AddBoss(bossChecklist, calamity, "Calamitas", order, type, DownedCalamitas, summon, collection, instructions, despawn, available); + AddBoss(bossChecklist, calamity, "The Calamitas Clone", order, type, DownedCalClone, summon, collection, instructions, despawn, () => true); } // Great Sand Shark @@ -515,7 +537,7 @@ namespace CalamityMod { BossDifficulty.TryGetValue("Leviathan", out float order); List bosses = new List() { NPCType(), NPCType() }; - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = "By killing an unknown entity in the Ocean Biome"; string despawn = CalamityUtils.ColorMessage("The aquatic entities sink back beneath the ocean depths.", new Color(0x7F, 0xFF, 0xD4)); @@ -532,9 +554,9 @@ namespace CalamityMod BossDifficulty.TryGetValue("AstrumAureus", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] at Night in the Astral Biome"; - string despawn = CalamityUtils.ColorMessage("Astrum Aureus’ program has been executed. Initiate recall.", new Color(0xFF, 0xD7, 0x00)); + string despawn = CalamityUtils.ColorMessage("Astrum Aureus' program has been executed. Initiate recall.", new Color(0xFF, 0xD7, 0x00)); string bossLogTex = "CalamityMod/NPCs/AstrumAureus/AstrumAureus_Head_Boss"; AddBoss(bossChecklist, calamity, "Astrum Aureus", order, type, DownedAureus, summon, collection, instructions, despawn, () => true, null, bossLogTex); } @@ -544,7 +566,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("PlaguebringerGoliath", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("HOSTILE SPECIMENS TERMINATED. INITIATE RECALL TO HOME BASE.", new Color(0x00, 0xFF, 0x00)); string bossLogTex = "CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_Head_Boss"; @@ -562,7 +584,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Ravager", out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The automaton of misshapen victims went looking for the true perpetrator.", new Color(0xB2, 0x22, 0x22)); string bossLogTex = "CalamityMod/NPCs/Ravager/RavagerBody_Head_Boss"; @@ -583,7 +605,7 @@ namespace CalamityMod int summon2 = ItemType(); int altar = ItemType(); List summons = new List() { summon1, summon2 }; - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon1}] or [i:{summon2}] as offering at an [i:{altar}]"; string despawn = CalamityUtils.ColorMessage("The infected deity retreats to the heavens.", new Color(0xFF, 0xD7, 0x00)); string bossLogTex = "CalamityMod/NPCs/AstrumDeus/AstrumDeusHead_Head_Boss"; @@ -602,15 +624,16 @@ namespace CalamityMod BossDifficulty.TryGetValue("ProfanedGuardians", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Hallow or Underworld Biomes"; string despawn = CalamityUtils.ColorMessage("The guardians must protect their goddess at all costs.", new Color(0xFF, 0xA5, 0x00)); string bossLogTex = "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommander_Head_Boss"; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist").Value; - Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); - sb.Draw(texture, centered, color); + float scale = 0.7f; + Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); + sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); }; AddBoss(bossChecklist, calamity, "Profaned Guardians", order, type, DownedGuardians, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); } @@ -620,7 +643,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Dragonfolly", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("The failed experiment returns to its reproductive routine.", new Color(0xFF, 0xD7, 0x00)); AddBoss(bossChecklist, calamity, "Dragonfolly", order, type, DownedBirb, summon, collection, instructions, despawn, () => true); @@ -631,7 +654,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Providence", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon}] in the Hallow or Underworld Biomes"; string despawn = CalamityUtils.ColorMessage("The Profaned Goddess vanishes in a burning blaze.", new Color(0xFF, 0xA5, 0x00)); string bossLogTex = "CalamityMod/NPCs/Providence/Providence_Head_Boss"; @@ -649,7 +672,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("CeaselessVoid", out float order); List bosses = new List() { NPCType(), NPCType() }; int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Dungeon"; string despawn = CalamityUtils.ColorMessage("The rift in time and space has moved away from your reach.", new Color(0x4B, 0x00, 0x82)); AddBoss(bossChecklist, calamity, "Ceaseless Void", order, bosses, DownedCeaselessVoid, summon, collection, instructions, despawn, () => true); @@ -660,7 +683,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("StormWeaver", out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in Space"; string despawn = CalamityUtils.ColorMessage("Storm Weaver hid itself once again within the stormfront.", new Color(0xEE, 0x82, 0xEE)); string bossLogTex = "CalamityMod/NPCs/StormWeaver/StormWeaverHead_Head_Boss"; @@ -677,7 +700,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Signus", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Underworld"; string despawn = CalamityUtils.ColorMessage("The Devourer's assassin has finished its easy task.", new Color(0xBA, 0x55, 0xD3)); AddBoss(bossChecklist, calamity, "Signus", order, type, DownedSignus, summon, collection, instructions, despawn, () => true); @@ -688,18 +711,38 @@ namespace CalamityMod BossDifficulty.TryGetValue("Polterghast", out float order); List bosses = new List() { NPCType(), NPCType() }; int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Kill 30 phantom spirits or use a [i:{summon}] in the Dungeon"; string despawn = CalamityUtils.ColorMessage("The volatile spirits disperse throughout the depths of the dungeon.", new Color(0xB0, 0xE0, 0xE6)); AddBoss(bossChecklist, calamity, "Polterghast", order, bosses, DownedPolterghast, summon, collection, instructions, despawn, () => true); } + // Mauler + { + BossDifficulty.TryGetValue("Mauler", out float order); + int type = NPCType(); + int summon = ItemType(); + string instructions = $"Spawns during Acid Rain after Polterghast has been defeated.\nStart Acid Rain with a [i:{summon}]"; + string despawn = CalamityUtils.ColorMessage("The ravenous shark has mauled everybody's corpses.", new Color(0xF0, 0xE6, 0x8C)); + AddMiniBoss(bossChecklist, calamity, "Mauler", order, type, DownedMauler, null, null, instructions, despawn, () => true); + } + + // Nuclear Terror + { + BossDifficulty.TryGetValue("NuclearTerror", out float order); + int type = NPCType(); + int summon = ItemType(); + string instructions = $"Spawns during Acid Rain after Polterghast has been defeated.\nStart Acid Rain with a [i:{summon}]"; + string despawn = CalamityUtils.ColorMessage("The radioactive monstrosity has further enforced its name.", new Color(0xF0, 0xE6, 0x8C)); + AddMiniBoss(bossChecklist, calamity, "Nuclear Terror", order, type, DownedNuclearTerror, null, null, instructions, despawn, () => true); + } + // Old Duke { BossDifficulty.TryGetValue("OldDuke", out float order); List bosses = new List() { NPCType() }; int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Defeat the Acid Rain event post-Polterghast or fish using a [i:{summon}] in the Sulphurous Sea"; string despawn = CalamityUtils.ColorMessage("The old duke disappears amidst the acidic downpour.", new Color(0xF0, 0xE6, 0x8C)); AddBoss(bossChecklist, calamity, "Old Duke", order, bosses, DownedBoomerDuke, summon, collection, instructions, despawn, () => true); @@ -710,7 +753,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("DevourerOfGods", out float order); int type = NPCType(); int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The Devourer of Gods has slain everyone and feasted on their essence.", new Color(0x00, 0xFF, 0xFF)); string bossHeadTex = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss"; @@ -726,9 +769,9 @@ namespace CalamityMod { BossDifficulty.TryGetValue("Yharon", out float order); int type = NPCType(); - int summon = ItemType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - string instructions = $"Use a [i:{summon}] in the Jungle Biome"; + int summon = ItemType(); + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("Yharon found you too weak to stay near your gravestone.", new Color(0xFF, 0xA5, 0x00)); string bossLogTex = "CalamityMod/NPCs/Yharon/Yharon_Head_Boss"; AddBoss(bossChecklist, calamity, "Yharon", order, type, DownedYharon, summon, collection, instructions, despawn, () => true, null, bossLogTex); @@ -741,7 +784,7 @@ namespace CalamityMod { BossDifficulty.TryGetValue("ExoMechs", out float order); List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = "By using a high-tech computer"; string despawn = CalamityUtils.ColorMessage("An imperfection after all... what a shame.", new Color(0x7F, 0xFF, 0xD4)); @@ -755,37 +798,19 @@ namespace CalamityMod AddBoss(bossChecklist, calamity, "Exo Mechs", order, bosses, DownedExoMechs, null, collection, instructions, despawn, () => true, portrait); } - // Supreme Calamitas + // Calamitas { - BossDifficulty.TryGetValue("SupremeCalamitas", out float order); + BossDifficulty.TryGetValue("Calamitas", out float order); int type = NPCType(); int summon1 = ItemType(); int summon2 = ItemType(); int altar = ItemType(); List summons = new List() { summon1, summon2 }; - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon1}] or a [i:{summon2}] as offering at an [i:{altar}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); string bossHeadTex = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; - AddBoss(bossChecklist, calamity, "Supreme Calamitas", order, type, DownedSCal, summons, collection, instructions, despawn, () => true, null, bossHeadTex); - } - - // Adult Eidolon Wyrm - { - BossDifficulty.TryGetValue("AdultEidolonWyrm", out float order); - int type = NPCType(); - int summon = ItemID.RodofDiscord; - List collection = new List() { ItemType() }; - string instructions = $"While in the Abyss, use an item that inflicts Chaos State"; - string despawn = CalamityUtils.ColorMessage("...", new Color(0x7F, 0xFF, 0xD4)); - string bossLogTex = "CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead_Head_Boss"; - - Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { - Texture2D texture = ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrm_BossChecklist").Value; - Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); - sb.Draw(texture, centered, color); - }; - AddBoss(bossChecklist, calamity, "Adult Eidolon Wyrm", order, type, DownedAdultEidolonWyrm, summon, collection, instructions, despawn, () => true, portrait, bossLogTex); + AddBoss(bossChecklist, calamity, "Supreme Witch, Calamitas", order, type, DownedSCal, summons, collection, instructions, despawn, () => true, null, bossHeadTex); } } @@ -842,6 +867,22 @@ namespace CalamityMod }; AddInvasion(bossChecklist, calamity, "Acid Rain (Post-Polter)", order, enemies, DownedBoomerDuke, summons, collection, instructions, () => true, portrait, iconTexture); } + // Boss Rush + { + InvasionDifficulty.TryGetValue("Boss Rush", out float order); + List enemies = new List() { 0 }; // This is for loot purposes, which no bosses give during the event + List summons = new List() { ItemType() }; + List collection = new List() { ItemType() }; + string instructions = $"Use a [i:{ItemType()}] found at the bottom of the Abyss"; + string iconTexture = "CalamityMod/UI/MiscTextures/BossRushIcon"; + Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { + Texture2D texture = ModContent.Request("CalamityMod/Skies/XerocEye").Value; + float scale = 0.5f; + Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); + sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + }; + AddInvasion(bossChecklist, calamity, "Boss Rush", order, enemies, DownedBossRush, summons, collection, instructions, () => true, portrait, iconTexture); + } } private static void AddCalamityBossLoot(Mod bossChecklist) @@ -849,92 +890,92 @@ namespace CalamityMod // King Slime AddLoot(bossChecklist, "KingSlime", new List() { ItemType() }, - new List() { ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); // Eye of Cthulhu AddLoot(bossChecklist, "EyeofCthulhu", new List() { ItemType(), ItemType() }, - new List() { ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); // Eater of Worlds AddLoot(bossChecklist, "EaterofWorldsHead", null, - new List() { ItemType(), ItemType(), ItemType() } + new List() { ItemType(), ItemType(), ItemType() } ); // Brain of Cthulhu AddLoot(bossChecklist, "BrainofCthulhu", null, - new List() { ItemType(), ItemType(), ItemType() } + new List() { ItemType(), ItemType(), ItemType() } ); // Queen Bee AddLoot(bossChecklist, "QueenBee", new List() { ItemType(), ItemID.Stinger, ItemType() }, - new List() { ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); // Skeletron AddLoot(bossChecklist, "SkeletronHead", null, - new List() { ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); // Wall of Flesh AddLoot(bossChecklist, "WallofFlesh", new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.CorruptionKey, ItemID.CrimsonKey }, - new List() { ItemType(), ItemType(), ItemType(), ItemType() } + new List() { ItemType(), ItemType(), ItemType(), ItemType() } ); // Queen Slime AddLoot(bossChecklist, "QueenSlime", new List() { ItemID.HallowedKey }, - new List() { ItemType() } + new List() { ItemType(), ItemType() } ); // The Twins AddLoot(bossChecklist, "TheTwins", new List() { ItemType() }, - new List() { ItemType(), ItemType(), ItemType() } + new List() { ItemType(), ItemType(), ItemType() } ); // The Destroyer AddLoot(bossChecklist, "TheDestroyer", - new List() { ItemType(), ItemType(), ItemType() } + new List() { ItemType(), ItemType(), ItemType() } ); // Skeletron Prime AddLoot(bossChecklist, "SkeletronPrime", null, - new List() { ItemType(), ItemType(), ItemType() } + new List() { ItemType(), ItemType(), ItemType() } ); // Plantera AddLoot(bossChecklist, "Plantera", new List() { ItemType(), ItemType(), ItemType(), ItemID.JungleKey }, - new List() { ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); AddSummons(bossChecklist, "Plantera", new List() { ItemType() }); // Golem AddLoot(bossChecklist, "Golem", new List() { ItemType(), ItemType() }, - new List() { ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); AddSummons(bossChecklist, "Golem", new List() { ItemType() }); // Empress of Light AddLoot(bossChecklist, "HallowBoss", null, - new List() { ItemType() } + new List() { ItemType(), ItemType() } ); // Duke Fishron AddLoot(bossChecklist, "DukeFishron", new List() { ItemType(), ItemType() }, - new List() { ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); // Betsy @@ -946,14 +987,14 @@ namespace CalamityMod // Lunatic Cultist AddLoot(bossChecklist, "CultistBoss", null, - new List() { ItemType(), ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); AddSummons(bossChecklist, "CultistBoss", new List() { ItemType() }); // Moon Lord AddLoot(bossChecklist, "MoonLord", new List() { ItemType(), ItemType() }, - new List() { ItemType(), ItemType() } + new List() { ItemType(), ItemType() } ); } @@ -1040,7 +1081,7 @@ namespace CalamityMod censusMod.Call("TownNPCCondition", NPCType(), "Have a [i:" + ItemID.PlatinumCoin + "] in your inventory after defeating Skeletron"); censusMod.Call("TownNPCCondition", NPCType(), "Have [i:" + ItemType() + "] in your inventory in Hardmode"); censusMod.Call("TownNPCCondition", NPCType(), "Defeat Cryogen"); - censusMod.Call("TownNPCCondition", NPCType(), "Defeat Supreme Calamitas"); + censusMod.Call("TownNPCCondition", NPCType(), "Defeat Supreme Witch, Calamitas"); } } @@ -1069,7 +1110,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index d2438fb90d..35f2d9dac9 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -185,7 +186,7 @@ namespace CalamityMod.NPCs.Abyss { if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType()) < 3) { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; + return SpawnCondition.CaveJellyfish.Chance * 0.5f; } return 0f; } @@ -209,8 +210,14 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bloatfish").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bloatfish2").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bloatfish3").Type, NPC.scale); + } } - if (NPC.scale < 2f) + if (NPC.scale < 2f || CalamityWorld.getFixedBoi) { NPC.scale += 0.05f; } diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index fb1f59645d..6e513802d0 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -67,6 +67,8 @@ namespace CalamityMod.NPCs.Abyss { if (!Main.npc[(int)NPC.ai[2]].active || (int)NPC.ai[2] < 0) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/Abyss/BobbitWormSegment.cs b/NPCs/Abyss/BobbitWormSegment.cs index 017d858680..7274f48a2c 100644 --- a/NPCs/Abyss/BobbitWormSegment.cs +++ b/NPCs/Abyss/BobbitWormSegment.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.Abyss if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.Water) { if (CalamityGlobalNPC.bobbitWormBottom.Contains(-1)) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; + return SpawnCondition.CaveJellyfish.Chance * 0.85f; } return 0f; } diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 6f0ebff4c5..a767c1fd04 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.Abyss if (NPC.velocity.X > -num263 && NPC.velocity.X < num263 && NPC.velocity.Y > -num263 && NPC.velocity.Y < num263) { NPC.TargetClosest(true); - float num264 = CalamityWorld.death ? 12f : 8f; + float num264 = CalamityWorld.death ? 12f : CalamityWorld.revenge ? 10f : 8f; Vector2 vector31 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); float num265 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - vector31.X; float num266 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - vector31.Y; @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.Abyss } if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; + return SpawnCondition.CaveJellyfish.Chance * 2.5f; } return SpawnCondition.OceanMonster.Chance * 0.1f; } diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index 9b5636dc99..c378537ac9 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Abyss NPC.noGravity = true; NPC.lavaImmune = true; NPC.width = 78; - NPC.height = 70; + NPC.height = 78; NPC.defense = 50; NPC.lifeMax = 5625; NPC.aiStyle = -1; @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -134,7 +134,7 @@ namespace CalamityMod.NPCs.Abyss public void Boom() { - SoundEngine.PlaySound(SoundID.NPCDeath14, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient && puffedUp) { int damageBoom = 45; @@ -144,24 +144,16 @@ namespace CalamityMod.NPCs.Abyss NPC.netUpdate = true; } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (!NPC.IsABestiaryIconDummy) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.Yellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ChaoticPufferGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } } @@ -238,10 +230,6 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.4f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 907313c626..8cb6acbf61 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -1,27 +1,29 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -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.Audio; namespace CalamityMod.NPCs.Abyss { public class ColossalSquid : ModNPC { - private bool hasBeenHit = false; + public bool hasBeenHit = false; + public bool clone = false; public override void SetStaticDefaults() { @@ -53,6 +55,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + NPC.Calamity().canBreakPlayerDefense = true; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } @@ -68,6 +71,7 @@ namespace CalamityMod.NPCs.Abyss public override void SendExtraAI(BinaryWriter writer) { writer.Write(hasBeenHit); + writer.Write(clone); writer.Write(NPC.chaseable); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); @@ -78,6 +82,7 @@ namespace CalamityMod.NPCs.Abyss public override void ReceiveExtraAI(BinaryReader reader) { hasBeenHit = reader.ReadBoolean(); + clone = reader.ReadBoolean(); NPC.chaseable = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); @@ -104,7 +109,7 @@ namespace CalamityMod.NPCs.Abyss } if (Main.rand.NextBool(300)) { - SoundEngine.PlaySound(SoundID.Zombie34, NPC.position); + SoundEngine.PlaySound(SoundID.Zombie34, NPC.Center); } NPC.noTileCollide = false; if (NPC.ai[0] == 0f) @@ -181,7 +186,7 @@ namespace CalamityMod.NPCs.Abyss NPC.ai[0] = 0f; NPC.ai[1] = 0f; } - if (num1311 < 160f && Main.player[NPC.target].active && !Main.player[NPC.target].dead) + if (num1311 < 160f && Main.player[NPC.target].active && !Main.player[NPC.target].dead && !clone) { NPC.Center = Main.player[NPC.target].Top; NPC.velocity = Vector2.Zero; @@ -290,7 +295,7 @@ namespace CalamityMod.NPCs.Abyss else if (NPC.ai[0] == 5f) { Player player7 = Main.player[NPC.target]; - if (!player7.active || player7.dead) + if (!player7.active || player7.dead || clone) { NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -343,6 +348,22 @@ namespace CalamityMod.NPCs.Abyss (Main.player[NPC.target].Center - NPC.Center).Length() < Main.player[NPC.target].Calamity().GetAbyssAggro(240f)) || NPC.justHit) { + if (CalamityWorld.getFixedBoi && Main.netMode != NetmodeID.MultiplayerClient && !clone && !hasBeenHit) + { + // spawn some baby colossal squids in gfb + for (int i = 0; i < 3; i++) + { + int squib = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-20, 20), (int)NPC.Center.Y + Main.rand.Next(-20, 20), ModContent.NPCType()); + if (squib.WithinBounds(Main.maxNPCs)) + { + Main.npc[squib].ModNPC().clone = true; + Main.npc[squib].ModNPC().hasBeenHit = true; + Main.npc[squib].scale = 0.25f; + Main.npc[squib].lifeMax /= 5; + Main.npc[squib].life /= 5; + } + } + } hasBeenHit = true; } @@ -352,7 +373,7 @@ namespace CalamityMod.NPCs.Abyss { if (Main.rand.NextBool(300)) { - SoundEngine.PlaySound(SoundID.Zombie34, NPC.position); + SoundEngine.PlaySound(SoundID.Zombie34, NPC.Center); } if (NPC.ai[3] > 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { @@ -397,7 +418,7 @@ namespace CalamityMod.NPCs.Abyss } NPC.localAI[2] = 1f; NPC.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 150f) + if (NPC.localAI[0] >= 150f) { NPC.localAI[0] = 0f; NPC.netUpdate = true; @@ -406,8 +427,14 @@ namespace CalamityMod.NPCs.Abyss { damage = 55; } - SoundEngine.PlaySound(SoundID.Item111, NPC.position); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 60, 0f, 2f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + if (clone) + { + damage /= 4; + } + SoundEngine.PlaySound(SoundID.Item111, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 60, 0f, 2f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); } NPC.rotation = NPC.velocity.X * 0.05f; NPC.velocity *= 0.975f; @@ -432,7 +459,7 @@ namespace CalamityMod.NPCs.Abyss { if (Main.rand.NextBool(300)) { - SoundEngine.PlaySound(SoundID.Zombie35, NPC.position); + SoundEngine.PlaySound(SoundID.Zombie35, NPC.Center); } NPC.localAI[2] = 0f; NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.02f; @@ -481,6 +508,28 @@ namespace CalamityMod.NPCs.Abyss } } } + float pushVelocity = 0.05f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) + { + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 160f) + { + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X -= pushVelocity; + else + NPC.velocity.X += pushVelocity; + + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y -= pushVelocity; + else + NPC.velocity.Y += pushVelocity; + } + } + } + } if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 6400f) { NPC.active = false; @@ -577,12 +626,20 @@ namespace CalamityMod.NPCs.Abyss } if (Main.netMode != NetmodeID.Server) { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid2").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid3").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid4").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid2").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid3").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid4").Type, NPC.scale); } } } + + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi && clone) + { + typeName = "Tiny Squid"; + } + } } } diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index dcf8eaa6f4..79d277f94b 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -28,8 +28,8 @@ namespace CalamityMod.NPCs.Abyss NPC.noGravity = true; NPC.chaseable = false; NPC.damage = 34; - NPC.width = 50; - NPC.height = 28; + NPC.width = 58; + NPC.height = 30; NPC.defense = 8; NPC.lifeMax = 110; NPC.aiStyle = -1; @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Abyss 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) @@ -344,23 +344,15 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - if (NPC.IsABestiaryIconDummy) + if (!NPC.IsABestiaryIconDummy) { - NPC.alpha = 0; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.Gold); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/CuttlefishGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -371,10 +363,6 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; @@ -400,6 +388,11 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cuttlefish").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cuttlefish2").Type, 1f); + } } } } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index d6ce81e25b..c7359ba761 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -42,8 +42,8 @@ namespace CalamityMod.NPCs.Abyss NPC.lavaImmune = true; NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 90; - NPC.width = 126; - NPC.height = 66; + NPC.width = 136; + NPC.height = 62; NPC.defense = 999999; NPC.lifeMax = 400; NPC.aiStyle = -1; @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.Abyss Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("DevilFishMask" + i).Type, 1f); } } - SoundEngine.PlaySound(MaskBreakSound, NPC.position); + SoundEngine.PlaySound(MaskBreakSound, NPC.Center); } if (NPC.wet) @@ -151,9 +151,9 @@ namespace CalamityMod.NPCs.Abyss if (flag14) { NPC.TargetClosest(true); - NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.5f : 0.25f) * speedBoost; - NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.3f : 0.15f) * speedBoost; - float velocity = CalamityWorld.death ? 12f : 6f; + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.5f : CalamityWorld.revenge ? 0.375f : 0.25f) * speedBoost; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.3f : CalamityWorld.revenge ? 0.225f : 0.15f) * speedBoost; + float velocity = CalamityWorld.death ? 12f : CalamityWorld.revenge ? 9f : 6f; if (NPC.velocity.X > velocity * speedBoost) { NPC.velocity.X = velocity * speedBoost; @@ -281,19 +281,15 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + if (!NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.Red); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -304,13 +300,9 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) { - return SpawnCondition.CaveJellyfish.Chance * 0.225f; - } - if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; + return SpawnCondition.CaveJellyfish.Chance * 0.55f; } return 0f; } @@ -337,6 +329,12 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Devilfish").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Devilfish2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Devilfish3").Type, 1f); + } } if (hitCounter <= 5) diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 4c94233c0d..107dbc4349 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -38,8 +38,8 @@ namespace CalamityMod.NPCs.Abyss NPC.lavaImmune = true; NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 90; - NPC.width = 126; - NPC.height = 66; + NPC.width = 136; + NPC.height = 62; NPC.defense = 999999; NPC.lifeMax = 400; NPC.aiStyle = -1; @@ -54,7 +54,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.Abyss Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("DevilFishMask" + i + (i == 3 ? "Alt" : "")).Type, 1f); } } - SoundEngine.PlaySound(DevilFish.MaskBreakSound, NPC.position); + SoundEngine.PlaySound(DevilFish.MaskBreakSound, NPC.Center); } if (NPC.wet) @@ -147,9 +147,9 @@ namespace CalamityMod.NPCs.Abyss if (flag14) { NPC.TargetClosest(true); - NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.5f : 0.25f) * speedBoost; - NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.3f : 0.15f) * speedBoost; - float velocity = CalamityWorld.death ? 12f : 6f; + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.5f : CalamityWorld.revenge ? 0.375f : 0.25f) * speedBoost; + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.3f : CalamityWorld.revenge ? 0.225f : 0.15f) * speedBoost; + float velocity = CalamityWorld.death ? 12f : CalamityWorld.revenge ? 9f : 6f; if (NPC.velocity.X > velocity * speedBoost) { NPC.velocity.X = velocity * speedBoost; @@ -277,19 +277,15 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + if (!NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.Red); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/DevilFishGlowAlt").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -300,13 +296,9 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) { - return SpawnCondition.CaveJellyfish.Chance * 0.225f; - } - if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; + return SpawnCondition.CaveJellyfish.Chance * 0.55f; } return 0f; } @@ -325,6 +317,12 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DevilfishAlt").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DevilfishAlt2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DevilfishAlt3").Type, 1f); + } } if (hitCounter <= 5) diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index cad05ae0f6..1ce8c969a0 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -129,8 +129,8 @@ namespace CalamityMod.NPCs.Abyss Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.LightYellow); + vector += vector11 * 1f + new Vector2(0f, NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlow").Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 38e438d45e..4fd1674b65 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -1,24 +1,26 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.AdultEidolonWyrm; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Sounds; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; -using CalamityMod.NPCs.AdultEidolonWyrm; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.Abyss { @@ -71,7 +73,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -100,11 +102,13 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { bool adultWyrmAlive = false; + SoundStyle roar = CalamityWorld.getFixedBoi ? Sunskater.DeathSound with { Pitch = Sunskater.DeathSound.Pitch - 0.5f } : CommonCalamitySounds.WyrmScreamSound; if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) { if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) adultWyrmAlive = true; } + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) { NPC.TargetClosest(true); @@ -124,14 +128,14 @@ namespace CalamityMod.NPCs.Abyss if (NPC.soundDelay <= 0) { NPC.soundDelay = 420; - SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, NPC.position); + SoundEngine.PlaySound(roar, NPC.Center); } } else { if (Main.rand.NextBool(900)) { - SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, NPC.position); + SoundEngine.PlaySound(roar, NPC.Center); } } if (NPC.ai[2] > 0f) @@ -170,66 +174,6 @@ namespace CalamityMod.NPCs.Abyss } TailSpawned = true; } - if (detectsPlayer) - { - NPC.localAI[0] += 1f; - if (NPC.localAI[0] >= 300f) - { - NPC.localAI[0] = 0f; - NPC.TargetClosest(true); - NPC.netUpdate = true; - int damage = adultWyrmAlive ? (Main.expertMode ? 150 : 200) : (Main.expertMode ? 60 : 80); - float xPos = Main.rand.NextBool(2) ? NPC.position.X + 200f : NPC.position.X - 200f; - Vector2 vector2 = new Vector2(xPos, NPC.position.Y + Main.rand.Next(-200, 201)); - int randomAmt = adultWyrmAlive ? 2 : 3; - int random = Main.rand.Next(randomAmt); - if (random == 0) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector2, Vector2.Zero, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (random == 1) - { - Vector2 vec = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitX * NPC.direction); - Vector2 vector4 = vec * (adultWyrmAlive ? 6f : 4f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector2, vector4, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); - } - else - { - if (Math.Abs(Main.player[NPC.target].velocity.X) > 0.1f || Math.Abs(Main.player[NPC.target].velocity.Y) > 0.1f) - { - SoundEngine.PlaySound(SoundID.Item117, Main.player[NPC.target].position); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(Main.player[NPC.target].position.X, Main.player[NPC.target].position.Y), - Main.player[NPC.target].width, Main.player[NPC.target].height, 185, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 0.6f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(Main.player[NPC.target].position.X, Main.player[NPC.target].position.Y), - Main.player[NPC.target].width, Main.player[NPC.target].height, 185, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - num624 = Dust.NewDust(new Vector2(Main.player[NPC.target].position.X, Main.player[NPC.target].position.Y), - Main.player[NPC.target].width, Main.player[NPC.target].height, 185, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 0.2f; - } - if (Math.Abs(Main.player[NPC.target].velocity.X) > 0.1f) - { - Main.player[NPC.target].velocity.X = -Main.player[NPC.target].velocity.X * 1.5f; - } - if (Math.Abs(Main.player[NPC.target].velocity.Y) > 0.1f) - { - Main.player[NPC.target].velocity.Y = -Main.player[NPC.target].velocity.Y * 1.5f; - } - } - } - } - } } if (NPC.velocity.X < 0f) { @@ -484,19 +428,14 @@ namespace CalamityMod.NPCs.Abyss Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.LightYellow); + vector += vector11 * 1f + new Vector2(0f, NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlow").Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water && !NPC.AnyNPCs(ModContent.NPCType()) && - !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) - { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.Water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index be855c165f..419aa6224a 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -30,8 +30,8 @@ namespace CalamityMod.NPCs.Abyss { NPC.noGravity = true; NPC.damage = 100; - NPC.width = 50; - NPC.height = 220; + NPC.width = 62; + NPC.height = 226; NPC.defense = 18; NPC.lifeMax = 800; NPC.aiStyle = -1; @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.Abyss if (NPC.velocity.X > -num263 && NPC.velocity.X < num263 && NPC.velocity.Y > -num263 && NPC.velocity.Y < num263) { NPC.TargetClosest(true); - float num264 = CalamityWorld.death ? 24f : 16f; + float num264 = CalamityWorld.death ? 24f : CalamityWorld.revenge ? 20f : 16f; Vector2 vector31 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float num265 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector31.X; float num266 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector31.Y; @@ -211,27 +211,19 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + if (!NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.Cyan); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 867ea3fc7f..3fcb34ac26 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -134,8 +134,8 @@ namespace CalamityMod.NPCs.Abyss Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.LightYellow); + vector += vector11 * 1f + new Vector2(0f, NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.White); Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GulperEelBodyGlow").Value, vector, new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index b520cb9936..9d255ddc43 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -92,6 +92,20 @@ namespace CalamityMod.NPCs.Abyss 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, 204, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) { NPC.TargetClosest(true); diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 1d6127b1c8..c3ec114a50 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -25,8 +25,8 @@ namespace CalamityMod.NPCs.Abyss { NPC.noGravity = true; NPC.damage = 40; - NPC.width = 60; - NPC.height = 26; + NPC.width = 58; + NPC.height = 32; NPC.defense = 15; NPC.lifeMax = 480; NPC.aiStyle = -1; @@ -96,19 +96,15 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + if (!NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Yellow); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/LaserfishGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 935b903c2d..3b777a5c47 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -36,8 +36,8 @@ namespace CalamityMod.NPCs.Abyss { NPC.noGravity = true; NPC.damage = 10; - NPC.width = 74; - NPC.height = 56; + NPC.width = 68; + NPC.height = 58; NPC.defense = 12; NPC.lifeMax = 800; NPC.aiStyle = -1; @@ -103,12 +103,12 @@ namespace CalamityMod.NPCs.Abyss { ++screamTimer; - int screamLimit = CalamityWorld.death ? 120 : 180; + int screamLimit = CalamityWorld.death ? 60 : CalamityWorld.revenge ? 120 : 180; if (screamTimer >= screamLimit) { if (screamTimer == screamLimit) { - SoundEngine.PlaySound(ScreamSound, NPC.position); + SoundEngine.PlaySound(ScreamSound, NPC.Center); if (Main.netMode != NetmodeID.Server) { if (!Main.player[NPC.target].dead && Main.player[NPC.target].active) @@ -253,7 +253,7 @@ namespace CalamityMod.NPCs.Abyss NPC.frameCounter = 0.0; NPC.frame.Y = NPC.frame.Y + frameHeight; } - if (screamTimer <= (CalamityWorld.death ? 120 : 180)) + if (screamTimer <= (CalamityWorld.death ? 60 : CalamityWorld.revenge ? 120 : 180)) { if (NPC.frame.Y > frameHeight * 5) { @@ -276,19 +276,15 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + if (!NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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(ModContent.Request("CalamityMod/NPCs/Abyss/LuminousCorvinaGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -326,6 +322,12 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, 139, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LuminousCorvina").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LuminousCorvina2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LuminousCorvina3").Type, 1f); + } } } } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 261fe3d889..89d40a4aab 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -39,8 +39,8 @@ namespace CalamityMod.NPCs.Abyss NPC.noGravity = true; NPC.noTileCollide = true; NPC.damage = 100; - NPC.width = 70; - NPC.height = 162; + NPC.width = 78; + NPC.height = 170; NPC.defense = 10; NPC.lifeMax = 6000; NPC.aiStyle = -1; @@ -189,19 +189,15 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + if (!NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.Purple); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/MirageJellyGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index ea03aac09f..a7913f771d 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -106,7 +106,7 @@ namespace CalamityMod.NPCs.Abyss } if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) { - return SpawnCondition.CaveJellyfish.Chance * 1.2f; + return SpawnCondition.CaveJellyfish.Chance * 2.2f; } return SpawnCondition.OceanMonster.Chance * 0.1f; } @@ -129,6 +129,12 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MorayEel").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MorayEel2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MorayEel3").Type, 1f); + } } } } diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index 6b605de16d..18d2a3a209 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -137,6 +137,8 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishBody").Type, 1f); } } } diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index a61e0b9953..bb142a2b19 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -87,6 +87,20 @@ namespace CalamityMod.NPCs.Abyss 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, 204, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) NPC.TargetClosest(true); @@ -335,6 +349,8 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishHead").Type, 1f); } } diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index 4fec13d088..bdafdfc74a 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -137,6 +137,8 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishTail").Type, 1f); } } } diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index 230b3d109d..739280ac87 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -1,19 +1,20 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.Abyss { @@ -57,7 +58,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -100,11 +101,11 @@ namespace CalamityMod.NPCs.Abyss NPC.soundDelay = 360; if (hasBeenHit) { - SoundEngine.PlaySound(EnragedRoarSound, NPC.position); + SoundEngine.PlaySound(EnragedRoarSound, NPC.Center); } else { - SoundEngine.PlaySound(SearchRoarSound, NPC.position); + SoundEngine.PlaySound(SearchRoarSound, NPC.Center); } } if (phase3 || phase1) @@ -495,7 +496,7 @@ namespace CalamityMod.NPCs.Abyss Main.dust[num21].noLight = true; Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; } - SoundEngine.PlaySound(EnragedRoarSound, NPC.position); + SoundEngine.PlaySound(EnragedRoarSound, NPC.Center); } NPC.ai[2] += 1f; if (NPC.ai[2] >= (float)num16) @@ -605,6 +606,12 @@ namespace CalamityMod.NPCs.Abyss NPC.netUpdate = true; return; } + if (CalamityWorld.getFixedBoi && Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] % 5 == 0) + { + Vector2 direction = vector - player.Center; + direction.Normalize(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, direction * 10f, ProjectileID.DemonSickle, NPC.damage / 2, 0f, Main.myPlayer); + } } } if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 6400f) @@ -648,11 +655,6 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water && !NPC.AnyNPCs(ModContent.NPCType()) && - !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.Water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 3d6833254e..0da8231ab7 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[3] { ModContent.GetInstance().Type, ModContent.GetInstance().Type, ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -88,7 +88,7 @@ namespace CalamityMod.NPCs.Abyss public override bool CheckDead() { - SoundEngine.PlaySound(SoundID.NPCDeath14, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath14, NPC.Center); NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); NPC.width = NPC.height = 40; @@ -117,22 +117,15 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - if (NPC.IsABestiaryIconDummy) - return; - - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + if (!NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.LightGreen); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/ToxicMinnowGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -174,15 +167,11 @@ namespace CalamityMod.NPCs.Abyss { if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; + return SpawnCondition.OceanMonster.Chance * 1.5f; } if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; - } - if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; + return SpawnCondition.CaveJellyfish.Chance * 2.0f; } return 0f; } diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 9a897baa6d..91e8528ef7 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -32,8 +32,8 @@ namespace CalamityMod.NPCs.Abyss { NPC.noGravity = true; NPC.damage = 75; - NPC.width = 72; - NPC.height = 30; + NPC.width = 76; + NPC.height = 36; NPC.defense = 10; NPC.lifeMax = 320; NPC.aiStyle = -1; @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.Abyss 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[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -116,19 +116,15 @@ namespace CalamityMod.NPCs.Abyss public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + if (!NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Value; + + var effects = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + Main.EntitySpriteDraw(tex, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY + 4), + NPC.frame, Color.White * 0.5f, NPC.rotation, NPC.frame.Size() / 2f, NPC.scale, effects, 0); } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = 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)ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 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.Gold); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/ViperfishGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -139,14 +135,14 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } if (spawnInfo.Player.Calamity().ZoneAbyssLayer2 && spawnInfo.Water) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } + if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) + { + return SpawnCondition.CaveJellyfish.Chance * 1.5f; + } return 0f; } diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index a2d663763a..e6397ddb54 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -180,12 +180,20 @@ namespace CalamityMod.NPCs.AcidRain public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + Vector2 headDrawPosition = NPC.Center - screenPos; + if (NPC.IsABestiaryIconDummy) + { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelBestiary").Value; + Rectangle eelArea = NPC.frame with { Width = 74 }; + Main.EntitySpriteDraw(texture, headDrawPosition, eelArea, NPC.GetAlpha(Color.White), NPC.rotation, eelArea.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0); + return false; + } + // Initialize the segment drawer. SegmentDrawer ??= new(SegmentWidthFunction, _ => NPC.GetAlpha(Color.White), null, GameShaders.Misc["CalamityMod:PrimitiveTexture"]); Texture2D headTexture = ModContent.Request(Texture).Value; Texture2D tailTexture = ModContent.Request("CalamityMod/NPCs/AcidRain/AcidEelTail").Value; - Vector2 headDrawPosition = NPC.Center - screenPos; Vector2[] segmentPositions = (Vector2[])NPC.oldPos.Clone(); Vector2 segmentAreaTopLeft = Vector2.One * 999999f; diff --git a/NPCs/AcidRain/AcidEelBestiary.png b/NPCs/AcidRain/AcidEelBestiary.png new file mode 100644 index 0000000000..6b69d69bea Binary files /dev/null and b/NPCs/AcidRain/AcidEelBestiary.png differ diff --git a/NPCs/AcidRain/BabyFlakCrab.cs b/NPCs/AcidRain/BabyFlakCrab.cs index de1a577a42..c936f6c348 100644 --- a/NPCs/AcidRain/BabyFlakCrab.cs +++ b/NPCs/AcidRain/BabyFlakCrab.cs @@ -152,9 +152,7 @@ namespace CalamityMod.NPCs.AcidRain } if (Main.netMode != NetmodeID.Server) { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("FlakCrabGore1").Type, 0.5f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("FlakCrabGore2").Type, 0.5f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("FlakCrabGore3").Type, 0.5f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BabyFlakCrabGore").Type, 1f); } } } diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index eea7e86afe..45a3cd9038 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -20,6 +20,7 @@ using Terraria.WorldBuilding; namespace CalamityMod.NPCs.AcidRain { + [AutoloadBossHead] public class CragmawMire : ModNPC { public enum CragmawAttackState @@ -497,6 +498,13 @@ namespace CalamityMod.NPCs.AcidRain } } + public override void OnKill() + { + // Mark Cragmaw Mire as dead + DownedBossSystem.downedCragmawMire = true; + CalamityNetcode.SyncWorld(); + } + public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage > 0) @@ -514,7 +522,7 @@ namespace CalamityMod.NPCs.AcidRain postPolter.AddFail(ModContent.ItemType(), hideLootReport: DownedBossSystem.downedPolterghast); npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); } } } diff --git a/NPCs/AcidRain/CragmawMire_Head_Boss.png b/NPCs/AcidRain/CragmawMire_Head_Boss.png new file mode 100644 index 0000000000..b6ab9bc94d Binary files /dev/null and b/NPCs/AcidRain/CragmawMire_Head_Boss.png differ diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index a9736df275..d33c289336 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -146,7 +146,7 @@ namespace CalamityMod.NPCs.AcidRain DustAngleMultiplier2 = Main.rand.NextFloat(4f); if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Zombie104, NPC.position); + SoundEngine.PlaySound(SoundID.Zombie104, NPC.Center); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, -Vector2.UnitY, ModContent.ProjectileType(), Main.expertMode ? 96 : 120, 4f, Main.myPlayer, 0f, NPC.whoAmI); } NPC.netUpdate = true; diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 4da41f3579..d145475695 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.AcidRain bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Encrusted with gunk that evaporates slowly from the sulphurous sea, these slimes actually form in the upper atmosphere’s acidic rain, before falling back to the earth.") + new FlavorTextBestiaryInfoElement("Encrusted with gunk that evaporates slowly from the sulphurous sea, these slimes actually form in the upper atmosphere's acidic rain, before falling back to the earth.") }); } @@ -96,7 +96,7 @@ namespace CalamityMod.NPCs.AcidRain } else { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; } } diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index e6a9c2c1ca..67c1f92dd0 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -19,6 +19,7 @@ using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { + [AutoloadBossHead] public class Mauler : ModNPC { // TODO -- Potentially add another attack in higher difficulty modes at some point? @@ -89,7 +90,7 @@ namespace CalamityMod.NPCs.AcidRain bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Sharks are perhaps one of the most resilient and well-adapted species in our planet’s history. It is no surprise that one of these apex predators has come to thrive in these seas.") + new FlavorTextBestiaryInfoElement("Sharks are perhaps one of the most resilient and well-adapted species in our planet's history. It is no surprise that one of these apex predators has come to thrive in these seas.") }); } @@ -453,7 +454,7 @@ namespace CalamityMod.NPCs.AcidRain npcLoot.Add(ItemID.SharkFin, 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 3); npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); } public override void HitEffect(int hitDirection, double damage) @@ -474,5 +475,53 @@ namespace CalamityMod.NPCs.AcidRain } } } + + public override void OnKill() + { + if (CalamityWorld.getFixedBoi) + { + Vector2 valueBoom = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = 200; + for (iBoom = 0; iBoom < 25; iBoom++) + { + int projectileType = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int boom1 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + } + for (int num621 = 0; num621 < 25; num621++) + { + int num622 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 31, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + Main.dust[num622].noGravity = true; + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + NPC.netUpdate = true; + } + // Mark Mauler as dead + DownedBossSystem.downedMauler = true; + CalamityNetcode.SyncWorld(); + } } } diff --git a/NPCs/AcidRain/Mauler_Head_Boss.png b/NPCs/AcidRain/Mauler_Head_Boss.png new file mode 100644 index 0000000000..e889811379 Binary files /dev/null and b/NPCs/AcidRain/Mauler_Head_Boss.png differ diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 667b2e684f..d5638edcb9 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -19,6 +19,7 @@ using Terraria.Audio; namespace CalamityMod.NPCs.AcidRain { + [AutoloadBossHead] public class NuclearTerror : ModNPC { public enum SpecialAttackState @@ -30,8 +31,10 @@ namespace CalamityMod.NPCs.AcidRain public int AttackIndex = 0; public int DelayTime = 0; + public int DeathrayTime = 0; public bool Dying = false; public bool Walking = false; + public bool hasDoneDeathray = false; public float JumpTimer = 0f; public Vector2 ShootPosition; public Player Target => Main.player[NPC.target]; @@ -73,6 +76,11 @@ namespace CalamityMod.NPCs.AcidRain public const float TeleportTime = 60f; public const float TeleportFadeinTime = 10f; public const float TeleportCooldown = 60f; + + public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/NuclearTerrorSpawn"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/NuclearTerrorDeath"); + public override void SetStaticDefaults() { DisplayName.SetDefault("Nuclear Terror"); @@ -107,8 +115,8 @@ namespace CalamityMod.NPCs.AcidRain NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; - NPC.HitSound = SoundID.NPCHit56; - NPC.DeathSound = SoundID.NPCDeath60; + NPC.HitSound = HitSound; + NPC.DeathSound = null; //Does the sound while on the death animation instead NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; @@ -130,9 +138,11 @@ namespace CalamityMod.NPCs.AcidRain writer.Write(NPC.dontTakeDamage); writer.Write(Dying); writer.Write(Walking); + writer.Write(hasDoneDeathray); writer.Write(AttackIndex); writer.Write(DelayTime); writer.Write(JumpTimer); + writer.Write(DeathrayTime); writer.WriteVector2(ShootPosition); } public override void ReceiveExtraAI(BinaryReader reader) @@ -140,8 +150,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.dontTakeDamage = reader.ReadBoolean(); Dying = reader.ReadBoolean(); Walking = reader.ReadBoolean(); + hasDoneDeathray = reader.ReadBoolean(); AttackIndex = reader.ReadInt32(); DelayTime = reader.ReadInt32(); + DeathrayTime = reader.ReadInt32(); JumpTimer = reader.ReadSingle(); ShootPosition = reader.ReadVector2(); } @@ -175,11 +187,21 @@ namespace CalamityMod.NPCs.AcidRain NPC.damage = Dying ? 0 : NPC.defDamage; TeleportCheck(); + // Play the spawn sound + if (AttackTime == 0f) + SoundEngine.PlaySound(SpawnSound, NPC.Center); AttackTime++; float wrappedAttackTime = AttackTime % AttackCycleTime; Walking = false; + if (CalamityWorld.getFixedBoi && !hasDoneDeathray && NPC.life <= NPC.lifeMax * 0.1f) + { + DeathrayTime++; + MasterSpark(); + return; + } + // Teleport if spam-collisions are done, they are pretty good indicators of being stuck. if (NPC.collideX) { @@ -438,6 +460,48 @@ namespace CalamityMod.NPCs.AcidRain } } + // Legendary Mode deathray attack + public void MasterSpark() + { + NPC.dontTakeDamage = true; + NPC.velocity.X *= 0.5f; + NPC.alpha = 0; + if (DeathrayTime < 240f) + { + int num5 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 200, default, 1.5f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-200, 201), (float)Main.rand.Next(-200, 201)); + vector.Normalize(); + vector *= (float)Main.rand.Next(100, 200) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = NPC.Center - vector; + } + else if (DeathrayTime == 240f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + SoundEngine.PlaySound(SoundID.Zombie104, NPC.Center); + int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 250, 0f, Main.myPlayer, NPC.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].rotation = NPC.spriteDirection * -MathHelper.PiOver2; + } + } + float screenShakePower = 20 * Utils.GetLerpValue(1300f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } + else if (DeathrayTime >= 630f) + { + NPC.dontTakeDamage = false; + hasDoneDeathray = true; + } + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * bossLifeScale); @@ -459,6 +523,7 @@ namespace CalamityMod.NPCs.AcidRain } if (Dying) { + SoundEngine.PlaySound(DeathSound, NPC.Center); if (NPC.frame.Y < frameHeight * 8) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -512,6 +577,13 @@ namespace CalamityMod.NPCs.AcidRain return Dying; } + public override void OnKill() + { + // Mark Nuclear Terror as dead + DownedBossSystem.downedNuclearTerror = true; + CalamityNetcode.SyncWorld(); + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 10; k++) @@ -529,7 +601,7 @@ namespace CalamityMod.NPCs.AcidRain npcLoot.Add(ModContent.ItemType(), 3); npcLoot.Add(ModContent.ItemType(), 3); npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); } } } diff --git a/NPCs/AcidRain/NuclearTerror_Head_Boss.png b/NPCs/AcidRain/NuclearTerror_Head_Boss.png new file mode 100644 index 0000000000..ac05aa3f40 Binary files /dev/null and b/NPCs/AcidRain/NuclearTerror_Head_Boss.png differ diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 1496a02f58..23e3ef7887 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -1,12 +1,16 @@ -using CalamityMod.BiomeManagers; +using System; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles.Metaballs; using CalamityMod.Projectiles.Enemy; +using CalamityMod.Projectiles.Magic; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -80,6 +84,16 @@ namespace CalamityMod.NPCs.AcidRain }); } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.Calamity().newAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.Calamity().newAI[0] = reader.ReadSingle(); + } + public override void AI() { Time++; @@ -192,6 +206,26 @@ namespace CalamityMod.NPCs.AcidRain // Prevent yeeting into the sky at the speed of light. NPC.velocity = Vector2.Clamp(NPC.velocity, new Vector2(-maxSpeed), new Vector2(maxSpeed)); + + if (CalamityWorld.getFixedBoi && !(!NPC.wet && NPC.collideY)) + { + // Spread the wrath of the damned + NPC.Calamity().newAI[0]++; + if (NPC.Calamity().newAI[0] % 5 == 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Bottom, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + FusableParticleManager.GetParticleSetByType().SpawnParticle(NPC.Bottom + Main.rand.NextVector2Circular(10f, 10f), 135f); + } + if (NPC.Calamity().newAI[0] % 30 == 0 && Main.netMode != NetmodeID.MultiplayerClient) + { + int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Bottom, Vector2.Zero, ModContent.ProjectileType(), 20, 0f, Main.myPlayer, 0, -1); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].DamageType = DamageClass.Default; + Main.projectile[p].friendly = false; + } + } + } } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index f3f1c9c8eb..ff71029b3b 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SetDefaults() { - NPC.aiStyle = 67; + NPC.aiStyle = NPCAIStyleID.Snail; NPC.damage = 10; NPC.width = 24; NPC.height = 24; diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index 5bfa84165b..ef3b5a1708 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.AcidRain bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("From below, the tips of their legs barely penetrate the surface of the water, and it is hard to distinguish their movements from the rain on the water’s surface.") + new FlavorTextBestiaryInfoElement("From below, the tips of their legs barely penetrate the surface of the water, and it is hard to distinguish their movements from the rain on the water's surface.") }); } diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index 221e35853a..e59b688c96 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -1,18 +1,20 @@ -using CalamityMod.BiomeManagers; +using System; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.AcidRain { public class Trilobite : ModNPC @@ -168,6 +170,12 @@ namespace CalamityMod.NPCs.AcidRain projDamage = (int)Math.Round(projDamage * 0.8); Vector2 spikeVelocity = -NPC.velocity.RotatedByRandom(0.18f); + if (CalamityWorld.getFixedBoi) // more true to the original concept art. + { + spikeVelocity = -projectile.velocity; + spikeVelocity.Normalize(); + spikeVelocity *= DownedBossSystem.downedPolterghast ? 8 : 5; + } Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Main.rand.NextVector2Unit() * NPC.Size * 0.7f, spikeVelocity, ModContent.ProjectileType(), projDamage, 3f); SpikeShootCountdown = Main.rand.Next(50, 65); NPC.netUpdate = true; diff --git a/Scenes/MusicScenes/AEWMusicScene.cs b/NPCs/AdultEidolonWyrm/AEWMusicScene.cs similarity index 92% rename from Scenes/MusicScenes/AEWMusicScene.cs rename to NPCs/AdultEidolonWyrm/AEWMusicScene.cs index 6857a08cc3..a49e9b18e5 100644 --- a/Scenes/MusicScenes/AEWMusicScene.cs +++ b/NPCs/AdultEidolonWyrm/AEWMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.AdultEidolonWyrm; +using CalamityMod.NPCs.AdultEidolonWyrm; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +8,6 @@ namespace CalamityMod.Systems public class AEWMusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; - public override int NPCType => ModContent.NPCType(); public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm"); public override int VanillaMusic => MusicID.Boss3; diff --git a/NPCs/AdultEidolonWyrm/AEWScreenShaderData.cs b/NPCs/AdultEidolonWyrm/AEWScreenShaderData.cs deleted file mode 100644 index 2beb8bea05..0000000000 --- a/NPCs/AdultEidolonWyrm/AEWScreenShaderData.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Graphics.Effects; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.AdultEidolonWyrm -{ - public class AEWScreenShaderData : ScreenShaderData - { - private int AEWIndex; - - public AEWScreenShaderData(string passName) - : base(passName) - { - } - - private void UpdateAEWIndex() - { - int AEWType = ModContent.NPCType(); - if (AEWIndex >= 0 && Main.npc[AEWIndex].active && Main.npc[AEWIndex].type == AEWType) - { - return; - } - AEWIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == AEWType) - { - AEWIndex = i; - break; - } - } - } - - public override void Update(GameTime gameTime) - { - if (AEWIndex == -1) - { - UpdateAEWIndex(); - if (AEWIndex == -1) - Filters.Scene["CalamityMod:AdultEidolonWyrm"].Deactivate(); - } - } - - public override void Apply() - { - UpdateAEWIndex(); - if (AEWIndex != -1) - { - UseTargetPosition(Main.npc[AEWIndex].Center); - } - base.Apply(); - } - } -} diff --git a/NPCs/AdultEidolonWyrm/AEWSky.cs b/NPCs/AdultEidolonWyrm/AEWSky.cs deleted file mode 100644 index 79c171874f..0000000000 --- a/NPCs/AdultEidolonWyrm/AEWSky.cs +++ /dev/null @@ -1,103 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.Graphics.Effects; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.AdultEidolonWyrm -{ - public class AEWSky : CustomSky - { - private bool isActive = false; - private float intensity = 0f; - private int AEWIndex = -1; - - public override void Update(GameTime gameTime) - { - if (AEWIndex == -1) - { - UpdateAEWIndex(); - if (AEWIndex == -1) - isActive = false; - } - - if (isActive && intensity < 1f) - intensity += 0.01f; - else if (!isActive && intensity > 0f) - intensity -= 0.01f; - } - - private float GetIntensity() - { - if (UpdateAEWIndex()) - { - float x = 0f; - if (AEWIndex != -1) - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[AEWIndex].Center); - - return 1f - Utils.SmoothStep(3000f, 6000f, x); - } - return 0f; - } - - public override Color OnTileColor(Color inColor) - { - float intensity = GetIntensity(); - return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); - } - - private bool UpdateAEWIndex() - { - int AEWType = ModContent.NPCType(); - if (AEWIndex >= 0 && Main.npc[AEWIndex].active && Main.npc[AEWIndex].type == AEWType) - { - return true; - } - AEWIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].type == AEWType) - { - AEWIndex = i; - break; - } - } - return AEWIndex != -1; - } - - public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) - { - if (maxDepth >= 0 && minDepth < 0) - { - float intensity = GetIntensity(); - spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); - } - } - - public override float GetCloudAlpha() - { - return 0f; - } - - public override void Activate(Vector2 position, params object[] args) - { - isActive = true; - } - - public override void Deactivate(params object[] args) - { - isActive = false; - } - - public override void Reset() - { - isActive = false; - } - - public override bool IsActive() - { - return isActive || intensity > 0f; - } - } -} diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBody.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBody.cs index 8271c1a8bf..d886c3a46c 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBody.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBody.cs @@ -66,11 +66,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - // Check if other segments are still alive, if not, die + // Check if other segments are still alive. If not, die. bool shouldDespawn = true; + int wyrmHeadID = ModContent.NPCType(); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + if (Main.npc[i].active && Main.npc[i].type == wyrmHeadID) { shouldDespawn = false; break; @@ -117,7 +118,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool spawnAncientLights = (calamityGlobalNPC_Head.newAI[0] == (float)AdultEidolonWyrmHead.Phase.ShadowFireballSpin && calamityGlobalNPC_Head.newAI[2] > 0f) || (calamityGlobalNPC_Head.newAI[0] == (float)AdultEidolonWyrmHead.Phase.FinalPhase && calamityGlobalNPC_Head.newAI[1] > 0f); - if (spawnAncientLights && Main.netMode != NetmodeID.MultiplayerClient) + if (spawnAncientLights) { if (Vector2.Distance(NPC.Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) > 160f) { @@ -127,67 +128,53 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (NPC.ai[3] % divisor == 0f && NPC.localAI[0] >= spawnAncientLightGateValue) { NPC.localAI[0] = 0f; - float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)NPC.ai[2]].Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); - float lightVelocity = (Main.player[Main.npc[(int)NPC.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; - Vector2 destination = Main.player[Main.npc[(int)NPC.ai[2]].target].Center - NPC.Center; - Vector2 velocity = Vector2.Normalize(destination) * lightVelocity; - int type = NPCID.AncientLight; - float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; - int light = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, type, 0, 0f, ai, velocity.X, velocity.Y, 255); - Main.npc[light].velocity = velocity; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)NPC.ai[2]].Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); + float lightVelocity = (Main.player[Main.npc[(int)NPC.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; + Vector2 destination = Main.player[Main.npc[(int)NPC.ai[2]].target].Center - NPC.Center; + Vector2 velocity = Vector2.Normalize(destination) * lightVelocity; + int type = NPCID.AncientLight; + float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; + int light = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, type, 0, 0f, ai, velocity.X, velocity.Y, 255); + Main.npc[light].velocity = velocity; + } } } } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + // Decide segment offset stuff. + NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; + Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center; + if (aheadSegment.rotation != NPC.rotation) { - try - { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; - } catch - { - } - - NPC.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; - - if (num191 < 0f) - NPC.spriteDirection = -1; - else if (num191 > 0f) - NPC.spriteDirection = 1; + directionToNextSegment = directionToNextSegment.RotatedBy(MathHelper.WrapAngle(aheadSegment.rotation - NPC.rotation) * 0.08f); + directionToNextSegment = directionToNextSegment.MoveTowards((aheadSegment.rotation - NPC.rotation).ToRotationVector2(), 1f); } + + NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; + NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * NPC.width; + NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector = center - screenPos; - vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyGlow").Value.Width, ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyGlow").Value.Height) * 0.5f; - vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), Color.White, NPC.rotation, vector11, 1f, spriteEffects, 0f); + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + + Vector2 center = NPC.Center - screenPos; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + + texture = ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyGlow").Value; + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + + return false; } public override bool CheckActive() => false; @@ -205,5 +192,13 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm } } } + + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Jared"; + } + } } } diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAlt.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAlt.cs index 26e50211c6..b1fdd1a9d5 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAlt.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAlt.cs @@ -66,11 +66,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - // Check if other segments are still alive, if not, die + // Check if other segments are still alive. If not, die. bool shouldDespawn = true; + int wyrmHeadID = ModContent.NPCType(); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + if (Main.npc[i].active && Main.npc[i].type == wyrmHeadID) { shouldDespawn = false; break; @@ -117,7 +118,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm bool shootShadowFireballs = (calamityGlobalNPC_Head.newAI[0] == (float)AdultEidolonWyrmHead.Phase.ShadowFireballSpin && calamityGlobalNPC_Head.newAI[2] > 0f) || (calamityGlobalNPC_Head.newAI[0] == (float)AdultEidolonWyrmHead.Phase.FinalPhase && calamityGlobalNPC_Head.newAI[1] > 0f); - if (shootShadowFireballs && Main.netMode != NetmodeID.MultiplayerClient) + if (shootShadowFireballs) { if (Vector2.Distance(NPC.Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) > 160f) { @@ -127,67 +128,53 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (NPC.ai[3] % divisor == 0f && NPC.localAI[0] >= shootShadowFireballGateValue) { NPC.localAI[0] = 0f; - float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)NPC.ai[2]].Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); - float fireballVelocity = (Main.player[Main.npc[(int)NPC.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; - Vector2 destination = Main.player[Main.npc[(int)NPC.ai[2]].target].Center - NPC.Center; - Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity; - int type = ProjectileID.CultistBossFireBallClone; - int damage = NPC.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)NPC.ai[2]].Center, Main.player[Main.npc[(int)NPC.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f); + float fireballVelocity = (Main.player[Main.npc[(int)NPC.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost; + Vector2 destination = Main.player[Main.npc[(int)NPC.ai[2]].target].Center - NPC.Center; + Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity; + int type = ProjectileID.CultistBossFireBallClone; + int damage = NPC.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + } } } } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + // Decide segment offset stuff. + NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; + Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center; + if (aheadSegment.rotation != NPC.rotation) { - try - { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; - } catch - { - } - - NPC.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; - - if (num191 < 0f) - NPC.spriteDirection = -1; - else if (num191 > 0f) - NPC.spriteDirection = 1; + directionToNextSegment = directionToNextSegment.RotatedBy(MathHelper.WrapAngle(aheadSegment.rotation - NPC.rotation) * 0.08f); + directionToNextSegment = directionToNextSegment.MoveTowards((aheadSegment.rotation - NPC.rotation).ToRotationVector2(), 1f); } + + NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; + NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * NPC.width; + NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector = center - screenPos; - vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAltGlow").Value.Width, ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAltGlow").Value.Height) * 0.5f; - vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAltGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), Color.White, NPC.rotation, vector11, 1f, spriteEffects, 0f); + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + + Vector2 center = NPC.Center - screenPos; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + + texture = ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmBodyAltGlow").Value; + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + + return false; } public override bool CheckActive() => false; @@ -205,5 +192,13 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm } } } + + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Jared"; + } + } } } diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs index 2910c9a7b5..2a251e5c59 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHead.cs @@ -10,17 +10,18 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.AdultEidolonWyrm { @@ -51,18 +52,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Base distance from the target for most attacks private const float baseDistance = 1000f; - // Base distance from target location in order to continue turning - private const float baseTurnDistance = 160f; - // The distance from target location in order to initiate an attack private const float baseAttackTriggerDistance = 80f; // Max distance from the target before they are unable to hear sound telegraphs private const float soundDistance = 2800f; - // The end location of each charge - Vector2 chargeDestination = default; - // Length variables private const int minLength = 40; private const int maxLength = 41; @@ -81,6 +76,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm //Sounds public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Scare"); + public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/EidolonWyrmRoarClose"); public override void SetStaticDefaults() @@ -106,9 +102,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.GetNPCDamage(); NPC.width = 254; NPC.height = 138; - NPC.defense = 100; - NPC.DR_NERD(0.4f); - NPC.LifeMaxNERB(2415000, 2898000, 800000); + NPC.LifeMaxNERB(2415000, 2898000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.aiStyle = -1; @@ -127,22 +121,32 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; + + if (CalamityWorld.getFixedBoi) + { + NPC.defense = 999; + NPC.DR_NERD(0.9f); + } + else + { + NPC.defense = 100; + NPC.DR_NERD(0.4f); + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - //AAAAAAAAAAAAH Scary abyss superboss guy so he gets pitch black bg and no biome source + // AAAAAAAAAAAAH Scary abyss superboss guy so he gets pitch black bg and no biome source. new MoonLordPortraitBackgroundProviderBestiaryInfoElement(), - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Traces of them appear even in records going back to before the Golden Age of Dragons… They may very well be a glimpse into the full potential of nature.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("Traces of them appear even in records as far back as the early Draconic Era... They may very well be a glimpse into the full potential of nature.") }); } public override void SendExtraAI(BinaryWriter writer) { - writer.WriteVector2(chargeDestination); writer.Write(rotationDirection); writer.Write(chargeVelocityScalar); writer.Write(NPC.localAI[0]); @@ -155,7 +159,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm public override void ReceiveExtraAI(BinaryReader reader) { - chargeDestination = reader.ReadVector2(); rotationDirection = reader.ReadInt32(); chargeVelocityScalar = reader.ReadSingle(); NPC.localAI[0] = reader.ReadSingle(); @@ -226,12 +229,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (i >= 0 && i < minLength) { if (i % 2 == 0) - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); else - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); } else - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); + 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] = NPC.whoAmI; @@ -330,7 +333,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; @@ -352,7 +355,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.Opacity = 0f; } - // Rotation and direction + // Direction and rotation NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; int direction = NPC.direction; NPC.direction = NPC.spriteDirection = (NPC.velocity.X > 0f) ? 1 : (-1); @@ -365,7 +368,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Charge variables Vector2 chargeVector = Vector2.Zero; float chargeDistance = baseDistance; - float turnDistance = baseTurnDistance; float chargeLocationDistance = baseAttackTriggerDistance; switch ((int)calamityGlobalNPC.newAI[1]) { @@ -399,8 +401,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm break; } Vector2 chargeLocation = destination + chargeVector; - Vector2 chargeVectorFlipped = chargeVector * -1f; - float chargePredictionAmt = death ? 50f : revenge ? 40f : expertMode ? 30f : 20f; // Lightning Rain variables Vector2 lightningRainLocation = new Vector2(0f, -baseDistance); @@ -408,7 +408,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Wyrm and Eidolist variables Vector2 eidolonWyrmPhaseLocation = new Vector2(0f, baseDistance); - float eidolonWyrmPhaseLocationDistance = baseAttackTriggerDistance; int eidolistScale = death ? 3 : revenge ? 2 : expertMode ? 1 : 0; int maxEidolists = (targetDownDeep ? 3 : 6) + eidolistScale; @@ -423,7 +422,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Ancient Doom variables Vector2 ancientDoomLocation = new Vector2(0f, -baseDistance); - float ancientDoomLocationDistance = baseAttackTriggerDistance; int ancientDoomScale = death ? 3 : revenge ? 2 : expertMode ? 1 : 0; int ancientDoomLimit = (targetDownDeep ? 4 : 8) + ancientDoomScale; int ancientDoomDistance = death ? 520 : revenge ? 535 : expertMode ? 550 : 600; @@ -433,7 +431,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm Vector2 lightningChargeVector = NPC.localAI[2] == 0f ? new Vector2(baseDistance, 0f) : new Vector2(-baseDistance, 0f); float lightningChargeLocationDistance = baseAttackTriggerDistance; Vector2 lightningChargeLocation = destination + lightningChargeVector; - Vector2 lightningChargeVectorFlipped = lightningChargeVector * -1f; float lightningSpawnY = 540f; Vector2 lightningSpawnLocation = new Vector2(NPC.Center.X, NPC.Center.Y - lightningSpawnY); int numLightningBolts = death ? 10 : revenge ? 8 : expertMode ? 6 : 4; @@ -441,51 +438,53 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Velocity and turn speed values float velocityScale = death ? 1.8f : revenge ? 1.5f : expertMode ? 1.2f : 0f; - float baseVelocity = (targetDownDeep ? 12f : 24f) + (targetDownDeep ? velocityScale : velocityScale * 2f); + float baseVelocity = (targetDownDeep ? 10f : 15f) + (targetDownDeep ? velocityScale : velocityScale * 1.5f); if (Main.getGoodWorld) baseVelocity *= 1.15f; - float turnSpeed = baseVelocity * 0.125f; - + float turnSpeed = baseVelocity * 0.015f; float normalChargeVelocityMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar); - float normalChargeTurnSpeedMult = MathHelper.Lerp(1f, 8f, chargeVelocityScalar); + float normalChargeTurnSpeedMult = MathHelper.Lerp(1f, 4f, chargeVelocityScalar); float invisiblePhaseVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); - float invisiblePhaseTurnSpeedMult = MathHelper.Lerp(1f, 6f, chargeVelocityScalar); + float invisiblePhaseTurnSpeedMult = MathHelper.Lerp(1f, 3f, chargeVelocityScalar); float fastChargeVelocityMult = MathHelper.Lerp(1f, 3f, chargeVelocityScalar); - float fastChargeTurnSpeedMult = MathHelper.Lerp(1f, 12f, chargeVelocityScalar); - float chargeVelocityScalarIncrement = 0.025f; + float fastChargeTurnSpeedMult = MathHelper.Lerp(1f, 8f, chargeVelocityScalar); + float chargeVelocityScalarIncrement = 0.005f; + float totalChargeDistance = 3000f; + + bool lookingAtTarget = NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(15f); // Telekinesis while enraged if (!targetDownDeep) { - if (Main.netMode != NetmodeID.MultiplayerClient) + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= 300f) { - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= 300f) + calamityGlobalNPC.newAI[3] = 0f; + + SoundEngine.PlaySound(SoundID.Item117, player.Center); + + for (int i = 0; i < 20; i++) { - calamityGlobalNPC.newAI[3] = 0f; - - SoundEngine.PlaySound(SoundID.Item117, player.position); - - for (int i = 0; i < 20; i++) + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 0.6f; + if (Main.rand.NextBool(2)) { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 0.6f; - if (Main.rand.NextBool(2)) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } + } - for (int j = 0; j < 30; j++) - { - int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 3f); - Main.dust[dust].noGravity = true; - dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 0.2f; - } + for (int j = 0; j < 30; j++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 185, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 0.2f; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { if (player.velocity.Length() > 0f) player.velocity *= -3f; } @@ -509,31 +508,41 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm baseVelocity *= normalChargeVelocityMult; turnSpeed *= normalChargeTurnSpeedMult; - turnDistance = chargeLocationDistance; if ((chargeLocation - NPC.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) - { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(RoarSound, Main.player[Main.myPlayer].Center); + // Set the scalar to max + if (chargeVelocityScalar < 1f) + chargeVelocityScalar = 1f; - chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; - NPC.velocity = Vector2.Normalize(chargeDestination - NPC.Center) * baseVelocity; - NPC.netUpdate = true; - NPC.netSpam -= 5; + // Lock into looking at the target + if (calamityGlobalNPC.newAI[2] < chargePhaseGateValue + 1f) + calamityGlobalNPC.newAI[2] += 1f; + + // Turn towards the target + if (!lookingAtTarget && calamityGlobalNPC.newAI[2] < chargePhaseGateValue + 2f) + { + baseVelocity /= normalChargeVelocityMult; + turnSpeed /= normalChargeTurnSpeedMult; } + + // Charge at the target else { - // Charge + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) + { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(RoarSound, Main.player[Main.myPlayer].Center); + } + + // Lock into the charge phase and use this for a charge time check + calamityGlobalNPC.newAI[2] += 1f; // Become totally visible NPC.Opacity = 1f; - destination = chargeDestination; - - if ((destination - NPC.Center).Length() < chargeLocationDistance) + float totalChargeTime = (totalChargeDistance / baseVelocity) + chargePhaseGateValue + 1f; + if (calamityGlobalNPC.newAI[2] > totalChargeTime) { NPC.ai[3] += 1f; float maxCharges = phase4 ? 1 : phase2 ? 2 : 3; @@ -569,7 +578,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Swim up destination += lightningRainLocation; - turnDistance = lightningRainLocationDistance; // Use a lerp to smoothly scale up velocity and turn speed chargeVelocityScalar += chargeVelocityScalarIncrement; @@ -688,31 +696,41 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm baseVelocity *= fastChargeVelocityMult; turnSpeed *= fastChargeTurnSpeedMult; - turnDistance = chargeLocationDistance; if ((chargeLocation - NPC.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) - { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(RoarSound, Main.player[Main.myPlayer].Center); + // Set the scalar to max + if (chargeVelocityScalar < 1f) + chargeVelocityScalar = 1f; - chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; - NPC.velocity = Vector2.Normalize(chargeDestination - NPC.Center) * baseVelocity; - NPC.netUpdate = true; - NPC.netSpam -= 5; + // Lock into looking at the target + if (calamityGlobalNPC.newAI[2] < chargePhaseGateValue + 1f) + calamityGlobalNPC.newAI[2] += 1f; + + // Turn towards the target + if (!lookingAtTarget && calamityGlobalNPC.newAI[2] < chargePhaseGateValue + 2f) + { + baseVelocity /= fastChargeVelocityMult; + turnSpeed /= fastChargeTurnSpeedMult; } + + // Charge very quickly else { - // Charge very quickly + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) + { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(RoarSound, Main.player[Main.myPlayer].Center); + } + + // Lock into the charge phase and use this for a charge time check + calamityGlobalNPC.newAI[2] += 1f; // Become totally visible NPC.Opacity = 1f; - destination = chargeDestination; - - if ((destination - NPC.Center).Length() < chargeLocationDistance) + float totalChargeTime = (totalChargeDistance / baseVelocity) + chargePhaseGateValue + 1f; + if (calamityGlobalNPC.newAI[2] > totalChargeTime) { if (!phase5) { @@ -754,19 +772,13 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm case (int)Phase.EidolonWyrmSpawn: destination += eidolonWyrmPhaseLocation; - turnDistance = eidolonWyrmPhaseLocationDistance; if (Main.netMode != NetmodeID.MultiplayerClient) { if (calamityGlobalNPC.newAI[2] == 0f) { if (!NPC.AnyNPCs(ModContent.NPCType())) - { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].Center); - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); - } } } @@ -796,31 +808,41 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm baseVelocity *= normalChargeVelocityMult; turnSpeed *= normalChargeTurnSpeedMult; - turnDistance = chargeLocationDistance; if ((chargeLocation - NPC.Center).Length() < chargeLocationDistance || calamityGlobalNPC.newAI[2] > chargePhaseGateValue) { - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) - { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(RoarSound, Main.player[Main.myPlayer].Center); + // Set the scalar to max + if (chargeVelocityScalar < 1f) + chargeVelocityScalar = 1f; - chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; - NPC.velocity = Vector2.Normalize(chargeDestination - NPC.Center) * baseVelocity; - NPC.netUpdate = true; - NPC.netSpam -= 5; + // Lock into looking at the target + if (calamityGlobalNPC.newAI[2] < chargePhaseGateValue + 1f) + calamityGlobalNPC.newAI[2] += 1f; + + // Turn towards the target + if (!lookingAtTarget && calamityGlobalNPC.newAI[2] < chargePhaseGateValue + 2f) + { + baseVelocity /= normalChargeVelocityMult; + turnSpeed /= normalChargeTurnSpeedMult; } + + // Charge else { - // Charge + if (calamityGlobalNPC.newAI[2] == chargePhaseGateValue + 1f) + { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(RoarSound, Main.player[Main.myPlayer].Center); + } + + // Lock into the charge phase and use this for a charge time check + calamityGlobalNPC.newAI[2] += 1f; // Become totally visible NPC.Opacity = 1f; - destination = chargeDestination; - - if ((destination - NPC.Center).Length() < chargeLocationDistance) + float totalChargeTime = (totalChargeDistance / baseVelocity) + chargePhaseGateValue + 1f; + if (calamityGlobalNPC.newAI[2] > totalChargeTime) { NPC.ai[3] += 1f; float maxCharges = phase4 ? 1 : phase3 ? 2 : 3; @@ -856,7 +878,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Swim down destination += iceMistLocation; - turnDistance = iceMistLocationDistance; // Use a lerp to smoothly scale up velocity and turn speed chargeVelocityScalar += chargeVelocityScalarIncrement; @@ -954,7 +975,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Swim up destination += spinLocation; - turnDistance = spinLocationDistance; // Use a lerp to smoothly scale up velocity and turn speed chargeVelocityScalar += chargeVelocityScalarIncrement; @@ -988,7 +1008,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm else { NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); - if (calamityGlobalNPC.newAI[2] >= spinPhaseDuration) { rotationDirection = 0; @@ -1011,19 +1030,18 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Swim up destination += ancientDoomLocation; - turnDistance = ancientDoomLocationDistance; if (NPC.localAI[1] < maxAncientDoomRings) { calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= ancientDoomPhaseGateValue) { - if (Main.netMode != NetmodeID.MultiplayerClient) + float aiGateValue = calamityGlobalNPC.newAI[2] - ancientDoomPhaseGateValue; + if (aiGateValue % ancientDoomGateValue == 0f) { - float aiGateValue = calamityGlobalNPC.newAI[2] - ancientDoomPhaseGateValue; - if (aiGateValue % ancientDoomGateValue == 0f) + // Spawn 3 (or more) circles of Ancient Dooms around the target + if (Main.netMode != NetmodeID.MultiplayerClient) { - // Spawn 3 (or more) circles of Ancient Dooms around the target int ancientDoomScale2 = (int)(aiGateValue / ancientDoomGateValue); ancientDoomLimit += ancientDoomScale2; ancientDoomDistance += ancientDoomScale2 * 45; @@ -1034,9 +1052,9 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + (float)(Math.Sin(i * ancientDoomDegrees) * ancientDoomDistance)), (int)(player.Center.Y + (float)(Math.Cos(i * ancientDoomDegrees) * ancientDoomDistance)), NPCID.AncientDoom, 0, NPC.whoAmI, 0f, ai2, 0f, Main.maxPlayers); } - NPC.localAI[1] += 1f; - NPC.TargetClosest(); } + NPC.localAI[1] += 1f; + NPC.TargetClosest(); } } } @@ -1068,54 +1086,68 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (chargeVelocityScalar > 1f) chargeVelocityScalar = 1f; - baseVelocity *= fastChargeVelocityMult; - turnSpeed *= fastChargeTurnSpeedMult; - turnDistance = lightningChargeLocationDistance; + baseVelocity *= normalChargeVelocityMult; + turnSpeed *= normalChargeTurnSpeedMult; if ((lightningChargeLocation - NPC.Center).Length() < lightningChargeLocationDistance || calamityGlobalNPC.newAI[2] > lightningChargePhaseGateValue) { - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] == lightningChargePhaseGateValue + 1f) - { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) - SoundEngine.PlaySound(RoarSound, Main.player[Main.myPlayer].Center); + // Set the scalar to max + if (chargeVelocityScalar < 1f) + chargeVelocityScalar = 1f; - chargeDestination = destination + lightningChargeVectorFlipped + player.velocity * chargePredictionAmt; - NPC.velocity = Vector2.Normalize(chargeDestination - NPC.Center) * baseVelocity; - NPC.netUpdate = true; - NPC.netSpam -= 5; + // Lock into looking at the target + if (calamityGlobalNPC.newAI[2] < lightningChargePhaseGateValue + 1f) + calamityGlobalNPC.newAI[2] += 1f; + + // Turn towards the target + if (!lookingAtTarget && calamityGlobalNPC.newAI[2] < lightningChargePhaseGateValue + 2f) + { + baseVelocity /= normalChargeVelocityMult; + turnSpeed /= normalChargeTurnSpeedMult; } + + // Charge else { - // Charge + if (calamityGlobalNPC.newAI[2] == lightningChargePhaseGateValue + 1f) + { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) + SoundEngine.PlaySound(RoarSound, Main.player[Main.myPlayer].Center); + } + + // Lock into the charge phase and use this for a charge time check + calamityGlobalNPC.newAI[2] += 1f; // Become totally visible NPC.Opacity = 1f; - destination = chargeDestination; - // Lightning barrage - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[3] == 0f) + if (NPC.localAI[3] == 0f) { if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Main.player[Main.myPlayer].Center); NPC.localAI[3] = 1f; - int type = ProjectileID.CultistBossLightningOrbArc; - int damage = NPC.GetProjectileDamage(type); - for (int i = 0; i < numLightningBolts; i++) + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 projectileDestination = player.Center - lightningSpawnLocation; - float ai = Main.rand.Next(100); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), lightningSpawnLocation, NPC.velocity * 0.5f, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); - Main.projectile[proj].tileCollide = false; - lightningSpawnLocation.Y += distanceBetweenBolts; - if (i == numLightningBolts / 2) + int type = ProjectileID.CultistBossLightningOrbArc; + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < numLightningBolts; i++) + { + Vector2 projectileDestination = player.Center - lightningSpawnLocation; + Vector2 projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * baseVelocity * 0.5f; + float ai = Main.rand.Next(100); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), lightningSpawnLocation, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + Main.projectile[proj].tileCollide = false; lightningSpawnLocation.Y += distanceBetweenBolts; + if (i == numLightningBolts / 2) + lightningSpawnLocation.Y += distanceBetweenBolts; + } } } - if ((destination - NPC.Center).Length() < lightningChargeLocationDistance) + float totalChargeTime = (totalChargeDistance / baseVelocity) + lightningChargePhaseGateValue + 1f; + if (calamityGlobalNPC.newAI[2] > totalChargeTime) { AIState = NPC.localAI[2] == 0f ? (float)Phase.LightningRain : (float)Phase.IceMist; calamityGlobalNPC.newAI[2] = 0f; @@ -1143,7 +1175,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm case (int)Phase.EidolistSpawn: destination += eidolonWyrmPhaseLocation; - turnDistance = eidolonWyrmPhaseLocationDistance; if (calamityGlobalNPC.newAI[2] == 0f) { @@ -1205,12 +1236,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= ancientDoomPhaseGateValue) { - if (Main.netMode != NetmodeID.MultiplayerClient) + float aiGateValue = calamityGlobalNPC.newAI[2] - ancientDoomPhaseGateValue; + if (aiGateValue % ancientDoomGateValue == 0f) { - float aiGateValue = calamityGlobalNPC.newAI[2] - ancientDoomPhaseGateValue; - if (aiGateValue % ancientDoomGateValue == 0f) + // Spawn 3 (or more) circles of Ancient Dooms around the target + if (Main.netMode != NetmodeID.MultiplayerClient) { - // Spawn 3 (or more) circles of Ancient Dooms around the target int ancientDoomScale2 = (int)(aiGateValue / ancientDoomGateValue); ancientDoomLimit += ancientDoomScale2; ancientDoomDistance += ancientDoomScale2 * 45; @@ -1221,18 +1252,17 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + (float)(Math.Sin(i * ancientDoomDegrees) * ancientDoomDistance)), (int)(player.Center.Y + (float)(Math.Cos(i * ancientDoomDegrees) * ancientDoomDistance)), NPCID.AncientDoom, 0, NPC.whoAmI, 0f, ai2, 0f, Main.maxPlayers); } - - if (calamityGlobalNPC.newAI[2] >= 240f) - calamityGlobalNPC.newAI[2] = -90f; - - NPC.TargetClosest(); } + + if (calamityGlobalNPC.newAI[2] >= 240f) + calamityGlobalNPC.newAI[2] = -90f; + + NPC.TargetClosest(); } } // Swim up destination += spinLocation; - turnDistance = spinLocationDistance; // Use a lerp to smoothly scale up velocity and turn speed chargeVelocityScalar += chargeVelocityScalarIncrement; @@ -1299,22 +1329,38 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (!targetDead) { - // Increase velocity if velocity is ever zero - if (NPC.velocity == Vector2.Zero) - NPC.velocity = Vector2.Normalize(player.Center - NPC.Center).SafeNormalize(Vector2.Zero) * baseVelocity; + // Ensure that speed stays within a specific range. + NPC.velocity = NPC.velocity.ClampMagnitude(baseVelocity * 0.2f, baseVelocity * 1.3f); + Vector2 idealVelocity = NPC.SafeDirectionTo(destination) * baseVelocity; - // Acceleration - if (!((destination - NPC.Center).Length() < turnDistance)) + if ((NPC.velocity.X > 0f && idealVelocity.X > 0f) || (NPC.velocity.X < 0f && idealVelocity.X < 0f) || (NPC.velocity.Y > 0f && idealVelocity.Y > 0f) || (NPC.velocity.Y < 0f && idealVelocity.Y < 0f)) { - float targetAngle = NPC.AngleTo(destination); - float f = NPC.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); - NPC.velocity = f.ToRotationVector2() * baseVelocity; + // Accelerate towards the ideal velocity. + NPC.velocity.X += (NPC.velocity.X < idealVelocity.X).ToDirectionInt() * turnSpeed; + NPC.velocity.Y += (NPC.velocity.Y < idealVelocity.Y).ToDirectionInt() * turnSpeed; + + // Swim more quickly towards the ideal velocity if there isn't much speed currently or if the velocity goes against the ideal velocity. + if (Math.Abs(idealVelocity.Y) < baseVelocity * 0.2 && ((NPC.velocity.X > 0f && idealVelocity.X < 0f) || (NPC.velocity.X < 0f && idealVelocity.X > 0f))) + NPC.velocity.Y += NPC.velocity.Y.DirectionalSign() * turnSpeed * 2f; + + if (Math.Abs(idealVelocity.X) < baseVelocity * 0.2 && ((NPC.velocity.Y > 0f && idealVelocity.Y < 0f) || (NPC.velocity.Y < 0f && idealVelocity.Y > 0f))) + NPC.velocity.X += NPC.velocity.X.DirectionalSign() * turnSpeed * 2f; + } + + // Choose whichever axis the Wyrm is closest to it's destination on and emphasize moving in that direction. + else if (MathHelper.Distance(destination.X, NPC.Center.X) > MathHelper.Distance(destination.Y, NPC.Center.Y)) + { + NPC.velocity.X += (NPC.velocity.X < idealVelocity.X).ToDirectionInt() * turnSpeed * 1.1f; + if (NPC.velocity.ManhattanDistance(Vector2.Zero) < baseVelocity * 0.5) + NPC.velocity.Y += NPC.velocity.Y.DirectionalSign() * turnSpeed; + } + else + { + NPC.velocity.Y += (NPC.velocity.Y < idealVelocity.Y).ToDirectionInt() * turnSpeed * 1.1f; + if (NPC.velocity.ManhattanDistance(Vector2.Zero) < baseVelocity * 0.5) + NPC.velocity.X += NPC.velocity.X.DirectionalSign() * turnSpeed; } } - - // Velocity upper limit - if (NPC.velocity.Length() > baseVelocity) - NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero) * baseVelocity; } private void ChargeDust(int dustAmt, float pie) @@ -1371,18 +1417,27 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm return null; } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) - { NPC.Opacity = 1f; - return; - } - Texture2D texture = ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHeadGlow").Value; - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 center = NPC.Center; - Main.spriteBatch.Draw(texture, center - screenPos, NPC.frame, Color.White, NPC.rotation, texture.Size() * 0.5f, NPC.scale, spriteEffects, 0f); + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + + Vector2 center = NPC.Center - screenPos; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + + texture = ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmHeadGlow").Value; + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + + return false; } public override void BossLoot(ref string name, ref int potionType) @@ -1398,22 +1453,18 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm npcLoot.Add(ModContent.ItemType(), 1, 80, 100); npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitas); + var postClone = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCalamitasClone); postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); postClone.Add(ItemID.Ectoplasm, 1, 21, 32); } - public override void OnKill() - { - // Mark Adult Eidolon Wyrm as defeated - DownedBossSystem.downedAdultEidolonWyrm = true; - CalamityNetcode.SyncWorld(); - CalamityGlobalNPC.SetNewBossJustDowned(NPC); - } - public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 5; k++) + // Create gore and dust hit effects. + if (Main.netMode == NetmodeID.Server) + return; + + for (int k = 0; k < 15; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) @@ -1421,10 +1472,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm for (int k = 0; k < 15; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WyrmAdult").Type, 1f); - } + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("WyrmAdult").Type, 1f); } } @@ -1436,10 +1484,18 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Jared"; + } + } + public override void OnHitPlayer(Player player, int damage, bool crit) { if (NPC.Opacity == 1f && damage > 0) - player.AddBuff(ModContent.BuffType(), 600, true); + player.AddBuff(ModContent.BuffType(), 1200, true); } } } diff --git a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTail.cs b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTail.cs index 5bc49867e9..ff211d3d83 100644 --- a/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTail.cs +++ b/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTail.cs @@ -55,11 +55,12 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; - // Check if other segments are still alive, if not, die + // Check if other segments are still alive. If not, die. bool shouldDespawn = true; + int wyrmHeadID = ModContent.NPCType(); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + if (Main.npc[i].active && Main.npc[i].type == wyrmHeadID) { shouldDespawn = false; break; @@ -104,55 +105,38 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm NPC.Opacity = 0f; } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2); - float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + // Decide segment offset stuff. + NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; + Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center; + if (aheadSegment.rotation != NPC.rotation) { - try - { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; - } catch - { - } - - NPC.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; - - if (num191 < 0f) - NPC.spriteDirection = -1; - else if (num191 > 0f) - NPC.spriteDirection = 1; + directionToNextSegment = directionToNextSegment.RotatedBy(MathHelper.WrapAngle(aheadSegment.rotation - NPC.rotation) * 0.08f); + directionToNextSegment = directionToNextSegment.MoveTowards((aheadSegment.rotation - NPC.rotation).ToRotationVector2(), 1f); } + + NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; + NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * NPC.width; + NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector = center - screenPos; - vector -= new Vector2(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTailGlow").Value.Width, ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTailGlow").Value.Height) * 0.5f; - vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTailGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), Color.White, NPC.rotation, vector11, 1f, spriteEffects, 0f); + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + + Vector2 center = NPC.Center - screenPos; + center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + center += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, center, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + + texture = ModContent.Request("CalamityMod/NPCs/AdultEidolonWyrm/AdultEidolonWyrmTailGlow").Value; + spriteBatch.Draw(texture, center, NPC.frame, Color.White * NPC.Opacity, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + + return false; } public override bool CheckActive() => false; @@ -170,5 +154,13 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm } } } + + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Jared"; + } + } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 56f25c1782..b471f5aa7b 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.AquaticScourge vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.getFixedBoi) { if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] > 300f) color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] - 300f) / 180f, 0f, 1f)); diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 1eea04dcf9..b3ae716c15 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.AquaticScourge vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.getFixedBoi) { if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] > 300f) color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] - 300f) / 180f, 0f, 1f)); diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 1bc0c5dce9..1329b31cab 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -52,7 +52,6 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - NPC.npcSlots = 16f; NPC.GetNPCDamage(); NPC.Calamity().canBreakPlayerDefense = true; NPC.width = 90; @@ -108,6 +107,7 @@ namespace CalamityMod.NPCs.AquaticScourge writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); + writer.Write(NPC.npcSlots); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -118,6 +118,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); + NPC.npcSlots = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -141,7 +142,7 @@ namespace CalamityMod.NPCs.AquaticScourge vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.getFixedBoi) { if (NPC.Calamity().newAI[3] > 300f) color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((NPC.Calamity().newAI[3] - 300f) / 180f, 0f, 1f)); @@ -254,8 +255,8 @@ namespace CalamityMod.NPCs.AquaticScourge // Lore bool firstASKill() => !DownedBossSystem.downedAquaticScourge; - npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(firstASKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -268,7 +269,7 @@ namespace CalamityMod.NPCs.AquaticScourge if (!DownedBossSystem.downedAquaticScourge) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(Mauler.RoarSound, Main.player[Main.myPlayer].position); + SoundEngine.PlaySound(Mauler.RoarSound, Main.player[Main.myPlayer].Center); string sulfSeaBoostKey = "Mods.CalamityMod.WetWormBossText"; Color sulfSeaBoostColor = AcidRainEvent.TextColor; diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 5e64aa1323..57007646e4 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.AquaticScourge vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.getFixedBoi) { if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] > 300f) color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)NPC.ai[2]].Calamity().newAI[3] - 300f) / 180f, 0f, 1f)); diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 9374283f58..08062a7df6 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -4,14 +4,15 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent.Bestiary; -using Terraria.ModLoader; -using Terraria.Audio; using ReLogic.Content; -using CalamityMod.Sounds; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.NPCs.Astral { @@ -32,7 +33,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 50; NPC.width = 66; NPC.height = 64; - NPC.aiStyle = 41; + NPC.aiStyle = NPCAIStyleID.Herpling; NPC.defense = 14; NPC.DR_NERD(0.15f); NPC.lifeMax = 300; diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 7777de7b4f..0282654375 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -71,8 +71,8 @@ namespace CalamityMod.NPCs.Astral { NPC.TargetClosest(true); } - float num = CalamityWorld.death ? 7.5f : 5f; - float num2 = CalamityWorld.death ? 0.075f : 0.05f; + float num = CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6.5f : 5f; + float num2 = CalamityWorld.death ? 0.08f : CalamityWorld.revenge ? 0.065f : 0.05f; Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float num4 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); float num5 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); @@ -146,7 +146,7 @@ namespace CalamityMod.NPCs.Astral NPC.velocity.Y = NPC.velocity.Y - num2; } NPC.localAI[0] += 1f; - if (NPC.justHit && !CalamityWorld.death) + if (NPC.justHit) { NPC.localAI[0] = 0f; } diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 87fc9fa70f..9200399522 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 40; NPC.width = 36; NPC.height = 31; - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; NPC.defense = 8; NPC.lifeMax = 200; NPC.knockBackResist = 0f; diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index aeef47d2fc..fdb29e7225 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Astral { NPC.width = 70; NPC.height = 34; - NPC.aiStyle = 3; + NPC.aiStyle = NPCAIStyleID.Fighter; NPC.damage = 55; NPC.defense = 20; NPC.DR_NERD(0.15f); diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 1d81b82e21..20a40ecc7f 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.Astral public override void AI() { - CalamityGlobalNPC.DoSpiderWallAI(NPC, ModContent.NPCType(), (CalamityWorld.death ? 3.6f : 2.4f), (CalamityWorld.death ? 0.15f : 0.1f)); + CalamityGlobalNPC.DoSpiderWallAI(NPC, ModContent.NPCType(), (CalamityWorld.death ? 3.6f : CalamityWorld.revenge ? 3f : 2.4f), (CalamityWorld.death ? 0.15f : CalamityWorld.revenge ? 0.125f : 0.1f)); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 11b44b8634..bebb479699 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -132,6 +132,7 @@ namespace CalamityMod.NPCs.Astral NPC.value = Item.buyPrice(0, 1, 0, 0); NPC.aiStyle = -1; NPC.DeathSound = DeathSound; + NPC.rarity = 1; Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) @@ -141,9 +142,14 @@ namespace CalamityMod.NPCs.Astral NPC.knockBackResist = 0.04f; NPC.lifeMax = 1600; } + if (CalamityWorld.revenge) + { + target_walkAcceleration = 0.16f; + target_walkMaxSpeed = 2.4f; + } if (CalamityWorld.death) { - target_walkAcceleration = 0.18f; + target_walkAcceleration = 0.2f; target_walkMaxSpeed = 3.2f; } NPC.Calamity().VulnerableToHeat = true; @@ -273,7 +279,7 @@ namespace CalamityMod.NPCs.Astral swingYeet = false; - if (Main.rand.NextBool(1000)) //Launch the player very fast very rarely + if (Main.rand.NextBool(1000) || CalamityWorld.getFixedBoi) //Launch the player very fast very rarely { horMult = 12f; verMult = 2.3f; diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index 51baf1e6d1..5e28e9bde9 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.Astral bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Within their shells, the virus brews a potent chemical. When the seer approaches a foe, it spits this chemical out of its mandibles, hoping to melt the intruder’s flesh.") + new FlavorTextBestiaryInfoElement("Within their shells, the virus brews a potent chemical. When the seer approaches a foe, it spits this chemical out of its mandibles, hoping to melt the intruder's flesh.") }); } @@ -115,13 +115,13 @@ namespace CalamityMod.NPCs.Astral vector.Normalize(); Vector2 spawnPoint = NPC.Center + vector * 42f; - if (NPC.ai[1] >= (CalamityWorld.death ? 120f : 160f)) + if (NPC.ai[1] >= (CalamityWorld.death ? 80f : CalamityWorld.revenge ? 120f : 160f)) { NPC.ai[1] = 0f; int n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); Main.npc[n].Center = spawnPoint; - Main.npc[n].velocity = vector * (CalamityWorld.death ? 12f : 10f); + Main.npc[n].velocity = vector * (CalamityWorld.death ? 12f : CalamityWorld.revenge ? 11f : 10f); } else if (NPC.ai[1] >= 140f) //oozin dust at the "mouth" { @@ -195,6 +195,7 @@ namespace CalamityMod.NPCs.Astral this.HideFromBestiary(); DisplayName.SetDefault("Seeker Spit"); Main.npcFrameCount[NPC.type] = 1; + NPCID.Sets.ProjectileNPC[Type] = true; } public override void SetDefaults() diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index f791efaee2..029e9a2d71 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.Astral public override void AI() { - CalamityGlobalNPC.DoVultureAI(NPC, (CalamityWorld.death ? 0.225f : 0.15f), (CalamityWorld.death ? 5.25f : 3.5f), 32, 50, 150, 150); + CalamityGlobalNPC.DoVultureAI(NPC, (CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : 0.15f), (CalamityWorld.death ? 5.5f : CalamityWorld.revenge ? 4.5f : 3.5f), 32, 50, 150, 150); //usually done in framing but I put it here because it makes more sense to. NPC.rotation = NPC.velocity.X * 0.1f; diff --git a/NPCs/Astral/HiveEnemy.cs b/NPCs/Astral/HiveEnemy.cs index 2d637b819d..872741746b 100644 --- a/NPCs/Astral/HiveEnemy.cs +++ b/NPCs/Astral/HiveEnemy.cs @@ -52,6 +52,10 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + if (CalamityWorld.getFixedBoi) + { + NPC.scale = 3f; + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -66,7 +70,7 @@ namespace CalamityMod.NPCs.Astral public override void AI() { NPC.ai[0]++; - if (NPC.ai[0] > (CalamityWorld.death ? 120f : 180f)) + if (NPC.ai[0] > (CalamityWorld.death ? 60f : CalamityWorld.revenge ? 120f : 180f)) { if (Main.rand.NextBool(100) && NPC.CountNPCS(ModContent.NPCType()) < 10) { diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index d2f5584b3e..eb7e2568d1 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -79,7 +79,7 @@ namespace CalamityMod.NPCs.Astral } else { - CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 4.5f : 3f), (CalamityWorld.death ? 0.075f : 0.05f), 200f); + CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 5f : CalamityWorld.revenge ? 4f : 3f), (CalamityWorld.death ? 0.08f : CalamityWorld.revenge ? 0.065f : 0.05f), 200f); Player myTarget = Main.player[NPC.target]; Vector2 toTarget = myTarget.Center - NPC.Center; if (!myTarget.dead && myTarget.active) diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index ff58fbfd1a..a9c8b70451 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -81,8 +81,8 @@ namespace CalamityMod.NPCs.Astral if (NPC.ai[0] == 0f) { - float acceleration = CalamityWorld.death ? 0.07f : 0.045f; - float maxSpeed = CalamityWorld.death ? 10.5f : 6.8f; + float acceleration = CalamityWorld.death ? 0.075f : CalamityWorld.revenge ? 0.06f : 0.045f; + float maxSpeed = CalamityWorld.death ? 10.8f : CalamityWorld.revenge ? 8.8f : 6.8f; if (NPC.Center.X > target.Center.X) { NPC.velocity.X -= acceleration; @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.Astral //if need to jump if (NPC.velocity.Y == 0f && (HoleBelow() || (NPC.collideX && NPC.position.X == NPC.oldPosition.X))) { - NPC.velocity.Y = CalamityWorld.death ? -7f : -5f; + NPC.velocity.Y = CalamityWorld.death ? -8f : CalamityWorld.revenge ? -6.5f : -5f; } //check if we can shoot at target. @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.Astral if (vector.Length() < 480f && Collision.CanHit(NPC.position, NPC.width, NPC.height, target.position, target.width, target.height)) { NPC.ai[1] += 1f; - if (NPC.ai[1] >= (CalamityWorld.death ? 60f : 120f)) + if (NPC.ai[1] >= (CalamityWorld.death ? 60f : CalamityWorld.revenge ? 90f : 120f)) { //fire projectile NPC.ai[0] = 1f; @@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.Astral NPC.velocity.X *= 0.95f; if (NPC.ai[2] == 20f) //Don't do >= 20f or it'll cause a wave of scythes { - SoundEngine.PlaySound(SoundID.Item71, NPC.position); + SoundEngine.PlaySound(SoundID.Item71, NPC.Center); Vector2 vector = Main.player[NPC.target].Center - NPC.Center; vector.Normalize(); int damage = DownedBossSystem.downedAstrumAureus ? 55 : 45; diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 47c509e84d..c9032e436a 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -70,9 +70,14 @@ namespace CalamityMod.NPCs.Astral NPC.knockBackResist = 0.4f; NPC.lifeMax = 350; } - if (CalamityWorld.death) + if (CalamityWorld.revenge) { travelAcceleration = 0.3f; + targetTime = 90f; + } + if (CalamityWorld.death) + { + travelAcceleration = 0.4f; targetTime = 60f; } NPC.Calamity().VulnerableToHeat = true; @@ -130,7 +135,7 @@ namespace CalamityMod.NPCs.Astral Player target = Main.player[NPC.target]; if (NPC.ai[3] >= 0) { - CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 8.25f : 5.5f), (CalamityWorld.death ? 0.0525f : 0.035f), 400f, 150, false); + CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 8.5f : CalamityWorld.revenge ? 7f : 5.5f), (CalamityWorld.death ? 0.055f : CalamityWorld.revenge ? 0.045f : 0.035f), 400f, 150, false); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, target.position, target.width, target.height)) { @@ -144,7 +149,7 @@ namespace CalamityMod.NPCs.Astral Vector2 between = target.Center - NPC.Center; //after locking target for x amount of time and being far enough away - int random = CalamityWorld.death ? 90 : 180; + int random = CalamityWorld.death ? 90 : CalamityWorld.revenge ? 135 : 180; if (between.Length() > 150 && NPC.ai[3] >= targetTime && Main.rand.NextBool(random)) { //set ai mode to target and travel diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index 4e01c62999..b9d6a8c0b9 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.Astral bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Within their shells, the virus brews a potent chemical. When the seer approaches a foe, it spits this chemical out of its mandibles, hoping to melt the intruder’s flesh.") + new FlavorTextBestiaryInfoElement("Within their shells, the virus brews a potent chemical. When the seer approaches a foe, it spits this chemical out of its mandibles, hoping to melt the intruder's flesh.") }); } @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Astral public override void AI() { - CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 8.7f : 5.8f), (CalamityWorld.death ? 0.045f : 0.03f), 350f); + CalamityGlobalNPC.DoFlyingAI(NPC, (CalamityWorld.death ? 9.8f : CalamityWorld.revenge ? 7.8f : 5.8f), (CalamityWorld.death ? 0.05f : CalamityWorld.revenge ? 0.04f : 0.03f), 350f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index e1a0236f6b..bfe4eef347 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Astral { NPC.width = 60; NPC.height = 50; - NPC.aiStyle = 14; //bats + NPC.aiStyle = NPCAIStyleID.Bat; //bats NPC.npcSlots = 0.5f; //needed? NPC.damage = 55; NPC.defense = 18; diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index 97a7810b6f..9876657d6f 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Astral bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A rare case of the astral infection creating a harmless creature. They flicker rather prettily, and you’re not going to be the only one who thinks so. They make useful bait.") + new FlavorTextBestiaryInfoElement("A rare case of the astral infection creating a harmless creature. They flicker rather prettily, and you're not going to be the only one who thinks so. They make useful bait.") }); } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 76858ddb95..c1234cda7e 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -35,9 +35,12 @@ namespace CalamityMod.NPCs.AstrumAureus public class AstrumAureus : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AureusHit", 4); - public static readonly SoundStyle StompSound = new("CalamityMod/Sounds/Custom/LegStomp"); + public static readonly SoundStyle StompSound = new("CalamityMod/Sounds/Custom/AstrumAureus/LegStomp"); + public static readonly SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AureusJump"); private bool stomping = false; + public int slimeProjCounter = 0; + public int slimePhase = 0; public override void SetStaticDefaults() { @@ -82,6 +85,8 @@ namespace CalamityMod.NPCs.AstrumAureus if (Main.getGoodWorld) NPC.scale *= 0.8f; + if (CalamityWorld.getFixedBoi) + NPC.scale *= 1.5f; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -90,7 +95,7 @@ namespace CalamityMod.NPCs.AstrumAureus BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A multi-legged mechanical beast, its very existence speaks of the extent of control the astral virus has. Not even machinery can stand against it.") + new FlavorTextBestiaryInfoElement("A multi-legged mechanical beast, its very existence speaks of the extent of control the astral virus has over the non-sapient. Not even machinery can stand against it.") }); } @@ -98,6 +103,8 @@ namespace CalamityMod.NPCs.AstrumAureus { writer.Write(stomping); writer.Write(NPC.alpha); + writer.Write(slimePhase); + writer.Write(slimeProjCounter); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); for (int i = 0; i < 4; i++) @@ -108,6 +115,8 @@ namespace CalamityMod.NPCs.AstrumAureus { stomping = reader.ReadBoolean(); NPC.alpha = reader.ReadInt32(); + slimePhase = reader.ReadInt32(); + slimeProjCounter = reader.ReadInt32(); NPC.localAI[2] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); for (int i = 0; i < 4; i++) @@ -213,13 +222,16 @@ namespace CalamityMod.NPCs.AstrumAureus public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + float lifeRatio = NPC.life / (float)NPC.lifeMax; + bool slimePhaseHP = lifeRatio <= 0.1f || (lifeRatio > 0.6f && lifeRatio <= 0.7f); + Texture2D NPCTexture = TextureAssets.Npc[NPC.type].Value; Texture2D GlowMaskTexture = TextureAssets.Npc[NPC.type].Value; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - if (NPC.ai[0] == 0f) + if (NPC.ai[0] == 0f || (slimePhaseHP && CalamityWorld.getFixedBoi)) { NPCTexture = TextureAssets.Npc[NPC.type].Value; GlowMaskTexture = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AstrumAureusGlow").Value; @@ -272,6 +284,10 @@ namespace CalamityMod.NPCs.AstrumAureus float rotation = NPC.rotation; float offsetY = NPC.gfxOffY; Color color36 = Color.White; + if (CalamityWorld.getFixedBoi && slimePhaseHP) + { + color36 = slimePhase == 0 ? Color.Yellow : Color.Violet; + } float amount9 = 0.5f; int num153 = 7; if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) @@ -295,12 +311,17 @@ namespace CalamityMod.NPCs.AstrumAureus Vector2 vector43 = NPC.Center - screenPos; vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector43, frame, NPC.GetAlpha(drawColor), rotation, vector11, scale, spriteEffects, 0f); + Color toUse = CalamityWorld.getFixedBoi && slimePhaseHP ? color36 : drawColor; + spriteBatch.Draw(NPCTexture, vector43, frame, NPC.GetAlpha(toUse), rotation, vector11, scale, spriteEffects, 0f); - if (NPC.ai[0] != 1) //draw only if not recharging + if (NPC.ai[0] != 1 || (slimePhaseHP && CalamityWorld.getFixedBoi)) //draw only if not recharging { Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Gold); Color color40 = Color.Lerp(Color.White, color, 0.5f); + if (CalamityWorld.getFixedBoi && slimePhaseHP) + { + color40 = slimePhase == 0 ? Color.Violet : Color.Yellow; + } if (CalamityConfig.Instance.Afterimages) { @@ -366,7 +387,7 @@ namespace CalamityMod.NPCs.AstrumAureus npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedAstrumAureus, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 947ffae56f..4f1e36d5b5 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -12,6 +12,8 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; namespace CalamityMod.NPCs.AstrumAureus { @@ -33,10 +35,11 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.GetNPCDamage(); NPC.width = 90; NPC.height = 60; - NPC.alpha = 255; + NPC.Opacity = 0f; NPC.defense = 10; - NPC.lifeMax = 3000; + NPC.lifeMax = 5000; NPC.knockBackResist = 0f; + NPC.dontTakeDamage = true; NPC.noGravity = true; NPC.noTileCollide = true; NPC.canGhostHeal = false; @@ -49,226 +52,173 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SendExtraAI(BinaryWriter writer) { writer.Write(NPC.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { NPC.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - NPC.damage = 0; + // Force despawn if Astrum Aureus isn't active + if (CalamityGlobalNPC.astrumAureus < 0 || !Main.npc[CalamityGlobalNPC.astrumAureus].active) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + NPC.active = false; + NPC.netUpdate = true; + return; + } - Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 0.6f, 0.25f, 0f); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.6f * NPC.Opacity * NPC.scale, 0.25f * NPC.Opacity * NPC.scale, 0f); - NPC.rotation = Math.Abs(NPC.velocity.X) * (float)NPC.direction * 0.04f; + NPC.rotation = Math.Abs(NPC.velocity.X) * NPC.direction * 0.04f; NPC.spriteDirection = NPC.direction; - if (NPC.alpha > 0) + if (NPC.Opacity < 1f) { - NPC.alpha -= 5; - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) + NPC.Opacity += 0.01f; + + if (NPC.Opacity > 0.33f) + NPC.velocity *= 0.95f; + + if (NPC.Opacity >= 1f) { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 0.8f); + NPC.Opacity = 1f; + NPC.dontTakeDamage = false; + } + + for (int i = 0; i < 8; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.5f; - num = num245; - } - } - - NPC.TargetClosest(); - - // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; - - if (lifeRatio <= 0.5f || Main.dayTime) - { - NPC.ai[1] += 1f; - NPC.dontTakeDamage = true; - Vector2 vector = Main.player[NPC.target].Center - NPC.Center; - Point point15 = NPC.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point15); - bool flag121 = tileSafely.HasUnactuatedTile && Main.tileSolid[tileSafely.TileType] && !Main.tileSolidTop[tileSafely.TileType] && !TileID.Sets.Platforms[tileSafely.TileType]; - if (NPC.ai[1] > ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 600f : 300f)) - { - NPC.Calamity().newAI[0] += 1f; - NPC.scale = MathHelper.Lerp(1f, 2f, NPC.Calamity().newAI[0] / 45f); - } - if (vector.Length() < 60f || flag121 || NPC.Calamity().newAI[0] >= 45f) - { - NPC.dontTakeDamage = false; - CheckDead(); - NPC.life = 0; - return; - } - float num1372 = 18f; - Vector2 vector167 = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); - float num1373 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector167.X; - float num1374 = Main.player[NPC.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; - NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; - - if (CalamityWorld.death || BossRushEvent.BossRushActive) - { - float pushVelocity = 0.5f; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active) - { - if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) - { - if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 320f) - { - if (NPC.position.X < Main.npc[i].position.X) - NPC.velocity.X = NPC.velocity.X - pushVelocity; - else - NPC.velocity.X = NPC.velocity.X + pushVelocity; - - if (NPC.position.Y < Main.npc[i].position.Y) - NPC.velocity.Y = NPC.velocity.Y - pushVelocity; - else - NPC.velocity.Y = NPC.velocity.Y + pushVelocity; - } - } - } - } } return; } - float num1446 = 7f; - int num1447 = 480; - if (NPC.localAI[1] == 1f) - { - NPC.localAI[1] = 0f; - if (Main.rand.NextBool(4)) - { - NPC.ai[0] = num1447; - } - } + NPC.TargetClosest(); - if (CalamityWorld.death || BossRushEvent.BossRushActive) + // Push away from each other + float pushVelocity = 0.5f; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 180f) + if (Main.npc[i].active) { - NPC.localAI[0] = 0f; - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) { - SoundEngine.PlaySound(SoundID.Item109, NPC.position); - float speed = 6f; - Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); - float num6 = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X; - float num7 = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y; - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, num6, num7, type, damage, 0f, Main.myPlayer); + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < (160f + 30f * (NPC.scale - 1f))) + { + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X = NPC.velocity.X - pushVelocity; + else + NPC.velocity.X = NPC.velocity.X + pushVelocity; + + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y = NPC.velocity.Y - pushVelocity; + else + NPC.velocity.Y = NPC.velocity.Y + pushVelocity; + } } } } - Vector2 value53 = NPC.Center + new Vector2((float)(NPC.direction * 20), 6f); - Vector2 vector251 = Main.player[NPC.target].Center - value53; - bool flag104 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - NPC.velocity = (NPC.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - NPC.velocity *= 0.98f; - } + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; - if (NPC.ai[2] != 0f && NPC.ai[3] != 0f) - { - SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, Color.Transparent, 0.6f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f); - NPC.velocity = Vector2.Zero; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, Color.Transparent, 0.6f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } + // Phase 2 check + bool phase2 = lifeRatio <= 0.5f || Main.dayTime; - NPC.ai[0] += 1f; - if (NPC.ai[0] >= num1447 && Main.netMode != NetmodeID.MultiplayerClient) + // Charge towards the target and explode after some time + int inertia = 30; + Vector2 vector = Main.player[NPC.target].Center - NPC.Center; + Vector2 vector2 = Main.npc[CalamityGlobalNPC.astrumAureus].Center - NPC.Center; + float distanceFromAureus = vector2.Length(); + float distanceFromTarget = vector.Length(); + float chargeVelocity = 8f; + if (phase2) { - NPC.ai[0] = 0f; - Point point12 = NPC.Center.ToTileCoordinates(); - Point point13 = Main.player[NPC.target].Center.ToTileCoordinates(); - int num1453 = 25; - int num1454 = 3; - int num1455 = 20; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 1000f) + inertia = 50; + chargeVelocity = 16f; + float engagePhase2GateValue = 60f; + float enlargeGateValue = engagePhase2GateValue + 300f; + + // Pause when phase 2 is triggered + NPC.ai[0] += 1f; + if (NPC.ai[0] < engagePhase2GateValue) { - flag106 = true; + NPC.velocity *= 0.95f; + return; } - while (!flag106 && num1457 < 100) + + // Emit dust and sound when phase 2 charging begins + if (NPC.ai[0] == engagePhase2GateValue) { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].HasUnactuatedTile) + SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaExplosionSound, NPC.Center); + + for (int j = 0; j < 10; j++) { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].LiquidType == LiquidID.Lava) + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 1.66f; + if (Main.rand.NextBool(2)) { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - NPC.ai[2] = (float)num1458; - NPC.ai[3] = (float)num1459; - break; + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } + Main.dust[dust].noGravity = true; + } + + for (int k = 0; k < 20; k++) + { + int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 2f; + dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 1.33f; + Main.dust[dust].noGravity = true; } } - NPC.netUpdate = true; + + // Grow in size + float enlargeDuration = 180f; + if (NPC.ai[0] >= enlargeGateValue) + { + NPC.Calamity().newAI[0] += 1f; + NPC.scale = MathHelper.Lerp(1f, 2f, NPC.Calamity().newAI[0] / enlargeDuration); + NPC.width = (int)(90f * NPC.scale); + NPC.height = (int)(60f * NPC.scale); + } + + // Check if it can explode + Point point = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool explodeOnCollision = tileSafely.HasUnactuatedTile && Main.tileSolid[tileSafely.TileType] && !Main.tileSolidTop[tileSafely.TileType] && !TileID.Sets.Platforms[tileSafely.TileType]; + bool explodeOnAureus = distanceFromAureus < (180f + 30f * (NPC.scale - 1f)) && !Main.dayTime; + if (vector.Length() < (60f + 30f * (NPC.scale - 1f)) || explodeOnCollision || explodeOnAureus || NPC.Calamity().newAI[0] >= enlargeDuration) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + return; + } } + + // Move towards the target + chargeVelocity += distanceFromTarget / 200f; + if (distanceFromTarget > chargeVelocity) + { + vector.Normalize(); + vector *= chargeVelocity; + } + NPC.velocity = (NPC.velocity * (inertia - 1) + vector) / inertia; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -278,15 +228,18 @@ namespace CalamityMod.NPCs.AstrumAureus public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - if (NPC.Calamity().newAI[0] >= 45f) + if (NPC.Calamity().newAI[0] >= 180f) return false; SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; + if (NPC.ai[0] >= 60f) + NPC.DrawBackglow(Color.Lerp(Color.Cyan, Color.Orange, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) with { A = 0 }, 2f + 8f * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f), spriteEffects, NPC.frame, screenPos); + Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 10; @@ -298,21 +251,21 @@ namespace CalamityMod.NPCs.AstrumAureus Color color38 = drawColor; color38 = Color.Lerp(color38, color36, amount9); color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } } Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + Color color37 = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) { @@ -320,9 +273,9 @@ namespace CalamityMod.NPCs.AstrumAureus { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } @@ -344,43 +297,18 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.frame.Y = frame * frameHeight; } - public override void HitEffect(int hitDirection, double damage) + public override void OnKill() { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hitDirection, -1f, 0, default, 1f); - } - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (damage > 0) - player.AddBuff(ModContent.BuffType(), 180, true); - } - - public override bool CheckDead() - { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); - NPC.position.X = NPC.position.X + (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); - NPC.damage = NPC.defDamage; - NPC.width = NPC.height = 432; - NPC.position.X = NPC.position.X - (float)(NPC.width / 2); - NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); // Split into a halo of projectiles in death mode if (CalamityWorld.death || BossRushEvent.BossRushActive) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = 4; + int totalProjectiles = 3 + (int)((NPC.scale - 1f) * 3); double radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage2 = NPC.GetProjectileDamage(type); @@ -392,33 +320,66 @@ namespace CalamityMod.NPCs.AstrumAureus for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, damage2, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 200; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, damage2, 0f, Main.myPlayer); } } } - for (int num621 = 0; num621 < 30; num621++) + // Return if Astrum Aureus isn't active + if (CalamityGlobalNPC.astrumAureus < 0 || !Main.npc[CalamityGlobalNPC.astrumAureus].active) + return; + + // Damage Aureus for a percentage of its HP if the spawn explodes on or near it + if (Main.netMode != NetmodeID.MultiplayerClient && (Main.npc[CalamityGlobalNPC.astrumAureus].Center - NPC.Center).Length() < (200f + 30f * (NPC.scale - 1f)) && !Main.dayTime) + Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), Main.npc[CalamityGlobalNPC.astrumAureus].Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Main.npc[CalamityGlobalNPC.astrumAureus].lifeMax / 200 * NPC.scale), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.astrumAureus].whoAmI); + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, 173, hitDirection, -1f, 0, default, 1f); + + if (NPC.life <= 0) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); + + NPC.position.X = NPC.position.X + NPC.width / 2; + NPC.position.Y = NPC.position.Y + NPC.height / 2; + NPC.damage = (int)(NPC.defDamage * NPC.scale); + NPC.width = NPC.height = (int)(216 * NPC.scale); + NPC.position.X = NPC.position.X - NPC.width / 2; + NPC.position.Y = NPC.position.Y - NPC.height / 2; + + for (int num621 = 0; num621 < 30; num621++) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + Main.dust[num622].noGravity = true; + } + + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; } - Main.dust[num622].noGravity = true; } - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - return true; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => NPC.Opacity == 1f; + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + int debuffType = CalamityWorld.getFixedBoi ? ModContent.BuffType() : ModContent.BuffType(); + player.AddBuff(debuffType, (int)(180 * NPC.scale), true); } } } diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 1d0cdb10bf..44122937af 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void HitEffect(int hitDirection, double damage) { - if (NPC.life <= 0) + if (NPC.life <= 0 && CalamityWorld.getFixedBoi) // I value people's computers { NPC.position.X = NPC.position.X + (NPC.width / 2); NPC.position.Y = NPC.position.Y + (NPC.height / 2); diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 0715b663be..c00405f93e 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -90,6 +90,13 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + if (CalamityWorld.getFixedBoi) + { + if (CalamityWorld.death) // killing 10 worms with half of the og's health is ridiculous + NPC.lifeMax /= 3; + NPC.value /= 5; + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -98,7 +105,7 @@ namespace CalamityMod.NPCs.AstrumDeus BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("The fragments of the star god’s corpse still hold some of their former power, and even after succumbing to a dark infection, then being torn apart by an upstart worm, they willfully seek to return to the stars.") + new FlavorTextBestiaryInfoElement("Revered as a God of the stars, it has been infected by the starborne illness. However, it has now been broken free from the infection's control and roams the stars once more, consuming dying stars and birthing them anew.") }); } @@ -210,29 +217,32 @@ namespace CalamityMod.NPCs.AstrumDeus { if (NPC.life <= 0) { - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = 50; - NPC.height = 50; - NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 5; num621++) + if (CalamityWorld.getFixedBoi && Main.rand.NextBool(5)) // I value people's computers { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = 50; + NPC.height = 50; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); + for (int num621 = 0; num621 < 5; num621++) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; } } } @@ -322,7 +332,7 @@ namespace CalamityMod.NPCs.AstrumDeus normalOnly.Add(ModContent.ItemType(), 1, 50, 80); } - npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.GreaterHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary + npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ItemID.SuperHealingPotion, 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary lastWorm.Add(ModContent.ItemType(), 10); // Relic @@ -333,11 +343,12 @@ namespace CalamityMod.NPCs.AstrumDeus lastWorm.Add(DropHelper.NormalVsExpertQuantity(ItemID.FragmentVortex, 1, 16, 24, 20, 32)); lastWorm.Add(DropHelper.NormalVsExpertQuantity(ItemID.FragmentNebula, 1, 16, 24, 20, 32)); lastWorm.Add(DropHelper.NormalVsExpertQuantity(ItemID.FragmentStardust, 1, 16, 24, 20, 32)); + lastWorm.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 16, 24, 20, 32)); // Lore bool firstDeusKill(DropAttemptInfo info) => !DownedBossSystem.downedAstrumDeus && !ShouldNotDropThings(info.npc); - npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(firstDeusKill, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 103c5b34d0..c7287a6729 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -155,7 +155,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void HitEffect(int hitDirection, double damage) { - if (NPC.life <= 0) + if (NPC.life <= 0 && CalamityWorld.getFixedBoi) // I value people's computers { NPC.position.X = NPC.position.X + (NPC.width / 2); NPC.position.Y = NPC.position.Y + (NPC.height / 2); diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 35f40e0ed3..a6a7ebfaad 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -51,6 +51,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + if (CalamityWorld.getFixedBoi) + NPC.scale *= 0.7f; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -84,6 +87,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Despawn if Brim doesn't exist if (CalamityGlobalNPC.brimstoneElemental < 0 || !Main.npc[CalamityGlobalNPC.brimstoneElemental].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index ce49054006..c352248d0e 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -18,10 +18,13 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; +using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -30,6 +33,16 @@ namespace CalamityMod.NPCs.BrimstoneElemental [AutoloadBossHead] public class BrimstoneElemental : ModNPC { + public enum Elemental + { + Brimstone = 0, + Sand = 1, + Rare = 2, + Cloud = 3, + Water = 4 + } + public int currentMode = (int)Elemental.Brimstone; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Elemental"); @@ -42,7 +55,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental }; value.Position.Y -= 24f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -76,13 +89,14 @@ namespace CalamityMod.NPCs.BrimstoneElemental { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A fallen goddess, past her prime of faithful worshippers. She feels an intense hatred for any being with enough self awareness to pity her.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("Roused from her deep slumber in relatively recent years, her awakening acted as the catalyst for Azafure’s downfall. Little is known of her nature, other than what may be assumed of any other elemental.") }); } public override void SendExtraAI(BinaryWriter writer) { + writer.Write(currentMode); writer.Write(NPC.chaseable); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); @@ -94,6 +108,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); + currentMode = reader.ReadInt32(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); @@ -114,8 +129,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void OnHitPlayer(Player player, int damage, bool crit) { - if (damage > 0) - player.AddBuff(ModContent.BuffType(), 240, true); + player.AddBuff(ModContent.BuffType(), 240, true); } public override void FindFrame(int frameHeight) // 9 total frames @@ -190,7 +204,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental normalOnly.Add(ModContent.ItemType(), 10); // Materials - normalOnly.Add(ModContent.ItemType(), 1, 4, 8); + normalOnly.Add(ModContent.ItemType(), 1, 4, 8); // Equipment int[] accs = new int[] @@ -215,7 +229,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -277,5 +292,62 @@ namespace CalamityMod.NPCs.BrimstoneElemental } } } + + 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; + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + + // Give brimmy an outline based on current elemental mode + if (CalamityWorld.getFixedBoi) + { + Color baseColor = Color.Red; + switch (currentMode) + { + case 0: + baseColor = Color.Red; + break; + case 1: + baseColor = Color.Tan; + break; + case 2: + baseColor = Color.Lime; + break; + case 3: + baseColor = Color.Gray; + break; + case 4: + baseColor = Color.Blue; + break; + } + CalamityUtils.EnterShaderRegion(spriteBatch); + Color outlineColor = Color.Lerp(baseColor, Color.White, 0.4f); + outlineColor *= NPC.Opacity; + Vector3 outlineHSL = Main.rgbToHsl(outlineColor); + float outlineThickness = MathHelper.Clamp(2f, 0f, 3f); + + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + + for (float i = 0; i < 1; i += 0.125f) + { + spriteBatch.Draw(texture, npcOffset + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, NPC.frame, outlineColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + } + CalamityUtils.ExitShaderRegion(spriteBatch); + } + spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } } } diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index f766567027..deb552ce68 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -7,11 +7,12 @@ using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -21,6 +22,7 @@ using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -128,6 +130,12 @@ namespace CalamityMod.NPCs.Bumblebirb bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); bool birbSpawn = NPC.ai[0] == 4f && NPC.ai[1] > 0f; + // Animation goes nyoom + if (CalamityWorld.getFixedBoi) + { + NPC.frameCounter += 4; + } + float newPhaseTimer = 180f; bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); @@ -404,8 +412,8 @@ namespace CalamityMod.NPCs.Bumblebirb public override void BossLoot(ref string name, ref int potionType) { - name = "A Dragonfolly"; - potionType = ModContent.ItemType(); + name = CalamityWorld.getFixedBoi ? "A Bumblebirb" : "A Dragonfolly"; + potionType = ItemID.SuperHealingPotion; } public override void ModifyNPCLoot(NPCLoot npcLoot) @@ -443,7 +451,7 @@ namespace CalamityMod.NPCs.Bumblebirb npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -454,6 +462,21 @@ namespace CalamityMod.NPCs.Bumblebirb DownedBossSystem.downedDragonfolly = true; CalamityNetcode.SyncWorld(); + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + int spacing = 40; + int amt = 7; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -462,6 +485,14 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Bumblebirb"; + } + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 8744581f82..b1aa11453f 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -1,9 +1,11 @@ -using CalamityMod.World; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +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; @@ -53,11 +55,28 @@ namespace CalamityMod.NPCs.Bumblebirb int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + for (int i = 0; i < 5; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } } public override void FindFrame(int frameHeight) { NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; + if (CalamityWorld.getFixedBoi) + { + NPC.frameCounter += 2D; + } if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base { NPC.frameCounter = 0D; @@ -104,6 +123,14 @@ namespace CalamityMod.NPCs.Bumblebirb return false; } + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Bumblebirb"; + } + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/Calamitas/CalScreenShaderData.cs b/NPCs/CalClone/CalScreenShaderData.cs similarity index 97% rename from NPCs/Calamitas/CalScreenShaderData.cs rename to NPCs/CalClone/CalScreenShaderData.cs index 06d67cc3d3..11ee4782e0 100644 --- a/NPCs/Calamitas/CalScreenShaderData.cs +++ b/NPCs/CalClone/CalScreenShaderData.cs @@ -5,7 +5,7 @@ using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -namespace CalamityMod.NPCs.Calamitas +namespace CalamityMod.NPCs.CalClone { public class CalScreenShaderData : ScreenShaderData { diff --git a/NPCs/Calamitas/CalSky.cs b/NPCs/CalClone/CalSky.cs similarity index 98% rename from NPCs/Calamitas/CalSky.cs rename to NPCs/CalClone/CalSky.cs index 787e8dc8ac..e7d242d4d0 100644 --- a/NPCs/Calamitas/CalSky.cs +++ b/NPCs/CalClone/CalSky.cs @@ -6,7 +6,7 @@ using Terraria.GameContent; using Terraria.Graphics.Effects; using Terraria.ModLoader; -namespace CalamityMod.NPCs.Calamitas +namespace CalamityMod.NPCs.CalClone { public class CalSky : CustomSky { diff --git a/NPCs/Calamitas/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs similarity index 91% rename from NPCs/Calamitas/CalamitasClone.cs rename to NPCs/CalClone/CalamitasClone.cs index 130ba19283..af0d17e635 100644 --- a/NPCs/Calamitas/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -27,14 +27,14 @@ using Terraria.Audio; using Terraria.GameContent.ItemDropRules; using CalamityMod.Sounds; -namespace CalamityMod.NPCs.Calamitas +namespace CalamityMod.NPCs.CalClone { [AutoloadBossHead] public class CalamitasClone : ModNPC { public override void SetStaticDefaults() { - DisplayName.SetDefault("Calamitas"); + DisplayName.SetDefault("Calamitas Clone"); Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Calamitas }; value.Position.Y -= 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -84,8 +84,8 @@ namespace CalamityMod.NPCs.Calamitas BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A mysterious burning form which only appears at night, wreathed in brimstone fire. It has a twisted mind and misplaced pride in its abilities.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("A mysterious burning form which only appears at night, wreathed in brimstone fire. It has a twisted mind and misplaced pride in its abilities.") }); } @@ -156,8 +156,12 @@ namespace CalamityMod.NPCs.Calamitas npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/Calamitas/CalamitasCloneGlow").Value; + texture = ModContent.Request("CalamityMod/NPCs/CalClone/CalamitasCloneGlow").Value; Color color = Color.Lerp(Color.White, Color.Red, 0.5f); + if (CalamityWorld.getFixedBoi) + { + color = Color.CornflowerBlue; + } if (CalamityConfig.Instance.Afterimages) { @@ -180,7 +184,7 @@ namespace CalamityMod.NPCs.Calamitas public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); + npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); npcLoot.Add(ItemID.BrokenHeroSword); // Normal drops: Everything that would otherwise be in the bag @@ -202,46 +206,46 @@ namespace CalamityMod.NPCs.Calamitas normalOnly.Add(ModContent.ItemType(), 10); // Materials - normalOnly.Add(ModContent.ItemType(), 1, 5, 10); + normalOnly.Add(ModContent.ItemType(), 1, 5, 10); normalOnly.Add(ModContent.ItemType(), 1, 25, 30); // Vanity - normalOnly.Add(ModContent.ItemType(), 7); + normalOnly.Add(ModContent.ItemType(), 7); var calVanity = ItemDropRule.Common(ModContent.ItemType(), 10); calVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); normalOnly.Add(calVanity); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ModContent.ItemType(), 10); // Relic npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCalamitas, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCalamitasClone, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() { CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitas); + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedCalamitasClone); // Abyss awakens after killing Calamitas string key = "Mods.CalamityMod.PlantBossText"; Color messageColor = Color.RoyalBlue; - if (!DownedBossSystem.downedCalamitas) + if (!DownedBossSystem.downedCalamitasClone) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].position); + SoundEngine.PlaySound(CommonCalamitySounds.WyrmScreamSound, Main.player[Main.myPlayer].Center); CalamityUtils.DisplayLocalizedText(key, messageColor); } - // Mark Calamitas as dead - DownedBossSystem.downedCalamitas = true; + // Mark the Calamitas Clone as dead + DownedBossSystem.downedCalamitasClone = true; CalamityNetcode.SyncWorld(); } diff --git a/NPCs/Calamitas/CalamitasClone.png b/NPCs/CalClone/CalamitasClone.png similarity index 100% rename from NPCs/Calamitas/CalamitasClone.png rename to NPCs/CalClone/CalamitasClone.png diff --git a/NPCs/Calamitas/CalamitasCloneGlow.png b/NPCs/CalClone/CalamitasCloneGlow.png similarity index 100% rename from NPCs/Calamitas/CalamitasCloneGlow.png rename to NPCs/CalClone/CalamitasCloneGlow.png diff --git a/NPCs/Calamitas/CalamitasClone_Head_Boss.png b/NPCs/CalClone/CalamitasClone_Head_Boss.png similarity index 100% rename from NPCs/Calamitas/CalamitasClone_Head_Boss.png rename to NPCs/CalClone/CalamitasClone_Head_Boss.png diff --git a/NPCs/Calamitas/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs similarity index 99% rename from NPCs/Calamitas/Cataclysm.cs rename to NPCs/CalClone/Cataclysm.cs index 0dbee9e480..af14001c08 100644 --- a/NPCs/Calamitas/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -13,7 +13,7 @@ using Terraria.ID; using Terraria.ModLoader; using System.IO; -namespace CalamityMod.NPCs.Calamitas +namespace CalamityMod.NPCs.CalClone { [AutoloadBossHead] public class Cataclysm : ModNPC @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Calamitas vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Calamitas/CataclysmGlow").Value; + texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CataclysmGlow").Value; Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Calamitas/Cataclysm.png b/NPCs/CalClone/Cataclysm.png similarity index 100% rename from NPCs/Calamitas/Cataclysm.png rename to NPCs/CalClone/Cataclysm.png diff --git a/NPCs/Calamitas/CataclysmGlow.png b/NPCs/CalClone/CataclysmGlow.png similarity index 100% rename from NPCs/Calamitas/CataclysmGlow.png rename to NPCs/CalClone/CataclysmGlow.png diff --git a/NPCs/Calamitas/Cataclysm_Head_Boss.png b/NPCs/CalClone/Cataclysm_Head_Boss.png similarity index 100% rename from NPCs/Calamitas/Cataclysm_Head_Boss.png rename to NPCs/CalClone/Cataclysm_Head_Boss.png diff --git a/NPCs/Calamitas/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs similarity index 99% rename from NPCs/Calamitas/Catastrophe.cs rename to NPCs/CalClone/Catastrophe.cs index 0d19e75495..68e5076599 100644 --- a/NPCs/Calamitas/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -13,7 +13,7 @@ using Terraria.ID; using Terraria.ModLoader; using System.IO; -namespace CalamityMod.NPCs.Calamitas +namespace CalamityMod.NPCs.CalClone { [AutoloadBossHead] public class Catastrophe : ModNPC @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Calamitas vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - texture2D15 = ModContent.Request("CalamityMod/NPCs/Calamitas/CatastropheGlow").Value; + texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CatastropheGlow").Value; Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Calamitas/Catastrophe.png b/NPCs/CalClone/Catastrophe.png similarity index 100% rename from NPCs/Calamitas/Catastrophe.png rename to NPCs/CalClone/Catastrophe.png diff --git a/NPCs/Calamitas/CatastropheGlow.png b/NPCs/CalClone/CatastropheGlow.png similarity index 100% rename from NPCs/Calamitas/CatastropheGlow.png rename to NPCs/CalClone/CatastropheGlow.png diff --git a/NPCs/Calamitas/Catastrophe_Head_Boss.png b/NPCs/CalClone/Catastrophe_Head_Boss.png similarity index 100% rename from NPCs/Calamitas/Catastrophe_Head_Boss.png rename to NPCs/CalClone/Catastrophe_Head_Boss.png diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs similarity index 98% rename from NPCs/Calamitas/SoulSeeker.cs rename to NPCs/CalClone/SoulSeeker.cs index 89b87d202c..6bafe656b1 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -11,7 +11,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.Calamitas +namespace CalamityMod.NPCs.CalClone { public class SoulSeeker : ModNPC { @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.Calamitas BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Guardians were brought together by Calamitas to shield its body from blows. It is possible that they are soul slurpers empowered and enslaved by a different brand of magic than brimstone.") + new FlavorTextBestiaryInfoElement("Guardians were brought together by the clone to shield its body from blows. It is possible that they are soul slurpers empowered and enslaved by a different brand of magic than brimstone.") }); } @@ -81,6 +81,8 @@ namespace CalamityMod.NPCs.Calamitas if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return false; @@ -207,7 +209,7 @@ namespace CalamityMod.NPCs.Calamitas drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/Calamitas/SoulSeekerGlow").Value; + texture = ModContent.Request("CalamityMod/NPCs/CalClone/SoulSeekerGlow").Value; Color glow = Color.Lerp(Color.White, Color.Red, colorLerpAmt); if (CalamityConfig.Instance.Afterimages) diff --git a/NPCs/Calamitas/SoulSeeker.png b/NPCs/CalClone/SoulSeeker.png similarity index 100% rename from NPCs/Calamitas/SoulSeeker.png rename to NPCs/CalClone/SoulSeeker.png diff --git a/NPCs/Calamitas/SoulSeekerGlow.png b/NPCs/CalClone/SoulSeekerGlow.png similarity index 100% rename from NPCs/Calamitas/SoulSeekerGlow.png rename to NPCs/CalClone/SoulSeekerGlow.png diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 8141348943..cdba98d627 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -9,15 +9,17 @@ using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -39,19 +41,24 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + bool getFuckedAI = CalamityWorld.getFixedBoi; + if (head) CalamityGlobalNPC.aquaticScourge = npc.whoAmI; // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || bossRush || Main.getGoodWorld) { - if (calamityGlobalNPC.newAI[0] == 0f) + if (nonHostile) { // Kiss my motherfucking ass you piece of shit game npc.timeLeft *= 20; + npc.npcSlots = 16f; CalamityMod.bossKillTimes.TryGetValue(npc.type, out int revKillTime); calamityGlobalNPC.KillTime = revKillTime; calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; npc.boss = head; npc.chaseable = true; npc.netUpdate = true; @@ -118,10 +125,10 @@ namespace CalamityMod.NPCs float colorFadeTimeAfterSpiral = 90f; float spiralGateValue = 480f; bool doSpiral = false; - if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && revenge) + if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (revenge || getFuckedAI)) { doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= spiralGateValue; - if (Vector2.Distance(npc.Center, player.Center) < 1000f || doSpiral) + if (Vector2.Distance(npc.Center, player.Center) < (getFuckedAI ? 1600f : 1000f) || doSpiral) calamityGlobalNPC.newAI[3] += 1f; if (doSpiral) @@ -129,18 +136,19 @@ namespace CalamityMod.NPCs npc.localAI[3] = colorFadeTimeAfterSpiral; // Vomit acid mist - float acidMistBarfDivisor = (float)Math.Floor(bossRush ? 4f : death ? 5f : 6f) * (phase3 ? 1.5f : 1f); + float acidMistBarfDivisor = getFuckedAI ? 2f : ((float)Math.Floor(bossRush ? 4f : death ? 5f : 6f) * (phase3 ? 1.5f : 1f)); if (calamityGlobalNPC.newAI[3] % acidMistBarfDivisor == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { float mistVelocity = death ? 10f : 8f; + Vector2 projectileVelocity = Vector2.Normalize(npc.Center + npc.velocity * 10f - npc.Center); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * mistVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 600; + Main.projectile[proj].timeLeft = getFuckedAI ? 240 : 600; } } @@ -152,7 +160,7 @@ namespace CalamityMod.NPCs { int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - int totalProjectiles = (phase4 ? 6 : 9) + (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3); + int totalProjectiles = (phase4 ? 6 : 9) + (getFuckedAI ? Main.rand.Next(-2, 3) : (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3)); float radians = MathHelper.TwoPi / totalProjectiles; float cloudVelocity = 1f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -cloudVelocity); @@ -173,11 +181,18 @@ namespace CalamityMod.NPCs // Spin velocity float velocity = (float)(Math.PI * 2D) / 120f; + // In GFB, contracts the radius as the fight progresses + if (getFuckedAI) + velocity *= phase3 ? 1.5f : phase2 ? 1.25f : 1f; npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[1]); + // Speed up even more in GFB for more radius + if (getFuckedAI && npc.velocity.Length() <= 32f) + npc.velocity *= 1.1f; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; // Reset and charge at target - if (calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f) + // Don't reset in GFB + if (!getFuckedAI && calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f) { calamityGlobalNPC.newAI[3] = 0f; npc.TargetClosest(); @@ -196,26 +211,26 @@ namespace CalamityMod.NPCs } // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = doSpiral; + bool immuneToSlowingDebuffs = doSpiral || getFuckedAI; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (head) { - if (head) + // Spawn segments + if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f) { - // Spawn segments - if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f) + if (Main.netMode != NetmodeID.MultiplayerClient) { - int maxLength = death ? 80 : revenge ? 40 : expertMode ? 35 : 30; + int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30; int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { @@ -237,73 +252,76 @@ namespace CalamityMod.NPCs NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } - calamityGlobalNPC.newAI[2] = 1f; } + calamityGlobalNPC.newAI[2] = 1f; + } - // Big barf attack - if (calamityGlobalNPC.newAI[0] == 1f && !doSpiral && phase2) + // Big barf attack + if (calamityGlobalNPC.newAI[0] == 1f && (!doSpiral && phase2) || (getFuckedAI && !phase3)) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= (revenge ? 360f : 420f)) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= (revenge ? 360f : 420f)) + if (Vector2.Distance(player.Center, npc.Center) > 320f) { - if (Vector2.Distance(player.Center, npc.Center) > 320f) + npc.localAI[0] = 0f; + npc.netUpdate = true; + SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] = 0f; - npc.netUpdate = true; - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.position); + int totalProjectiles = bossRush ? 10 : expertMode ? 8 : 6; + if (phase3) + totalProjectiles *= 2; - if (Main.netMode != NetmodeID.MultiplayerClient) + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + for (int i = 0; i < totalProjectiles; i++) { - int totalProjectiles = bossRush ? 10 : expertMode ? 8 : 6; - if (phase3) - totalProjectiles *= 2; + Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + velocity.Normalize(); + velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - velocity.Normalize(); - velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f; + float maximumVelocityMult = death ? 0.75f : 0.5f; + if (expertMode) + velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio)); - float maximumVelocityMult = death ? 0.75f : 0.5f; - if (expertMode) - velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio)); - - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(velocity) * 5f, velocity, type, damage, 0f, Main.myPlayer); - } + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(velocity) * 5f, velocity, type, damage, 0f, Main.myPlayer); } } } } } + } - // Fire teeth depending on body type - else + // Fire teeth depending on body type + else + { + if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4)) { - if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4)) - { - npc.localAI[0] += 1f; - float shootProjectile = 300; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; + npc.localAI[0] += 1f; + float shootProjectile = 300; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; - if (npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) + { + if (npc.localAI[0] % divisor == 0f && (npc.ai[0] % 3f == 0f || getFuckedAI || !death)) { - if (npc.localAI[0] % divisor == 0f && (npc.ai[0] % 3f == 0f || !death)) + npc.TargetClosest(); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + SoundEngine.PlaySound(SoundID.Item17, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Item17, npc.Center); float toothVelocity = death ? 9f : 8f; Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); float accelerate = phase4 ? 1f : 0f; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * toothVelocity, type, damage, 0f, Main.myPlayer, accelerate, 0f); - npc.netUpdate = true; } + npc.netUpdate = true; } } } @@ -344,7 +362,7 @@ namespace CalamityMod.NPCs } float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; - if (player.dead || Vector2.Distance(npc.Center, player.Center) > maxDistance) + if (player.dead || Vector2.Distance(npc.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) { calamityGlobalNPC.newAI[1] = 1f; npc.TargetClosest(false); @@ -415,10 +433,10 @@ namespace CalamityMod.NPCs } num188 += 3f * enrageScale; num189 += 0.06f * enrageScale; - if (death) + if (death || getFuckedAI) { num188 += 5f; - num189 -= 0.03f; + num189 -= getFuckedAI ? 0f : 0.03f; num188 += Vector2.Distance(player.Center, npc.Center) * 0.001f; num189 += Vector2.Distance(player.Center, npc.Center) * 0.000045f; } @@ -580,6 +598,7 @@ namespace CalamityMod.NPCs public static void BrimstoneElementalAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + BrimstoneElemental.BrimstoneElemental brimmy = npc.ModNPC(); // Used for Brimling AI states CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; @@ -587,9 +606,6 @@ namespace CalamityMod.NPCs // Emit light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.2f, 0f, 0f); - // Center - Vector2 vectorCenter = npc.Center; - // Set damage npc.damage = npc.defDamage; @@ -603,7 +619,7 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; - bool despawnDistance = Vector2.Distance(player.Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance350Tiles; + bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; if (!player.active || player.dead || despawnDistance) { @@ -690,7 +706,7 @@ namespace CalamityMod.NPCs { if (Main.rand.Next(3) < dustAmt) { - int dust = Dust.NewDust(vectorCenter - new Vector2(size), size * 2, size * 2, 235, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); + int dust = Dust.NewDust(npc.Center - new Vector2(size), size * 2, size * 2, 235, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.2f; Main.dust[dust].fadeIn = 1f; @@ -728,12 +744,42 @@ namespace CalamityMod.NPCs npc.rotation = npc.velocity.X * 0.04f; if (npc.ai[0] != 5 || (npc.ai[1] < 180f && npc.ai[0] == 5f)) { - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = npc.Center.X - player.Center.X; npc.direction = playerLocation < 0f ? 1 : -1; npc.spriteDirection = npc.direction; } } + if (CalamityWorld.getFixedBoi) // in gfb, Brimmy channels the power of the other elementals. + { + int newMode; + if (lifeRatio <= 0.8f && lifeRatio > 0.6f) + { + newMode = 1; // Sand + } + else if (lifeRatio <= 0.6f && lifeRatio > 0.4f) + { + newMode = 2; // Rare Sand + } + else if (lifeRatio <= 0.4f && lifeRatio > 0.2f) + { + newMode = 3; // Cloud + } + else if (lifeRatio <= 0.2f) + { + newMode = 4; // Water + } + else + { + newMode = 0; // Brimstone, default + } + if (newMode != brimmy.currentMode) + { + SoundEngine.PlaySound(SoundID.Item29, npc.Center); + } + brimmy.currentMode = newMode; + } + if (npc.ai[0] == -1f) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -825,11 +871,14 @@ namespace CalamityMod.NPCs npc.alpha += bossRush ? 4 : death ? 3 : 2; if (npc.alpha >= 255) { - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(ModContent.NPCType()) < (death ? 1 : 2) && revenge) + int spawnType = brimmy.currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); + int enemyCount = brimmy.currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && brimmy.currentMode != 2) // dont spawn anything if gfb rare sand { - NPC.NewNPC(npc.GetSource_FromAI(), (int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); + for (int i = 0; i < enemyCount; i++) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, spawnType); } - SoundEngine.PlaySound(SoundID.Item8, vectorCenter); + SoundEngine.PlaySound(SoundID.Item8, npc.Center); npc.alpha = 255; npc.position = position; for (int n = 0; n < 15; n++) @@ -848,6 +897,42 @@ namespace CalamityMod.NPCs // Avoid cheap bullshit npc.damage = 0; + if (npc.alpha >= 255) + { + if (CalamityWorld.getFixedBoi) + { + SoundEngine.PlaySound(SoundID.Item68, npc.Center); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 pos = npc.Center; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + if (brimmy.currentMode >= 1 && brimmy.currentMode <= 3) + { + int tornadoType = brimmy.currentMode == 3 ? ModContent.ProjectileType() : ProjectileID.SandnadoHostileMark; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (brimmy.currentMode == 2) + { + int healAmt = npc.lifeMax / 25; + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } + npc.alpha -= 50; if (npc.alpha <= 0) { @@ -875,7 +960,7 @@ namespace CalamityMod.NPCs npc.chaseable = true; npc.rotation = npc.velocity.X * 0.04f; - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = npc.Center.X - player.Center.X; npc.direction = playerLocation < 0f ? 1 : -1; npc.spriteDirection = npc.direction; @@ -891,6 +976,11 @@ namespace CalamityMod.NPCs float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); + if (brimmy.currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item30, player.Center); + } Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * velocity; int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(projectileVelocity) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); Main.projectile[proj].timeLeft = 240; @@ -900,6 +990,11 @@ namespace CalamityMod.NPCs velocity = (death ? 5f : 4f) + 2f * enrageScale; type = ModContent.ProjectileType(); damage = npc.GetProjectileDamage(type); + if (brimmy.currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item21, player.Center); + } projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * velocity; int numProj = death ? 8 : 4; int spread = death ? 90 : 45; @@ -951,14 +1046,14 @@ namespace CalamityMod.NPCs float projectileSpeed = death ? 9f : revenge ? 8f : 6f; projectileSpeed += 2f * enrageScale; - vectorCenter = player.Center - vectorCenter; + Vector2 projectileVelocity = player.Center - npc.Center; float radialOffset = 0.2f; float diameter = 80f; - vectorCenter = Vector2.Normalize(vectorCenter) * projectileSpeed; + projectileVelocity = Vector2.Normalize(projectileVelocity) * projectileSpeed; - Vector2 velocity = vectorCenter; + Vector2 velocity = projectileVelocity; velocity.Normalize(); velocity *= diameter; @@ -970,7 +1065,7 @@ namespace CalamityMod.NPCs { float radians = j - (totalProjectiles - 1f) / 2f; Vector2 offset = velocity.RotatedBy(offsetAngle * radians); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, vectorCenter, type, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 300; Main.projectile[proj].tileCollide = false; } @@ -979,6 +1074,11 @@ namespace CalamityMod.NPCs float radians2 = MathHelper.TwoPi / totalProjectiles; type = ModContent.ProjectileType(); damage = npc.GetProjectileDamage(type); + if (brimmy.currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item26, player.Center); + } double angleA = radians2 * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB)); @@ -1005,7 +1105,7 @@ namespace CalamityMod.NPCs npc.velocity *= 0.95f; npc.rotation = npc.velocity.X * 0.04f; - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = npc.Center.X - player.Center.X; npc.direction = playerLocation < 0f ? 1 : -1; npc.spriteDirection = npc.direction; @@ -1029,7 +1129,7 @@ namespace CalamityMod.NPCs npc.defense = npc.defDefense * 2; - Vector2 source = new Vector2(vectorCenter.X + (npc.spriteDirection > 0 ? 34f : -34f), vectorCenter.Y - 74f); + Vector2 source = new Vector2(npc.Center.X + (npc.spriteDirection > 0 ? 34f : -34f), npc.Center.Y - 74f); Vector2 aimAt = player.Center + player.velocity * 20f; float aimResponsiveness = bossRush ? 0.05f : (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; @@ -1072,11 +1172,11 @@ namespace CalamityMod.NPCs else if (npc.ai[1] >= 180f) { npc.velocity *= 0.95f; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (npc.ai[1] == 180f) { - if (npc.ai[1] == 180f) + SoundEngine.PlaySound(SoundID.Item68, source); + if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Item68, source); Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); laserVelocity2.Normalize(); int type = ModContent.ProjectileType(); @@ -1084,6 +1184,11 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); if (Main.getGoodWorld) Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + if (CalamityWorld.getFixedBoi) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } } } } @@ -1110,7 +1215,7 @@ namespace CalamityMod.NPCs } if (npc.ai[1] % playSoundTimer == 0f) - SoundEngine.PlaySound(SoundID.Item20, npc.position); + SoundEngine.PlaySound(SoundID.Item20, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1120,6 +1225,12 @@ namespace CalamityMod.NPCs if (Main.getGoodWorld) Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + if (CalamityWorld.getFixedBoi) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + calamityGlobalNPC.newAI[0] = 1f; } else @@ -1131,6 +1242,11 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); if (Main.getGoodWorld) Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); + if (CalamityWorld.getFixedBoi) + { + Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); + } } } } @@ -1173,9 +1289,9 @@ namespace CalamityMod.NPCs // Seeker ring if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode) { + SoundEngine.PlaySound(SoundID.Item72, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Item72, npc.position); int seekerAmt = death ? 10 : 5; int seekerSpread = 360 / seekerAmt; int seekerDistance = death ? 180 : 150; @@ -1200,35 +1316,35 @@ namespace CalamityMod.NPCs // Bullet hells at 70% and 10%, brothers at 40% if (npc.life > 0) { - if (Main.netMode != NetmodeID.MultiplayerClient) + int num660 = (int)(npc.lifeMax * 0.3); + if ((npc.life + num660) < calamityGlobalNPC.newAI[0]) { - int num660 = (int)(npc.lifeMax * 0.3); - if ((npc.life + num660) < calamityGlobalNPC.newAI[0]) + calamityGlobalNPC.newAI[0] = npc.life; + if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.1) { - calamityGlobalNPC.newAI[0] = npc.life; - if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.1) - { - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - calamityGlobalNPC.newAI[2] = 2f; - SpawnDust(); - } - else if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.4) + SoundEngine.PlaySound(SoundID.Item109, npc.Center); + calamityGlobalNPC.newAI[2] = 2f; + SpawnDust(); + } + else if (calamityGlobalNPC.newAI[0] <= npc.lifeMax * 0.4) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - - string key = "Mods.CalamityMod.CalamitasBossText2"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - SpawnDust(); - } - else - { - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - calamityGlobalNPC.newAI[2] = 1f; - SpawnDust(); } + + string key = "Mods.CalamityMod.CalamitasBossText2"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + SpawnDust(); + } + else + { + SoundEngine.PlaySound(SoundID.Item109, npc.Center); + calamityGlobalNPC.newAI[2] = 1f; + SpawnDust(); } } } @@ -1466,6 +1582,10 @@ namespace CalamityMod.NPCs { int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); + if (CalamityWorld.getFixedBoi) + { + type = ModContent.ProjectileType(); + } float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; float projSpeed = bossRush ? 6.25f : 5f; if (calamityGlobalNPC.newAI[3] <= 300f) @@ -1955,7 +2075,7 @@ namespace CalamityMod.NPCs if (npc.localAI[2] > 22f) { npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.position); + SoundEngine.PlaySound(SoundID.Item34, npc.Center); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1991,7 +2111,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 1f) { - SoundEngine.PlaySound(SoundID.Roar, npc.position); + SoundEngine.PlaySound(SoundID.Roar, npc.Center); npc.rotation = num842; float num870 = 14f + (death ? 4f * (1f - lifeRatio) : 0f); @@ -2011,6 +2131,28 @@ namespace CalamityMod.NPCs npc.velocity.X = num871 * num873; npc.velocity.Y = num872 * num873; npc.ai[1] = 2f; + + if (CalamityWorld.getFixedBoi) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); + if (bossRush) + damage /= 2; + int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } return; } @@ -2235,7 +2377,7 @@ namespace CalamityMod.NPCs if (npc.localAI[2] > 36f) { npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.position); + SoundEngine.PlaySound(SoundID.Item34, npc.Center); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2271,7 +2413,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 1f) { - SoundEngine.PlaySound(SoundID.Roar, npc.position); + SoundEngine.PlaySound(SoundID.Roar, npc.Center); npc.rotation = num842; float num870 = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); @@ -2291,6 +2433,28 @@ namespace CalamityMod.NPCs npc.velocity.X = num871 * num873; npc.velocity.Y = num872 * num873; npc.ai[1] = 2f; + + if (CalamityWorld.getFixedBoi) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); + if (bossRush) + damage /= 2; + int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } return; } @@ -2339,13 +2503,28 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.astrumAureus = npc.whoAmI; + // Variables bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - npc.damage = npc.defDamage; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f); + bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f); + bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode; + bool phase5 = lifeRatio < 0.3f && revenge; + + // Exhaustion + bool exhausted = npc.ai[2] >= (phase3 ? 2f : 1f); + calamityGlobalNPC.DR = exhausted ? 0.25f : 0.5f; + npc.defense = exhausted ? npc.defDefense / 2 : npc.defDefense; + npc.damage = exhausted ? 0 : npc.defDamage; // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit float noProjectileOrPhaseIncrementTime = 240f; @@ -2373,9 +2552,6 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - float enrageScale = bossRush ? 1f : 0f; if (Main.dayTime || bossRush) { @@ -2383,17 +2559,11 @@ namespace CalamityMod.NPCs enrageScale += 1f; } - // Phases - bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f); - bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f); - bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode; - bool phase5 = lifeRatio < 0.3f && revenge; - float astralFlameBarrageTimerIncrement = 1f; if (expertMode) astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); - float walkingVelocity = death ? 6f : 5f; + float walkingVelocity = 5f; walkingVelocity += 3f * enrageScale; if (phase5) walkingVelocity += 2f; @@ -2404,7 +2574,7 @@ namespace CalamityMod.NPCs if (Main.getGoodWorld) walkingVelocity *= 1.15f; - float walkingProjectileVelocity = walkingVelocity - (1.5f * enrageScale); + float walkingProjectileVelocity = walkingVelocity * 0.8f; // Direction npc.spriteDirection = (npc.direction > 0) ? 1 : -1; @@ -2449,6 +2619,63 @@ namespace CalamityMod.NPCs else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f; + bool geldonPhase2 = lifeRatio <= 0.1f; + if (CalamityWorld.getFixedBoi && (geldonPhase1 || geldonPhase2)) + { + AstrumAureus.AstrumAureus astrumAureus = npc.ModNPC(); + astrumAureus.slimeProjCounter++; + if (astrumAureus.slimeProjCounter % 180 == 0) + { + SoundEngine.PlaySound(SoundID.Item33, npc.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (astrumAureus.slimePhase == 1) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + astrumAureus.slimePhase = 0; + } + else + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float num1070 = 7f; + float num1071 = player.Center.X - npc.Center.X; + float num1072 = player.Center.Y - npc.Center.Y; + float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); + num1073 = num1070 / num1073; + num1071 *= num1073; + num1072 *= num1073; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, num1071, num1072, type, damage, 0f, Main.myPlayer); + for (int i = 0; i < 4; i++) + { + Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, num1071 + offset.X, num1072 + offset.Y, type, damage, 0f, Main.myPlayer); + } + astrumAureus.slimePhase = 1; + } + } + } + CalamityGlobalAI.BuffedMimicAI(npc, mod); + npc.noGravity = false; + npc.noTileCollide = false; + return; + } + else + { + npc.noGravity = true; + } + // Emit light when not Idle if (npc.ai[0] != 1f) Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); @@ -2466,7 +2693,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] >= 5f && npc.ai[0] != 7) { npc.localAI[0] = 0f; - SoundEngine.PlaySound(SoundID.Item109, npc.position); + SoundEngine.PlaySound(SoundID.Item109, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2490,7 +2717,7 @@ namespace CalamityMod.NPCs { npc.localAI[0] = 0f; - SoundEngine.PlaySound(SoundID.Item33, npc.position); + SoundEngine.PlaySound(SoundID.Item33, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -2513,7 +2740,7 @@ namespace CalamityMod.NPCs if (phase3) { - float flameVelocity = walkingProjectileVelocity * 2f; + float flameVelocity = walkingProjectileVelocity; maxProjectiles = 2; spread = 45; @@ -2571,14 +2798,31 @@ namespace CalamityMod.NPCs // Slow down npc.velocity.X *= 0.8f; - // Stay vulnerable for a maximum of 2 seconds + // Stay vulnerable for 3 seconds npc.ai[1] += 1f; - if (npc.ai[1] >= (phase2 ? 30f : 120f) || bossRush) + if (npc.ai[1] >= 180f || bossRush) { - // Set AI to next phase (Walk) and reset other AI + // Set AI to random state and reset other AI arrays npc.TargetClosest(); - npc.ai[0] = Main.rand.NextBool() ? 3f : 2f; + switch (Main.rand.Next(phase3 ? 3 : 2)) + { + case 0: + npc.ai[0] = 2f; + break; + + case 1: + npc.ai[0] = 3f; + break; + + case 2: + npc.ai[0] = 5f; + break; + + default: + break; + } npc.ai[1] = 0f; + npc.ai[2] = 0f; // Stop colliding with tiles if entering walking phase npc.noTileCollide = npc.ai[0] == 2f; @@ -2668,8 +2912,9 @@ namespace CalamityMod.NPCs // Set AI to next phase (Jump) and reset other AI npc.TargetClosest(); - npc.ai[0] = Main.rand.NextBool() ? (phase2 ? 5f : 1f) : 3f; + npc.ai[0] = exhausted ? 1f : 3f; npc.ai[1] = 0f; + npc.ai[2] += 1f; npc.netUpdate = true; } @@ -2706,17 +2951,18 @@ namespace CalamityMod.NPCs // The limit for how much Aureus can multiply its jump velocity float speedMultLimit = 1f; + // Maxes out when the player is a full 2000 pixels away from or above Aureus + float multiplier = 1f / 2000f; + // Increase Aureus jump velocity X if it's far enough away from the player float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis); float distanceGateValue = 400f; bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode; if (increaseJumpVelocityX) { - // Maxes out when the player is a full 1920 pixels away from Aureus - float multiplier = 1f / 1920f; - calamityGlobalNPC.newAI[1] = (distanceAwayFromTarget - distanceGateValue) * multiplier; - if (calamityGlobalNPC.newAI[1] > speedMultLimit) - calamityGlobalNPC.newAI[1] = speedMultLimit; + calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier; + if (calamityGlobalNPC.newAI[0] > speedMultLimit) + calamityGlobalNPC.newAI[0] = speedMultLimit; } // Increase Aureus jump velocity Y if it's far enough above the player @@ -2724,28 +2970,28 @@ namespace CalamityMod.NPCs bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge; if (increaseJumpVelocityY) { - // Maxes out when the player is a full 1080 pixels above Aureus - float multiplier = 1f / 1080f; - calamityGlobalNPC.newAI[0] = distanceBelowTarget * multiplier; - if (calamityGlobalNPC.newAI[0] > speedMultLimit) - calamityGlobalNPC.newAI[0] = speedMultLimit; + calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier; + if (calamityGlobalNPC.newAI[1] > speedMultLimit) + calamityGlobalNPC.newAI[1] = speedMultLimit; } - float velocity = 24f; + float velocity = 20f; velocity += 6f * enrageScale; if (expertMode) - velocity += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); + velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); if (Main.getGoodWorld) velocity *= 1.15f; npc.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - npc.Center).SafeNormalize(Vector2.Zero) * velocity; npc.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f); - npc.noTileCollide = expertMode; + npc.noTileCollide = true; npc.ai[0] = 4f; npc.ai[1] = 0f; + SoundEngine.PlaySound(AstrumAureus.AstrumAureus.JumpSound, npc.Center); + npc.netUpdate = true; } } @@ -2761,21 +3007,27 @@ namespace CalamityMod.NPCs if (npc.velocity.Y == 0f) { // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc - SoundEngine.PlaySound(NPCs.AstrumAureus.AstrumAureus.StompSound, npc.position); + SoundStyle soundToPlay = CalamityWorld.getFixedBoi ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound; + SoundEngine.PlaySound(soundToPlay, npc.Center); + + if (CalamityWorld.getFixedBoi) + { + float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) npc.TargetClosest(); - npc.ai[2] += 1f; + npc.localAI[1] += 1f; float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f; - if (npc.ai[2] >= maxStompAmt) + if (npc.localAI[1] >= maxStompAmt) { - npc.ai[0] = phase2 ? (Main.rand.NextBool() ? (phase3 ? 2f : 1f) : 5f) : (Main.rand.NextBool() ? 2f : 1f); - npc.ai[2] = 0f; + npc.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f); + npc.localAI[1] = 0f; + npc.ai[2] += 1f; npc.ai[3] = 0f; - - // Stop colliding with tiles if entering walking phase - npc.noTileCollide = npc.ai[0] == 2f; - + npc.noTileCollide = false; npc.netUpdate = true; } else @@ -2802,16 +3054,30 @@ namespace CalamityMod.NPCs } // Fire lasers or flames on stomp - SoundEngine.PlaySound(SoundID.Item33, npc.position); + SoundEngine.PlaySound(SoundID.Item33, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - if (calamityGlobalNPC.newAI[2] == 0f) + if (CalamityWorld.getFixedBoi) + { + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + else if (calamityGlobalNPC.newAI[2] == 0f && phase2) { calamityGlobalNPC.newAI[2] = 1f; - float flameVelocity = 12f; - int maxProjectiles = !phase2 ? (bossRush ? 3 : death ? 2 : 1) : (bossRush ? 4 : death ? 3 : 2); - int spread = !phase2 ? (bossRush ? 28 : death ? 22 : 16) : (bossRush ? 36 : death ? 28 : 20); + float flameVelocity = 6f; + int maxProjectiles = bossRush ? 4 : death ? 3 : 2; + int spread = bossRush ? 36 : death ? 28 : 20; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -2822,14 +3088,14 @@ namespace CalamityMod.NPCs for (int i = 0; i < maxProjectiles; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } else { calamityGlobalNPC.newAI[2] = 0f; - float laserVelocity = death ? 7f : 6f; + float laserVelocity = death ? 6f : 5f; int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13); int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); @@ -2853,7 +3119,7 @@ namespace CalamityMod.NPCs { // Set velocities while falling, this happens before the stomp // Fall through - if (!player.dead && expertMode) + if (!player.dead) { if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) npc.noTileCollide = true; @@ -2876,12 +3142,12 @@ namespace CalamityMod.NPCs npc.velocity.Y = -3f; float fallSpeed = 1.2f; - fallSpeed += 0.8f * enrageScale; + fallSpeed += 0.36f * enrageScale; if (expertMode) - fallSpeed += death ? 0.6f * (1f - lifeRatio) : 0.4f * (1f - lifeRatio); + fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); - if (calamityGlobalNPC.newAI[0] > 0f) - fallSpeed *= calamityGlobalNPC.newAI[0] + 1f; + if (calamityGlobalNPC.newAI[1] > 0f) + fallSpeed *= calamityGlobalNPC.newAI[1] + 1f; npc.velocity.Y += fallSpeed; } @@ -2892,8 +3158,8 @@ namespace CalamityMod.NPCs float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f; velocityXChange += 0.1f * enrageScale; - if (calamityGlobalNPC.newAI[1] > 0f) - velocityXChange *= calamityGlobalNPC.newAI[1] + 1f; + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXChange *= calamityGlobalNPC.newAI[0] + 1f; if (npc.direction < 0) npc.velocity.X -= velocityXChange; @@ -2901,12 +3167,12 @@ namespace CalamityMod.NPCs npc.velocity.X += velocityXChange; float velocityXCap = 12f; - velocityXCap += 8f * enrageScale; + velocityXCap += 3.6f * enrageScale; if (expertMode) - velocityXCap += death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); - if (calamityGlobalNPC.newAI[1] > 0f) - velocityXCap *= calamityGlobalNPC.newAI[1] + 1f; + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXCap *= calamityGlobalNPC.newAI[0] + 1f; float playerLocation = npc.Center.X - player.Center.X; int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; @@ -2934,14 +3200,14 @@ namespace CalamityMod.NPCs // Slow down npc.velocity.X *= 0.8f; - // Spawn slimes and start teleport + // Start teleport if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; if (death) npc.localAI[2] += 1.25f; - if (phase3) + if (phase4) { npc.localAI[1] += 1f; if (death) @@ -2950,55 +3216,39 @@ namespace CalamityMod.NPCs if (npc.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f)) { - // Spawn slimes - bool spawnFlag = revenge; - if (NPC.CountNPCS(ModContent.NPCType()) > 1) - spawnFlag = false; - - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - - if (death) - { - int damageAmt = npc.lifeMax / 100; - npc.life -= damageAmt; - if (npc.life < 1) - npc.life = 1; - - npc.HealEffect(-damageAmt, true); - } - } - // Reset localAI and find a teleport destination npc.TargetClosest(); npc.localAI[1] = 0f; - int num1249 = 0; - int num1250; - int num1251; - while (true) + Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f; + Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int num235 = 5; + int num238 = 0; + while (num238 < 100) { - num1249++; - num1250 = (int)player.Center.X / 16; - num1251 = (int)player.Center.Y / 16; - num1250 += Main.rand.Next(-30, 31); - num1251 += Main.rand.Next(-30, 31); + num238++; + int num239 = Main.rand.Next(point4.X - num235, point4.X + num235 + 1); + int num240 = Main.rand.Next(point4.Y - num235, point4.Y); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2(num1250 * 16, num1251 * 16), 1, 1, player.position, player.width, player.height)) + if (!Main.tile[num239, num240].HasUnactuatedTile) + { + npc.ai[1] = num239 * 16 + 8; + npc.ai[3] = num240 * 16 + 16; break; - - if (num1249 > 100) - goto Block; + } } - // Set AI to next phase (Mid-teleport), set AI 2 and 3 to teleport coordinates X and Y respectively + // Default teleport if the above conditions aren't met in 100 iterations + if (num238 >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; + npc.ai[1] = bottom.X; + npc.ai[3] = bottom.Y; + } + + // Set AI to next phase (Mid-teleport) npc.ai[0] = 6f; - npc.ai[2] = num1250; - npc.ai[3] = num1251; npc.netUpdate = true; - Block: - ; } } @@ -3014,7 +3264,7 @@ namespace CalamityMod.NPCs if (death) npc.localAI[2] += 1.25f; - if (phase3) + if (phase4) { if (death) npc.localAI[2] += 1.25f; @@ -3025,8 +3275,7 @@ namespace CalamityMod.NPCs if (npc.alpha >= 255) { // Set position to teleport destination - npc.position.X = npc.ai[2] * 16f - (npc.width / 2); - npc.position.Y = npc.ai[3] * 16f - (npc.height / 2); + npc.Bottom = new Vector2(npc.ai[1], npc.ai[3]); // Reset alpha and set AI to next phase (End of teleport) npc.alpha = 255; @@ -3039,7 +3288,7 @@ namespace CalamityMod.NPCs if (npc.soundDelay == 0) { npc.soundDelay = 15; - SoundEngine.PlaySound(SoundID.Item109, npc.position); + SoundEngine.PlaySound(SoundID.Item109, npc.Center); } // Emit dust to make the teleport pretty @@ -3064,17 +3313,25 @@ namespace CalamityMod.NPCs if (npc.alpha <= 0) { // Spawn slimes - bool spawnFlag = phase4; - if (NPC.CountNPCS(ModContent.NPCType()) > 1) + bool spawnFlag = expertMode; + if (NPC.CountNPCS(ModContent.NPCType()) >= 2) spawnFlag = false; if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + int slime = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + Main.npc[slime].velocity.Y = -10f; + Main.npc[slime].netUpdate = true; + if (revenge) + { + slime = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); + Main.npc[slime].velocity.Y = -15f; + Main.npc[slime].netUpdate = true; + } if (death) { - int damageAmt = npc.lifeMax / 100; + int damageAmt = npc.lifeMax / 50; npc.life -= damageAmt; if (npc.life < 1) npc.life = 1; @@ -3085,8 +3342,9 @@ namespace CalamityMod.NPCs // Reset alpha and set AI to next phase (Idle) npc.alpha = 0; - npc.ai[0] = phase3 ? (Main.rand.NextBool() ? 3f : 2f) : (Main.rand.NextBool() ? 1f : 2f); - npc.ai[2] = 0f; + npc.ai[0] = exhausted ? 1f : 2f; + npc.ai[1] = 0f; + npc.ai[2] += 1f; npc.localAI[3] = noProjectileOrPhaseIncrementTime; // Stop colliding with tiles if entering walking phase @@ -3099,7 +3357,7 @@ namespace CalamityMod.NPCs if (npc.soundDelay == 0) { npc.soundDelay = 15; - SoundEngine.PlaySound(SoundID.Item109, npc.position); + SoundEngine.PlaySound(SoundID.Item109, npc.Center); } // Emit dust to make the teleport pretty @@ -3118,8 +3376,8 @@ namespace CalamityMod.NPCs float gravity = 0.36f + 0.12f * enrageScale; float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale; - if (calamityGlobalNPC.newAI[0] > 0f && !reduceFallSpeed) - maxFallSpeed *= calamityGlobalNPC.newAI[0] + 1f; + if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) + maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; if (Main.getGoodWorld && !reduceFallSpeed) { @@ -3217,7 +3475,8 @@ namespace CalamityMod.NPCs // Length of worms int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; int phase2Length = phase1Length / 2; - int maxLength = doubleWormPhase ? phase2Length : phase1Length; + int gfbLength = phase1Length / 10; + int maxLength = CalamityWorld.getFixedBoi && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; // Split into two worms if (head) @@ -3302,48 +3561,52 @@ namespace CalamityMod.NPCs // Do not spawn worms client side. The server handles this. if (Main.netMode != NetmodeID.MultiplayerClient) { - // Now that the original worm doesn't exist, startCount can be zero. - // int startCount = npc.whoAmI + phase1Length + 1; - int startIndexHeadOne = 1; - int headOneID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadOne); - Main.npc[headOneID].Calamity().newAI[0] = 1f; - Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; - Main.npc[headOneID].timeLeft *= 20; - Main.npc[headOneID].netUpdate = true; - - // On server, immediately send the correct extra AI of this head to clients. - if (Main.netMode == NetmodeID.Server) + int wormamt = CalamityWorld.getFixedBoi ? 5 : 1; + for (int i = 0; i < wormamt; i++) { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - netMessage.Write((byte)headOneID); - netMessage.Write(Main.npc[headOneID].Calamity().newAI[0]); - netMessage.Write(Main.npc[headOneID].Calamity().newAI[1]); - netMessage.Write(Main.npc[headOneID].Calamity().newAI[2]); - netMessage.Write(Main.npc[headOneID].Calamity().newAI[3]); - netMessage.Send(); - } + // Now that the original worm doesn't exist, startCount can be zero. + // int startCount = npc.whoAmI + phase1Length + 1; + int startIndexHeadOne = 1; + int headOneID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadOne); + Main.npc[headOneID].Calamity().newAI[0] = 1f; + Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; + Main.npc[headOneID].timeLeft *= 20; + Main.npc[headOneID].netUpdate = true; - // Make sure the second split worm is also contiguous. - int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; - int headTwoID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadTwo); - Main.npc[headTwoID].Calamity().newAI[0] = 2f; - Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; - Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; - Main.npc[headTwoID].timeLeft *= 20; - Main.npc[headTwoID].netUpdate = true; + // On server, immediately send the correct extra AI of this head to clients. + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)headOneID); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[0]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[1]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[2]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[3]); + netMessage.Send(); + } - // On server, immediately send the correct extra AI of this head to clients. - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - netMessage.Write((byte)headTwoID); - netMessage.Write(Main.npc[headTwoID].Calamity().newAI[0]); - netMessage.Write(Main.npc[headTwoID].Calamity().newAI[1]); - netMessage.Write(Main.npc[headTwoID].Calamity().newAI[2]); - netMessage.Write(Main.npc[headTwoID].Calamity().newAI[3]); - netMessage.Send(); + // Make sure the second split worm is also contiguous. + int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; + int headTwoID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadTwo); + Main.npc[headTwoID].Calamity().newAI[0] = 2f; + Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; + Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; + Main.npc[headTwoID].timeLeft *= 20; + Main.npc[headTwoID].netUpdate = true; + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)headTwoID); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[0]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[1]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[2]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[3]); + netMessage.Send(); + } } SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); @@ -3351,6 +3614,35 @@ namespace CalamityMod.NPCs return; } } + + if (CalamityWorld.getFixedBoi && calamityGlobalNPC.newAI[1] < 10f) // desync the deuses + { + float pushForce = 0.25f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherDeus = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherDeus.active || k == npc.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherDeus.type == npc.type; + float taxicabDist = Vector2.Distance(npc.Center, otherDeus.Center); + float distancegate = 320f; + if (sameProjType && taxicabDist < distancegate) + { + if (npc.position.X < otherDeus.position.X) + npc.velocity.X -= pushForce; + else + npc.velocity.X += pushForce; + + if (npc.position.Y < otherDeus.position.Y) + npc.velocity.Y -= pushForce; + else + npc.velocity.Y += pushForce; + } + } + } } // Copy dontTakeDamage and Opacity from head @@ -3372,6 +3664,7 @@ namespace CalamityMod.NPCs npc.realLife = (int)npc.ai[2]; // Emit light + if (!CalamityWorld.getFixedBoi) Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); // Dust and alpha effects @@ -3909,8 +4202,6 @@ namespace CalamityMod.NPCs CalamityGlobalNPC.voidBoss = npc.whoAmI; - Vector2 vector = npc.Center; - // Percent life remaining double lifeRatio = npc.life / (double)npc.lifeMax; @@ -3947,12 +4238,12 @@ namespace CalamityMod.NPCs npc.ai[2] = 1f; for (int i = 0; i < darkEnergyAmt; i++) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); } // If there are any Dark Energies alive, change AI and don't take damage @@ -3965,7 +4256,7 @@ namespace CalamityMod.NPCs 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, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) npc.TargetClosest(); Player player = Main.player[npc.target]; @@ -3974,11 +4265,11 @@ namespace CalamityMod.NPCs bool moveVeryFast = Vector2.Distance(npc.Center, player.Center) > 960f || (!player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0); // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -4014,7 +4305,7 @@ namespace CalamityMod.NPCs // Move closer to the target before trying to succ if (movingDuringSuccPhase) { - if (Vector2.Distance(vector, player.Center) > 320f || !Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) + if (Vector2.Distance(npc.Center, player.Center) > 320f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) Movement(true); else npc.ai[3] = 1f; @@ -4041,7 +4332,7 @@ namespace CalamityMod.NPCs // Move towards target again if they get outside the succ radius float moveCloserGateValue = suckDistance * 0.75f; - if (Vector2.Distance(vector, player.Center) > moveCloserGateValue) + if (Vector2.Distance(npc.Center, player.Center) > moveCloserGateValue) npc.ai[3] = 0f; // Ceaseless Void sucks in dark energy in different patterns @@ -4052,7 +4343,7 @@ namespace CalamityMod.NPCs float distanceDivisor = h + 1f; float dustDistance = suckDistance / distanceDivisor; int numDust = (int)(0.1f * MathHelper.TwoPi * dustDistance); - float angleIncrement = MathHelper.TwoPi / (float)numDust; + float angleIncrement = MathHelper.TwoPi / numDust; Vector2 dustOffset = new Vector2(dustDistance, 0f); dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); @@ -4063,10 +4354,10 @@ namespace CalamityMod.NPCs if (Main.rand.NextBool(var)) { dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(vector, 1, 1, ModContent.DustType()); - Main.dust[dust].position = vector + dustOffset; + int dust = Dust.NewDust(npc.Center, 1, 1, ModContent.DustType()); + Main.dust[dust].position = npc.Center + dustOffset; Main.dust[dust].fadeIn = 1f; - Main.dust[dust].velocity = Vector2.Normalize(vector - Main.dust[dust].position) * dustVelocity; + Main.dust[dust].velocity = Vector2.Normalize(npc.Center - Main.dust[dust].position) * dustVelocity; Main.dust[dust].scale = 3f - h; } } @@ -4075,15 +4366,15 @@ namespace CalamityMod.NPCs float succPower = 0.125f + finalPhaseDustRatio * 0.125f; for (int i = 0; i < Main.maxPlayers; i++) { - float distance = Vector2.Distance(Main.player[i].Center, vector); + float distance = Vector2.Distance(Main.player[i].Center, npc.Center); if (distance < suckDistance && Main.player[i].grappling[0] == -1) { - if (Collision.CanHit(vector, 1, 1, Main.player[i].Center, 1, 1)) + if (Collision.CanHit(npc.Center, 1, 1, Main.player[i].Center, 1, 1)) { float distanceRatio = distance / suckDistance; float multiplier = 1f - distanceRatio; - if (Main.player[i].Center.X < vector.X) + if (Main.player[i].Center.X < npc.Center.X) Main.player[i].velocity.X += succPower * multiplier; else Main.player[i].velocity.X -= succPower * multiplier; @@ -4121,9 +4412,9 @@ namespace CalamityMod.NPCs // Beam Portals if (calamityGlobalNPC.newAI[1] == 0f) { - int numBeamPortals = bossRush ? 3 : revenge ? 2 : 1; + int numBeamPortals = bossRush ? 4 : revenge ? 3 : 2; float degrees = 360 / numBeamPortals; - float beamPortalDistance = bossRush ? 800f : death ? 960f : revenge ? 1000f : expertMode ? 1040f : 1080f; + float beamPortalDistance = bossRush ? 360f : death ? 400f : revenge ? 420f : expertMode ? 440f : 480f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); for (int i = 0; i < numBeamPortals; i++) @@ -4146,7 +4437,7 @@ namespace CalamityMod.NPCs // Suck in Dark Energy projectiles from far away calamityGlobalNPC.newAI[3] += 1f; - float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 36f : 12f) * projectileFireRateMultiplier; + float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 24f : 12f) * projectileFireRateMultiplier; if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) { calamityGlobalNPC.newAI[3] = 0f; @@ -4163,15 +4454,15 @@ namespace CalamityMod.NPCs float radialOffset = MathHelper.ToRadians(npc.localAI[1]); for (int i = 0; i < totalProjectiles; i++) { - Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; + Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); } npc.localAI[1] += 10f; } // Summon some extra projectiles in Expert Mode - if (phase2 && expertMode && !summonLessDarkEnergies) + if (phase2 && expertMode) { npc.localAI[2] += 1f; if (npc.localAI[2] >= 60f * projectileFireRateMultiplier) @@ -4190,15 +4481,15 @@ namespace CalamityMod.NPCs float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); for (int i = 0; i < totalProjectiles; i++) { - Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; + Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); } } } // Summon some extra projectiles in Revengeance Mode - if (phase4 && revenge && !summonLessDarkEnergies) + if (phase4 && revenge) { npc.localAI[3] += 1f; if (npc.localAI[3] >= 90f * projectileFireRateMultiplier) @@ -4217,8 +4508,8 @@ namespace CalamityMod.NPCs float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); for (int i = 0; i < totalProjectiles; i++) { - Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; + Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); } } @@ -4240,13 +4531,15 @@ namespace CalamityMod.NPCs } // Destroy all Dark Energies if their total HP is below 20% - int darkEnergyMaxHP = bossRush ? 44000 : 12000; + int darkEnergyMaxHP = bossRush ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); if (totalDarkEnergyHP < succPhaseGateValue) { - SoundEngine.PlaySound(SoundID.NPCDeath44, vector); + SoundEngine.PlaySound(SoundID.NPCDeath44, npc.Center); // Kill all Dark Energies for (int i = 0; i < Main.maxNPCs; i++) @@ -4268,8 +4561,8 @@ namespace CalamityMod.NPCs random += j * 2; int dustAmtSpawned = 0; int scale = random * 13; - float dustPositionX = vector.X - (scale / 2); - float dustPositionY = vector.Y - (scale / 2); + float dustPositionX = npc.Center.X - (scale / 2); + float dustPositionY = npc.Center.Y - (scale / 2); while (dustAmtSpawned < dustAmt) { float dustVelocityX = Main.rand.Next(-random, random); @@ -4281,8 +4574,8 @@ namespace CalamityMod.NPCs dustVelocityY *= dustVelocity; int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f); Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = vector.X; - Main.dust[dust].position.Y = vector.Y; + Main.dust[dust].position.X = npc.Center.X; + Main.dust[dust].position.Y = npc.Center.Y; Main.dust[dust].position.X += Main.rand.Next(-10, 11); Main.dust[dust].position.Y += Main.rand.Next(-10, 11); Main.dust[dust].velocity.X = dustVelocityX; @@ -4398,34 +4691,34 @@ namespace CalamityMod.NPCs { for (int i = 0; i < darkEnergyAmt; i++) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 4f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 4f, 0f, 0f); } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 3f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 3f, 0f, 0f); } else if (phase3) { for (int i = 0; i < darkEnergyAmt; i++) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 3f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 3f, 0f, 0f); } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2f, 0f, 0f); } else { for (int i = 0; i < darkEnergyAmt; i++) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2.5f, 0f, 0f); } // Despawn potentially hazardous projectiles when entering a new phase @@ -4470,7 +4763,6 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - Vector2 vector = npc.Center; // Adjust slowing debuff immunity bool immuneToSlowingDebuffs = npc.ai[0] == 3f || npc.ai[0] == 3.1f || npc.ai[0] == 3.2f; @@ -4480,7 +4772,7 @@ namespace CalamityMod.NPCs npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; @@ -4495,7 +4787,7 @@ namespace CalamityMod.NPCs npc.localAI[1] = 0f; // If dragonfolly is off screen, enrage for the next couple attacks - if (Vector2.Distance(player.Center, vector) > 1200f) + if (Vector2.Distance(player.Center, npc.Center) > 1200f) npc.localAI[2] = 2f; // Enrage scale @@ -4516,12 +4808,12 @@ namespace CalamityMod.NPCs enrageScale = 3f; // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; @@ -4580,7 +4872,23 @@ namespace CalamityMod.NPCs // Sound if (calamityGlobalNPC.newAI[1] == newPhaseTimer - 60f) { - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = 0.25f }, npc.position); + float squawkpitch = CalamityWorld.getFixedBoi ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + int spacing = 20; + int amt = 5; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); + Vector2 ai0 = npc.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } } if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) @@ -4602,7 +4910,23 @@ namespace CalamityMod.NPCs // Sound if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) { - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = 0.25f }, npc.position); + float squawkpitch = CalamityWorld.getFixedBoi ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + int spacing = 20; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); + Vector2 ai0 = npc.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } } if (calamityGlobalNPC.newAI[0] >= newPhaseTimer) @@ -5083,7 +5407,23 @@ namespace CalamityMod.NPCs // Sound if (npc.ai[1] == birbSpawnPhaseTimer - 60f) { - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = 0.25f }, npc.position); + float squawkpitch = CalamityWorld.getFixedBoi ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + int spacing = 30; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); + Vector2 ai0 = npc.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -5126,13 +5466,28 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); if (ai0 > 3f) ai0 = 3f; Projectile.NewProjectile(npc.GetSource_FromAI(), vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); npc.netUpdate = true; } + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + int spacing = 30; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); + Vector2 ai0 = npc.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } } npc.ai[1] += 1f; @@ -5148,12 +5503,11 @@ namespace CalamityMod.NPCs public static void Bumblebirb2AI(NPC npc, Mod mod, bool bossMinion) { Player player = Main.player[npc.target]; - Vector2 vector = npc.Center; float rotationMult = 4f; float rotationAmt = 0.04f; - if (Vector2.Distance(player.Center, vector) > 5600f) + if (Vector2.Distance(player.Center, npc.Center) > 5600f) { if (npc.timeLeft > 5) { @@ -5226,7 +5580,7 @@ namespace CalamityMod.NPCs value44.Normalize(); value44 *= scaleFactor20; npc.velocity = (npc.velocity * (num1377 - 1f) + value44) / num1377; - if (Main.getGoodWorld) + if (Main.getGoodWorld && !CalamityWorld.getFixedBoi) npc.velocity *= 1.15f; } else if (npc.velocity.Length() > 2f) @@ -5276,7 +5630,7 @@ namespace CalamityMod.NPCs value45.Normalize(); value45 *= scaleFactor21; npc.velocity = (npc.velocity * (num1378 - 1f) + value45) / num1378; - if (Main.getGoodWorld) + if (Main.getGoodWorld && !CalamityWorld.getFixedBoi) npc.velocity *= 1.15f; npc.netSpam = 5; @@ -5305,7 +5659,7 @@ namespace CalamityMod.NPCs vector242.Normalize(); vector242 *= scaleFactor22; npc.velocity = (npc.velocity * (num1379 - 1f) + vector242) / num1379; - if (Main.getGoodWorld) + if (Main.getGoodWorld && !CalamityWorld.getFixedBoi) npc.velocity *= 1.15f; if (npc.velocity.X < 0f) @@ -5321,7 +5675,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] > 10f) { npc.velocity = vector242; - if (Main.getGoodWorld) + if (Main.getGoodWorld && !CalamityWorld.getFixedBoi) npc.velocity *= 1.15f; if (npc.velocity.X < 0f) @@ -5404,6 +5758,16 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] >= exhaustionGateValue) calamityGlobalNPC.newAI[1] = 1f; + float alphaScale = (255 - npc.alpha) / 255f; + float redLight = (phase3AI ? 0.4f : phase2AI ? 0.64f : 0.88f) * alphaScale; + float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), redLight, greenLight, 0f); + + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); + else if (!Main.raining) + CalamityUtils.StartRain(); + // Adjust stats calamityGlobalNPC.DR = exhausted ? 0f : 0.5f; npc.defense = exhausted ? 0 : npc.defDefense; @@ -5478,25 +5842,26 @@ namespace CalamityMod.NPCs idlePhaseVelocity *= 0.25f; // Variables - int toothBallBelchPhaseTimer = bossRush ? 35 : death ? 90 : 120; - int toothBallBelchPhaseDivisor = bossRush ? 7 : death ? 18 : 24; + int maxToothBallBelches = bossRush ? 5 : death ? 4 : 3; + int toothBallBelchPhaseDivisor = bossRush ? 24 : death ? 30 : 40; + int toothBallBelchPhaseTimer = toothBallBelchPhaseDivisor * maxToothBallBelches; float toothBallBelchPhaseAcceleration = bossRush ? 0.95f : death ? 0.6f : 0.55f; float toothBallBelchPhaseVelocity = bossRush ? 14f : death ? 10f : 9f; + float toothBallFinalVelocity = death ? 14f : revenge ? 13f : 12f; float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; float sharkronVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; int num9 = 120; int num10 = 180; int num12 = 30; - int num13 = bossRush ? 35 : death ? 90 : 120; - int toothBallSpinPhaseDivisor = bossRush ? 7 : death ? 18 : 24; - float spinTime = num13 / 2; + int toothBallSpinPhaseDivisor = bossRush ? 27 : death ? 32 : 45; + int num13 = maxToothBallBelches * toothBallSpinPhaseDivisor; + float spinTime = num13 / 2f; float toothBallSpinToothBallVelocity = bossRush ? 14f : death ? 9.5f : 9f; - float scaleFactor4 = 22f; + float scaleFactor4 = CalamityWorld.getFixedBoi ? 44f : 22f; float num15 = MathHelper.TwoPi / spinTime; int num16 = 75; - Vector2 vector = npc.Center; Player player = Main.player[npc.target]; // Get target @@ -5508,11 +5873,11 @@ namespace CalamityMod.NPCs } // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) npc.TargetClosest(); // Despawn - if (player.dead || Vector2.Distance(player.Center, vector) > 8800f) + if (player.dead || Vector2.Distance(player.Center, npc.Center) > 8800f) { npc.TargetClosest(); @@ -5547,6 +5912,28 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] % 60f == 0f) SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound, player.Center); + if (CalamityWorld.getFixedBoi) + { + float screenShakePower = 10 * Utils.GetLerpValue(800f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + if (calamityGlobalNPC.newAI[0] == exhaustionGateValue) + { + SoundEngine.PlaySound(SoundID.NPCDeath64 with { Pitch = SoundID.NPCDeath64.Pitch - 0.9f, Volume = SoundID.NPCDeath64.Volume + 0.4f}, player.Center); // fart + } + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[0] % 5f == 0f) + { + Vector2 dist = player.Center - npc.Center; + dist.Normalize(); + dist *= 3; + dist.X += Main.rand.NextFloat(-0.5f, 0.5f); + dist.Y += Main.rand.NextFloat(-0.5f, 0.5f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, -dist, type, damage, 0, Main.myPlayer); + } + } + calamityGlobalNPC.newAI[0] -= bossRush ? 1.5f : 1f; if (calamityGlobalNPC.newAI[0] <= 0f) { @@ -5582,8 +5969,8 @@ namespace CalamityMod.NPCs // Enrage if (biomeEnraged) { - toothBallBelchPhaseTimer = 30; - toothBallBelchPhaseDivisor = 6; + toothBallBelchPhaseTimer = 60; + toothBallBelchPhaseDivisor = 20; toothBallBelchPhaseAcceleration = 1f; toothBallBelchPhaseVelocity = 15f; goreVelocityX = 12f; @@ -5594,7 +5981,7 @@ namespace CalamityMod.NPCs idlePhaseVelocity = 20f; chargeTime = 25; chargeVelocity += 8f; - toothBallSpinPhaseDivisor = 6; + toothBallSpinPhaseDivisor = 24; toothBallSpinToothBallVelocity = 15f; npc.damage = npc.defDamage * 2; npc.defense = npc.defDefense * 3; @@ -5622,7 +6009,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 8f || npc.ai[0] == 13f) rateOfRotation = 0.05f; - Vector2 rotationVector = player.Center - vector; + Vector2 rotationVector = player.Center - npc.Center; if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) { // Rotate to show direction of predictive charge @@ -5631,7 +6018,7 @@ namespace CalamityMod.NPCs if (npc.ai[3] < 6f) { rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; } } else if (npc.ai[0] == 5f && !phase3) @@ -5639,7 +6026,7 @@ namespace CalamityMod.NPCs if (npc.ai[3] < 4f) { rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; } } else if (npc.ai[0] == 10f) @@ -5647,7 +6034,7 @@ namespace CalamityMod.NPCs if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f) { rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; } } } @@ -5713,7 +6100,7 @@ namespace CalamityMod.NPCs npc.velocity *= 0.98f; // Direction - int num19 = Math.Sign(player.Center.X - vector.X); + int num19 = Math.Sign(player.Center.X - npc.Center.X); if (num19 != 0) { npc.direction = num19; @@ -5749,7 +6136,7 @@ namespace CalamityMod.NPCs Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f; } - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.position); + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); } npc.ai[2] += 1f; @@ -5767,13 +6154,13 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); + npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * idlePhaseVelocity; + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; npc.SimpleFlyMovement(vector3, idlePhaseAcceleration); // Rotation and direction - int num22 = Math.Sign(player.Center.X - vector.X); + int num22 = Math.Sign(player.Center.X - npc.Center.X); if (num22 != 0) { if (npc.ai[2] == 0f && num22 != npc.direction) @@ -5825,7 +6212,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; // Velocity - Vector2 distanceVector = player.Center + player.velocity * 20f - vector; + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); @@ -5880,7 +6267,7 @@ namespace CalamityMod.NPCs int num24 = 7; for (int j = 0; j < num24; j++) { - Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * pie / num24) + vector; + Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * pie / num24) + npc.Center; Vector2 vector4 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f); Main.dust[num25].noGravity = true; @@ -5907,29 +6294,64 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); + npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * toothBallBelchPhaseVelocity; + Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * toothBallBelchPhaseVelocity; npc.SimpleFlyMovement(vector5, toothBallBelchPhaseAcceleration); // Play sounds and spawn Tooth Balls if (npc.ai[2] == 0f) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.position); + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); if (npc.ai[2] % toothBallBelchPhaseDivisor == 0f) { - if (npc.ai[2] % 40f == 0f && npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + if (npc.ai[2] != 0f) + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + Vector2 vector6 = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; + Vector2 toothBallVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * toothBallFinalVelocity; + Vector2 toothBallSpawnPos = new Vector2(vector6.X, vector6.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (npc.width + 20) / 2f + vector; - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector6.X, (int)vector6.Y + 45, ModContent.NPCType()); + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * npc.velocity.Length(); + Main.npc[toothBall].netUpdate = true; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulfurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; } } // Direction - int num26 = Math.Sign(player.Center.X - vector.X); + int num26 = Math.Sign(player.Center.X - npc.Center.X); if (num26 != 0) { npc.direction = num26; @@ -5959,20 +6381,20 @@ namespace CalamityMod.NPCs // Play sound and spawn sharks if (npc.ai[2] == num9 - 30) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); if (npc.ai[2] >= num9 - 90) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { calamityGlobalNPC.newAI[2] += 100f; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + 900f), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - 900f), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); if (Main.getGoodWorld) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + 1800f), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - 1800f), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); } } } @@ -5999,20 +6421,20 @@ namespace CalamityMod.NPCs // Sound if (npc.ai[2] == num10 - 60) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.position); + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); if (npc.ai[2] >= num10 - 60) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { calamityGlobalNPC.newAI[2] += 150f; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + 50f + calamityGlobalNPC.newAI[2]), (int)(vector.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - 50f - calamityGlobalNPC.newAI[2]), (int)(vector.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); if (Main.getGoodWorld) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(vector.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(vector.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); } } } @@ -6037,13 +6459,13 @@ namespace CalamityMod.NPCs { // Velocity if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); + npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * idlePhaseVelocity; + Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; npc.SimpleFlyMovement(vector8, idlePhaseAcceleration); // Direction and rotation - int num27 = Math.Sign(player.Center.X - vector.X); + int num27 = Math.Sign(player.Center.X - npc.Center.X); if (num27 != 0) { if (npc.ai[2] == 0f && num27 != npc.direction) @@ -6093,7 +6515,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; // Velocity and rotation - Vector2 distanceVector = player.Center + player.velocity * 20f - vector; + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); @@ -6113,7 +6535,7 @@ namespace CalamityMod.NPCs else if (num28 == 2) { // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * scaleFactor4; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction @@ -6162,7 +6584,7 @@ namespace CalamityMod.NPCs int num29 = 7; for (int k = 0; k < num29; k++) { - Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (num29 / 2 - 1)) * pie / num29) + vector; + Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (num29 / 2 - 1)) * pie / num29) + npc.Center; Vector2 vector9 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num30 = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f); Main.dust[num30].noGravity = true; @@ -6190,11 +6612,11 @@ namespace CalamityMod.NPCs // Play sounds and spawn Tooth Balls and a Vortex if (npc.ai[2] == 0f) { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.position); + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; + Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); @@ -6203,17 +6625,50 @@ namespace CalamityMod.NPCs if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) { - if (npc.ai[2] % 45f == 0f && npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + if (npc.ai[2] != 0f) + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; + Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(vector10.X, vector10.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType()); - Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = Main.rand.Next(30, 181); + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = npc.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 30f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulfurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; } } @@ -6243,18 +6698,18 @@ namespace CalamityMod.NPCs // Play sound if (npc.ai[2] == num9 - 30) { - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); int totalGore = Main.getGoodWorld ? 40 : 20; for (int i = 0; i < totalGore; i++) { - float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat() + 0.5f); - float velocityY = goreVelocityY * (Main.rand.NextFloat() + 0.5f); + float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); if (Main.getGoodWorld) { @@ -6273,8 +6728,8 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[2] += 100f; float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); } } @@ -6300,20 +6755,20 @@ namespace CalamityMod.NPCs // Sound if (npc.ai[2] == num10 - 60) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.position); + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); if (npc.ai[2] >= num10 - 60) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { calamityGlobalNPC.newAI[2] += 200f; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + 50f + calamityGlobalNPC.newAI[2]), (int)(vector.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - 50f - calamityGlobalNPC.newAI[2]), (int)(vector.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); if (Main.getGoodWorld) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(vector.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(vector.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); } } } @@ -6343,13 +6798,13 @@ namespace CalamityMod.NPCs // Movement location if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); + npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - vector - npc.velocity) * idlePhaseVelocity; + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); // Rotation and direction - int num32 = Math.Sign(player.Center.X - vector.X); + int num32 = Math.Sign(player.Center.X - npc.Center.X); if (num32 != 0) { if (npc.ai[2] == 0f && num32 != npc.direction) @@ -6406,7 +6861,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; // Velocity and rotation - Vector2 distanceVector = player.Center + player.velocity * 20f - vector; + Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); @@ -6441,7 +6896,7 @@ namespace CalamityMod.NPCs else if (num33 == 4) { // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * scaleFactor4; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction @@ -6475,7 +6930,7 @@ namespace CalamityMod.NPCs int num34 = 7; for (int m = 0; m < num34; m++) { - Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (num34 / 2 - 1)) * pie / num34) + vector; + Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (num34 / 2 - 1)) * pie / num34) + npc.Center; Vector2 vector11 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int num35 = Dust.NewDust(arg_2444_0 + vector11, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f); Main.dust[num35].noGravity = true; @@ -6517,18 +6972,18 @@ namespace CalamityMod.NPCs // Play sound if (npc.ai[2] == num12 / 2) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.position); + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num12 / 2) { // Teleport location if (npc.ai[1] == 0f) - npc.ai[1] = 600 * Math.Sign((vector - player.Center).X); + npc.ai[1] = 600 * Math.Sign((npc.Center - player.Center).X); // Rotation and direction Vector2 center = player.Center + new Vector2(npc.ai[1], -300f); - vector = npc.Center = center; - int num36 = Math.Sign(player.Center.X - vector.X); + Vector2 npcCenter = npc.Center = center; + int num36 = Math.Sign(player.Center.X - npcCenter.X); if (num36 != 0) { if (npc.ai[2] == 0f && num36 != npc.direction) @@ -6572,18 +7027,18 @@ namespace CalamityMod.NPCs // Play sound if (npc.ai[2] == num9 - 30) { - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); int totalGore = Main.getGoodWorld ? 40 : 20; for (int i = 0; i < totalGore; i++) { - float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat() + 0.5f); - float velocityY = goreVelocityY * (Main.rand.NextFloat() + 0.5f); + float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); if (Main.getGoodWorld) { @@ -6602,13 +7057,13 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[2] += 150f; float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - x), (int)(vector.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); if (Main.getGoodWorld) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X + x), (int)(vector.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(vector.X - x), (int)(vector.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); } } } @@ -6632,11 +7087,11 @@ namespace CalamityMod.NPCs // Play sounds and spawn Tooth Balls and a Vortex if (npc.ai[2] == 0f) { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.position); + modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; + Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); @@ -6645,22 +7100,55 @@ namespace CalamityMod.NPCs if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) { - if (npc.ai[2] % 45f == 0f && npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.position); + if (npc.ai[2] != 0f) + SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); + Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; + Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(vector10.X, vector10.Y + 45f); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; - int num31 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType()); - Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Main.npc[num31].netUpdate = true; - Main.npc[num31].ai[3] = Main.rand.Next(30, 361); + int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = npc.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 60f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulfurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; } } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction); + npc.velocity = npc.velocity.RotatedBy(-(double)num15 * npc.direction); npc.rotation -= num15 * npc.direction; npc.ai[2] += 1f; @@ -6875,8 +7363,8 @@ namespace CalamityMod.NPCs #region Unicorn AI public static void UnicornAI(NPC npc, Mod mod, bool spin, float bounciness, float speedDetect, float speedAdditive, float bouncy1 = -8.5f, float bouncy2 = -7.5f, float bouncy3 = -7f, float bouncy4 = -6f, float bouncy5 = -8f) { - bool DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); - bool DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); + bool DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); + bool DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); int num = 30; bool flag2 = false; bool flag3 = false; @@ -6957,6 +7445,12 @@ namespace CalamityMod.NPCs { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, -1f, 0, default, 1f); } + if (CalamityWorld.getFixedBoi) + { + float screenShakePower = 2 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } } if (npc.type == ModContent.NPCType()) { @@ -7060,7 +7554,24 @@ namespace CalamityMod.NPCs position.X += npc.velocity.X; int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * num10)) / 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 && ((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]) || (Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile)) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - num10, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - num10, y - 3].TileType])) + + // 21JAN2023: Ozzatron -- this is probably the single most unmaintainable if statement I've ever seen + // I have broken all the individual statements out even though I do not fully understand the code. + Tile t_xy = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile t_xy1 = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + Tile t_xy2 = CalamityUtils.ParanoidTileRetrieval(x, y - 2); + Tile t_xy3 = CalamityUtils.ParanoidTileRetrieval(x, y - 3); + Tile t_xOffY3 = CalamityUtils.ParanoidTileRetrieval(x - num10, y - 3); // 3 down, offset 1 in the direction of the NPC's movement + Tile t_xy4 = CalamityUtils.ParanoidTileRetrieval(x, y - 4); + bool positionCheck = (float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X; + bool tileSolidityCheck1 = t_xy.HasUnactuatedTile && !t_xy.TopSlope && !t_xy1.TopSlope && Main.tileSolid[t_xy.TileType] && !Main.tileSolidTop[t_xy.TileType]; + bool oneBelowIsSolidHalf = t_xy1.IsHalfBlock && t_xy1.HasUnactuatedTile; + bool canFallThrough = !t_xy1.HasUnactuatedTile || !Main.tileSolid[t_xy1.TileType] || Main.tileSolidTop[t_xy1.TileType] || (t_xy1.IsHalfBlock && (!t_xy4.HasUnactuatedTile || !Main.tileSolid[t_xy4.TileType] || Main.tileSolidTop[t_xy4.TileType])); + bool twoDownIsNonSolid = !t_xy2.HasUnactuatedTile || !Main.tileSolid[t_xy2.TileType] || Main.tileSolidTop[t_xy2.TileType]; + bool threeDownIsNonSolid = !t_xy3.HasUnactuatedTile || !Main.tileSolid[t_xy3.TileType] || Main.tileSolidTop[t_xy3.TileType]; + // Notice it doesn't check for platforms in ther offset position. This is why walking AIs twirl on 1-wide platforms in hellevators. They have to turn around before this check succeeds. + bool threeDownOffsetIsNonSolid = !t_xOffY3.HasUnactuatedTile || !Main.tileSolid[t_xOffY3.TileType]; + if (positionCheck && (tileSolidityCheck1 || oneBelowIsSolidHalf) && canFallThrough && twoDownIsNonSolid && threeDownIsNonSolid && threeDownOffsetIsNonSolid) { float num13 = (float)(y * 16); if (Main.tile[x, y].IsHalfBlock) @@ -7138,6 +7649,11 @@ namespace CalamityMod.NPCs #endregion #region Swimming AI + // Passiveness: + // 0 = Catfish, Flounder, Frogfish, Viperfish, Moray Eel, Laserfish + // 1 = Blinded Angler + // 2 = Prism-Back, Toxic Minnow + // 3 = Sea Minnow public static void PassiveSwimmingAI(NPC npc, Mod mod, int passiveness, float detectRange, float xSpeed, float ySpeed, float speedLimitX, float speedLimitY, float rotation, bool spriteFacesLeft = true) { if (spriteFacesLeft) @@ -7150,55 +7666,62 @@ namespace CalamityMod.NPCs { npc.TargetClosest(true); } + Player target = Main.player[npc.target]; if (npc.justHit && passiveness != 3) { npc.chaseable = true; } if (npc.wet) { - bool flag14 = npc.chaseable; + bool hasWetTarget = npc.chaseable; npc.TargetClosest(false); + target = Main.player[npc.target]; + // Player detection behavior if (passiveness != 2) { if (npc.type == ModContent.NPCType()) { - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + if (target.wet && !target.dead) { - flag14 = true; + hasWetTarget = true; npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up } } - if (npc.type == ModContent.NPCType()) + if (npc.type == ModContent.NPCType()) { - if (!Main.player[npc.target].dead) + if (!target.dead) { - flag14 = true; + hasWetTarget = true; npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up } } - else if (Main.player[npc.target].wet && !Main.player[npc.target].dead && - (Main.player[npc.target].Center - npc.Center).Length() < detectRange && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + else if (target.wet && !target.dead && (target.Center - npc.Center).Length() < detectRange && + Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - flag14 = true; + hasWetTarget = true; npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up } else { if (passiveness == 1) { - flag14 = false; + hasWetTarget = false; } } } - if ((Main.player[npc.target].dead || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) && flag14) + if ((target.dead || !Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) && hasWetTarget) { - flag14 = false; + hasWetTarget = false; } - if (!flag14 || passiveness == 0) + + // Swim back and forth + if (!hasWetTarget || passiveness == 2) { if (passiveness == 0) + { npc.TargetClosest(true); + target = Main.player[npc.target]; + } if (npc.collideX) { npc.velocity.X = npc.velocity.X * -1f; @@ -7222,77 +7745,82 @@ namespace CalamityMod.NPCs } } } - if (flag14 && passiveness != 2) + + if (hasWetTarget && passiveness != 2) { npc.TargetClosest(true); + target = Main.player[npc.target]; + // Swim away from the player if (passiveness == 3) { npc.velocity.X = npc.velocity.X - (float)npc.direction * xSpeed; npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * ySpeed; } + // Swim toward the player else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 2f * xSpeed : xSpeed); - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 2f * ySpeed : ySpeed); + npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 2f * ySpeed : CalamityWorld.revenge ? 1.5f * ySpeed : ySpeed); } - float velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : speedLimitX; - float velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : speedLimitY; + float velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : CalamityWorld.revenge ? 1.5f * speedLimitX : speedLimitX; + float velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : CalamityWorld.revenge ? 1.5f * speedLimitY : speedLimitY; npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -velocityCapX, velocityCapX); npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -velocityCapY, velocityCapY); + + if (npc.justHit) + npc.localAI[0] = 0f; + + // Laserfish shoot the player if (npc.type == ModContent.NPCType()) { - npc.localAI[0] += (CalamityWorld.death ? 2f : 1f); + npc.localAI[0] += (CalamityWorld.death ? 2f : CalamityWorld.revenge ? 1.5f : 1f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { float speed = 5f; Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 50; - if (Main.expertMode) - { - damage = 40; - } - int beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 25f : -25f), npc.Center.Y + (Main.player[npc.target].position.Y > npc.Center.Y ? 5f : -5f), num6, num7, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer, 0f, 0f); + float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); + float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + dist = speed / dist; + velX *= dist; + velY *= dist; + int damage = Main.expertMode ? 40 : 50; + int beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 25f : -25f), npc.Center.Y + (target.position.Y > npc.Center.Y ? 5f : -5f), velX, velY, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer); Main.projectile[beam].tileCollide = true; } } } - if (npc.type == ModContent.NPCType()) + + // Flounder shoot Sulphuric Mist at the player + if (npc.type == ModContent.NPCType()) { - if ((Main.player[npc.target].Center - npc.Center).Length() < 350f) + if ((target.Center - npc.Center).Length() < 350f) { - npc.localAI[0] += (CalamityWorld.death ? 3f : 1f); + npc.localAI[0] += (CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2f : 1f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) { npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { float speed = 4f; Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 35; - if (Main.expertMode) - { - damage = 25; - } - int beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, num6, num7, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); + float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); + float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + dist = speed / dist; + velX *= dist; + velY *= dist; + int damage = Main.expertMode ? 25 : 35; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, velX, velY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); } } } } + + // Sea Minnows face away from the player if (npc.type == ModContent.NPCType()) { npc.direction *= -1; @@ -7300,6 +7828,7 @@ namespace CalamityMod.NPCs } else { + // No target behavior npc.velocity.X += (float)npc.direction * 0.1f; if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) { @@ -7342,6 +7871,7 @@ namespace CalamityMod.NPCs } else { + // Out of water behavior if (npc.velocity.Y == 0f) { npc.velocity.X = npc.velocity.X * 0.94f; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 788e20251e..5d733d5676 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -3,16 +3,20 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies; +using CalamityMod.World; using Microsoft.Xna.Framework; using ReLogic.Utilities; using System; using System.Collections.Generic; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.GameContent; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities; namespace CalamityMod.NPCs { @@ -228,14 +232,17 @@ namespace CalamityMod.NPCs if (npc.ModNPC.AIType != 0) npcType = npc.ModNPC.AIType; } + if (npcType == NPCID.Psycho) { BuffedPsychoAI(npc); } + if (npcType == NPCID.SwampThing) { BuffedSwampThingAI(npc); } + if (npcType == NPCID.CreatureFromTheDeep) { // Swimming @@ -260,6 +267,7 @@ namespace CalamityMod.NPCs { npc.direction = 1; } + // If there's nothing in the way of the player, swim towards them if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1)) { @@ -279,6 +287,7 @@ namespace CalamityMod.NPCs Vector2 directionVectorNormalized = new Vector2((float)npc.direction, -1f); directionVectorNormalized.Normalize(); directionVectorNormalized *= velocityMultiplier; + // If the speed is low, make the turn speed higher if (velocityMultiplier < 5f) { @@ -290,11 +299,12 @@ namespace CalamityMod.NPCs } else { - npc.knockBackResist = 0.2f; + npc.knockBackResist = CalamityWorld.death ? 0.1f : 0.2f; npc.noGravity = false; npc.width = 18; npc.height = 40; npc.position = npc.Center - npc.Size / 2f; + // If was just swimming, set values to return to land if (npc.ai[3] == -0.10101f) { @@ -312,6 +322,7 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.CultistArcherBlue || npcType == NPCID.CultistArcherWhite) { // Pissed off @@ -354,6 +365,7 @@ namespace CalamityMod.NPCs } npc.damage = npc.defDamage; } + if (npcType == NPCID.MartianOfficer && npc.ai[2] == 0f && npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { // If Martian Officer is ready to generate shield, generate it. @@ -364,6 +376,7 @@ namespace CalamityMod.NPCs Main.npc[shield].ai[0] = (float)npc.whoAmI; Main.npc[shield].netUpdate = true; } + if (npcType == NPCID.MartianOfficer) { int shield = (int)npc.ai[2] - 1; @@ -377,7 +390,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; if (npc.localAI[0] == -1f) { - npc.localAI[0] = 120f; + npc.localAI[0] = CalamityWorld.death ? 60f : 120f; } if (npc.localAI[0] > 0f) { @@ -385,6 +398,7 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.GraniteGolem) { int activeTime = 300; @@ -424,15 +438,16 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } } + if (npcType == NPCID.Medusa) { int afterHitTime = 90; int afterWaitTime = 210; int maxTime = 270; - int debuffTime = 2 * 60; // 2 seconds + int debuffTime = (CalamityWorld.death ? 4 : 2) * 60; // 2 seconds in Rev, 4 seconds in Death int turnToStoneTime = 20; - float mesudaActiveDistance = 900f; - float medusaEffectDistance = 1000f; + float mesudaActiveDistance = CalamityWorld.death ? 1500f : 900f; + float medusaEffectDistance = CalamityWorld.death ? 1600f : 1000f; if (npc.ai[2] > 0f) { npc.ai[2] -= 1f; @@ -498,7 +513,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.Server) { Player player = Main.player[Main.myPlayer]; - if (!player.dead && player.active && player.FindBuffIndex(156) == -1) + if (!player.dead && player.active && player.FindBuffIndex(BuffID.Stoned) == -1) { if (npc.Distance(player.Center) < medusaEffectDistance) { @@ -526,6 +541,7 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.GoblinSummoner) { // Shit out minion things @@ -540,7 +556,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[3] += 1f; - if (npc.localAI[3] > (float)Main.rand.Next(20, 120)) + if (npc.localAI[3] > (float)Main.rand.Next(20, CalamityWorld.death ? 40 : 120)) { npc.localAI[3] = 0f; Vector2 spawnPosition = npc.Center; @@ -682,7 +698,7 @@ namespace CalamityMod.NPCs spawnPosiion.Y -= 70f; npc.velocity.X *= 0.8f; npc.ai[2] += 1f; - if (npc.ai[2] == 30f) + if (npc.ai[2] == (CalamityWorld.death ? 15f : 30f)) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -751,6 +767,7 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.SolarSolenian) { npc.reflectsProjectiles = false; @@ -794,7 +811,7 @@ namespace CalamityMod.NPCs npc.ai[2] -= 1f; if (npc.velocity.Y == 0f) { - npc.ai[2] = 60f; + npc.ai[2] = CalamityWorld.death ? 60f : 90f; } else if (npc.ai[2] < (float)(chargeTime * -1f - yFlyTime)) { @@ -805,23 +822,24 @@ namespace CalamityMod.NPCs } } npc.reflectsProjectiles = true; - npc.takenDamageMultiplier = 3f; + npc.takenDamageMultiplier = CalamityWorld.death ? 2f : 3f; if (npc.justHit) { - npc.ai[2] = 60f; + npc.ai[2] = CalamityWorld.death ? 60f : 90f; npc.netUpdate = true; } return false; } } } + if (npcType == NPCID.SolarDrakomire) { int timeToReset = 42; int timeToBreathFire = 18; if (npc.justHit) { - npc.ai[2] = 60f; + npc.ai[2] = CalamityWorld.death ? 30f : 60f; npc.netUpdate = true; } if (npc.ai[2] > 0f) @@ -841,7 +859,7 @@ namespace CalamityMod.NPCs } if (solarFlareCount > maxFlareCount) { - npc.ai[2] = 60f; + npc.ai[2] = CalamityWorld.death ? 30f : 60f; } else if (((Main.player[npc.target].Center.X < npc.Center.X && npc.direction < 0) || (Main.player[npc.target].Center.X > npc.Center.X && npc.direction > 0)) && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) { @@ -883,10 +901,11 @@ namespace CalamityMod.NPCs return false; } } + if (npcType == NPCID.VortexLarva) { npc.localAI[0] += 1f; - if (npc.localAI[0] >= 150f) + if (npc.localAI[0] >= (CalamityWorld.death ? 90f : 150f)) { int centerTileX = (int)npc.Center.X / 16 - 1; int centerTileY = (int)npc.Center.Y / 16 - 1; @@ -903,19 +922,19 @@ namespace CalamityMod.NPCs { maxValue = 16; } - else if (npc.localAI[0] < 60f) + else if (npc.localAI[0] < (CalamityWorld.death ? 45f : 60f)) { maxValue = 8; } - else if (npc.localAI[0] < 90f) + else if (npc.localAI[0] < (CalamityWorld.death ? 60f : 90f)) { maxValue = 4; } - else if (npc.localAI[0] < 120f) + else if (npc.localAI[0] < (CalamityWorld.death ? 75f : 120f)) { maxValue = 2; } - else if (npc.localAI[0] < 150f) + else if (npc.localAI[0] < (CalamityWorld.death ? 90f : 150f)) { maxValue = 1; } @@ -935,11 +954,12 @@ namespace CalamityMod.NPCs dust.position.Y += 4f; } } + if (npcType == NPCID.VortexHornet) { npc.localAI[0] += 1f; npc.localAI[0] += Math.Abs(npc.velocity.X) / 2f; - if (npc.localAI[0] >= 600f && Main.netMode != NetmodeID.MultiplayerClient) + if (npc.localAI[0] >= (CalamityWorld.death ? 300f : 600f) && Main.netMode != NetmodeID.MultiplayerClient) { int centerTileX = (int)npc.Center.X / 16 - 2; int centerTileY = (int)npc.Center.Y / 16 - 3; @@ -952,23 +972,23 @@ namespace CalamityMod.NPCs } } int maxValue2; - if (npc.localAI[0] < 120f) + if (npc.localAI[0] < (CalamityWorld.death ? 60f : 120f)) { maxValue2 = 32; } - else if (npc.localAI[0] < 240f) + else if (npc.localAI[0] < (CalamityWorld.death ? 120f : 240f)) { maxValue2 = 16; } - else if (npc.localAI[0] < 360f) + else if (npc.localAI[0] < (CalamityWorld.death ? 180f : 360f)) { maxValue2 = 6; } - else if (npc.localAI[0] < 480f) + else if (npc.localAI[0] < (CalamityWorld.death ? 240f : 480f)) { maxValue2 = 2; } - else if (npc.localAI[0] < 600f) + else if (npc.localAI[0] < (CalamityWorld.death ? 300f : 600f)) { maxValue2 = 1; } @@ -984,6 +1004,7 @@ namespace CalamityMod.NPCs dust.noLight = true; } } + bool jump = false; if (npc.velocity.X == 0f) { @@ -993,14 +1014,17 @@ namespace CalamityMod.NPCs { jump = false; } + if (Main.netMode != NetmodeID.MultiplayerClient && npcType == NPCID.Lihzahrd && (double)npc.life <= (double)npc.lifeMax * 0.9) { npc.Transform(NPCID.LihzahrdCrawler); } + if (Main.netMode != NetmodeID.MultiplayerClient && npcType == NPCID.Nutcracker && (double)npc.life <= (double)npc.lifeMax * 0.9) { npc.Transform(NPCID.NutcrackerSpinning); } + // This variable seems to have a lot of purposes. // I wasn't sure what I could name it that isn't very vague int aiGateValue = 60; @@ -1034,6 +1058,7 @@ namespace CalamityMod.NPCs } } } + bool canIncrementAI3 = false; bool reset = true; if (npcType == NPCID.Yeti || npcType == NPCID.CorruptBunny || npcType == NPCID.Crab || npcType == NPCID.Clown || npcType == NPCID.SkeletonArcher || npcType == NPCID.GoblinArcher || npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType() @@ -1051,11 +1076,13 @@ namespace CalamityMod.NPCs { reset = false; } + bool ableToAlterAI3 = false; if (npcType == NPCID.VortexRifleman || npcType == NPCID.GoblinSummoner) { ableToAlterAI3 = true; } + // This variable means so many fucking things for different NPCs // Such as npc spawn timer, projectile timer, ect // From what I can gather, the ai2 value's max for spawning things also varies @@ -1094,10 +1121,11 @@ namespace CalamityMod.NPCs { goto PrepareToShoot; } - // If anyone can give me an explanation of the real noticable differences between - //& and && (same with | and ||) with booleans, - // I'd greatly appreciate it - PrepareToShoot: + + // If anyone can give me an explanation of the real noticable differences between + //& and && (same with | and ||) with booleans, + // I'd greatly appreciate it + PrepareToShoot: if (!ableToAlterAI3 & flag7) { if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) @@ -1125,6 +1153,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } } + if (npcType == NPCID.Nailhead && Main.netMode != NetmodeID.MultiplayerClient) { if (npc.localAI[3] > 0f) @@ -1186,6 +1215,7 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.Butcher) { if (npc.velocity.Y < -0.3f || npc.velocity.Y > 0.3f) @@ -1197,6 +1227,7 @@ namespace CalamityMod.NPCs npc.knockBackResist = 0.1f; } } + if (npcType == NPCID.ThePossessed) { npc.knockBackResist = 0.25f; @@ -1248,6 +1279,7 @@ namespace CalamityMod.NPCs npc.noGravity = false; npc.ai[2] = 0f; } + if (npcType == NPCID.Fritz && npc.velocity.Y == 0f && (Main.player[npc.target].Center - npc.Center).Length() < 150f && Math.Abs(npc.velocity.X) > 3f && ((npc.velocity.X < 0f && npc.Center.X > Main.player[npc.target].Center.X) || (npc.velocity.X > 0f && npc.Center.X < Main.player[npc.target].Center.X))) { npc.velocity.X *= 2f; @@ -1280,6 +1312,7 @@ namespace CalamityMod.NPCs } } } + if (npc.ai[3] < (float)aiGateValue && (Main.eclipse || !Main.dayTime || (double)npc.position.Y > Main.worldSurface * 16.0 || (Main.invasionType == InvasionID.GoblinArmy && (npcType == NPCID.Yeti || npcType == NPCID.ElfArcher)) || (Main.invasionType == InvasionID.GoblinArmy && (npcType == NPCID.GoblinPeon || npcType == NPCID.GoblinThief || npcType == NPCID.GoblinWarrior || npcType == NPCID.GoblinArcher || npcType == NPCID.GoblinSummoner)) || (npcType == NPCID.GoblinScout || (Main.invasionType == InvasionID.PirateInvasion && npcType >= 212 && npcType <= 216)) || (Main.invasionType == InvasionID.MartianMadness && (npcType == NPCID.BrainScrambler || npcType == NPCID.RayGunner || npcType == NPCID.MartianOfficer || npcType == NPCID.GrayGrunt || npcType == NPCID.MartianEngineer || npcType == NPCID.GigaZapper || npcType == NPCID.Scutlix || npcType == NPCID.MartianWalker)) || (npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.CorruptBunny || npcType == NPCID.Crab || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy || npcType == NPCID.SkeletonArcher || npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType() || npcType == NPCID.CorruptPenguin || npcType == NPCID.FaceMonster || npcType == NPCID.SnowFlinx || npcType == NPCID.Lihzahrd || npcType == NPCID.LihzahrdCrawler || npcType == NPCID.IcyMerman || npcType == NPCID.CochinealBeetle || npcType == NPCID.CyanBeetle || npcType == NPCID.LacBeetle || npcType == NPCID.SeaSnail || npcType == NPCID.BloodCrawler || npcType == NPCID.IceGolem || npcType == NPCID.ZombieMushroom || npcType == NPCID.ZombieMushroomHat || npcType == NPCID.AnomuraFungus || npcType == NPCID.MushiLadybug || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.CultistArcherBlue || npcType == NPCID.CultistArcherWhite || npcType == NPCID.CrimsonBunny || npcType == NPCID.CrimsonPenguin || npcType == NPCID.NebulaSoldier || (npcType == NPCID.StardustSoldier && (npc.ai[1] >= 180f || npc.ai[1] < 90f))) || (npcType == NPCID.StardustSpiderBig || npcType == NPCID.VortexRifleman || npcType == NPCID.VortexSoldier || npcType == NPCID.VortexHornet || npcType == NPCID.VortexLarva || npcType == NPCID.WalkingAntlion || npcType == NPCID.SolarDrakomire || npcType == NPCID.SolarSolenian || (npcType >= 524 && npcType <= 527)) || npcType == NPCID.DesertLamiaLight || npcType == NPCID.DesertLamiaDark || npcType == NPCID.DesertScorpionWalk || npcType == NPCID.DesertBeast)) { if ((npcType == NPCID.Zombie || npcType == NPCID.ZombieXmas || npcType == NPCID.ZombieSweater || npcType == NPCID.Skeleton || (npcType >= NPCID.BoneThrowingSkeleton && npcType <= NPCID.BoneThrowingSkeleton4) || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.SkeletonArcher || npcType == NPCID.BaldZombie || npcType == NPCID.UndeadViking || npcType == NPCID.ZombieEskimo || npcType == NPCID.Frankenstein || npcType == NPCID.PincushionZombie || npcType == NPCID.SlimedZombie || npcType == NPCID.SwampZombie || npcType == NPCID.TwiggyZombie || npcType == NPCID.ArmoredViking || npcType == NPCID.FemaleZombie || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.ZombieRaincoat || npcType == NPCID.SkeletonSniper || npcType == NPCID.TacticalSkeleton || npcType == NPCID.SkeletonCommando || npcType == NPCID.ZombieSuperman || npcType == NPCID.ZombiePixie || npcType == NPCID.ZombieDoctor || npcType == NPCID.GreekSkeleton) && Main.rand.NextBool(1000)) @@ -1371,6 +1404,7 @@ namespace CalamityMod.NPCs npc.direction = 1; } } + if (npcType == NPCID.Vampire || npcType == NPCID.NutcrackerSpinning) { if (npcType == NPCID.Vampire && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) @@ -1411,21 +1445,21 @@ namespace CalamityMod.NPCs } else if (npcType == NPCID.LihzahrdCrawler) { - FighterRunningAI(npc, 6f, 0.12f, 0.8f, true, 0.8f); + FighterRunningAI(npc, CalamityWorld.death ? 8f : 6f, 0.12f, 0.8f, true, 0.8f); } else if (npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType() || npcType == NPCID.SwampThing || npcType == NPCID.PirateCorsair || npcType == NPCID.MushiLadybug || npcType == NPCID.DesertLamiaLight || npcType == NPCID.DesertLamiaDark) { - FighterRunningAI(npc, 4f, 0.09f, 0.8f, true, 0.8f); + FighterRunningAI(npc, CalamityWorld.death ? 6f : 4f, 0.09f, 0.8f, true, 0.8f); } else if (npcType == NPCID.CreatureFromTheDeep || npcType == NPCID.GoblinThief || npcType == NPCID.ArmoredSkeleton || npcType == NPCID.Werewolf || npcType == NPCID.BlackRecluse || npcType == NPCID.Frankenstein || npcType == NPCID.Nymph || npcType == NPCID.ArmoredViking || npcType == NPCID.PirateDeckhand || npcType == NPCID.AnomuraFungus || npcType == NPCID.Splinterling || npcType == NPCID.Yeti || npcType == NPCID.Nutcracker || npcType == NPCID.Krampus || (npcType >= 524 && npcType <= 527) || npcType == NPCID.DesertScorpionWalk) { - FighterRunningAI(npc, 3f, 0.09f, 0.8f); + FighterRunningAI(npc, CalamityWorld.death ? 3f : 2.5f, 0.09f, 0.8f); } else if (npcType == NPCID.Clown) { - FighterRunningAI(npc, 4f, 0.06f, 0.8f); + FighterRunningAI(npc, CalamityWorld.death ? 5f : 4f, 0.06f, 0.8f); } - else if (npcType == NPCID.Skeleton || npcType == NPCID.GoblinPeon || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.CorruptBunny || npcType == NPCID.GoblinScout || npcType == NPCID.PossessedArmor || npcType == NPCID.WallCreeper || npcType == NPCID.BloodCrawler || npcType == NPCID.UndeadViking || npcType == NPCID.CorruptPenguin || npcType == NPCID.SnowFlinx || npcType == NPCID.Lihzahrd || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.CochinealBeetle || npcType == NPCID.CyanBeetle || npcType == NPCID.LacBeetle || npcType == NPCID.FlyingSnake || npcType == NPCID.FaceMonster || npcType == NPCID.ZombieMushroom || npcType == NPCID.ZombieElf || npcType == NPCID.ZombieElfBeard || npcType == NPCID.ZombieElfGirl || npcType == NPCID.GingerbreadMan || npcType == NPCID.GrayGrunt || npcType == NPCID.GigaZapper || npcType == NPCID.Fritz || npcType == NPCID.Nailhead || npcType == NPCID.Psycho || npcType == NPCID.CrimsonBunny || npcType == NPCID.ThePossessed || npcType == NPCID.CrimsonPenguin || npcType == NPCID.Medusa || npcType == NPCID.GraniteGolem || npcType == NPCID.VortexRifleman || npcType == NPCID.VortexSoldier) + else if (npcType == NPCID.Skeleton || npcType == NPCID.SporeSkeleton || npcType == NPCID.GoblinPeon || npcType == NPCID.AngryBones || npcType == NPCID.AngryBonesBig || npcType == NPCID.AngryBonesBigMuscle || npcType == NPCID.AngryBonesBigHelmet || npcType == NPCID.CorruptBunny || npcType == NPCID.GoblinScout || npcType == NPCID.PossessedArmor || npcType == NPCID.WallCreeper || npcType == NPCID.BloodCrawler || npcType == NPCID.UndeadViking || npcType == NPCID.CorruptPenguin || npcType == NPCID.SnowFlinx || npcType == NPCID.Lihzahrd || npcType == NPCID.HeadacheSkeleton || npcType == NPCID.MisassembledSkeleton || npcType == NPCID.PantlessSkeleton || npcType == NPCID.CochinealBeetle || npcType == NPCID.CyanBeetle || npcType == NPCID.LacBeetle || npcType == NPCID.FlyingSnake || npcType == NPCID.FaceMonster || npcType == NPCID.ZombieMushroom || npcType == NPCID.ZombieElf || npcType == NPCID.ZombieElfBeard || npcType == NPCID.ZombieElfGirl || npcType == NPCID.GingerbreadMan || npcType == NPCID.GrayGrunt || npcType == NPCID.GigaZapper || npcType == NPCID.Fritz || npcType == NPCID.Nailhead || npcType == NPCID.Psycho || npcType == NPCID.CrimsonBunny || npcType == NPCID.ThePossessed || npcType == NPCID.CrimsonPenguin || npcType == NPCID.Medusa || npcType == NPCID.GraniteGolem || npcType == NPCID.VortexRifleman || npcType == NPCID.VortexSoldier) { float maxVelocity = 1.5f; if (npcType == NPCID.AngryBonesBig) @@ -1504,7 +1538,10 @@ namespace CalamityMod.NPCs { maxVelocity *= 1f + (1f - npc.scale); } - maxVelocity *= 1.5f; + maxVelocity *= 1.25f; + if (CalamityWorld.death) + maxVelocity *= 1.25f; + bool extraSlowdown = npc.velocity.Y == 0f && npcType == NPCID.Fritz && ((npc.direction > 0 && npc.velocity.X < 0f) || (npc.direction < 0 && npc.velocity.X > 0f)); FighterRunningAI(npc, maxVelocity, 0.09f, 0.9f, extraSlowdown, 0.9f); } @@ -1560,7 +1597,10 @@ namespace CalamityMod.NPCs maxVelocity = 2.5f; } maxVelocity *= 1f + (1f - npc.scale); - maxVelocity *= 1.5f; + maxVelocity *= 1.25f; + if (CalamityWorld.death) + maxVelocity *= 1.25f; + FighterRunningAI(npc, maxVelocity, 0.09f, 0.8f, false); } else if (npcType >= 305 && npcType <= 314) @@ -1586,7 +1626,10 @@ namespace CalamityMod.NPCs { maxVelocity = 1f; } - maxVelocity *= 1.5f; + maxVelocity *= 1.25f; + if (CalamityWorld.death) + maxVelocity *= 1.25f; + if (npcType < 310) //Pogo stick Scarecrows { if (npc.velocity.Y == 0f) @@ -1610,7 +1653,7 @@ namespace CalamityMod.NPCs } else if (npcType == NPCID.Crab || npcType == NPCID.SeaSnail || npcType == NPCID.VortexLarva) { - FighterRunningAI(npc, 1f, 0.06f, 0.7f); + FighterRunningAI(npc, CalamityWorld.death ? 4f : 1f, 0.06f, 0.7f); } else if (npcType == NPCID.Mummy || npcType == NPCID.DarkMummy || npcType == NPCID.LightMummy) { @@ -1620,19 +1663,23 @@ namespace CalamityMod.NPCs { maxVelocity *= 1.5f; } + if (CalamityWorld.death) + { + maxVelocity *= 1.25f; + } FighterRunningAI(npc, maxVelocity, acceleration, 0.7f); } else if (npcType == NPCID.BoneLee) { - FighterRunningAI(npc, 7f, 0.3f, 0.7f); + FighterRunningAI(npc, CalamityWorld.death ? 10f : 7f, 0.3f, 0.7f); } else if (npcType == NPCID.IceGolem) { - FighterRunningAI(npc, 3f, 0.3f, 0.7f); + FighterRunningAI(npc, CalamityWorld.death ? 4.5f : 3f, 0.3f, 0.7f); } else if (npcType == NPCID.Eyezor) { - FighterRunningAI(npc, 3.5f, 0.3f, 0.8f); + FighterRunningAI(npc, CalamityWorld.death ? 5f : 3.5f, 0.3f, 0.8f); } else if (npcType == NPCID.MartianEngineer) { @@ -1645,7 +1692,7 @@ namespace CalamityMod.NPCs } else { - FighterRunningAI(npc, 3.5f, 0.2f, 0.8f); + FighterRunningAI(npc, CalamityWorld.death ? 5f : 3.5f, 0.2f, 0.8f); } } else if (npcType == NPCID.Butcher) @@ -1683,21 +1730,21 @@ namespace CalamityMod.NPCs { acceleration *= 0.8f; } - FighterRunningAI(npc, 7f, acceleration, 0.8f); + FighterRunningAI(npc, CalamityWorld.death ? 10f : 7f, acceleration, 0.8f); } - else if (npcType == NPCID.WalkingAntlion) + else if (npcType == NPCID.GiantWalkingAntlion || npcType == NPCID.WalkingAntlion || npcType == NPCID.LarvaeAntlion) { - float xAdditive = 3.5f; + float xAdditive = CalamityWorld.death ? 3.5f : 3f; float turnValue = 90f; float absoluteVelocityX = Math.Abs(npc.velocity.X); if (absoluteVelocityX > 2.75f) { - xAdditive = 7f; + xAdditive = CalamityWorld.death ? 7f : 6f; turnValue += 100f; } else if (absoluteVelocityX > 2.25) { - xAdditive = 5f; + xAdditive = CalamityWorld.death ? 5f : 4.25f; turnValue += 80f; } if (Math.Abs(npc.velocity.Y) < 0.5) @@ -1764,8 +1811,13 @@ namespace CalamityMod.NPCs acceleration = 0.15f; turnMultiplier = 0.98f; } - maxVelocity *= 1.5f; - acceleration *= 1.5f; + maxVelocity *= 1.25f; + acceleration *= 1.25f; + if (CalamityWorld.death) + { + maxVelocity *= 1.25f; + acceleration *= 1.25f; + } FighterRunningAI(npc, maxVelocity, acceleration, turnMultiplier); } else if ((npcType >= NPCID.ArmedZombie && npcType <= NPCID.ArmedZombieCenx) || npcType == NPCID.Crawdad || npcType == NPCID.Crawdad2) @@ -1773,7 +1825,7 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f) { npc.damage = npc.defDamage; - float maxVelocity = 1.5f; + float maxVelocity = CalamityWorld.death ? 2.5f : 1.5f; maxVelocity *= 1f + (1f - npc.scale); FighterRunningAI(npc, maxVelocity, 0.09f, 0.8f, true, 0.8f); if (npc.velocity.Y == 0f && (!Main.dayTime || (double)npc.position.Y > Main.worldSurface * 16.0) && !Main.player[npc.target].dead) @@ -1883,9 +1935,12 @@ namespace CalamityMod.NPCs { velocityMax *= 1f + (1f - npc.scale); } - velocityMax *= 1.5f; + velocityMax *= 1.25f; + if (CalamityWorld.death) + velocityMax *= 1.25f; FighterRunningAI(npc, velocityMax, 0.09f, 0.8f, true, 0.8f); } + if (npcType >= 277 && npcType <= 280) { Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0.2f, 0.1f, 0f); @@ -2047,7 +2102,7 @@ namespace CalamityMod.NPCs { npc.localAI[2]++; bool closeToPlayer = npc.Distance(Main.player[npc.target].Center) < 600f && Math.Abs(npc.SafeDirectionTo(Main.player[npc.target].Center).Y) < 0.5f; - if (npc.localAI[2] >= Main.rand.Next(240, 480) && closeToPlayer && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + if (npc.localAI[2] >= Main.rand.Next(240, CalamityWorld.death ? 300 : 480) && closeToPlayer && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) { npc.localAI[2] = 0f; Vector2 spawnPosition = npc.Center + new Vector2(npc.direction * 30f, 2f); @@ -2276,6 +2331,7 @@ namespace CalamityMod.NPCs npc.rotation += npc.velocity.X * 0.08f; } } + // Turn into a bat if (npcType == NPCID.Vampire && Main.netMode != NetmodeID.MultiplayerClient) { @@ -2284,42 +2340,35 @@ namespace CalamityMod.NPCs npc.Transform(NPCID.VampireBat); } } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.velocity.Y == 0f) TryConvertToWallClimber(npc); - if (Main.netMode != NetmodeID.MultiplayerClient && Main.expertMode && npc.target >= 0 && (npcType == NPCID.BlackRecluse || npcType == NPCID.BlackRecluseWall) && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + bool prehardmodeSpiders = npc.type == NPCID.WallCreeper || npc.type == NPCID.WallCreeperWall || npc.type == NPCID.BloodCrawler || npc.type == NPCID.BloodCrawlerWall; + if (Main.netMode != NetmodeID.MultiplayerClient && Main.expertMode && npc.target >= 0 && (npcType == NPCID.BlackRecluse || npcType == NPCID.BlackRecluseWall || npc.type == NPCID.JungleCreeper || npc.type == NPCID.JungleCreeperWall || prehardmodeSpiders) && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) { npc.localAI[0] += 1f; if (npc.justHit) - { - npc.localAI[0] -= (float)Main.rand.Next(5, 20); - if (npc.localAI[0] < 0f) - { - npc.localAI[0] = 0f; - } - } - if (npc.localAI[0] > (float)Main.rand.Next(120, 240)) + npc.localAI[0] = 0f; + + float webSpitGateValue = CalamityWorld.death ? 240f : 390f; + if (npc.localAI[0] >= webSpitGateValue) { npc.localAI[0] = 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 10f, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * (prehardmodeSpiders ? 6f : 10f), ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); } } + if (npcType == NPCID.IceGolem) { - if (npc.justHit && Main.rand.NextBool(3)) - { - npc.ai[2] -= (float)Main.rand.Next(20); - } - if (npc.ai[2] < 0f) - { + if (npc.justHit) npc.ai[2] = 0f; - } + if (npc.confused) - { npc.ai[2] = 0f; - } + npc.ai[2] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 90f && npc.velocity.Y == 0f && !Main.player[npc.target].dead && !Main.player[npc.target].frozen && ((npc.direction > 0 && npc.Center.X < Main.player[npc.target].Center.X) || (npc.direction < 0 && npc.Center.X > Main.player[npc.target].Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= (CalamityWorld.death ? 60f : 90f) && npc.velocity.Y == 0f && !Main.player[npc.target].dead && !Main.player[npc.target].frozen && ((npc.direction > 0 && npc.Center.X < Main.player[npc.target].Center.X) || (npc.direction < 0 && npc.Center.X > Main.player[npc.target].Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.netUpdate = true; Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 15; @@ -2327,30 +2376,26 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; } } + if (npcType == NPCID.Eyezor) { if (npc.justHit) - { - npc.ai[2] -= (float)Main.rand.Next(20); - } - if (npc.ai[2] < 0f) - { npc.ai[2] = 0f; - } + if (npc.confused) - { npc.ai[2] = 0f; - } + npc.ai[2] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 60f && npc.velocity.Y == 0f && !Main.player[npc.target].dead && !Main.player[npc.target].frozen && ((npc.direction > 0 && npc.Center.X < Main.player[npc.target].Center.X) || (npc.direction < 0 && npc.Center.X > Main.player[npc.target].Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= (CalamityWorld.death ? 60f : 90f) && npc.velocity.Y == 0f && !Main.player[npc.target].dead && !Main.player[npc.target].frozen && ((npc.direction > 0 && npc.Center.X < Main.player[npc.target].Center.X) || (npc.direction < 0 && npc.Center.X > Main.player[npc.target].Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float speed = 15f; + float speed = 12f; Vector2 spawnPosition = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + 12f); Vector2 velocity = Vector2.Normalize(Main.player[npc.target].Center - spawnPosition) * speed; Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition, velocity, ProjectileID.EyeLaser, 40, 0f, Main.myPlayer, 0f, 0f); npc.ai[2] = 0f; } } + if (npcType == NPCID.MartianEngineer) { if (npc.confused) @@ -2412,6 +2457,7 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.GigaZapper) { if (npc.confused) @@ -2435,6 +2481,7 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.SkeletonArcher || npcType == NPCID.GoblinArcher || npcType == NPCID.IcyMerman || @@ -2597,38 +2644,38 @@ namespace CalamityMod.NPCs { npc.localAI[2] += 1f; } - float num140 = 11f; + float num140 = CalamityWorld.death ? 6f : 11f; if (npcType == NPCID.GoblinArcher) { - num140 = 9f; + num140 = CalamityWorld.death ? 5f : 9f; } if (npcType == NPCID.IcyMerman) { - num140 = 7f; + num140 = CalamityWorld.death ? 4f : 7f; } if (npcType == NPCID.Paladin) { - num140 = 9f; + num140 = CalamityWorld.death ? 5f : 9f; } if (npcType == NPCID.SkeletonCommando) { - num140 = 4f; + num140 = CalamityWorld.death ? 2.5f : 4f; } if (npcType == NPCID.PirateDeadeye) { - num140 = 14f; + num140 = CalamityWorld.death ? 8f : 14f; } if (npcType == NPCID.PirateCrossbower) { - num140 = 16f; + num140 = CalamityWorld.death ? 9f : 16f; } if (npcType == NPCID.RayGunner) { - num140 = 7f; + num140 = CalamityWorld.death ? 4f : 7f; } if (npcType == NPCID.MartianWalker) { - num140 = 8f; + num140 = CalamityWorld.death ? 5f : 8f; } if (npcType == NPCID.StardustSpiderBig) { @@ -2636,15 +2683,15 @@ namespace CalamityMod.NPCs } if (npcType >= 449 && npcType <= 452) { - num140 = 7f; + num140 = CalamityWorld.death ? 4f : 7f; } if (npcType == NPCID.GreekSkeleton) { - num140 = 8f; + num140 = CalamityWorld.death ? 5f : 8f; } if (npcType == NPCID.DrManFly) { - num140 = 7.5f; + num140 = CalamityWorld.death ? 4.5f : 7.5f; } if (npcType == NPCID.StardustSoldier) { @@ -2652,7 +2699,7 @@ namespace CalamityMod.NPCs } if (npcType >= 498 && npcType <= 506) { - num140 = 7f; + num140 = CalamityWorld.death ? 4f : 7f; } num140 *= 1.25f; Vector2 spawnPosition = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -2855,23 +2902,38 @@ namespace CalamityMod.NPCs distX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - spawnPosition.X; distY = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - spawnPosition.Y; magnitude = (float)Math.Sqrt((distX * distX + distY * distY)); - magnitude = 12f / magnitude; + magnitude = (CalamityWorld.death ? 8f : 12f) / magnitude; distX += (float)Main.rand.Next(-40, 41); distY += (float)Main.rand.Next(-40, 41); distX *= magnitude; distY *= magnitude; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, distX, distY, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, distX, distY, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + if (CalamityWorld.death) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].timeLeft = 1200; + } } } else if (npcType == NPCID.StardustSoldier) { - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition.X, spawnPosition.Y, distX, distY, projectileType, damage, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition.X, spawnPosition.Y, distX, distY, projectileType, damage, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + if (CalamityWorld.death) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].timeLeft = 480; + } } else if (npcType == NPCID.NebulaSoldier) { for (int i = 0; i < 4; i++) { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X - (float)(npc.spriteDirection * 4), npc.Center.Y + 6f, (float)(-3 + 2 * i) * 0.15f, (float)(-(float)Main.rand.Next(0, 3)) * 0.2f - 0.1f, projectileType, damage, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X - (float)(npc.spriteDirection * 4), npc.Center.Y + 6f, (float)(-3 + 2 * i) * 0.15f, (float)(-(float)Main.rand.Next(0, 3)) * 0.2f - 0.1f, projectileType, damage, 0f, Main.myPlayer, 0f, (float)npc.whoAmI); + if (CalamityWorld.death) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].timeLeft = 1200; + } } } else if (npcType == NPCID.StardustSpiderBig) @@ -2881,7 +2943,12 @@ namespace CalamityMod.NPCs } else { - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition.X, spawnPosition.Y, distX, distY, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition.X, spawnPosition.Y, distX, distY, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + if (CalamityWorld.death) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].timeLeft = 1200; + } } } if (Math.Abs(distY) > Math.Abs(distX) * 2f) @@ -2919,6 +2986,7 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; } } + if (npcType == NPCID.DrManFly && !Main.eclipse) { npcAllowedToShoot = true; @@ -2968,6 +3036,10 @@ namespace CalamityMod.NPCs { maxAttackDistance = 400f; } + if (CalamityWorld.death) + { + maxAttackDistance *= 1.25f; + } if (playerDistance < maxAttackDistance) { npc.netUpdate = true; @@ -3003,6 +3075,7 @@ namespace CalamityMod.NPCs } } } + if (npc.ai[2] <= 0f || (npcAllowedToShoot && (num136 == -1 || npc.ai[1] < (float)num136 || npc.ai[1] >= (float)(num136 + num137)))) { float maxVelocity = 1f; @@ -3078,6 +3151,7 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.MartianWalker) { npc.localAI[2] += 1f; @@ -3089,19 +3163,29 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.Clown && Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead) { + if (npc.justHit) + npc.ai[2] = 0f; + npc.ai[2] += 1f; - if (npc.ai[2] > 180f) + if (npc.ai[2] > (CalamityWorld.death ? 60f : 180f)) { Vector2 spawnPosition = new Vector2(npc.position.X + (float)npc.width * 0.5f - (float)(npc.direction * 24), npc.position.Y + 4f); int velocityX = 3 * npc.direction; int velocityY = -5; int num160 = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition.X, spawnPosition.Y, velocityX, velocityY, ProjectileID.HappyBomb, 0, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num160].timeLeft = 300; + if (CalamityWorld.death) + { + Main.projectile[num160].extraUpdates += 1; + Main.projectile[num160].timeLeft = 600; + } npc.ai[2] = 0f; } } + bool canOpenDoors = false; if (npc.velocity.Y == 0f) { @@ -3117,10 +3201,12 @@ namespace CalamityMod.NPCs } } } + if (npcType == NPCID.VortexLarva) { canOpenDoors = false; } + if (npc.velocity.Y >= 0f) { int velocitySign = 0; @@ -3191,6 +3277,7 @@ namespace CalamityMod.NPCs } } } + if (canOpenDoors) { int x = (int)((npc.Center.X + (float)(15 * npc.direction)) / 16f); @@ -3366,6 +3453,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; } + // Teleport (Chaos elementals) if (Main.netMode != NetmodeID.MultiplayerClient && (npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType()) && npc.ai[3] >= (float)aiGateValue) { @@ -3418,10 +3506,58 @@ namespace CalamityMod.NPCs #region Flying AI public static bool BuffedFlyingAI(NPC npc, Mod mod) { - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) + if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) + NPCUtils.TargetClosestNonBees(npc); + else if (npc.target < 0 || npc.target <= Main.maxPlayers || Main.player[npc.target].dead) + npc.TargetClosest(); + + if (npc.type == NPCID.BloodSquid) { - npc.TargetClosest(true); + if (Main.dayTime) + { + npc.velocity.Y -= 0.3f; + npc.EncourageDespawn(60); + } + + npc.position += npc.netOffset; + if (npc.alpha == 255) + { + npc.spriteDirection = npc.direction; + npc.velocity.Y = -6f; + for (int i = 0; i < 35; i++) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + dust.velocity *= 1f; + dust.scale = 1f + Main.rand.NextFloat() * 0.5f; + dust.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f; + dust.velocity += npc.velocity * 0.5f; + } + } + + npc.alpha -= 15; + if (npc.alpha < 0) + npc.alpha = 0; + + if (npc.alpha != 0) + { + for (int j = 0; j < 2; j++) + { + Dust dust2 = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + dust2.velocity *= 1f; + dust2.scale = 1f + Main.rand.NextFloat() * 0.5f; + dust2.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f; + dust2.velocity += npc.velocity * 0.3f; + } + } + + npc.position -= npc.netOffset; } + + NPCAimedTarget targetData = npc.GetTargetData(); + bool targetDead = false; + if (targetData.Type == NPCTargetType.Player) + targetDead = Main.player[npc.target].dead; + float num = 6f; float num2 = 0.05f; if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) @@ -3434,6 +3570,37 @@ namespace CalamityMod.NPCs num = 4.2f; num2 = 0.022f; } + else if (npc.type == NPCID.BloodSquid) + { + num = 6f; + num2 = 0.1f; + } + else if (npc.type == NPCID.Hornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) + { + num = 3.5f; + num2 = 0.021f; + if (npc.type == NPCID.HornetFatty) + { + num = 3f; + num2 = 0.017f; + } + + num *= 1f - npc.scale; + num2 *= 1f - npc.scale; + if ((double)(npc.position.Y / 16f) < Main.worldSurface) + { + if (Main.player[npc.target].position.Y - npc.position.Y > 300f && npc.velocity.Y < 0f) + npc.velocity.Y *= 0.97f; + + if (Main.player[npc.target].position.Y - npc.position.Y < 80f && npc.velocity.Y > 0f) + npc.velocity.Y *= 0.97f; + } + } + else if (npc.type == NPCID.MossHornet) + { + num = 4f; + num2 = 0.017f; + } else if (npc.type == NPCID.Parrot) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -3462,8 +3629,45 @@ namespace CalamityMod.NPCs num = 5f; num2 = 0.03f; } - num *= 1.5f; - num2 *= 1.5f; + else if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) + { + npc.ai[1] += 1f; + float originalFlyAwayTime = 60f; + float flyAwayTime = CalamityWorld.death ? 30f : 40f; + float originalFlyAwayVelocity = 6f; + float flyAwayDistance = originalFlyAwayTime * originalFlyAwayVelocity; + float flyAwayVelocity = flyAwayDistance / flyAwayTime; + float num3 = (npc.ai[1] - flyAwayTime) / flyAwayTime; + if (num3 > 1f) + { + num3 = 1f; + } + else + { + if (npc.velocity.X > flyAwayVelocity) + npc.velocity.X = flyAwayVelocity; + + if (npc.velocity.X < -flyAwayVelocity) + npc.velocity.X = -flyAwayVelocity; + + if (npc.velocity.Y > flyAwayVelocity) + npc.velocity.Y = flyAwayVelocity; + + if (npc.velocity.Y < -flyAwayVelocity) + npc.velocity.Y = -flyAwayVelocity; + } + + num = 5f; + num2 = 0.1f; + num2 *= num3; + } + num *= 1.25f; + num2 *= 1.25f; + if (CalamityWorld.death) + { + num *= 1.25f; + num2 *= 1.25f; + } Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); @@ -3491,9 +3695,9 @@ namespace CalamityMod.NPCs num4 *= num6; num5 *= num6; } - if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Probe || npc.type == NPCID.Crimera || npc.type == NPCID.Moth) + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Probe || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) { - if (num7 > 100f || npc.type == NPCID.Corruptor) + if (num7 > 100f || npc.type == NPCID.Corruptor || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) { npc.ai[0] += 1f; if (npc.ai[0] > 0f) @@ -3517,13 +3721,13 @@ namespace CalamityMod.NPCs npc.ai[0] = -200f; } } - if (num7 < 150f && (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera)) + if (num7 < 150f && (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid)) { npc.velocity.X = npc.velocity.X + num4 * 0.009f; npc.velocity.Y = npc.velocity.Y + num5 * 0.009f; } } - if (Main.player[npc.target].dead) + if (targetDead) { num4 = (float)npc.direction * num / 2f; num5 = -num / 2f; @@ -3531,7 +3735,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X < num4) { npc.velocity.X = npc.velocity.X + num2; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.velocity.X < 0f && num4 > 0f) + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.X < 0f && num4 > 0f) { npc.velocity.X = npc.velocity.X + num2; } @@ -3539,7 +3743,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.X > num4) { npc.velocity.X = npc.velocity.X - num2; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.velocity.X > 0f && num4 < 0f) + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.X > 0f && num4 < 0f) { npc.velocity.X = npc.velocity.X - num2; } @@ -3547,7 +3751,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y < num5) { npc.velocity.Y = npc.velocity.Y + num2; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.velocity.Y < 0f && num5 > 0f) + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.Y < 0f && num5 > 0f) { npc.velocity.Y = npc.velocity.Y + num2; } @@ -3555,7 +3759,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.Y > num5) { npc.velocity.Y = npc.velocity.Y - num2; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.velocity.Y > 0f && num5 < 0f) + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.Probe && npc.type != NPCID.BloodSquid && npc.velocity.Y > 0f && num5 < 0f) { npc.velocity.Y = npc.velocity.Y - num2; } @@ -3575,6 +3779,9 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.Probe) { + if (npc.justHit) + npc.localAI[0] = 0f; + npc.localAI[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) { @@ -3605,11 +3812,11 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + MathHelper.Pi; } } - else if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera) + else if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid) { npc.rotation = (float)Math.Atan2((double)num5, (double)num4) - MathHelper.PiOver2; } - else if (npc.type == NPCID.Moth) + else if (npc.type == NPCID.Moth || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) { if (npc.velocity.X > 0f) { @@ -3625,7 +3832,7 @@ namespace CalamityMod.NPCs { npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - MathHelper.PiOver2; } - if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.MeteorHead || npc.type == NPCID.Corruptor || npc.type == NPCID.Probe || npc.type == NPCID.Crimera || npc.type == NPCID.Moth) + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.MeteorHead || npc.type == NPCID.Corruptor || npc.type == NPCID.Probe || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) { float num11 = 0.7f; if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) @@ -3658,7 +3865,12 @@ namespace CalamityMod.NPCs npc.velocity.Y = -2f; } } - if (npc.type == NPCID.MeteorHead) + if (npc.type == NPCID.BloodSquid) + { + int num13 = Dust.NewDust(npc.position, npc.width, npc.height, 5, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100); + Main.dust[num13].velocity *= 0.5f; + } + else if (npc.type == NPCID.MeteorHead) { int num12 = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); Dust dust = Main.dust[num12]; @@ -3666,7 +3878,7 @@ namespace CalamityMod.NPCs dust.velocity.X *= 0.3f; dust.velocity.Y *= 0.3f; } - else if (npc.type != NPCID.Probe && npc.type != NPCID.Moth && npc.type != NPCID.Parrot && Main.rand.NextBool(20)) + else if (npc.type != NPCID.Probe && npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && Main.rand.NextBool(20)) { int num13 = 18; if (npc.type == NPCID.Crimera) @@ -3686,7 +3898,7 @@ namespace CalamityMod.NPCs dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; } - if ((npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera) && npc.wet) + if ((npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid) && npc.wet) { if (npc.velocity.Y > 0f) { @@ -3711,6 +3923,72 @@ namespace CalamityMod.NPCs } npc.TargetClosest(true); } + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) + { + if (npc.wet) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.95f; + + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + + npc.TargetClosest(); + } + + if (npc.ai[1] == 101f) + { + SoundEngine.PlaySound(SoundID.Item17, npc.position); + npc.ai[1] = 0f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += (npc.type == NPCID.MossHornet ? 2f : 1f) * 0.1f * npc.scale; + if (npc.justHit) + npc.ai[1] = 0f; + + if (targetData.Type == NPCTargetType.Player) + { + Player player = Main.player[npc.target]; + if (player != null && player.stealth == 0f && player.itemAnimation == 0) + npc.ai[1] = 0f; + } + + if (npc.ai[1] >= 240f) + { + if (targetData.Type != 0 && Collision.CanHit(npc, targetData)) + { + float num17 = (CalamityWorld.death || Main.hardMode) ? 5f : 8f; + Vector2 vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height / 2); + float num18 = targetData.Center.X - vector2.X; + float num19 = targetData.Center.Y - vector2.Y; + if ((num18 < 0f && npc.velocity.X < 0f) || (num18 > 0f && npc.velocity.X > 0f)) + { + float num20 = (float)Math.Sqrt(num18 * num18 + num19 * num19); + num20 = num17 / num20; + num18 *= num20; + num19 *= num20; + int num21 = (int)(10f * npc.scale); + if (npc.type == NPCID.MossHornet) + num21 = (int)(30f * npc.scale); + + int num22 = ProjectileID.Stinger; + int num23 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector2.X, vector2.Y, num18, num19, num22, num21, 0f, Main.myPlayer); + Main.projectile[num23].timeLeft = (CalamityWorld.death || Main.hardMode) ? 600 : 300; + Main.projectile[num23].extraUpdates += (CalamityWorld.death || Main.hardMode) ? 1 : 0; + npc.ai[1] = 101f; + npc.netUpdate = true; + } + else + npc.ai[1] = 0f; + } + else + npc.ai[1] = 0f; + } + } + } if (npc.type == NPCID.Probe & flag) { if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) @@ -3725,19 +4003,61 @@ namespace CalamityMod.NPCs npc.velocity.X = npc.velocity.X * 0.9f; } } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.type == NPCID.Corruptor && !Main.player[npc.target].dead) + if (Main.netMode != NetmodeID.MultiplayerClient && !targetDead) { - npc.localAI[0] += 1f; - if (npc.localAI[0] == 180f) + if (npc.type == NPCID.Corruptor) { - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (npc.justHit) + npc.localAI[0] = 0f; + + npc.localAI[0] += 1f; + if (npc.localAI[0] == 180f) { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 112, 0, 0f, 0f, 0f, 0f, 255); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (float)(npc.height / 2) + npc.velocity.Y), 112, 0, 0f, 0f, 0f, 0f, 255); + } + npc.localAI[0] = 0f; + } + } + + if (npc.type == NPCID.BloodSquid) + { + if (npc.justHit) + npc.localAI[0] = 0f; + + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 120f) + { + if (targetData.Type != 0 && Collision.CanHit(npc, targetData)) + { + if ((npc.Center - targetData.Center).Length() < 400f) + { + Vector2 vector3 = npc.DirectionTo(new Vector2(targetData.Center.X, targetData.Position.Y)); + npc.velocity = -vector3 * 5f; + npc.netUpdate = true; + npc.localAI[0] = 0f; + vector3 = npc.DirectionTo(new Vector2(targetData.Center.X, targetData.Position.Y)); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, vector3 * (CalamityWorld.death ? 6f : 10f), ProjectileID.BloodShot, 50, 1f, Main.myPlayer); + if (CalamityWorld.death) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].timeLeft = 1200; + } + } + else + { + npc.localAI[0] = 50f; + } + } + else + { + npc.localAI[0] = 50f; + } } - npc.localAI[0] = 0f; } } - if ((Main.dayTime && npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.MeteorHead && npc.type != NPCID.Corruptor && npc.type != NPCID.Moth && npc.type != NPCID.Parrot) || Main.player[npc.target].dead) + if ((Main.dayTime && npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.MeteorHead && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && npc.type != NPCID.Corruptor && npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.BloodSquid) || Main.player[npc.target].dead) { npc.velocity.Y = npc.velocity.Y - num2 * 2f; if (npc.timeLeft > 10) @@ -3771,9 +4091,33 @@ namespace CalamityMod.NPCs } } - if (npc.type == NPCID.StardustWormHead && npc.ai[1] == 0f) + if (npc.type >= NPCID.BloodEelHead && npc.type <= NPCID.BloodEelTail) { - npc.ai[1] = (float)Main.rand.Next(-2, 0); + npc.position += npc.netOffset; + npc.dontTakeDamage = (npc.alpha > 0); + if (npc.type == NPCID.BloodEelHead || (npc.type != NPCID.BloodEelHead && Main.npc[(int)npc.ai[1]].alpha < 85)) + { + if (npc.dontTakeDamage) + { + for (int k = 0; k < 2; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100); + } + } + + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + if (npc.alpha == 0 && Main.rand.NextBool(5)) + Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100); + + npc.position -= npc.netOffset; + } + else if (npc.type == NPCID.StardustWormHead && npc.ai[1] == 0f) + { + npc.ai[1] = Main.rand.Next(-2, 0); npc.netUpdate = true; } @@ -3817,11 +4161,17 @@ namespace CalamityMod.NPCs } } + if (npc.type == NPCID.BloodEelHead && Main.dayTime) + { + npc.EncourageDespawn(60); + npc.velocity.Y += 1f; + } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.type == NPCID.WyvernHead && npc.ai[0] == 0f) { - int maxParts = 21; + int maxParts = CalamityWorld.death ? 30 : 21; npc.ai[3] = (float)npc.whoAmI; npc.realLife = npc.whoAmI; int num6 = npc.whoAmI; @@ -3859,7 +4209,7 @@ namespace CalamityMod.NPCs npc.ai[3] = (float)npc.whoAmI; npc.realLife = npc.whoAmI; int num12 = npc.whoAmI; - int num13 = Main.rand.Next(11, 15); + int num13 = Main.rand.Next(11, CalamityWorld.death ? 25 : 15); for (int m = 0; m < num13; m++) { int num14 = NPCID.TombCrawlerBody; @@ -3882,7 +4232,7 @@ namespace CalamityMod.NPCs npc.ai[3] = (float)npc.whoAmI; npc.realLife = npc.whoAmI; int num20 = npc.whoAmI; - int num21 = 50; + int num21 = CalamityWorld.death ? 70 : 50; for (int num22 = 0; num22 < num21; num22++) { int num23 = NPCID.SolarCrawltipedeBody; @@ -3900,7 +4250,30 @@ namespace CalamityMod.NPCs } } - if ((isSplittingNPCHead || isSplittingNPCBody || npc.type == NPCID.GiantWormHead || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerHead || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody) && npc.ai[0] == 0f) + if (npc.type == NPCID.BloodEelHead && npc.ai[0] == 0f) + { + npc.ai[3] = npc.whoAmI; + npc.realLife = npc.whoAmI; + int num22 = 0; + int num23 = npc.whoAmI; + int num24 = CalamityWorld.death ? 44 : 34; + for (int num25 = 0; num25 < num24; num25++) + { + int num26 = NPCID.BloodEelBody; + if (num25 == num24 - 1) + num26 = NPCID.BloodEelTail; + + num22 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), num26, npc.whoAmI); + Main.npc[num22].ai[3] = npc.whoAmI; + Main.npc[num22].realLife = npc.whoAmI; + Main.npc[num22].ai[1] = num23; + Main.npc[num22].CopyInteractions(npc); + Main.npc[num23].ai[0] = num22; + NetMessage.SendData(23, -1, -1, null, num22); + num23 = num22; + } + } + else if ((isSplittingNPCHead || isSplittingNPCBody || npc.type == NPCID.GiantWormHead || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerHead || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody) && npc.ai[0] == 0f) { if (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead) { @@ -3913,25 +4286,25 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.DevourerHead: - npc.ai[2] = (float)Main.rand.Next(13, 19); + npc.ai[2] = (float)Main.rand.Next(13, CalamityWorld.death ? 30 : 19); break; case NPCID.GiantWormHead: - npc.ai[2] = (float)Main.rand.Next(25, 31); + npc.ai[2] = (float)Main.rand.Next(25, CalamityWorld.death ? 50 : 31); break; case NPCID.BoneSerpentHead: - npc.ai[2] = (float)Main.rand.Next(16, 23); + npc.ai[2] = (float)Main.rand.Next(16, CalamityWorld.death ? 33 : 23); break; case NPCID.DiggerHead: - npc.ai[2] = (float)Main.rand.Next(12, 18); + npc.ai[2] = (float)Main.rand.Next(12, CalamityWorld.death ? 27 : 18); break; case NPCID.SeekerHead: - npc.ai[2] = (float)Main.rand.Next(27, 33); + npc.ai[2] = (float)Main.rand.Next(27, CalamityWorld.death ? 45 : 33); break; case NPCID.LeechHead: - npc.ai[2] = (float)Main.rand.Next(5, 8); + npc.ai[2] = (float)Main.rand.Next(CalamityWorld.death ? 3 : 5, CalamityWorld.death ? 5 : 8); break; case NPCID.DuneSplicerHead: - npc.ai[2] = (float)Main.rand.Next(15, 24); + npc.ai[2] = (float)Main.rand.Next(15, CalamityWorld.death ? 35 : 24); break; } @@ -4072,6 +4445,10 @@ namespace CalamityMod.NPCs { flag2 = true; } + if (npc.type >= NPCID.BloodEelHead && npc.type <= NPCID.BloodEelTail) + { + flag2 = true; + } if (!flag2) { for (int num33 = num29; num33 < num30; num33++) @@ -4119,7 +4496,7 @@ namespace CalamityMod.NPCs } } - if (npc.type >= NPCID.WyvernHead && npc.type <= NPCID.WyvernTail) + if ((npc.type >= NPCID.WyvernHead && npc.type <= NPCID.WyvernTail) || (npc.type >= NPCID.BloodEelHead && npc.type <= NPCID.BloodEelTail)) { if (npc.velocity.X < 0f) { @@ -4205,8 +4582,8 @@ namespace CalamityMod.NPCs } if (npc.type == NPCID.WyvernHead) { - num37 = 13f; - num38 = 0.25f; + num37 = 11f; + num38 = 0.3f; } if (npc.type == NPCID.StardustWormHead) { @@ -4232,6 +4609,17 @@ namespace CalamityMod.NPCs num38 += 0.1f; } } + if (npc.type == NPCID.BloodEelHead) + { + num37 = 18f; + num38 = 0.6f; + } + + if (CalamityWorld.death) + { + num37 *= 1.25f; + num38 *= 1.25f; + } Vector2 vector2 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num39 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); @@ -4281,8 +4669,8 @@ namespace CalamityMod.NPCs } else { - num37 = 20f; - num38 = 0.6f; + num37 = 28f; + num38 = 0.8f; } float num47 = num37 * 1.3f; float num48 = num37 * 0.7f; @@ -4366,13 +4754,17 @@ namespace CalamityMod.NPCs { num53 += 6; } + if (npc.type >= NPCID.BloodEelHead && npc.type <= NPCID.BloodEelTail) + { + num53 = 24; + } num52 = (num52 - (float)num53) / num52; num39 *= num52; num40 *= num52; npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num39; npc.position.Y = npc.position.Y + num40; - if (npc.type >= NPCID.WyvernHead && npc.type <= NPCID.WyvernTail) + if ((npc.type >= NPCID.WyvernHead && npc.type <= NPCID.WyvernTail) || (npc.type >= NPCID.BloodEelHead && npc.type <= NPCID.BloodEelTail)) { if (num39 < 0f) { @@ -4430,7 +4822,7 @@ namespace CalamityMod.NPCs } else { - if (npc.type != NPCID.WyvernHead && npc.type != NPCID.LeechHead && npc.type != NPCID.SolarCrawltipedeHead && npc.soundDelay == 0) + if (npc.type != NPCID.WyvernHead && npc.type != NPCID.LeechHead && npc.type != NPCID.SolarCrawltipedeHead && npc.type != NPCID.BloodEelHead && npc.soundDelay == 0) { float num54 = num52 / 40f; if (num54 < 10f) @@ -4519,7 +4911,7 @@ namespace CalamityMod.NPCs if (Math.Abs(npc.velocity.X) < num37 / 2f) { if (npc.velocity.X == 0f) - npc.velocity.X = npc.velocity.X - (float)npc.direction; + npc.velocity.X = npc.velocity.X - npc.direction; npc.velocity.X = npc.velocity.X * 1.1f; } @@ -4527,6 +4919,31 @@ namespace CalamityMod.NPCs npc.velocity.Y = npc.velocity.Y - num38; } } + + if (npc.type == NPCID.BloodEelHead) + { + float num69 = 120f; + if (((npc.velocity.X > 0f && num39 < 0f) || (npc.velocity.X < 0f && num39 > 0f) || (npc.velocity.Y > 0f && num40 < 0f) || (npc.velocity.Y < 0f && num40 > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > num38 / 2f && num52 < num69) + { + flag6 = true; + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num37) + npc.velocity *= 1.1f; + } + if (npc.position.Y > Main.player[npc.target].position.Y || Main.player[npc.target].dead) + { + flag6 = true; + if (Math.Abs(npc.velocity.X) < num37 / 2f) + { + if (npc.velocity.X == 0f) + npc.velocity.X -= npc.direction; + + npc.velocity.X *= 1.1f; + } + else if (npc.velocity.Y > 0f - num37) + npc.velocity.Y -= num38; + } + } + if (!flag6) { if ((npc.velocity.X > 0f && num39 > 0f) || (npc.velocity.X < 0f && num39 < 0f) || (npc.velocity.Y > 0f && num40 > 0f) || (npc.velocity.Y < 0f && num40 < 0f)) @@ -4784,6 +5201,10 @@ namespace CalamityMod.NPCs num = num77; } } + + if (npc.justHit) + npc.ai[0] = 2f; + npc.ai[0] += 2f; if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) { @@ -4931,7 +5352,9 @@ namespace CalamityMod.NPCs } if (flag7) { - Projectile.NewProjectile(npc.GetSource_FromAI(), (float)(num100 * 16 + 8), (float)(num101 * 16 + 8), 0f, 0f, ProjectileID.DesertDjinnCurse, 0, 1f, Main.myPlayer, (float)npc.target, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), (float)(num100 * 16 + 8), (float)(num101 * 16 + 8), 0f, 0f, ProjectileID.DesertDjinnCurse, 0, 1f, Main.myPlayer, (float)npc.target, 0f); + if (CalamityWorld.death) + Main.projectile[proj].extraUpdates += 1; break; } } @@ -4945,14 +5368,14 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - float num102 = 6f; + float num102 = CalamityWorld.death ? 8f : 6f; if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) { - num102 = 8f; + num102 = CalamityWorld.death ? 10f : 8f; } if (npc.type == NPCID.RaggedCaster || npc.type == NPCID.RaggedCasterOpenCoat) { - num102 = 4f; + num102 = CalamityWorld.death ? 5f : 4f; } Vector2 vector13 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y); float num103 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector13.X; @@ -5002,7 +5425,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.RuneWizard) { - float num109 = 10f; + float num109 = CalamityWorld.death ? 12f : 10f; Vector2 vector14 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num110 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector14.X; float num111 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector14.Y; @@ -5169,6 +5592,12 @@ namespace CalamityMod.NPCs break; } + if (CalamityWorld.death) + { + acceleration *= 1.25f; + minDistance *= 1.25f; + } + float maxVelocity = 2f + (npc.type == NPCID.ManEater ? 1f : 0f) + (npc.type == NPCID.AngryTrapper ? 2f : 0f); @@ -5268,6 +5697,9 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.Clinger && !Main.player[npc.target].dead) { + if (npc.justHit) + npc.localAI[0] = 0f; + npc.localAI[0] += 1f; if (npc.localAI[0] >= 90f) { @@ -5289,6 +5721,9 @@ namespace CalamityMod.NPCs } if (npc.type == NPCID.GiantFungiBulb && !Main.player[npc.target].dead) { + if (npc.justHit) + npc.localAI[0] = 0f; + npc.localAI[0] += 1f; if (npc.localAI[0] >= 120f) { @@ -5384,12 +5819,12 @@ namespace CalamityMod.NPCs { npc.TargetClosest(true); } - float maxSpeedX = 6f; - float maxSpeedY = 2.5f; + float maxSpeedX = CalamityWorld.death ? 6f : 5f; + float maxSpeedY = CalamityWorld.death ? 2.5f : 2f; float xAccel = 0.12f; float xAccelBoost1 = 0.12f; - float xAccelBoost2 = 0.07f; + float xAccelBoost2 = 0.06f; float yAccel = 0.06f; float yAccelBoost1 = 0.07f; @@ -5402,15 +5837,15 @@ namespace CalamityMod.NPCs npc.directionY = -1; npc.direction *= -1; } - maxSpeedX = maxSpeedY = 9f; + maxSpeedX = maxSpeedY = CalamityWorld.death ? 11f : 9f; xAccel = yAccel = 0.3f; xAccelBoost1 = yAccelBoost1 = 0.12f; xAccelBoost2 = yAccelBoost2 = 0.07f; } else if (npc.type == NPCID.FlyingSnake) { - maxSpeedX = 6f; - maxSpeedY = 3.5f; + maxSpeedX = CalamityWorld.death ? 9f : 6f; + maxSpeedY = CalamityWorld.death ? 5f : 3.5f; xAccel = 0.3f; xAccelBoost1 = 0.12f; @@ -5433,18 +5868,18 @@ namespace CalamityMod.NPCs npc.type == NPCID.GiantFlyingFox || npc.type == ModContent.NPCType()) { - maxSpeedX = 6f; - maxSpeedY = 2.5f; + maxSpeedX = CalamityWorld.death ? 6f : 5f; + maxSpeedY = CalamityWorld.death ? 2.5f : 2f; if (npc.wet) { if (npc.velocity.Y > 0f) { npc.velocity.Y *= 0.95f; } - npc.velocity.Y -= 0.7f; - if (npc.velocity.Y < -6f) + npc.velocity.Y -= 0.6f; + if (npc.velocity.Y < -5f) { - npc.velocity.Y = -6f; + npc.velocity.Y = -5f; } npc.TargetClosest(true); } @@ -5476,10 +5911,10 @@ namespace CalamityMod.NPCs { npc.velocity.Y *= 0.95f; } - npc.velocity.Y -= 0.7f; - if (npc.velocity.Y < -6f) + npc.velocity.Y -= 0.6f; + if (npc.velocity.Y < -5f) { - npc.velocity.Y = -6f; + npc.velocity.Y = -5f; } npc.TargetClosest(true); } @@ -5542,6 +5977,9 @@ namespace CalamityMod.NPCs } if (Main.netMode != NetmodeID.MultiplayerClient) { + if (npc.justHit) + npc.ai[0] = 0f; + if (npc.type == NPCID.Harpy) { npc.ai[0] += 1f; @@ -5551,10 +5989,15 @@ namespace CalamityMod.NPCs { int damage = 15; int type = ProjectileID.HarpyFeather; - Vector2 featherVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 6f; + Vector2 featherVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * (CalamityWorld.death ? 4f : 6f); int feather = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, featherVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[feather].timeLeft = 300; + if (CalamityWorld.death) + { + Main.projectile[feather].extraUpdates += 1; + Main.projectile[feather].timeLeft = 600; + } } } else if (npc.ai[0] >= 400f + Main.rand.Next(200)) @@ -5571,10 +6014,15 @@ namespace CalamityMod.NPCs { int damage = 21; int type = ProjectileID.DemonSickle; - Vector2 sickleVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 0.2f; + Vector2 sickleVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * (CalamityWorld.death ? 0.15f : 0.2f); int sickle = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, sickleVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[sickle].timeLeft = 300; + if (CalamityWorld.death) + { + Main.projectile[sickle].extraUpdates += 1; + Main.projectile[sickle].timeLeft = 600; + } } } else if (npc.ai[0] >= 300f + Main.rand.Next(200)) @@ -5591,7 +6039,7 @@ namespace CalamityMod.NPCs { Vector2 spawnPosition = npc.Center; - float tridentSpeed = 0.2f; + float tridentSpeed = CalamityWorld.death ? 0.15f : 0.2f; Vector2 tridentVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * tridentSpeed; spawnPosition += npc.velocity * 5f; @@ -5599,6 +6047,11 @@ namespace CalamityMod.NPCs int type = ProjectileID.UnholyTridentHostile; int trident = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition + tridentVelocity * 100f, tridentVelocity, type, damage, 3f, Main.myPlayer, 0f, 0f); Main.projectile[trident].timeLeft = 300; + if (CalamityWorld.death) + { + Main.projectile[trident].extraUpdates += 1; + Main.projectile[trident].timeLeft = 600; + } } } else if (npc.ai[0] >= 250f + Main.rand.Next(200)) @@ -5622,7 +6075,7 @@ namespace CalamityMod.NPCs { bool noWetTargets = false; npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + if ((Main.player[npc.target].wet || (CalamityWorld.death && npc.Distance(Main.player[npc.target].Center) < 400f)) && !Main.player[npc.target].dead) { noWetTargets = true; } @@ -5962,7 +6415,7 @@ namespace CalamityMod.NPCs if (!npc.friendly) { npc.TargetClosest(false); - if (Main.player[npc.target].wet && !Main.player[npc.target].dead) + if ((Main.player[npc.target].wet || (CalamityWorld.death && npc.Distance(Main.player[npc.target].Center) < 400f)) && !Main.player[npc.target].dead) { targetInWater = true; } @@ -6101,6 +6554,9 @@ namespace CalamityMod.NPCs } } + if (npc.justHit) + npc.ai[0] = 199f; + //Decrement the firing cooldown, play a sound if at full meaning it just fired if (npc.ai[0] > 0f) { @@ -6123,8 +6579,8 @@ namespace CalamityMod.NPCs int projType = ProjectileID.SandBallFalling; - // 3 to 5 in Death, if FTW is also enabled, 8 to 13 (random chance for 10x the amount) - int projAmt = Main.rand.Next(3, 6); + // 2 to 3 in Rev, 3 to 5 in Death, if FTW is also enabled, 8 to 13 (random chance for 10x the amount) + int projAmt = Main.rand.Next(CalamityWorld.death ? 3 : 2, CalamityWorld.death ? 6 : 4); if (Main.getGoodWorld) { projAmt = Main.rand.Next(8, 14); @@ -6224,8 +6680,8 @@ namespace CalamityMod.NPCs } else { - float num282 = 9f * npc.ai[3]; - float num283 = 0.3f * npc.ai[3]; + float num282 = (CalamityWorld.death ? 12f : 9f) * npc.ai[3]; + float num283 = (CalamityWorld.death ? 0.4f : 0.3f) * npc.ai[3]; float num284 = num282 / num283 / 2f; if (npc.ai[0] >= 1f && npc.ai[0] < (float)((int)num284)) { @@ -6283,7 +6739,7 @@ namespace CalamityMod.NPCs npc.directionY = 1; npc.ai[0] = 1f; } - int num285 = 6; + int num285 = CalamityWorld.death ? 9 : 6; if (npc.ai[1] == 0f) { npc.rotation += (float)(npc.direction * npc.directionY) * 0.13f; @@ -6329,7 +6785,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) + if (npc.localAI[0] >= (CalamityWorld.death ? 90f : 120f)) { npc.localAI[0] = 0f; for (int num1501 = 0; num1501 < 4; num1501++) @@ -6434,7 +6890,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.Gastropod) { - float num291 = 8f; + float num291 = 6f; Vector2 vector33 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num292 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector33.X; float num293 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector33.Y; @@ -6444,11 +6900,17 @@ namespace CalamityMod.NPCs num292 *= num294; num293 *= num294; + if (npc.justHit) + { + npc.localAI[1] = 0f; + npc.ai[3] = 0f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] == 32f && !Main.player[npc.target].npcTypeNoAggro[npc.type]) { int damage = 25; int projType = ProjectileID.PinkLaser; - int num297 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector33.X, vector33.Y, num292, num293, projType, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector33.X, vector33.Y, num292, num293, projType, damage, 0f, Main.myPlayer, 0f, 0f); } num290 = 12; @@ -6465,7 +6927,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] == 0f) { npc.localAI[1] += 1f; - if (npc.localAI[1] > 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && !Main.player[npc.target].npcTypeNoAggro[npc.type]) + if (npc.localAI[1] > (CalamityWorld.death ? 60f : 120f) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && !Main.player[npc.target].npcTypeNoAggro[npc.type]) { npc.localAI[1] = 0f; npc.ai[3] = 1f; @@ -6533,11 +6995,17 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2((double)num302, (double)num301); } + if (npc.justHit) + { + npc.localAI[1] = 0f; + npc.ai[3] = 0f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] == 16f) { int dmg = 45; int projType = ProjectileID.FrostBlastHostile; - int num306 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector34.X, vector34.Y, num301, num302, projType, dmg, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector34.X, vector34.Y, num301, num302, projType, dmg, 0f, Main.myPlayer, 0f, 0f); } num290 = 15; @@ -6554,7 +7022,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] == 0f) { npc.localAI[1] += 1f; - if (npc.localAI[1] > 120f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (npc.localAI[1] > (CalamityWorld.death ? 60f : 120f) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; npc.ai[3] = 1f; @@ -6575,10 +7043,13 @@ namespace CalamityMod.NPCs num290 = 9; } + if (npc.justHit) + npc.ai[3] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient && !npc.confused) { npc.ai[3] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= 120f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= (CalamityWorld.death ? 60f : 120f)) { npc.ai[3] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].head)) @@ -6594,7 +7065,7 @@ namespace CalamityMod.NPCs num310 *= num311; int dmg = 40; int projType = ProjectileID.GoldenShowerHostile; - int num314 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector35.X, vector35.Y, num308, num310, projType, dmg, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), vector35.X, vector35.Y, num308, num310, projType, dmg, 0f, Main.myPlayer, 0f, 0f); } } } @@ -6770,6 +7241,10 @@ namespace CalamityMod.NPCs { num319 = 2.5f; } + if (CalamityWorld.death) + { + num319 *= 1.25f; + } if (npc.type == NPCID.Poltergeist) { @@ -6834,6 +7309,10 @@ namespace CalamityMod.NPCs { num319 = 2.5f; } + if (CalamityWorld.death) + { + num319 *= 1.25f; + } if (npc.directionY == -1 && npc.velocity.Y > -num319) { @@ -6903,7 +7382,7 @@ namespace CalamityMod.NPCs // Charge if (npc.ai[0] == 0f) { - float chargeSpeed = 12f; + float chargeSpeed = CalamityWorld.death ? 16f : 12f; npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * chargeSpeed; npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver4; @@ -6916,10 +7395,10 @@ namespace CalamityMod.NPCs // Slow down if (npc.ai[0] == 1f) { - npc.velocity *= 0.99f; + npc.velocity *= CalamityWorld.death ? 0.98f : 0.99f; npc.ai[1] += 1f; // Get ready to spin and then charge again. - if (npc.ai[1] >= 100f) + if (npc.ai[1] >= (CalamityWorld.death ? 50f : 100f)) { npc.netUpdate = true; npc.ai[0] = 2f; @@ -6930,14 +7409,15 @@ namespace CalamityMod.NPCs // Spin else { - npc.velocity *= 0.96f; + npc.velocity *= CalamityWorld.death ? 0.94f : 0.96f; npc.ai[1] += 1f; - float anglularSpeed = npc.ai[1] / 60f; + float anglularSpeed = npc.ai[1] / (CalamityWorld.death ? 90f : 150f); anglularSpeed = 0.1f + anglularSpeed * 0.4f; - npc.rotation += anglularSpeed * (float)npc.direction; + npc.rotation += anglularSpeed * npc.direction; + // Charge - if (npc.ai[1] >= 60f) + if (npc.ai[1] >= (CalamityWorld.death ? 90f : 150f)) { npc.netUpdate = true; npc.ai[0] = 0f; @@ -6963,14 +7443,7 @@ namespace CalamityMod.NPCs else if (npc.position.Y / 16f > Main.worldSurface) { npc.TargetClosest(true); - if (Main.player[npc.target].ZoneSnow) - { - npc.ai[3] = 4f; - } - else - { - npc.ai[3] = 2f; - } + npc.ai[3] = 2f; } else { @@ -6979,7 +7452,7 @@ namespace CalamityMod.NPCs } // Never wait. Go straight for the player. - if (npc.type == NPCID.PresentMimic) + if (npc.type == NPCID.PresentMimic || npc.type == NPCID.IceMimic) { npc.ai[3] = 1f; } @@ -7159,7 +7632,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.StardustSpiderSmall) { npc.ai[1] += 1f; - bool flag5 = npc.ai[1] >= 120f; + bool flag5 = npc.ai[1] >= (CalamityWorld.death ? 60f : 120f); if (!flag5 && npc.velocity.Y == 0f) { for (int j = 0; j < Main.maxPlayers; j++) @@ -7228,7 +7701,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] >= 60f) { - npc.ai[1] = (float)(-(float)Main.rand.Next(320, 601)); + npc.ai[1] = (float)(-(float)Main.rand.Next(320, CalamityWorld.death ? 361 : 601)); npc.ai[2] = 0f; } } @@ -7303,6 +7776,12 @@ namespace CalamityMod.NPCs float num6 = 9f; float num7 = 0.1f; + if (CalamityWorld.death) + { + num6 *= 1.25f; + num7 *= 1.25f; + } + if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { if (npc.type == NPCID.Wolf || npc.type == ModContent.NPCType()) @@ -7400,6 +7879,11 @@ namespace CalamityMod.NPCs num6 = 6f + num8 * (float)npc.direction * 4f; num7 = 0.2f; } + if (CalamityWorld.death) + { + num6 *= 1.25f; + num7 *= 1.25f; + } if (npc.velocity.X < -num6 || npc.velocity.X > num6) { if (npc.velocity.Y == 0f) @@ -7670,7 +8154,7 @@ namespace CalamityMod.NPCs } npc.ai[1] += 1f; - if (npc.ai[1] >= 400f) + if (npc.ai[1] >= (CalamityWorld.death ? 400f : 500f)) { npc.ai[1] = 0f; npc.ai[0] = 1f; @@ -8125,12 +8609,17 @@ namespace CalamityMod.NPCs npc.TargetClosest(true); } - float speed = 3f; - float mvtAdjust = 0.12f; + float speed = 2.5f; + float mvtAdjust = 0.1f; if (npc.type == NPCID.DesertScorpionWall) { - speed = 6f; - mvtAdjust = 0.24f; + speed = 5f; + mvtAdjust = 0.2f; + } + if (CalamityWorld.death) + { + speed *= 1.25f; + mvtAdjust *= 1.25f; } //Calculate how to reach the target @@ -8292,16 +8781,23 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - //Black Recluses shoot Web Spit - if (Main.netMode != NetmodeID.MultiplayerClient && npc.target >= 0 && (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall) && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + bool prehardmodeSpiders = npc.type == NPCID.WallCreeper || npc.type == NPCID.WallCreeperWall || npc.type == NPCID.BloodCrawler || npc.type == NPCID.BloodCrawlerWall; + if (Main.netMode != NetmodeID.MultiplayerClient && + npc.target >= 0 && + (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall || npc.type == NPCID.JungleCreeper || npc.type == NPCID.JungleCreeperWall || prehardmodeSpiders) && + Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) { npc.localAI[0] += 1f; - if (npc.localAI[0] > (float)Main.rand.Next(180, 600)) + if (npc.justHit) + npc.localAI[0] = 0f; + + float webSpitGateValue = CalamityWorld.death ? 240f : 390f; + if (npc.localAI[0] >= webSpitGateValue) { npc.localAI[0] = 0f; Vector2 velocity = Main.player[npc.target].Center - npc.Center; velocity.Normalize(); - velocity *= 8f; + velocity *= prehardmodeSpiders ? 5f : 8f; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); } } @@ -8421,7 +8917,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.Derpling) { - npc.ai[0] += 4f; + npc.ai[0] += 3f; } else { @@ -8463,49 +8959,49 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 2f) { - npc.velocity.Y = -11.5f; - npc.velocity.X = npc.velocity.X + 4f * (float)npc.direction; + npc.velocity.Y = -14f; + npc.velocity.X = npc.velocity.X + 3f * (float)npc.direction; if (num587 < 350f && num587 > 200f) { npc.velocity.X = npc.velocity.X + (float)npc.direction; } - npc.ai[0] = -200f; + npc.ai[0] = CalamityWorld.death ? -100f : -200f; npc.ai[1] = 0f; npc.ai[3] = npc.position.X; } else { - npc.velocity.Y = -7.5f; - npc.velocity.X = npc.velocity.X + (float)(6 * npc.direction); + npc.velocity.Y = -10f; + npc.velocity.X = npc.velocity.X + (float)(5 * npc.direction); if (num587 < 350f && num587 > 200f) { npc.velocity.X = npc.velocity.X + (float)npc.direction; } - npc.ai[0] = -120f; + npc.ai[0] = CalamityWorld.death ? -60f : -120f; npc.ai[1] += 1f; } } else if (npc.ai[1] == 3f) { npc.velocity.Y = -9f; - npc.velocity.X = npc.velocity.X + (float)(4 * npc.direction); + npc.velocity.X = npc.velocity.X + (float)(2 * npc.direction); if (num587 < 350f && num587 > 200f) { npc.velocity.X = npc.velocity.X + (float)npc.direction; } - npc.ai[0] = -200f; + npc.ai[0] = CalamityWorld.death ? -100f : -200f; npc.ai[1] = 0f; npc.ai[3] = npc.position.X; } else { npc.velocity.Y = -5f; - npc.velocity.X = npc.velocity.X + (float)(8 * npc.direction); + npc.velocity.X = npc.velocity.X + (float)(4 * npc.direction); if (num587 < 350f && num587 > 200f) { npc.velocity.X = npc.velocity.X + (float)npc.direction; } - npc.ai[0] = -120f; + npc.ai[0] = CalamityWorld.death ? -60f : -120f; npc.ai[1] += 1f; } } @@ -8588,9 +9084,59 @@ namespace CalamityMod.NPCs } npc.velocity.Y = (float)npc.directionY; } + if (npc.type == NPCID.EyeballFlyingFish) + { + npc.position += npc.netOffset; + if (npc.alpha == 255) + { + npc.velocity.Y = -6f; + npc.netUpdate = true; + for (int num662 = 0; num662 < 15; num662++) + { + Dust dust2 = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + Dust dust = dust2; + dust.velocity *= 0.5f; + dust2.scale = 1f + Main.rand.NextFloat() * 0.5f; + dust2.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f; + dust = dust2; + dust.velocity += npc.velocity * 0.5f; + } + } + + npc.alpha -= 15; + if (npc.alpha < 0) + npc.alpha = 0; + + if (npc.alpha != 0) + { + for (int num663 = 0; num663 < 2; num663++) + { + Dust dust3 = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + Dust dust = dust3; + dust.velocity *= 1f; + dust3.scale = 1f + Main.rand.NextFloat() * 0.5f; + dust3.fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f; + dust = dust3; + dust.velocity += npc.velocity * 0.3f; + } + } + + if (Main.rand.NextBool(3)) + { + Dust dust4 = Dust.NewDustDirect(npc.position, npc.width, npc.height, 5); + Dust dust = dust4; + dust.velocity *= 0f; + dust4.alpha = 120; + dust4.scale = 0.7f + Main.rand.NextFloat() * 0.5f; + dust = dust4; + dust.velocity += npc.velocity * 0.3f; + } + + npc.position -= npc.netOffset; + } int num631 = npc.target; int direction2 = npc.direction; - if (npc.target == Main.maxPlayers || Main.player[npc.target].wet || Main.player[npc.target].dead || Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + if (npc.target == Main.maxPlayers || (Main.player[npc.target].wet && npc.type != NPCID.EyeballFlyingFish) || Main.player[npc.target].dead || Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) { npc.ai[0] = 90f; npc.TargetClosest(true); @@ -8612,7 +9158,7 @@ namespace CalamityMod.NPCs float num637 = 100f; float num638 = Math.Abs(npc.position.X + (float)(npc.width / 2) - (Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2))); float num639 = Main.player[npc.target].position.Y - (float)(npc.height / 2); - if (npc.type == NPCID.FlyingAntlion) + if (npc.type == NPCID.FlyingAntlion || npc.type == NPCID.GiantFlyingAntlion) { num632 = 0.09f; num633 = 0.03f; @@ -8647,6 +9193,26 @@ namespace CalamityMod.NPCs num = num640; } } + else if (npc.type == NPCID.EyeballFlyingFish) + { + num632 = 0.16f; + num633 = 0.12f; + num634 = 9f; + num635 = 5f; + num636 = 0f; + num637 = 250f; + num639 = Main.player[npc.target].position.Y; + if (Main.dayTime) + { + num639 = 0f; + npc.direction *= -1; + } + } + if (CalamityWorld.death) + { + num634 *= 1.25f; + num632 *= 1.25f; + } if (npc.ai[0] <= 0f) { num634 *= 0.8f; @@ -8724,7 +9290,7 @@ namespace CalamityMod.NPCs { npc.velocity.Y = num635; } - if (npc.wet) + if (npc.wet && npc.type != NPCID.EyeballFlyingFish) { if (npc.velocity.Y > 0f) { @@ -8745,8 +9311,8 @@ namespace CalamityMod.NPCs { npc.noGravity = true; npc.TargetClosest(true); - float speed = 6f; - float acceleration = 0.25f; + float speed = CalamityWorld.death ? 9f : 6f; + float acceleration = CalamityWorld.death ? 0.3f : 0.25f; Vector2 idealVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center - 300f * Vector2.UnitY) * speed; float playerDistance = npc.Distance(Main.player[npc.target].Center); @@ -8789,13 +9355,16 @@ namespace CalamityMod.NPCs } // Make it rain - float minXRainDistance = 150f; + float minXRainDistance = CalamityWorld.death ? 200f : 150f; if (npc.Center.X > Main.player[npc.target].position.X - minXRainDistance && npc.position.X < Main.player[npc.target].Center.X + minXRainDistance && npc.Center.Y < Main.player[npc.target].position.Y && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && Main.netMode != NetmodeID.MultiplayerClient) { + if (npc.justHit) + npc.ai[0] = 0f; + npc.ai[0] += 1f; if (npc.ai[0] % 8f == 0f) { @@ -8804,7 +9373,7 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(npc.GetSource_FromAI(), rainSpawnPosition, Vector2.UnitY * 5f, ProjectileID.RainNimbus, 20, 0f, Main.myPlayer, 0f, 0f); if (npc.ai[0] % 16f == 0f) { - float speedX = (float)Main.rand.NextFloat(-3f, 3f) * (Main.rand.NextFloat() - 0.5f); + float speedX = (float)Main.rand.NextFloat(CalamityWorld.death ? -6f : -3f, CalamityWorld.death ? 6f : 3f) * (Main.rand.NextFloat() - 0.5f); Projectile.NewProjectile(npc.GetSource_FromAI(), rainSpawnPosition, new Vector2(speedX, 5f), ProjectileID.FrostShard, 20, 0f, Main.myPlayer, 0f, 0f); } } @@ -8828,32 +9397,48 @@ namespace CalamityMod.NPCs if (npc.velocity.Y > 1f) npc.velocity.Y = 1f; - npc.TargetClosest(true); - float acceleration = 0.2f; - float velocity = 5f; + // Use regular AI if not spawned by a Giant Plantera Bulb + if (npc.ai[0] != -1f) + { + npc.TargetClosest(true); + float acceleration = Main.expertMode ? 0.2f : 0.1f; + float velocity = Main.expertMode ? 5f : 3f; + if (CalamityWorld.death) + { + acceleration *= 1.25f; + velocity *= 1.25f; + } - // Simple movement AI. You shouldn't need any help from comments to parse this. - if (npc.Center.X < Main.player[npc.target].position.X) - { - if (npc.velocity.X < 0f) + // Simple movement AI. You shouldn't need any help from comments to parse this. + if (npc.Center.X < Main.player[npc.target].position.X) { - npc.velocity.X *= 0.96f; + if (npc.velocity.X < 0f) + { + npc.velocity.X *= 0.96f; + } + npc.velocity.X += acceleration; } - npc.velocity.X += acceleration; - } - else if (npc.position.X > Main.player[npc.target].Center.X) - { - if (npc.velocity.X > 0f) + else if (npc.position.X > Main.player[npc.target].Center.X) { - npc.velocity.X *= 0.96f; + if (npc.velocity.X > 0f) + { + npc.velocity.X *= 0.96f; + } + npc.velocity.X -= acceleration; + } + if (npc.velocity.X > velocity || npc.velocity.X < -velocity) + { + npc.velocity.X *= 0.97f; } - npc.velocity.X -= acceleration; } - if (npc.velocity.X > velocity || npc.velocity.X < -velocity) + else { - npc.velocity.X *= 0.97f; + npc.velocity.X *= 0.98f; + npc.damage = npc.defDamage = 0; } + npc.rotation = npc.velocity.X * 0.2f; + return false; } #endregion @@ -8955,7 +9540,7 @@ namespace CalamityMod.NPCs // Shoot laser if (npc.ai[0] == 60f) { - npc.ai[0] = -120f; + npc.ai[0] = CalamityWorld.death ? -60f : -120f; // The "+ Main.player[npc.target].velocity * 20f" part ensures the turret will aim ahead of the player Vector2 distanceVector = Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - (npc.Center - Vector2.UnitY * 10f); @@ -9039,6 +9624,12 @@ namespace CalamityMod.NPCs chargeAcceleration *= chargeIntertia; + if (CalamityWorld.death) + { + upwardChargeSpeed *= 1.25f; + chargeSpeed *= 1.25f; + } + // Drone dust if (npc.type == NPCID.MartianDrone && npc.ai[0] != 3f) { @@ -9206,7 +9797,7 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - npc.velocity *= 0.95f; + npc.velocity *= CalamityWorld.death ? 0.9f : 0.95f; } if (hasCoolDustPhase && npc.ai[0] != 3f && Vector2.Distance(npc.Center, Main.player[npc.target].Center) < 64f) @@ -9222,7 +9813,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 3f) { npc.position = npc.Center; - npc.width = npc.height = 240; + npc.width = npc.height = CalamityWorld.death ? 360 : 240; npc.position -= npc.Size; npc.velocity = Vector2.Zero; @@ -9351,7 +9942,7 @@ namespace CalamityMod.NPCs npc.velocity *= 0.93f; - if (npc.ai[1] >= 45f) + if (npc.ai[1] >= (CalamityWorld.death ? 5f : 45f)) { npc.ai[1] = 0f; npc.ai[0] = 2f; @@ -9426,6 +10017,9 @@ namespace CalamityMod.NPCs // How much time is needed before the egg hatches float hatchTimer = ((int)npc.ai[1] == NPCID.Mothron ? 480f : 240f); + if (CalamityWorld.death) + hatchTimer *= 0.5f; + npc.ai[0] += 1f; if (npc.ai[0] >= hatchTimer) { @@ -9485,7 +10079,7 @@ namespace CalamityMod.NPCs Vector2 value46 = Main.player[npc.target].Center - npc.Center; value46.Y -= (float)(Main.player[npc.target].height / 4); float attackTimeMax1 = value46.Length(); - if (attackTimeMax1 > 800f) + if (attackTimeMax1 > (CalamityWorld.death ? 400f : 800f)) { npc.ai[0] = 2f; return false; @@ -9533,7 +10127,7 @@ namespace CalamityMod.NPCs Vector2 value47 = Main.player[npc.target].Center - npc.Center; float attackTimeMax2 = value47.Length(); float attackTimeMax3 = 2f; - attackTimeMax3 += attackTimeMax2 / 100f; + attackTimeMax3 += attackTimeMax2 / (CalamityWorld.death ? 160f : 180f); int attackTimeMax4 = 50; value47.Normalize(); value47 *= attackTimeMax3; @@ -9549,7 +10143,7 @@ namespace CalamityMod.NPCs npc.noTileCollide = true; Vector2 value48 = Main.player[npc.target].Center - npc.Center; float attackTimeMax5 = value48.Length(); - float scaleFactor23 = 4f; + float scaleFactor23 = CalamityWorld.death ? 3f : 2.5f; int attackTimeMax6 = 4; value48.Normalize(); value48 *= scaleFactor23; @@ -9597,7 +10191,7 @@ namespace CalamityMod.NPCs value51.Normalize(); npc.velocity = value51 * 0.1f; } - float scaleFactor24 = 3f; + float scaleFactor24 = CalamityWorld.death ? 2.5f : 2f; float num1390 = 20f; value51 = npc.velocity; value51.Normalize(); @@ -9640,6 +10234,1004 @@ namespace CalamityMod.NPCs } #endregion + #region Star Cell AI + public static bool BuffedStarCellAI(NPC npc, Mod mod) + { + npc.noTileCollide = false; + if (npc.ai[0] == 0f) + { + npc.TargetClosest(); + if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 1f; + } + else + { + Vector2 vector204 = Main.player[npc.target].Center - npc.Center; + vector204.Y -= Main.player[npc.target].height / 4; + float num1324 = vector204.Length(); + if (num1324 > 800f) + { + npc.ai[0] = 2f; + } + else + { + Vector2 center31 = npc.Center; + center31.X = Main.player[npc.target].Center.X; + Vector2 vector205 = center31 - npc.Center; + if (vector205.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center31, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center31.X; + npc.ai[2] = center31.Y; + Vector2 center32 = npc.Center; + center32.Y = Main.player[npc.target].Center.Y; + if (vector205.Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center32, 1, 1) && Collision.CanHit(center32, 1, 1, Main.player[npc.target].position, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center32.X; + npc.ai[2] = center32.Y; + } + } + else + { + center31 = npc.Center; + center31.Y = Main.player[npc.target].Center.Y; + if ((center31 - npc.Center).Length() > 8f && Collision.CanHit(npc.Center, 1, 1, center31, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center31.X; + npc.ai[2] = center31.Y; + } + } + + if (npc.ai[0] == 0f) + { + npc.localAI[0] = 0f; + vector204.Normalize(); + vector204 *= 0.5f; + npc.velocity += vector204; + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + } + } + } + else if (npc.ai[0] == 1f) + { + npc.rotation += npc.direction * 0.3f; + Vector2 value35 = Main.player[npc.target].Center - npc.Center; + if (npc.type == NPCID.NebulaHeadcrab) + value35 = Main.player[npc.target].Top - npc.Center; + + float num1325 = value35.Length(); + float num1326 = CalamityWorld.death ? 9f : 7.5f; + num1326 += num1325 / 100f; + int num1327 = CalamityWorld.death ? 40 : 45; + value35.Normalize(); + value35 *= num1326; + npc.velocity = (npc.velocity * (num1327 - 1) + value35) / num1327; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + } + + if (npc.type == NPCID.NebulaHeadcrab && num1325 < 40f && Main.player[npc.target].active && !Main.player[npc.target].dead) + { + bool flag84 = true; + for (int num1328 = 0; num1328 < Main.maxNPCs; num1328++) + { + NPC nPC7 = Main.npc[num1328]; + if (nPC7.active && nPC7.type == npc.type && nPC7.ai[0] == 5f && nPC7.target == npc.target) + { + flag84 = false; + break; + } + } + + if (flag84) + { + npc.Center = Main.player[npc.target].Top; + npc.velocity = Vector2.Zero; + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + } + else if (npc.ai[0] == 2f) + { + npc.rotation = npc.velocity.X * 0.1f; + npc.noTileCollide = true; + Vector2 value36 = Main.player[npc.target].Center - npc.Center; + float num1329 = value36.Length(); + float num1330 = CalamityWorld.death ? 6f : 4.5f; + int num1331 = 2; + value36.Normalize(); + value36 *= num1330; + npc.velocity = (npc.velocity * (num1331 - 1) + value36) / num1331; + if (num1329 < 600f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.ai[0] = 0f; + } + else if (npc.ai[0] == 3f) + { + npc.rotation = npc.velocity.X * 0.1f; + Vector2 value37 = new Vector2(npc.ai[1], npc.ai[2]); + Vector2 value38 = value37 - npc.Center; + float num1332 = value38.Length(); + float num1333 = CalamityWorld.death ? 4f : 3f; + float num1334 = 2f; + value38.Normalize(); + value38 *= num1333; + npc.velocity = (npc.velocity * (num1334 - 1f) + value38) / num1334; + if (npc.collideX || npc.collideY) + { + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + + if (num1332 < num1333 || num1332 > 800f || Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + npc.ai[0] = 0f; + } + else if (npc.ai[0] == 4f) + { + npc.rotation = npc.velocity.X * 0.1f; + if (npc.collideX) + npc.velocity.X *= -0.8f; + + if (npc.collideY) + npc.velocity.Y *= -0.8f; + + Vector2 value39; + if (npc.velocity.X == 0f && npc.velocity.Y == 0f) + { + value39 = Main.player[npc.target].Center - npc.Center; + value39.Y -= Main.player[npc.target].height / 4; + value39.Normalize(); + npc.velocity = value39 * 0.1f; + } + + float num1335 = CalamityWorld.death ? 4f : 3f; + float num1336 = CalamityWorld.death ? 16f : 18f; + value39 = npc.velocity; + value39.Normalize(); + value39 *= num1335; + npc.velocity = (npc.velocity * (num1336 - 1f) + value39) / num1336; + npc.ai[1] += 1f; + if (npc.ai[1] > 180f) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + } + + if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + npc.ai[0] = 0f; + + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 5f && !Collision.SolidCollision(npc.position - new Vector2(10f, 10f), npc.width + 20, npc.height + 20)) + { + npc.localAI[0] = 0f; + Vector2 center33 = npc.Center; + center33.X = Main.player[npc.target].Center.X; + if (Collision.CanHit(npc.Center, 1, 1, center33, 1, 1) && Collision.CanHit(npc.Center, 1, 1, center33, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center33, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center33.X; + npc.ai[2] = center33.Y; + } + else + { + center33 = npc.Center; + center33.Y = Main.player[npc.target].Center.Y; + if (Collision.CanHit(npc.Center, 1, 1, center33, 1, 1) && Collision.CanHit(Main.player[npc.target].Center, 1, 1, center33, 1, 1)) + { + npc.ai[0] = 3f; + npc.ai[1] = center33.X; + npc.ai[2] = center33.Y; + } + } + } + } + else if (npc.ai[0] == 5f) + { + Player player8 = Main.player[npc.target]; + if (!player8.active || player8.dead) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + else + { + npc.Center = ((player8.gravDir == 1f) ? player8.Top : player8.Bottom) + new Vector2(player8.direction * 4, 0f); + npc.gfxOffY = player8.gfxOffY; + npc.velocity = Vector2.Zero; + if (!player8.creativeGodMode) + player8.AddBuff(BuffID.Obstructed, 59); + } + } + + if (npc.type == NPCID.StardustCellBig) + { + npc.rotation = 0f; + for (int num1337 = 0; num1337 < Main.maxNPCs; num1337++) + { + if (num1337 != npc.whoAmI && Main.npc[num1337].active && Main.npc[num1337].type == npc.type && Math.Abs(npc.position.X - Main.npc[num1337].position.X) + Math.Abs(npc.position.Y - Main.npc[num1337].position.Y) < npc.width) + { + if (npc.position.X < Main.npc[num1337].position.X) + npc.velocity.X -= 0.05f; + else + npc.velocity.X += 0.05f; + + if (npc.position.Y < Main.npc[num1337].position.Y) + npc.velocity.Y -= 0.05f; + else + npc.velocity.Y += 0.05f; + } + } + } + else + { + if (npc.type != NPCID.NebulaHeadcrab) + return false; + + npc.hide = npc.ai[0] == 5f; + npc.rotation = npc.velocity.X * 0.1f; + for (int num1338 = 0; num1338 < Main.maxNPCs; num1338++) + { + if (num1338 != npc.whoAmI && Main.npc[num1338].active && Main.npc[num1338].type == npc.type && Math.Abs(npc.position.X - Main.npc[num1338].position.X) + Math.Abs(npc.position.Y - Main.npc[num1338].position.Y) < npc.width) + { + if (npc.position.X < Main.npc[num1338].position.X) + npc.velocity.X -= 0.05f; + else + npc.velocity.X += 0.05f; + + if (npc.position.Y < Main.npc[num1338].position.Y) + npc.velocity.Y -= 0.05f; + else + npc.velocity.Y += 0.05f; + } + } + } + + return false; + } + #endregion + + #region Ancient Vision AI + public static bool BuffedAncientVisionAI(NPC npc, Mod mod) + { + if (npc.alpha > 0) + { + npc.alpha -= 30; + if (npc.alpha < 0) + npc.alpha = 0; + } + + npc.noGravity = true; + npc.noTileCollide = true; + npc.knockBackResist = 0f; + + for (int num1339 = 0; num1339 < Main.maxNPCs; num1339++) + { + if (num1339 == npc.whoAmI || !Main.npc[num1339].active || Main.npc[num1339].type != npc.type) + continue; + + Vector2 vector206 = Main.npc[num1339].Center - npc.Center; + if (!(vector206.Length() < 50f)) + continue; + + vector206.Normalize(); + if (vector206.X == 0f && vector206.Y == 0f) + { + if (num1339 > npc.whoAmI) + vector206.X = 1f; + else + vector206.X = -1f; + } + + vector206 *= 0.4f; + npc.velocity -= vector206; + NPC nPC = Main.npc[num1339]; + nPC.velocity += vector206; + } + + if (npc.type == NPCID.ShadowFlameApparition) + { + float num1340 = 120f; + if (npc.localAI[0] < num1340) + { + if (npc.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Item8, npc.Center); + npc.TargetClosest(); + if (npc.direction > 0) + npc.velocity.X += 2f; + else + npc.velocity.X -= 2f; + + npc.position += npc.netOffset; + for (int num1341 = 0; num1341 < 20; num1341++) + { + Vector2 center34 = npc.Center; + center34.Y -= 18f; + Vector2 vector207 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + vector207.Normalize(); + vector207 *= Main.rand.Next(0, 100) * 0.1f; + center34 += vector207; + vector207.Normalize(); + vector207 *= Main.rand.Next(50, 90) * 0.2f; + int num1342 = Dust.NewDust(center34, 1, 1, 27); + Main.dust[num1342].velocity = -vector207 * 0.3f; + Main.dust[num1342].alpha = 100; + if (Main.rand.NextBool()) + { + Main.dust[num1342].noGravity = true; + Dust dust = Main.dust[num1342]; + dust.scale += 0.3f; + } + } + + npc.position -= npc.netOffset; + } + + npc.localAI[0] += 1f; + float num1343 = 1f - npc.localAI[0] / num1340; + float num1344 = num1343 * 20f; + for (int num1345 = 0; num1345 < num1344; num1345++) + { + if (Main.rand.NextBool(5)) + { + npc.position += npc.netOffset; + int num1346 = Dust.NewDust(npc.position, npc.width, npc.height, 27); + Main.dust[num1346].alpha = 100; + Dust dust = Main.dust[num1346]; + dust.velocity *= 0.3f; + dust = Main.dust[num1346]; + dust.velocity += npc.velocity * 0.75f; + Main.dust[num1346].noGravity = true; + npc.position -= npc.netOffset; + } + } + } + } + + if (npc.type == NPCID.AncientCultistSquidhead) + { + float num1347 = 120f; + if (npc.localAI[0] < num1347) + { + if (npc.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Item8, npc.Center); + npc.TargetClosest(); + if (npc.direction > 0) + npc.velocity.X += 2f; + else + npc.velocity.X -= 2f; + } + + npc.localAI[0] += 1f; + int num1348 = 10; + for (int num1349 = 0; num1349 < 2; num1349++) + { + npc.position += npc.netOffset; + int num1350 = Dust.NewDust(npc.position - new Vector2(num1348), npc.width + num1348 * 2, npc.height + num1348 * 2, 228, 0f, 0f, 100, default(Color), 2f); + Main.dust[num1350].noGravity = true; + Main.dust[num1350].noLight = true; + npc.position -= npc.netOffset; + } + } + } + + if (npc.ai[0] == 0f) + { + npc.TargetClosest(); + npc.ai[0] = 1f; + npc.ai[1] = npc.direction; + } + else if (npc.ai[0] == 1f) + { + npc.TargetClosest(); + float num1351 = 0.5f; + float num1352 = 10f; + float num1353 = 4f; + float num1354 = 550f; + float num1355 = 3f; + if (npc.type == NPCID.AncientCultistSquidhead) + { + num1351 = 0.8f; + num1352 = 16f; + num1354 = 440f; + num1353 = 6f; + } + if (CalamityWorld.death) + { + num1351 *= 1.25f; + num1352 *= 1.25f; + num1354 *= 0.9f; + num1355 -= 1f; + } + + npc.velocity.X += npc.ai[1] * num1351; + if (npc.velocity.X > num1352) + npc.velocity.X = num1352; + + if (npc.velocity.X < 0f - num1352) + npc.velocity.X = 0f - num1352; + + float num1356 = Main.player[npc.target].Center.Y - npc.Center.Y; + if (Math.Abs(num1356) > num1353) + num1355 = CalamityWorld.death ? 10f : 12f; + + if (num1356 > num1353) + num1356 = num1353; + else if (num1356 < 0f - num1353) + num1356 = 0f - num1353; + + npc.velocity.Y = (npc.velocity.Y * (num1355 - 1f) + num1356) / num1355; + if ((npc.ai[1] > 0f && Main.player[npc.target].Center.X - npc.Center.X < 0f - num1354) || (npc.ai[1] < 0f && Main.player[npc.target].Center.X - npc.Center.X > num1354)) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + if (npc.Center.Y + 20f > Main.player[npc.target].Center.Y) + npc.ai[1] = -1f; + else + npc.ai[1] = 1f; + } + } + else if (npc.ai[0] == 2f) + { + float num1357 = 0.6f; + float num1358 = 0.93f; + float num1359 = 7f; + if (npc.type == NPCID.AncientCultistSquidhead) + { + num1357 = 0.45f; + num1359 = 10f; + num1358 = 0.87f; + } + if (CalamityWorld.death) + { + num1357 *= 1.25f; + num1358 *= 0.9f; + num1359 *= 1.25f; + } + + npc.velocity.Y += npc.ai[1] * num1357; + if (npc.velocity.Length() > num1359) + npc.velocity *= num1358; + + if (npc.velocity.X > -1f && npc.velocity.X < 1f) + { + npc.TargetClosest(); + npc.ai[0] = 3f; + npc.ai[1] = npc.direction; + } + } + else if (npc.ai[0] == 3f) + { + float num1360 = 0.6f; + float num1361 = 0.3f; + float num1362 = 7f; + float num1363 = 0.93f; + if (npc.type == NPCID.AncientCultistSquidhead) + { + num1360 = 0.8f; + num1361 = 0.45f; + num1362 = 9f; + num1363 = 0.87f; + } + if (CalamityWorld.death) + { + num1360 *= 1.25f; + num1361 *= 1.25f; + num1362 *= 1.25f; + num1363 *= 0.9f; + } + + npc.velocity.X += npc.ai[1] * num1360; + if (npc.Center.Y > Main.player[npc.target].Center.Y) + npc.velocity.Y -= num1361; + else + npc.velocity.Y += num1361; + + if (npc.velocity.Length() > num1362) + npc.velocity *= num1363; + + if (npc.velocity.Y > -1f && npc.velocity.Y < 1f) + { + npc.TargetClosest(); + npc.ai[0] = 0f; + npc.ai[1] = npc.direction; + } + } + + if (npc.type == NPCID.AncientCultistSquidhead) + { + int num1364 = 10; + npc.position += npc.netOffset; + + int num1366 = Dust.NewDust(npc.position - new Vector2(num1364), npc.width + num1364 * 2, npc.height + num1364 * 2, 228, 0f, 0f, 100, default(Color), 2f); + Main.dust[num1366].noGravity = true; + Main.dust[num1366].noLight = true; + + npc.position -= npc.netOffset; + } + + return false; + } + #endregion + + #region Big Mimic AI + public static bool BuffedBigMimicAI(NPC npc, Mod mod) + { + npc.knockBackResist = 0.2f * Main.GameModeInfo.KnockbackToEnemiesMultiplier; + npc.dontTakeDamage = false; + npc.noTileCollide = false; + npc.noGravity = false; + npc.reflectsProjectiles = false; + if (npc.ai[0] != 7f && Main.player[npc.target].dead) + { + npc.TargetClosest(); + if (Main.player[npc.target].dead) + { + npc.ai[0] = 7f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + + if (npc.ai[0] == 0f) + { + npc.TargetClosest(); + Vector2 vector208 = Main.player[npc.target].Center - npc.Center; + if (Main.netMode != NetmodeID.MultiplayerClient && (npc.velocity.X != 0f || npc.velocity.Y > 100f || npc.justHit || vector208.Length() < 80f)) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) + { + npc.ai[1] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] > 36f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) + { + Vector2 vector209 = Main.player[npc.target].Center - npc.Center; + if (Main.netMode != NetmodeID.MultiplayerClient && vector209.Length() > 600f) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(); + npc.velocity.X *= 0.85f; + npc.ai[1] += 1f; + float num1367 = 10f + (CalamityWorld.death ? 10f : 20f) * (npc.life / (float)npc.lifeMax); + float num1368 = 5f + (CalamityWorld.death ? 7f : 5f) * (1f - npc.life / (float)npc.lifeMax); + float num1369 = CalamityWorld.death ? 7f : 5f; + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + num1369 += 2f; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] > num1367) + { + npc.ai[3] += 1f; + if (npc.ai[3] >= 3f) + { + npc.ai[3] = 0f; + num1369 *= 2f; + num1368 /= 2f; + } + + npc.ai[1] = 0f; + npc.velocity.Y -= num1369; + npc.velocity.X = num1368 * npc.direction; + npc.netUpdate = true; + } + } + else + { + npc.knockBackResist = 0f; + 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; + } + + npc.ai[2] += 1f; + if (npc.ai[2] > (CalamityWorld.death ? 130f : 170f) && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + switch (Main.rand.Next(3)) + { + case 0: + npc.ai[0] = 3f; + break; + case 1: + npc.ai[0] = 4f; + npc.noTileCollide = true; + npc.velocity.Y = CalamityWorld.death ? -12f : -10f; + break; + case 2: + npc.ai[0] = 6f; + break; + default: + npc.ai[0] = 2f; + break; + } + + if (Main.tenthAnniversaryWorld && npc.type == NPCID.BigMimicJungle && npc.ai[0] == 3f && Main.rand.NextBool()) + npc.ai[0] = 8f; + + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 3f) + { + npc.velocity.X *= 0.85f; + npc.dontTakeDamage = true; + npc.ai[1] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (CalamityWorld.death ? 60f : 120f)) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + + if (Main.expertMode) + { + npc.ReflectProjectiles(npc.Hitbox); + npc.reflectsProjectiles = true; + } + } + else if (npc.ai[0] == 4f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.TargetClosest(); + Vector2 center35 = Main.player[npc.target].Center; + center35.Y -= 350f; + Vector2 value40 = center35 - npc.Center; + if (npc.ai[2] == 1f) + { + npc.ai[1] += 1f; + value40 = Main.player[npc.target].Center - npc.Center; + value40.Normalize(); + value40 *= CalamityWorld.death ? 12f : 10f; + npc.velocity = (npc.velocity * 4f + value40) / 5f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] > 6f) + { + npc.ai[1] = 0f; + npc.ai[0] = 4.1f; + npc.ai[2] = 0f; + npc.velocity = value40; + npc.netUpdate = true; + } + } + else if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 40f && npc.Center.Y < Main.player[npc.target].Center.Y - 300f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.netUpdate = true; + } + } + else + { + value40.Normalize(); + value40 *= CalamityWorld.death ? 16f : 14f; + npc.velocity = (npc.velocity * 5f + value40) / 6f; + } + } + else if (npc.ai[0] == 4.1f) + { + npc.knockBackResist = 0f; + if (npc.ai[2] == 0f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.ai[2] = 1f; + + if (npc.position.Y + npc.height >= Main.player[npc.target].position.Y || npc.velocity.Y <= 0f) + { + npc.ai[1] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] > 10f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.ai[0] = 5f; + } + } + else if (npc.ai[2] == 0f) + { + npc.noTileCollide = true; + npc.noGravity = true; + npc.knockBackResist = 0f; + } + + npc.velocity.Y += CalamityWorld.death ? 0.3f : 0.25f; + if (npc.velocity.Y > (CalamityWorld.death ? 24f : 20f)) + npc.velocity.Y = CalamityWorld.death ? 24f : 20f; + } + else if (npc.ai[0] == 5f) + { + 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 value41 = Main.player[npc.target].Center - npc.Center; + value41.Y -= 4f; + if (Main.netMode != NetmodeID.MultiplayerClient && value41.Length() < 200f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + if (value41.Length() > 10f) + { + value41.Normalize(); + value41 *= CalamityWorld.death ? 15f : 12.5f; + } + + npc.velocity = (npc.velocity * 4f + value41) / 5f; + } + else if (npc.ai[0] == 6f) + { + npc.knockBackResist = 0f; + if (npc.velocity.Y == 0f) + { + npc.TargetClosest(); + npc.velocity.X *= 0.8f; + npc.ai[1] += 1f; + if (npc.ai[1] > 5f) + { + npc.ai[1] = 0f; + npc.velocity.Y -= 4f; + if (Main.player[npc.target].position.Y + Main.player[npc.target].height < npc.Center.Y) + npc.velocity.Y -= 1.25f; + + if (Main.player[npc.target].position.Y + Main.player[npc.target].height < npc.Center.Y - 40f) + npc.velocity.Y -= 1.5f; + + if (Main.player[npc.target].position.Y + Main.player[npc.target].height < npc.Center.Y - 80f) + npc.velocity.Y -= 1.75f; + + if (Main.player[npc.target].position.Y + Main.player[npc.target].height < npc.Center.Y - 120f) + npc.velocity.Y -= 2f; + + if (Main.player[npc.target].position.Y + Main.player[npc.target].height < npc.Center.Y - 160f) + npc.velocity.Y -= 2.25f; + + if (Main.player[npc.target].position.Y + Main.player[npc.target].height < npc.Center.Y - 200f) + npc.velocity.Y -= 2.5f; + + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) + npc.velocity.Y -= 2f; + + npc.velocity.X = (CalamityWorld.death ? 16 : 14) * npc.direction; + npc.ai[2] += 1f; + npc.netUpdate = true; + } + } + else + { + npc.velocity.X *= 0.98f; + if (npc.direction < 0 && npc.velocity.X > -8f) + npc.velocity.X = -8f; + + if (npc.direction > 0 && npc.velocity.X < 8f) + npc.velocity.X = 8f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 3f && npc.velocity.Y == 0f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 7f) + { + npc.damage = 0; + npc.life = npc.lifeMax; + npc.defense = 9999; + npc.noTileCollide = true; + npc.alpha += 7; + if (npc.alpha > 255) + npc.alpha = 255; + + npc.velocity.X *= 0.98f; + } + else + { + if (npc.ai[0] != 8f) + return false; + + npc.velocity.X *= 0.85f; + npc.ai[1] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!Main.tenthAnniversaryWorld || npc.ai[1] >= 180f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + else if (npc.ai[1] % 20f == 0f) + { + int num = 10; + for (int i = 0; i < num; i++) + { + int itemID = ItemID.Sets.ItemsForStuffCannon[Main.rand.Next(ItemID.Sets.ItemsForStuffCannon.Length)]; + int item = Item.NewItem(npc.GetSource_Loot(), (int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, itemID, 1, noBroadcast: false, -1, noGrabDelay: true); + float num2 = Main.rand.Next(10, 26); + Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector2 = Main.player[npc.target].Center - new Vector2(0f, 120f); + float num3 = vector2.X - vector.X; + float num4 = vector2.Y - vector.Y; + num3 += Main.rand.Next(-50, 51) * 0.1f; + num4 += Main.rand.Next(-50, 51) * 0.1f; + float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4); + num5 = num2 / num5; + num3 *= num5; + num4 *= num5; + num3 += Main.rand.Next(-50, 51) * 0.1f; + num4 += Main.rand.Next(-50, 51) * 0.1f; + Main.item[item].velocity.X = num3; + Main.item[item].velocity.Y = num4; + Main.item[item].noGrabDelay = 100; + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item); + } + } + } + } + return false; + } + #endregion + + #region Small Star Cell AI + public static bool BuffedSmallStarCellAI(NPC npc, Mod mod) + { + float num1470 = CalamityWorld.death ? 100f : 200f; + if (npc.velocity.Length() > 4f) + npc.velocity *= 0.95f; + + npc.velocity *= 0.99f; + npc.ai[0]++; + float num1471 = MathHelper.Clamp(npc.ai[0] / num1470, 0f, 1f); + npc.scale = 1f + 0.3f * num1471; + if (npc.ai[0] >= num1470) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.Transform(NPCID.StardustCellBig); + npc.netUpdate = true; + } + + return false; + } + + npc.rotation += npc.velocity.X * 0.1f; + if (!(npc.ai[0] > 20f)) + return false; + + Vector2 center39 = npc.Center; + int num1472 = (int)(npc.ai[0] / (num1470 / 2f)); + for (int num1473 = 0; num1473 < num1472 + 1; num1473++) + { + if (Main.rand.NextBool()) + { + int num1474 = 226; + float num1475 = 0.4f; + if (num1473 % 2 == 1) + { + num1474 = 226; + num1475 = 0.65f; + } + + Vector2 vector222 = center39 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (12f - num1472 * 2); + int num1476 = Dust.NewDust(vector222 - Vector2.One * 12f, 24, 24, num1474, npc.velocity.X / 2f, npc.velocity.Y / 2f); + Dust dust = Main.dust[num1476]; + dust.position -= new Vector2(2f); + Main.dust[num1476].velocity = Vector2.Normalize(center39 - vector222) * 1.5f * (10f - num1472 * 2f) / 10f; + Main.dust[num1476].noGravity = true; + Main.dust[num1476].scale = num1475; + Main.dust[num1476].customData = npc; + } + } + + return false; + } + #endregion + + #region Flow Invader AI + public static bool BuffedFlowInvaderAI(NPC npc, Mod mod) + { + float num1477 = CalamityWorld.death ? 8f : 6.5f; + float moveSpeed = CalamityWorld.death ? 0.25f : 0.2f; + npc.TargetClosest(); + Vector2 desiredVelocity3 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, -300f); + float num1478 = desiredVelocity3.Length(); + if (num1478 < 20f) + { + desiredVelocity3 = npc.velocity; + } + else if (num1478 < 40f) + { + desiredVelocity3.Normalize(); + desiredVelocity3 *= num1477 * 0.35f; + } + else if (num1478 < 80f) + { + desiredVelocity3.Normalize(); + desiredVelocity3 *= num1477 * 0.65f; + } + else + { + desiredVelocity3.Normalize(); + desiredVelocity3 *= num1477; + } + + npc.SimpleFlyMovement(desiredVelocity3, moveSpeed); + npc.rotation = npc.velocity.X * 0.1f; + if (!((npc.ai[0] += 1f) >= (CalamityWorld.death ? 30f : 50f))) + return false; + + npc.ai[0] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector223 = Vector2.Zero; + while (Math.Abs(vector223.X) < 1.5f) + vector223 = Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * new Vector2(5f, 3f); + + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, vector223, ProjectileID.StardustJellyfishSmall, 60, 0f, Main.myPlayer, 0f, npc.whoAmI); + Main.projectile[proj].extraUpdates += 1; + } + + return false; + } + #endregion + #endregion #region DD2 Event AIs diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 57613ad6fd..47481bbb68 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -15,7 +15,7 @@ using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Crags; @@ -26,6 +26,7 @@ using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Perforator; @@ -59,6 +60,7 @@ using Terraria.Enums; using Terraria.GameContent.Achievements; using Terraria.GameContent.Events; using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.Utilities; @@ -105,14 +107,26 @@ namespace CalamityMod.NPCs public bool? VulnerableToElectricity = null; public bool? VulnerableToWater = null; - // Eskimo Set effect + public const double BaseDoTDamageMult = 1D; + public const double VulnerableToDoTDamageMult = 2D; + public const double VulnerableToDoTDamageMult_Worms_SlimeGod = 1.5; + + // Eskimo Set and Cryo Stone effects public bool IncreasedColdEffects_EskimoSet = false; + public bool IncreasedColdEffects_CryoStone = false; + + // Transformer effect + + public bool IncreasedElectricityEffects_Transformer = false; // Fireball, Cinnamon Roll and Hellfire Treads effects public bool IncreasedHeatEffects_Fireball = false; public bool IncreasedHeatEffects_CinnamonRoll = false; public bool IncreasedHeatEffects_HellfireTreads = false; + // Toxic Heart effect + public bool IncreasedSicknessEffects_ToxicHeart = false; + // Evergreen Gin effect public bool IncreasedSicknessAndWaterEffects_EvergreenGin = false; @@ -203,7 +217,6 @@ namespace CalamityMod.NPCs public int yellowCandle = 0; public int pearlAura = 0; public int bBlood = 0; - public int dFlames = 0; public int marked = 0; public int irradiated = 0; public int bFlames = 0; @@ -221,6 +234,7 @@ namespace CalamityMod.NPCs public int cDepth = 0; public int gsInferno = 0; public int dragonFire = 0; + public int miracleBlight = 0; public int astralInfection = 0; public int wDeath = 0; public int nightwither = 0; @@ -261,6 +275,7 @@ namespace CalamityMod.NPCs public static int calamitas = -1; public static int leviathan = -1; public static int siren = -1; + public static int astrumAureus = -1; public static int scavenger = -1; public static int energyFlame = -1; public static int doughnutBoss = -1; @@ -314,6 +329,12 @@ namespace CalamityMod.NPCs // Other Boss Rush stuff public bool DoesNotDisappearInBossRush; + + // On-Kill variables + public bool gladiatorOnKill = true; + + // Variable for if enemy has been recently hit by an ArcZap + public int arcZapCooldown = 0; #endregion #region Instance Per Entity and TML 1.4 Cloning @@ -348,9 +369,12 @@ namespace CalamityMod.NPCs myClone.VulnerableToWater = VulnerableToWater; myClone.IncreasedColdEffects_EskimoSet = IncreasedColdEffects_EskimoSet; + myClone.IncreasedColdEffects_CryoStone = IncreasedColdEffects_CryoStone; + myClone.IncreasedElectricityEffects_Transformer = IncreasedElectricityEffects_Transformer; myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball; myClone.IncreasedHeatEffects_CinnamonRoll = IncreasedHeatEffects_CinnamonRoll; myClone.IncreasedHeatEffects_HellfireTreads = IncreasedHeatEffects_HellfireTreads; + myClone.IncreasedSicknessEffects_ToxicHeart = IncreasedSicknessEffects_ToxicHeart; myClone.IncreasedSicknessAndWaterEffects_EvergreenGin = IncreasedSicknessAndWaterEffects_EvergreenGin; myClone.velocityPriorToPhaseSwap = velocityPriorToPhaseSwap; @@ -401,7 +425,6 @@ namespace CalamityMod.NPCs myClone.yellowCandle = yellowCandle; myClone.pearlAura = pearlAura; myClone.bBlood = bBlood; - myClone.dFlames = dFlames; myClone.marked = marked; myClone.irradiated = irradiated; myClone.bFlames = bFlames; @@ -415,6 +438,7 @@ namespace CalamityMod.NPCs myClone.cDepth = cDepth; myClone.gsInferno = gsInferno; + myClone.miracleBlight = miracleBlight; myClone.dragonFire = dragonFire; myClone.astralInfection = astralInfection; myClone.wDeath = wDeath; @@ -493,6 +517,7 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref catastrophe, NPCType()); ResetSavedIndex(ref calamitas, NPCType()); ResetSavedIndex(ref leviathan, NPCType()); + ResetSavedIndex(ref astrumAureus, NPCType()); ResetSavedIndex(ref siren, NPCType()); ResetSavedIndex(ref scavenger, NPCType()); ResetSavedIndex(ref energyFlame, NPCType()); @@ -535,6 +560,7 @@ namespace CalamityMod.NPCs CurrentlyIncreasingDefenseOrDR = false; CanHaveBossHealthBar = false; ShouldCloseHPBar = false; + if (arcZapCooldown > 0) { arcZapCooldown--; } } #endregion @@ -739,61 +765,69 @@ namespace CalamityMod.NPCs bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; - double heatDamageMult = slimed ? ((wormBoss || slimeGod) ? 2D : 5D) : 1D; + double heatDamageMult = slimed ? ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; if (VulnerableToHeat.HasValue) { if (VulnerableToHeat.Value) - heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 1.5 : 2D) : ((wormBoss || slimeGod) ? 2D : 5D); + heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 1.25 : 1.5) : ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else heatDamageMult *= slimed ? 0.2 : 0.5; } - double coldDamageMult = 1D; + double coldDamageMult = BaseDoTDamageMult; if (VulnerableToCold.HasValue) { if (VulnerableToCold.Value) - coldDamageMult *= wormBoss ? 2D : 5D; + coldDamageMult *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else coldDamageMult *= 0.5; } - double sicknessDamageMult = irradiated > 0 ? (wormBoss ? 2D : 5D) : 1D; + double sicknessDamageMult = irradiated > 0 ? (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; if (VulnerableToSickness.HasValue) { if (VulnerableToSickness.Value) - sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 1.5 : 2D) : (wormBoss ? 2D : 5D); + sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else sicknessDamageMult *= irradiated > 0 ? 0.2 : 0.5; } bool increasedElectricityDamage = npc.wet || npc.honeyWet || npc.lavaWet || npc.dripping; - double electricityDamageMult = increasedElectricityDamage ? (wormBoss ? 2D : 5D) : 1D; + double electricityDamageMult = increasedElectricityDamage ? (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; if (VulnerableToElectricity.HasValue) { if (VulnerableToElectricity.Value) - electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 1.5 : 2D) : (wormBoss ? 2D : 5D); + electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); else electricityDamageMult *= increasedElectricityDamage ? 0.2 : 0.5; } - double waterDamageMult = 1D; + double waterDamageMult = BaseDoTDamageMult; if (VulnerableToWater.HasValue) { if (VulnerableToWater.Value) - waterDamageMult *= wormBoss ? 2D : 5D; + waterDamageMult *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else waterDamageMult *= 0.5; } + if (IncreasedColdEffects_EskimoSet) + coldDamageMult += 0.25; + if (IncreasedColdEffects_CryoStone) + coldDamageMult += 0.5; + + if (IncreasedElectricityEffects_Transformer) + electricityDamageMult += 0.5; + if (IncreasedHeatEffects_Fireball) heatDamageMult += 0.25; if (IncreasedHeatEffects_CinnamonRoll) heatDamageMult += 0.5; if (IncreasedHeatEffects_HellfireTreads) heatDamageMult += 0.5; - - if (IncreasedColdEffects_EskimoSet) - coldDamageMult += 0.25; + + if (IncreasedSicknessEffects_ToxicHeart) + sicknessDamageMult += 0.5; if (IncreasedSicknessAndWaterEffects_EvergreenGin) { @@ -802,9 +836,9 @@ namespace CalamityMod.NPCs } // Subtract 1 for the vanilla damage multiplier because it's already dealing DoT in the vanilla regen code. - double vanillaHeatDamageMult = heatDamageMult - 1D; - double vanillaColdDamageMult = coldDamageMult - 1D; - double vanillaSicknessDamageMult = sicknessDamageMult - 1D; + double vanillaHeatDamageMult = heatDamageMult - BaseDoTDamageMult; + double vanillaColdDamageMult = coldDamageMult - BaseDoTDamageMult; + double vanillaSicknessDamageMult = sicknessDamageMult - BaseDoTDamageMult; // On Fire if (npc.onFire) @@ -833,24 +867,24 @@ namespace CalamityMod.NPCs damage = baseHellfireDoTValue / 4; } - // Daybroken - if (npc.daybreak) - { - int projAmt = 0; - for (int k = 0; k < Main.maxProjectiles; k++) - { - if (Main.projectile[k].active && Main.projectile[k].type == ProjectileID.Daybreak && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == npc.whoAmI) - projAmt++; - } + // Daybroken + if (npc.daybreak) + { + int projAmt = 0; + for (int k = 0; k < Main.maxProjectiles; k++) + { + if (Main.projectile[k].active && Main.projectile[k].type == ProjectileID.Daybreak && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == npc.whoAmI) + projAmt++; + } - if (projAmt == 0) - projAmt = 1; + if (projAmt == 0) + projAmt = 1; int baseDaybreakDoTValue = (int)(projAmt * 2 * 100 * vanillaHeatDamageMult); npc.lifeRegen -= baseDaybreakDoTValue; if (damage < baseDaybreakDoTValue / 4) damage = baseDaybreakDoTValue / 4; - } + } // Shadowflame if (npc.shadowFlame) @@ -864,14 +898,14 @@ namespace CalamityMod.NPCs // Brimstone Flames if (bFlames > 0) { - int baseBrimstoneFlamesDoTValue = (int)(40 * heatDamageMult); + int baseBrimstoneFlamesDoTValue = (int)(60 * heatDamageMult); ApplyDPSDebuff(baseBrimstoneFlamesDoTValue, baseBrimstoneFlamesDoTValue / 5, ref npc.lifeRegen, ref damage); } // Holy Flames if (hFlames > 0) { - int baseHolyFlamesDoTValue = (int)(50 * heatDamageMult); + int baseHolyFlamesDoTValue = (int)(200 * heatDamageMult); ApplyDPSDebuff(baseHolyFlamesDoTValue, baseHolyFlamesDoTValue / 5, ref npc.lifeRegen, ref damage); } @@ -889,13 +923,6 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseDragonFireDoTValue, baseDragonFireDoTValue / 5, ref npc.lifeRegen, ref damage); } - // Demon Flames - if (dFlames > 0) - { - int baseDemonFlamesDoTValue = (int)(2500 * heatDamageMult); - ApplyDPSDebuff(baseDemonFlamesDoTValue, baseDemonFlamesDoTValue / 5, ref npc.lifeRegen, ref damage); - } - // Banishing Fire if (banishingFire > 0) { @@ -931,7 +958,7 @@ namespace CalamityMod.NPCs // Oiled bool hasColdOil = npc.onFrostBurn || npc.onFrostBurn2; bool hasHotOil = npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame; - bool hasModHotOil = bFlames > 0 || hFlames > 0 || gsInferno > 0 || dragonFire > 0 || dFlames > 0 || banishingFire > 0 || vulnerabilityHex > 0; + bool hasModHotOil = bFlames > 0 || hFlames > 0 || gsInferno > 0 || dragonFire > 0 || banishingFire > 0 || vulnerabilityHex > 0; if (npc.oiled && (hasColdOil || hasHotOil || hasModHotOil)) { double multiplier = 1D; @@ -1032,6 +1059,8 @@ namespace CalamityMod.NPCs Shred.TickDebuff(npc, this); if (bBlood > 0) ApplyDPSDebuff(50, 10, ref npc.lifeRegen, ref damage); + if (miracleBlight > 0) + ApplyDPSDebuff(2500, 500, ref npc.lifeRegen, ref damage); // Reduce DoT on worm bosses by 75%. if (wormBoss && npc.lifeRegen < 0) @@ -1296,7 +1325,7 @@ namespace CalamityMod.NPCs else if (CalamityLists.DestroyerIDs.Contains(npc.type)) { npc.lifeMax = (int)(npc.lifeMax * 1.25); - npc.scale *= CalamityWorld.death ? 2.5f : 1.5f; + npc.scale *= CalamityWorld.getFixedBoi ? 2.5f : CalamityWorld.death ? 2f : 1.5f; npc.npcSlots = 10f; } else if (npc.type == NPCID.Probe) @@ -1304,7 +1333,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.death) npc.lifeMax = (int)(npc.lifeMax * 2.0); - npc.scale *= CalamityWorld.death ? 2f : 1.2f; + npc.scale *= CalamityWorld.getFixedBoi ? 2f : CalamityWorld.death ? 1.5f : 1.2f; } else if (npc.type == NPCID.SkeletronPrime) { @@ -2203,6 +2232,10 @@ namespace CalamityMod.NPCs npc.coldDamage = true; break; + case NPCID.PirateGhost: + npc.lifeMax = (int)(npc.lifeMax * 0.33); + break; + case NPCID.BloodSquid: npc.lifeMax = (int)(npc.lifeMax * 0.25); break; @@ -2555,14 +2588,16 @@ namespace CalamityMod.NPCs #endregion #region Strike NPC + // Incoming defense to this function is already affected by the vanilla debuffs Ichor (-15) and Betsy's Curse (-40), and cannot be below zero. public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { // Don't bother tampering with the damage if it is already zero. - // Zero damage does not happen in the base game and is always indicative of antibutcher in Calamity. + // Zero damage does not happen in the base game; if something has been set to zero damage by another mod, it's really not intended to do damage. if (damage == 0D) - return false; + return true; - // Override hand/head eye 'death' code and use custom 'death' code instead, this is here just in case the AI code fails + // Safety for ML's eyes on Rev+ so that the boss doesn't remain invulnerable forever + // TODO -- this is very old, is it still needed? if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) @@ -2580,16 +2615,19 @@ namespace CalamityMod.NPCs } } + // Armor penetration has already been applied as bonus damage. // Yellow Candle provides +5% damage which ignores both DR and defense. - // However, armor penetration bonus damage has already been applied, so it's slightly higher than it should be. + // This means Yellow Candle is buffing armor penetration and technically not ignoring defense, + // but it's small enough to let it slide. double yellowCandleDamage = 0.05 * damage; // Apply modifications to enemy's current defense based on Calamity debuffs. // As with defense and DR, flat reductions apply first, then multiplicative reductions. + // + // Ozzatron 05JAN2023: fixed doubled armor pen, this time for real int effectiveDefense = defense - (marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) - (wither > 0 ? WitherDebuff.DefenseReduction : 0) - - (int)Main.LocalPlayer.GetArmorPenetration() - miscDefenseLoss; // Defense can never be negative and has a minimum value of zero. @@ -2613,6 +2651,8 @@ namespace CalamityMod.NPCs } // Large Deus worm takes reduced damage to last a long enough time. + // TODO -- WHY DOES DEUS HAVE THIS UNDOCUMENTED MULTIPLIER HERE?? + // this should be in ModifyHitNPC for deus himself if (CalamityLists.AstrumDeusIDs.Contains(npc.type) && newAI[0] == 0f) damage *= 0.8; @@ -2623,9 +2663,13 @@ namespace CalamityMod.NPCs if (damage == 0D) return false; - // Cancel out vanilla defense math by reversing the calculation vanilla is about to perform. - // While roundabout, this is safer than returning false to stop vanilla damage calculations entirely. - // Other mods will probably expect the vanilla code to run and may compensate for it themselves. + // Immediately after StrikeNPC runs, vanilla does the following 3 things: + // 1 - Reduces damage by vanilla effective defense + // 2 - Doubles damage if it's a crit + // 3 - Multiplies by vanilla takenDamageMultiplier if it's over 1.0 + // + // The following line cancels out vanilla defense calculations, since we just did our own above. + // We return true to allow all 3 to run, but cancel out #1, meaning crits and Crawltipede still work. damage = Main.CalculateDamageNPCsTake((int)damage, -defense); return true; } @@ -2859,11 +2903,43 @@ namespace CalamityMod.NPCs return DreadnautilusAI.BuffedDreadnautilusAI(npc, Mod); // Disable teleports for hardmode dungeon casters if they get hit - if (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite && npc.justHit) + if (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite && npc.justHit && !CalamityWorld.revenge) { npc.ai[0] = 1f; } + if (npc.type == NPCID.CultistBoss || npc.type == NPCID.CultistBossClone) + { + if (npc.type == NPCID.CultistBossClone) + { + if (Main.npc[(int)npc.ai[3]].active) + { + // Emit light + float lifeRatio = Main.npc[(int)npc.ai[3]].life / (float)Main.npc[(int)npc.ai[3]].lifeMax; + float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D); + Color lightColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt); + Lighting.AddLight(npc.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f); + } + } + else + { + // Emit light + float lifeRatio = npc.life / (float)npc.lifeMax; + float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D); + Color lightColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt); + Lighting.AddLight(npc.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f); + + // Decrement the hit counter for the shield flicker + if (newAI[1] > 0f) + newAI[1] -= 1f; + + // Cultist shield hitbox + Vector2 hitboxSize = new Vector2(216f / 1.4142f); + if (npc.Size != hitboxSize) + npc.Size = hitboxSize; + } + } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { switch (npc.type) @@ -3000,11 +3076,11 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.Retinazer) return TwinsAI.TrueMeleeRetinazerPhase2AI(npc); - if (CalamityWorld.death) + if (CalamityWorld.revenge) { switch (npc.aiStyle) { - case 1: + case NPCAIStyleID.Slime: if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || @@ -3037,11 +3113,13 @@ namespace CalamityMod.NPCs case NPCID.SlimeRibbonRed: case NPCID.SlimeSpiked: case NPCID.SandSlime: + case NPCID.GoldenSlime: return SlimeAI.BuffedSlimeAI(npc, Mod); } } break; - case 2: + + case NPCAIStyleID.DemonEye: if (npc.type == NPCType()) { return DemonEyeAI.BuffedDemonEyeAI(npc, Mod); @@ -3067,7 +3145,8 @@ namespace CalamityMod.NPCs } } break; - case 3: + + case NPCAIStyleID.Fighter: if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { @@ -3086,6 +3165,7 @@ namespace CalamityMod.NPCs case NPCID.ArmedZombieTwiggy: case NPCID.ArmedZombieCenx: case NPCID.Skeleton: + case NPCID.SporeSkeleton: case NPCID.AngryBones: case NPCID.UndeadMiner: case NPCID.CorruptBunny: @@ -3219,7 +3299,9 @@ namespace CalamityMod.NPCs case NPCID.Salamander7: case NPCID.Salamander8: case NPCID.Salamander9: + case NPCID.GiantWalkingAntlion: case NPCID.WalkingAntlion: + case NPCID.LarvaeAntlion: case NPCID.DesertGhoul: case NPCID.DesertGhoulCorruption: case NPCID.DesertGhoulCrimson: @@ -3261,7 +3343,8 @@ namespace CalamityMod.NPCs } } break; - case 5: + + case NPCAIStyleID.Flying: switch (npc.type) { case NPCID.ServantofCthulhu: @@ -3271,10 +3354,21 @@ namespace CalamityMod.NPCs case NPCID.Crimera: case NPCID.Moth: case NPCID.Parrot: + case NPCID.Bee: + case NPCID.BeeSmall: + case NPCID.BloodSquid: + case NPCID.Hornet: + case NPCID.HornetFatty: + case NPCID.HornetHoney: + case NPCID.HornetLeafy: + case NPCID.HornetSpikey: + case NPCID.HornetStingy: + case NPCID.MossHornet: return CalamityGlobalAI.BuffedFlyingAI(npc, Mod); } break; - case 6: + + case NPCAIStyleID.Worm: switch (npc.type) { case NPCID.DevourerHead: @@ -3292,29 +3386,39 @@ namespace CalamityMod.NPCs case NPCID.WyvernBody2: case NPCID.WyvernBody3: case NPCID.WyvernTail: - case NPCID.DiggerHead: - case NPCID.DiggerBody: - case NPCID.DiggerTail: - case NPCID.SeekerHead: - case NPCID.SeekerBody: - case NPCID.SeekerTail: case NPCID.LeechHead: case NPCID.LeechBody: case NPCID.LeechTail: case NPCID.TombCrawlerHead: case NPCID.TombCrawlerBody: case NPCID.TombCrawlerTail: - case NPCID.DuneSplicerHead: - case NPCID.DuneSplicerBody: - case NPCID.DuneSplicerTail: case NPCID.StardustWormHead: case NPCID.SolarCrawltipedeHead: case NPCID.SolarCrawltipedeBody: case NPCID.SolarCrawltipedeTail: + case NPCID.BloodEelHead: + case NPCID.BloodEelBody: + case NPCID.BloodEelTail: return CalamityGlobalAI.BuffedWormAI(npc, Mod); + + // Death Mode splitting worms. + case NPCID.DiggerHead: + case NPCID.DiggerBody: + case NPCID.DiggerTail: + case NPCID.SeekerHead: + case NPCID.SeekerBody: + case NPCID.SeekerTail: + case NPCID.DuneSplicerHead: + case NPCID.DuneSplicerBody: + case NPCID.DuneSplicerTail: + if (CalamityWorld.death) + return CalamityGlobalAI.BuffedWormAI(npc, Mod); + else + return true; } break; - case 8: + + case NPCAIStyleID.Caster: switch (npc.type) { case NPCID.FireImp: @@ -3332,7 +3436,8 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedCasterAI(npc, Mod); } break; - case 13: + + case NPCAIStyleID.ManEater: switch (npc.type) { case NPCID.ManEater: @@ -3344,7 +3449,8 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedPlantAI(npc, Mod); } break; - case 14: + + case NPCAIStyleID.Bat: if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { return CalamityGlobalAI.BuffedBatAI(npc, Mod); @@ -3368,11 +3474,13 @@ namespace CalamityMod.NPCs case NPCID.RedDevil: case NPCID.FlyingSnake: case NPCID.VampireBat: + case NPCID.SporeBat: return CalamityGlobalAI.BuffedBatAI(npc, Mod); } } break; - case 16: + + case NPCAIStyleID.Piranha: switch (npc.type) { case NPCID.CorruptGoldfish: @@ -3385,7 +3493,8 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedSwimmingAI(npc, Mod); } break; - case 18: + + case NPCAIStyleID.Jellyfish: switch (npc.type) { case NPCID.BlueJellyfish: @@ -3397,28 +3506,32 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedJellyfishAI(npc, Mod); } break; - case 19: + + case NPCAIStyleID.Antlion: switch (npc.type) { case NPCID.Antlion: return CalamityGlobalAI.BuffedAntlionAI(npc, Mod); } break; - case 20: + + case NPCAIStyleID.SpikeBall: switch (npc.type) { case NPCID.SpikeBall: return CalamityGlobalAI.BuffedSpikeBallAI(npc, Mod); } break; - case 21: + + case NPCAIStyleID.BlazingWheel: switch (npc.type) { case NPCID.BlazingWheel: return CalamityGlobalAI.BuffedBlazingWheelAI(npc, Mod); } break; - case 22: + + case NPCAIStyleID.HoveringFighter: switch (npc.type) { case NPCID.Pixie: @@ -3434,7 +3547,8 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedHoveringAI(npc, Mod); } break; - case 23: + + case NPCAIStyleID.EnchantedSword: switch (npc.type) { case NPCID.CursedHammer: @@ -3443,15 +3557,18 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedFlyingWeaponAI(npc, Mod); } break; - case 25: + + case NPCAIStyleID.Mimic: switch (npc.type) { case NPCID.Mimic: case NPCID.PresentMimic: + case NPCID.IceMimic: return CalamityGlobalAI.BuffedMimicAI(npc, Mod); } break; - case 26: + + case NPCAIStyleID.Unicorn: if (npc.type == NPCType()) { return CalamityGlobalAI.BuffedUnicornAI(npc, Mod); @@ -3471,7 +3588,8 @@ namespace CalamityMod.NPCs } } break; - case 39: + + case NPCAIStyleID.GiantTortoise: if (npc.type == NPCType()) { return CalamityGlobalAI.BuffedTortoiseAI(npc, Mod); @@ -3489,7 +3607,8 @@ namespace CalamityMod.NPCs } } break; - case 40: + + case NPCAIStyleID.Spider: switch (npc.type) { case NPCID.BlackRecluseWall: @@ -3500,7 +3619,8 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedSpiderAI(npc, Mod); } break; - case 41: + + case NPCAIStyleID.Herpling: if (npc.type == NPCType()) { return CalamityGlobalAI.BuffedHerplingAI(npc, Mod); @@ -3515,37 +3635,35 @@ namespace CalamityMod.NPCs } } break; - case 44: + + case NPCAIStyleID.FlyingFish: switch (npc.type) { case NPCID.FlyingFish: + case NPCID.GiantFlyingAntlion: case NPCID.FlyingAntlion: + case NPCID.EyeballFlyingFish: return CalamityGlobalAI.BuffedFlyingFishAI(npc, Mod); } break; - case 49: + + case NPCAIStyleID.AngryNimbus: switch (npc.type) { case NPCID.AngryNimbus: return CalamityGlobalAI.BuffedAngryNimbusAI(npc, Mod); } break; - case 50: - switch (npc.type) - { - case NPCID.FungiSpore: - case NPCID.Spore: - return CalamityGlobalAI.BuffedSporeAI(npc, Mod); - } - break; - case 73: + + case NPCAIStyleID.TeslaTurret: switch (npc.type) { case NPCID.MartianTurret: return CalamityGlobalAI.BuffedTeslaTurretAI(npc, Mod); } break; - case 74: + + case NPCAIStyleID.Corite: switch (npc.type) { case NPCID.MartianDrone: @@ -3553,21 +3671,54 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedCoriteAI(npc, Mod); } break; - case 80: + + case NPCAIStyleID.MartianProbe: switch (npc.type) { case NPCID.MartianProbe: return CalamityGlobalAI.BuffedMartianProbeAI(npc, Mod); } break; - case 89: + + case NPCAIStyleID.StarCell: + switch (npc.type) + { + case NPCID.StardustCellBig: + case NPCID.NebulaHeadcrab: + case NPCID.DeadlySphere: + return CalamityGlobalAI.BuffedStarCellAI(npc, Mod); + } + break; + + case NPCAIStyleID.AncientVision: + switch (npc.type) + { + case NPCID.ShadowFlameApparition: + case NPCID.AncientCultistSquidhead: + return CalamityGlobalAI.BuffedAncientVisionAI(npc, Mod); + } + break; + + case NPCAIStyleID.BiomeMimic: + switch (npc.type) + { + case NPCID.BigMimicCorruption: + case NPCID.BigMimicCrimson: + case NPCID.BigMimicHallow: + case NPCID.BigMimicJungle: + return CalamityGlobalAI.BuffedBigMimicAI(npc, Mod); + } + break; + + case NPCAIStyleID.MothronEgg: switch (npc.type) { case NPCID.MothronEgg: return CalamityGlobalAI.BuffedMothronEggAI(npc, Mod); } break; - case 91: + + case NPCAIStyleID.GraniteElemental: if (npc.type == NPCType()) { return CalamityGlobalAI.BuffedGraniteElementalAI(npc, Mod); @@ -3581,15 +3732,30 @@ namespace CalamityMod.NPCs } } break; + + case NPCAIStyleID.SmallStarCell: + switch (npc.type) + { + case NPCID.StardustCellSmall: + return CalamityGlobalAI.BuffedSmallStarCellAI(npc, Mod); + } + break; + + case NPCAIStyleID.FlowInvader: + switch (npc.type) + { + case NPCID.StardustJellyfishBig: + return CalamityGlobalAI.BuffedFlowInvaderAI(npc, Mod); + } + break; + default: break; } } - else if (Main.expertMode) - { - if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore) - return CalamityGlobalAI.BuffedSporeAI(npc, Mod); - } + + if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore) + return CalamityGlobalAI.BuffedSporeAI(npc, Mod); // Fairies don't run away and are immune to damage while wearing Fairy Boots. if (npc.type >= NPCID.FairyCritterPink && npc.type <= NPCID.FairyCritterBlue && (npc.ai[2] < 2f || npc.ai[2] == 7f)) @@ -4012,6 +4178,58 @@ namespace CalamityMod.NPCs #region Post AI public override void PostAI(NPC npc) { + // Worm heads emit dust when close enough to the player and digging through tiles + if (npc.type == NPCID.GiantWormHead || npc.type == NPCID.DiggerHead || npc.type == NPCID.DevourerHead || + npc.type == NPCID.SeekerHead || npc.type == NPCID.TombCrawlerHead || npc.type == NPCID.BoneSerpentHead || + npc.type == NPCID.DuneSplicerHead) + { + 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, 204, 0f, 0f, 150, default, 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + } + + // Plants that go through tiles emit spores while inside tiles + else if (npc.type == NPCID.ManEater || npc.type == NPCID.Snatcher || npc.type == NPCID.AngryTrapper) + { + 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(10)) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 44, 0f, 0f, 250, default, 0.4f); + dust.fadeIn = 0.7f; + } + } + } + + // Clingers emit cursed fire while inside tiles + else if (npc.type == NPCID.Clinger) + { + 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(5)) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 75, 0f, 0f, 100, default, 1.5f); + dust.noGravity = true; + } + } + } + // Debuff decrements if (debuffResistanceTimer > 0) debuffResistanceTimer--; @@ -4047,8 +4265,6 @@ namespace CalamityMod.NPCs pearlAura--; if (bBlood > 0) bBlood--; - if (dFlames > 0) - dFlames--; if (vulnerabilityHex > 0) vulnerabilityHex--; if (marked > 0) @@ -4070,6 +4286,8 @@ namespace CalamityMod.NPCs gsInferno--; if (dragonFire > 0) dragonFire--; + if (miracleBlight > 0) + miracleBlight--; if (astralInfection > 0) astralInfection--; if (wDeath > 0) @@ -4319,7 +4537,8 @@ namespace CalamityMod.NPCs if (CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || CalamityLists.PerforatorIDs.Contains(npc.type) || CalamityLists.AquaticScourgeIDs.Contains(npc.type) || CalamityLists.DestroyerIDs.Contains(npc.type) || CalamityLists.AstrumDeusIDs.Contains(npc.type) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || - npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType()) + npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || + npc.type == NPCType()) { double damageMult = CalamityLists.ThanatosIDs.Contains(npc.type) ? 0.35 : 0.5; if (item.CountsAsClass() && item.type != ItemType() && item.type != ItemType()) @@ -4336,6 +4555,10 @@ namespace CalamityMod.NPCs MakeTownNPCsTakeMoreDamage(npc, projectile, Mod, ref damage); + //Block natural falling stars from killing boss spawners randomly + if ((projectile.type == ProjectileID.FallingStar && projectile.damage >= 1000) && (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType())) + damage = 0; + // Supercrits var cgp = projectile.Calamity(); if (cgp.supercritHits != 0) @@ -4359,6 +4582,9 @@ namespace CalamityMod.NPCs } } + // + // DAAWNLIGHT SPIRIT ORIGIN AIM IMPLEMENTATION + // int bullseyeType = ProjectileType(); Projectile bullseye = null; for (int i = 0; i < Main.maxProjectiles; i++) @@ -4430,6 +4656,7 @@ namespace CalamityMod.NPCs } } + // Plague Reaper deals 1.1x damage to Plagued enemies if (!projectile.npcProj && !projectile.trap) { if (projectile.CountsAsClass() && modPlayer.plagueReaper && pFlames > 0) @@ -4468,7 +4695,8 @@ namespace CalamityMod.NPCs damage = (int)(damage * 0.1); } - // TODO -- What in god's name is this? + // Generalized pierce resistance that stacks with all other resistances for some specific bosses defined in a list. + // The actual resistance formula isn't really a problem, but the implementation of this desperately needs refactoring. private void PierceResistGlobal(Projectile projectile, NPC npc, ref int damage) { // Thanatos segments do not trigger pierce resistance if they are closed @@ -4524,6 +4752,16 @@ namespace CalamityMod.NPCs if (npc.life <= 0 && npc.Organic() && RancorBurnTime > 0) DeathAshParticle.CreateAshesFromNPC(npc); + // Cultist shield flicker + if (npc.type == NPCID.CultistBoss) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + newAI[1] = 35f; + npc.netUpdate = true; + } + } + if (CalamityWorld.revenge) { switch (npc.type) @@ -4552,15 +4790,10 @@ namespace CalamityMod.NPCs } break; - case NPCID.Demon: - case NPCID.VoodooDemon: - npc.ai[0] += Main.getGoodWorld ? 5f : 1f; - break; - case NPCID.CursedHammer: case NPCID.EnchantedSword: case NPCID.CrimsonAxe: - if (npc.life <= npc.lifeMax * 0.5 || Main.getGoodWorld) + if (Main.getGoodWorld) npc.justHit = false; break; @@ -4571,27 +4804,21 @@ namespace CalamityMod.NPCs case NPCID.IceTortoise: case NPCID.BlackRecluse: case NPCID.BlackRecluseWall: - if (npc.life <= npc.lifeMax * 0.25 || Main.getGoodWorld) + if (Main.getGoodWorld) npc.justHit = false; break; case NPCID.Paladin: - if (npc.life <= npc.lifeMax * 0.15 || Main.getGoodWorld) + if (Main.getGoodWorld) npc.justHit = false; break; - - case NPCID.Clown: - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead) - npc.ai[2] += 29f; - - break; } if (npc.type == NPCType()) { - if (npc.life <= npc.lifeMax * 0.25 || Main.getGoodWorld) + if (Main.getGoodWorld) npc.justHit = false; } } @@ -4845,7 +5072,7 @@ namespace CalamityMod.NPCs spawnInfo.Player.Calamity().ZoneCalamity || spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneSunkenSea || - (spawnInfo.Player.Calamity().ZoneAstral && !NPC.LunarApocalypseIsUp); + (spawnInfo.Player.Calamity().ZoneAstral && !spawnInfo.Player.PillarZone()); // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode if (spawnInfo.Player.ZoneRockLayerHeight && spawnInfo.Water && !calamityBiomeZone) @@ -5161,6 +5388,28 @@ namespace CalamityMod.NPCs Lighting.AddLight(npc.position, 0.1f, 0f, 0.135f); } + if (miracleBlight > 0) + { + void spawnMiracleBlightDust() + { + Vector2 dustCorner = npc.position - 2f * Vector2.One; + Vector2 dustVel = npc.velocity + new Vector2(0f, Main.rand.NextFloat(-15f, -12f)); + Dust d = Dust.NewDustDirect(dustCorner, npc.width + 4, npc.height + 4, (int)CalamityDusts.MiracleBlight, dustVel.X, dustVel.Y); + d.noGravity = true; + } + + // Miracle Blight spawned dust scales with the NPC's size + float blightDustFactor = 0.0005f; + float dustToCreate = blightDustFactor * npc.width * npc.height; + if (dustToCreate > 5f) + dustToCreate = 5f; + for (int i = 0; i < (int)dustToCreate; ++i) + spawnMiracleBlightDust(); + + if (dustToCreate < 1f && Main.rand.NextFloat() < dustToCreate) + spawnMiracleBlightDust(); + } + if (astralInfection > 0) { if (Main.rand.Next(5) < 3) @@ -5217,23 +5466,6 @@ namespace CalamityMod.NPCs } } - if (dFlames > 0) - { - if (Main.rand.Next(5) < 4) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, (int)CalamityDusts.PurpleCosmilite, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; - if (Main.rand.NextBool(4)) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - Lighting.AddLight(npc.position, 0.1f, 0f, 0.135f); - } - if (sulphurPoison > 0) { if (Main.rand.Next(5) < 4) @@ -5358,10 +5590,10 @@ namespace CalamityMod.NPCs buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/BurningBlood").Value); if (cDepth > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/CrushDepth").Value); - if (dFlames > 0) - buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/DemonFlames").Value); if (dragonFire > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/Dragonfire").Value); + if (miracleBlight > 0) + buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/MiracleBlight").Value); if (gsInferno > 0) buffTextureList.Add(Request("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno").Value); if (hFlames > 0) @@ -5409,7 +5641,7 @@ namespace CalamityMod.NPCs if (tSad > 0) buffTextureList.Add(Request("CalamityMod/Buffs/StatDebuffs/TemporalSadness").Value); if (tesla > 0) - buffTextureList.Add(Request("CalamityMod/Buffs/StatDebuffs/TeslaFreeze").Value); + buffTextureList.Add(Request("CalamityMod/Buffs/StatDebuffs/GalvanicCorrosion").Value); if (timeSlow > 0) buffTextureList.Add(Request("CalamityMod/Buffs/StatDebuffs/TimeDistortion").Value); if (wDeath > 0) @@ -5599,6 +5831,7 @@ namespace CalamityMod.NPCs } else { + // VHex and Miracle Blight visuals do not appear if Odd Mushroom is in use for sanity reasons if (npc.Calamity().vulnerabilityHex > 0) { float compactness = npc.width * 0.6f; @@ -5614,6 +5847,24 @@ namespace CalamityMod.NPCs } else VulnerabilityHexFireDrawer = null; + + if (npc.Calamity().miracleBlight > 0) + { + // this is horrible but I can't figure out a better way to do it + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + + MiscShaderData msd = GameShaders.Misc["CalamityMod:MiracleBlight"]; + msd.SetShaderTexture(Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"), 1); + msd.UseOpacity(0.48f); + DrawData dd = new() + { + texture = TextureAssets.Npc[npc.type].Value, + position = npc.position - Main.screenPosition, + sourceRect = npc.frame, + }; + msd.Apply(dd); + } } // Draw a pillar of light and fade the background as an animation when skipping things in the DD2 event. @@ -5640,11 +5891,78 @@ namespace CalamityMod.NPCs spriteBatch.Draw(TextureAssets.MagicPixel.Value, drawPosition, null, beamColor, 0f, origin, scale, SpriteEffects.None, 0f); } } + + if (CalamityWorld.getFixedBoi && NPC.AnyNPCs(NPCType())) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + var midnightShader = GameShaders.Armor.GetShaderFromItemId(ItemID.MidnightRainbowDye); + midnightShader.Apply(); + } return true; } public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + // Energy shield + if (npc.type == NPCID.CultistBoss || npc.type == NPCID.CultistBossClone) + { + spriteBatch.EnterShaderRegion(); + + float intensity = newAI[1] / 35f; + + float lifeRatio = npc.type == NPCID.CultistBoss ? (npc.life / (float)npc.lifeMax) : (Main.npc[(int)npc.ai[3]].life / (float)Main.npc[(int)npc.ai[3]].lifeMax); + + float flickerPower = 0f; + if (lifeRatio < 0.85f) + flickerPower += 0.1f; + if (lifeRatio < 0.7f) + flickerPower += 0.1f; + if (lifeRatio < 0.55f) + flickerPower += 0.1f; + if (lifeRatio < 0.4f) + flickerPower += 0.1f; + if (lifeRatio < 0.25f) + flickerPower += 0.1f; + if (lifeRatio < 0.1f) + flickerPower += 0.1f; + + float opacity = 1f; + opacity *= MathHelper.Lerp(MathHelper.Max(1f - flickerPower, 0.56f), 1f, (float)Math.Pow(Math.Cos(Main.GlobalTimeWrappedHourly * MathHelper.Lerp(3f, 5f, flickerPower)) * 0.5 + 0.5, 24D)); + + // Dampen the opacity and intensity slightly, to allow Cultist to be more easily visible inside of the forcefield. + // Dampen the opacity and intensity a bit more for the Clones. + float intensityAndOpacityMult = npc.type == NPCID.CultistBossClone ? 0.9f : 1f; + intensity *= intensityAndOpacityMult; + opacity *= intensityAndOpacityMult; + + Texture2D forcefieldTexture = Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture").Value; + + if (npc.type == NPCID.CultistBoss) + GameShaders.Misc["CalamityMod:SupremeShield"].SetShaderTexture(Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); + else + GameShaders.Misc["CalamityMod:SupremeShield"].UseImage1("Images/Misc/noise"); + + float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D); + Color forcefieldColor = Color.Lerp(Color.MediumSpringGreen, Color.Black, colorTransitionAmt); + Color secondaryForcefieldColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt); + + forcefieldColor *= opacity; + secondaryForcefieldColor *= opacity; + + GameShaders.Misc["CalamityMod:SupremeShield"].UseSecondaryColor(secondaryForcefieldColor); + GameShaders.Misc["CalamityMod:SupremeShield"].UseColor(forcefieldColor); + GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(intensity); + GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:SupremeShield"].Apply(); + + // Actual Cultist has a bigger shield than the Clones. + float shieldScale = npc.type == NPCID.CultistBossClone ? 1.65f : MathHelper.Lerp(1.65f, 3f, (float)Math.Pow((double)lifeRatio, 2D)); + spriteBatch.Draw(forcefieldTexture, npc.Center - Main.screenPosition, null, Color.White * opacity, 0f, forcefieldTexture.Size() * 0.5f, shieldScale, SpriteEffects.None, 0f); + + spriteBatch.ExitShaderRegion(); + } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { // His afterimages I can't get to work, so fuck it @@ -5778,18 +6096,20 @@ namespace CalamityMod.NPCs #endregion #region Any Events - public static bool AnyEvents(Player player) + public static bool AnyEvents(Player player, bool checkBloodMoon = false) { - if (Main.invasionType > InvasionID.None) + if (Main.invasionType > InvasionID.None && Main.invasionProgressNearInvasion) return true; if (player.PillarZone()) return true; - if (DD2Event.Ongoing) + if (DD2Event.Ongoing && player.ZoneOldOneArmy) return true; - if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && (Main.eclipse || Main.bloodMoon || Main.pumpkinMoon || Main.snowMoon)) + if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && (Main.eclipse || Main.pumpkinMoon || Main.snowMoon)) return true; if (AcidRainEvent.AcidRainEventIsOngoing && player.InSulphur()) return true; + if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.bloodMoon && checkBloodMoon) + return true; return false; } #endregion @@ -5896,7 +6216,7 @@ namespace CalamityMod.NPCs } else if (type == NPCType()) { - return DownedBossSystem.downedCalamitas; + return DownedBossSystem.downedCalamitasClone; } else if (type == NPCType() || type == NPCType()) { @@ -5964,7 +6284,7 @@ namespace CalamityMod.NPCs } else if (type == NPCType()) { - return DownedBossSystem.downedSCal; + return DownedBossSystem.downedCalamitas; } else if (type == NPCType()) { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index f4a1d5f94f..a93053b77d 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -12,6 +12,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Tiles.Ores; @@ -449,7 +450,7 @@ namespace CalamityMod.NPCs // Old Lord Oathsword @ 8.33% Normal, 14.29% Expert+ case NPCID.BoneSerpentHead: npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 12, 7)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 12, 7)); break; // Red Devil @@ -459,14 +460,21 @@ namespace CalamityMod.NPCs case NPCID.RedDevil: npcLoot.ChangeDropRate(ItemID.FireFeather, 1, 10); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 2, 1)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 2, 1)); break; #endregion #region Blood Moon + // All Blood Moon enemies + // Drop Blood Orbs @ 100% (25% for common enemies) + case NPCID.BloodZombie: + case NPCID.Drippler: + npcLoot.Add(ModContent.ItemType(), 4); + break; - // All Blood Moon fishing enemies - // Drop more Blood Orbs @ 100% + case NPCID.Clown: + npcLoot.Add(ModContent.ItemType(), 1, 6, 12); + break; // Wandering Eye Fish // Bouncing Eyeball @ 10% Normal, 16.66% Expert+ @@ -484,8 +492,10 @@ namespace CalamityMod.NPCs npcLoot.Add(ModContent.ItemType(), 1, 15, 30); break; + // Dreadnautilus drops the Blood Moon lore case NPCID.BloodNautilus: npcLoot.Add(ModContent.ItemType(), 1, 20, 40); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDreadnautilus, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; #endregion @@ -509,7 +519,6 @@ namespace CalamityMod.NPCs // Dark Mage T1 // Dark Mage's Tome drops in Revengeance case NPCID.DD2DarkMageT1: - rev.Add(ItemID.DarkMageMasterTrophy); rev.Add(ItemID.DarkMageBookMountItem, 4); break; @@ -602,10 +611,10 @@ namespace CalamityMod.NPCs break; // Deadly Sphere - // Defective Sphere @ 20% Normal, 33.33% Expert+ + // Defective Sphere @ 4% Normal, 6.67% Expert+ // Darksun Fragment @ 50% IF Devourer of Gods dead case NPCID.DeadlySphere: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); postDoG.Add(ModContent.ItemType(), 2); break; #endregion @@ -733,8 +742,33 @@ namespace CalamityMod.NPCs // Martian Saucer case NPCID.MartianSaucerCore: - // Nullification Pistol @ 14.29% Normal, 25% Expert+ - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + // Drops all of its weapons Calamity Style @ 25% each + // This requires erasing its vanilla behavior. + try + { + npcLoot.RemoveWhere((rule) => + { + if (rule is OneFromOptionsNotScaledWithLuckDropRule vanillaItems) + return vanillaItems.dropIds[0] == ItemID.Xenopopper; + return false; + }); + + int[] saucerItems = new int[] + { + ItemID.Xenopopper, + ItemID.XenoStaff, + ItemID.LaserMachinegun, + ItemID.ElectrosphereLauncher, + ItemID.InfluxWaver, + ModContent.ItemType() + }; + + npcLoot.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, saucerItems)); + + //Cosmic Car Key is also in the vanilla selection pool. Pull it out. + npcLoot.Add(ItemID.CosmicCarKey, 4); + } + catch (ArgumentNullException) { } // Master items drop in Revengeance rev.Add(ItemID.UFOMasterTrophy); @@ -839,7 +873,7 @@ namespace CalamityMod.NPCs rev.Add(ItemID.KingSlimePetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedSlimeKing, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedSlimeKing, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.EyeofCthulhu: @@ -856,11 +890,13 @@ namespace CalamityMod.NPCs rev.Add(ItemID.EyeOfCthulhuPetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedBoss1, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedBoss1, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.EaterofWorldsHead: - // Expert+ drops are also available on Normal, also stuff that would be in the bag otherwise + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + // Expert+ drops are also available on Normal. Drop what would be in the bag otherwise LeadingConditionRule EoWKill = new(DropHelper.If((info) => info.npc.boss)); EoWKill.Add(DropHelper.PerPlayer(ItemID.WormScarf)); EoWKill.Add(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -875,14 +911,14 @@ namespace CalamityMod.NPCs // Corruption World OR Drunk World: Corruption Lore LeadingConditionRule eowCorruptionLore = new(DropHelper.If((info) => info.npc.boss && (!WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2, desc: DropHelper.FirstKillText)); - eowCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); - eowCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); + eowCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); + eowCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); npcLoot.Add(eowCorruptionLore); // Crimson World OR Drunk World: Crimson Lore LeadingConditionRule eowCrimsonLore = new(DropHelper.If((info) => info.npc.boss && (WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2, desc: DropHelper.FirstKillText)); - eowCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); - eowCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); + eowCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); + eowCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); npcLoot.Add(eowCrimsonLore); break; @@ -899,14 +935,14 @@ namespace CalamityMod.NPCs // Corruption World OR Drunk World: Corruption Lore LeadingConditionRule bocCorruptionLore = new(DropHelper.If(() => (!WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2, desc: DropHelper.FirstKillText)); - bocCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); - bocCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); + bocCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); + bocCorruptionLore.Add(ModContent.ItemType(), hideLootReport: WorldGen.crimson && !WorldGen.drunkWorldGen); npcLoot.Add(bocCorruptionLore); // Crimson World OR Drunk World: Crimson Lore LeadingConditionRule bocCrimsonLore = new(DropHelper.If(() => (WorldGen.crimson || WorldGen.drunkWorldGen) && !NPC.downedBoss2, desc: DropHelper.FirstKillText)); - bocCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); - bocCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); + bocCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); + bocCrimsonLore.Add(ModContent.ItemType(), hideLootReport: !WorldGen.crimson && !WorldGen.drunkWorldGen); npcLoot.Add(bocCrimsonLore); break; @@ -919,7 +955,7 @@ namespace CalamityMod.NPCs if (notExpert is LeadingConditionRule LCR_NotExpert) { LCR_NotExpert.ChainedRules.RemoveAll((chainAttempt) => - chainAttempt is Chains.TryIfSucceeded c && c.RuleToChain is OneFromOptionsNotScaledWithLuckDropRule weapons && weapons.dropIds[0] == ItemID.PewMaticHorn); + chainAttempt is Chains.TryIfSucceeded c && c.RuleToChain is OneFromRulesRule weapons); // Define a replacement rule which drops the weapons Calamity style. var deerWeapons = new int[] @@ -973,7 +1009,7 @@ namespace CalamityMod.NPCs rev.Add(ItemID.QueenBeePetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedQueenBee, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedQueenBee, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.SkeletronHead: @@ -1000,7 +1036,7 @@ namespace CalamityMod.NPCs rev.Add(ItemID.SkeletronPetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedBoss3, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedBoss3, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.WallofFlesh: @@ -1083,8 +1119,8 @@ namespace CalamityMod.NPCs rev.Add(ItemID.WallOfFleshGoatMountItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !Main.hardMode, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(() => !Main.hardMode, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !Main.hardMode, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !Main.hardMode, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.QueenSlimeBoss: @@ -1102,6 +1138,9 @@ namespace CalamityMod.NPCs rev.Add(ItemID.QueenSlimeMasterTrophy); rev.Add(ItemID.QueenSlimePetItem, 4); + // Lore + npcLoot.AddConditionalPerPlayer(() => !NPC.downedQueenSlime, ModContent.ItemType(), desc: DropHelper.FirstKillText); + break; case NPCID.TheDestroyer: @@ -1122,8 +1161,8 @@ namespace CalamityMod.NPCs rev.Add(ItemID.DestroyerPetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedMechBoss1, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedMechBoss1, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); break; case NPCID.Retinazer: @@ -1161,8 +1200,8 @@ namespace CalamityMod.NPCs rev.AddIf((info) => IsLastTwinStanding(info), ItemID.TwinsPetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer((info) => !NPC.downedMechBoss2 && IsLastTwinStanding(info), ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); + npcLoot.AddConditionalPerPlayer((info) => !NPC.downedMechBoss2 && IsLastTwinStanding(info), ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); break; case NPCID.SkeletronPrime: @@ -1183,8 +1222,8 @@ namespace CalamityMod.NPCs rev.Add(ItemID.SkeletronPrimePetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedMechBoss3, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedMechBoss3, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(ShouldDropMechLore, ModContent.ItemType(), desc: DropHelper.MechBossText); break; case NPCID.Plantera: @@ -1244,7 +1283,7 @@ namespace CalamityMod.NPCs rev.Add(ItemID.PlanteraPetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedPlantBoss, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedPlantBoss, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.Golem: @@ -1299,7 +1338,7 @@ namespace CalamityMod.NPCs rev.Add(ItemID.GolemPetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedGolemBoss, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedGolemBoss, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.DD2Betsy: @@ -1336,6 +1375,9 @@ namespace CalamityMod.NPCs // Remove the vanilla loot rule for Duke Fishron's weapon drops. This requires digging through his loot rule tree. try { + // Remove the vanilla loot rule for Fishron Wings because it's part of the Calamity Style set. + npcLoot.RemoveWhere((rule) => rule is ItemDropWithConditionRule conditionalRule && conditionalRule.itemId == ItemID.FishronWings); + var dukeRootRules = npcLoot.Get(false); IItemDropRule notExpert = dukeRootRules.Find((rule) => rule is LeadingConditionRule dukeLCR && dukeLCR.condition is Conditions.NotExpert); if (notExpert is LeadingConditionRule LCR_NotExpert) @@ -1356,10 +1398,6 @@ namespace CalamityMod.NPCs ItemID.FishronWings, }; LCR_NotExpert.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, dukeItems)); - - // Remove the vanilla loot rule for Fishron Wings because it's part of the Calamity Style set. - dukeRootRules.RemoveAll((rule) => - rule is ItemDropWithConditionRule conditionalRule && conditionalRule.condition is Conditions.NotExpert && conditionalRule.itemId == ItemID.FishronWings); } } catch (ArgumentNullException) { } @@ -1376,7 +1414,7 @@ namespace CalamityMod.NPCs rev.Add(ItemID.DukeFishronPetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedFishron, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedFishron, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.HallowBoss: @@ -1424,6 +1462,9 @@ namespace CalamityMod.NPCs rev.Add(ItemID.FairyQueenMasterTrophy); rev.Add(ItemID.FairyQueenPetItem, 4); + // Lore + npcLoot.AddConditionalPerPlayer(() => !NPC.downedEmpressOfLight, ModContent.ItemType(), desc: DropHelper.FirstKillText); + break; case NPCID.CultistBoss: @@ -1434,10 +1475,7 @@ namespace CalamityMod.NPCs npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedAncientCultist, ModContent.ItemType(), desc: DropHelper.FirstKillText); - - // Special Blood Moon Lore - npcLoot.AddConditionalPerPlayer(() => Main.bloodMoon, ModContent.ItemType(), desc: DropHelper.BloodMoonText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedAncientCultist, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; case NPCID.MoonLordCore: @@ -1484,7 +1522,7 @@ namespace CalamityMod.NPCs rev.Add(ItemID.MoonLordPetItem, 4); // Lore - npcLoot.AddConditionalPerPlayer(() => !NPC.downedMoonlord, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !NPC.downedMoonlord, ModContent.ItemType(), desc: DropHelper.FirstKillText); break; default: @@ -1534,26 +1572,42 @@ namespace CalamityMod.NPCs LeadingConditionRule tarragonDrop = new LeadingConditionRule(DropHelper.TarragonSetBonusHeartCondition); tarragonDrop.Add(ItemID.Heart, 5, hideLootReport: true); globalLoot.Add(tarragonDrop); - - // Blood Orb drops: 20% chance from any valid enemy on the surface during a Blood Moon - // See the condition lambda in DropHelper for details - // Does not show up in the Bestiary - LeadingConditionRule bloodOrbDrop = new LeadingConditionRule(DropHelper.BloodOrbBaseCondition); - bloodOrbDrop.Add(ModContent.ItemType(), 5, hideLootReport: true); - globalLoot.Add(bloodOrbDrop); - - // Bloodflare set bonus Blood Orb drops: 50% chance from any valid enemy on the surface during a Blood Moon - // See the condition lambda in DropHelper for details - // Does not show up in the Bestiary - LeadingConditionRule bloodflareBloodOrbDrop = new LeadingConditionRule(DropHelper.BloodOrbBloodflareCondition); - bloodflareBloodOrbDrop.Add(ModContent.ItemType(), 2, hideLootReport: true); - globalLoot.Add(bloodflareBloodOrbDrop); } #endregion #region Pre Kill public override bool PreKill(NPC npc) { + // Stop all random food drops that aren't sold, crafted or etc. + var randomFoodItems = new int[] + { + ItemID.ApplePie, + ItemID.BananaSplit, + ItemID.BBQRibs, + ItemID.Burger, + ItemID.MilkCarton, + ItemID.ChocolateChipCookie, + ItemID.CoffeeCup, + ItemID.CreamSoda, + ItemID.FriedEgg, + ItemID.Fries, + ItemID.Grapes, + ItemID.Hotdog, + ItemID.IceCream, + ItemID.Milkshake, + ItemID.Nachos, + ItemID.Pizza, + ItemID.PotatoChips, + ItemID.ShrimpPoBoy, + ItemID.Spaghetti, + ItemID.Steak + }; + DropHelper.BlockDrops(randomFoodItems); + + // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ + if (CalamityWorld.revenge && (CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper)) + DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); + // Boss Rush pre-kill effects if (BossRushEvent.BossRushActive) { @@ -1582,10 +1636,6 @@ namespace CalamityMod.NPCs if (CalamityWorld.death && !SplittingWormLootBlockWrapper(npc, Mod)) DropHelper.BlockEverything(); - // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ - if (CalamityWorld.revenge && (CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper)) - DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); - // Check whether bosses should be spawned naturally as a result of this NPC's death. CheckBossSpawn(npc); @@ -1603,7 +1653,7 @@ namespace CalamityMod.NPCs SetNewBossJustDowned(npc); } - // On-kill NON-LOOT behavior for every other vanilla boss + // On-kill NON-LOOT behavior for every other vanilla boss (and Dreadnautilus) switch (npc.type) { case NPCID.KingSlime: @@ -1628,6 +1678,15 @@ namespace CalamityMod.NPCs case NPCID.SkeletronHead: SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad, NPCID.Demolitionist }, NPC.downedBoss3); SetNewBossJustDowned(npc); + + // First kill: Notify of Abyss chests being unlocked. + if (!NPC.downedBoss3) + { + World.Abyss.UnlockAllAbyssChests(); + + string keysk = "Mods.CalamityMod.SkeletronAbyssChestNotification"; + CalamityUtils.DisplayLocalizedText(keysk, new Color(76, 181, 76)); + } break; case NPCID.WallofFlesh: @@ -1656,6 +1715,12 @@ namespace CalamityMod.NPCs } break; + case NPCID.BloodNautilus: + // Mark Dreadnautilus as dead (Vanilla does not keep track of it) + DownedBossSystem.downedDreadnautilus = true; + CalamityNetcode.SyncWorld(); + break; + case NPCID.QueenSlimeBoss: SetNewBossJustDowned(npc); break; @@ -1704,7 +1769,7 @@ namespace CalamityMod.NPCs Color messageColor2 = Color.Goldenrod; // TODO -- this should probably be moved to a thread like Aureus meteor - CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.65f, 0.85f, 3, 8, TileID.Dirt, TileID.Stone); + CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.65f, 0.85f, 5, 10, TileID.Dirt, TileID.Stone); CalamityUtils.DisplayLocalizedText(key, messageColor); CalamityUtils.DisplayLocalizedText(key2, messageColor2); @@ -1735,7 +1800,7 @@ namespace CalamityMod.NPCs if (!NPC.downedGolemBoss) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(PlagueSound, Main.player[Main.myPlayer].position); + SoundEngine.PlaySound(PlagueSound, Main.player[Main.myPlayer].Center); string key3 = "Mods.CalamityMod.BabyBossText"; Color messageColor3 = Color.Lime; @@ -1828,7 +1893,7 @@ namespace CalamityMod.NPCs { string key = "Mods.CalamityMod.HardmodeOreTier4Text"; Color messageColor = new Color(50, 255, 130); - CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.7f, 0.9f, 3, 8, TileID.Pearlstone, TileID.HallowHardenedSand, TileID.HallowSandstone, TileID.HallowedIce); + CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.55f, 0.9f, 3, 8, TileID.Pearlstone, TileID.HallowHardenedSand, TileID.HallowSandstone, TileID.HallowedIce); CalamityUtils.DisplayLocalizedText(key, messageColor); } } @@ -1927,7 +1992,8 @@ namespace CalamityMod.NPCs } } - if (NPC.downedPlantBoss && (npc.type == NPCID.SandShark || npc.type == NPCID.SandsharkHallow || npc.type == NPCID.SandsharkCorrupt || npc.type == NPCID.SandsharkCrimson) && !NPC.AnyNPCs(ModContent.NPCType())) + bool normalShark = npc.type == NPCID.SandShark || npc.type == NPCID.SandsharkHallow || npc.type == NPCID.SandsharkCorrupt || npc.type == NPCID.SandsharkCrimson; + if (NPC.downedPlantBoss && (normalShark || (npc.type == ModContent.NPCType() && CalamityWorld.getFixedBoi)) && !NPC.AnyNPCs(ModContent.NPCType())) { CalamityMod.sharkKillCount++; if (CalamityMod.sharkKillCount == 4) @@ -1948,7 +2014,7 @@ namespace CalamityMod.NPCs { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) { - SoundEngine.PlaySound(Mauler.RoarSound, Main.player[Main.myPlayer].position); + SoundEngine.PlaySound(Mauler.RoarSound, Main.player[Main.myPlayer].Center); } int lastPlayer = npc.lastInteraction; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 09cef6a4b8..dd101b5d21 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -2,30 +2,28 @@ using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; -using CalamityMod.Items.Ammo.FiniteUse; using CalamityMod.Items.Armor; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Dyes; using CalamityMod.Items.Dyes.HairDye; using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Placeables.Furniture.Fountains; -using CalamityMod.Items.Placeables.Walls; using CalamityMod.Items.Potions; using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Typeless.FiniteUse; using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Walls; using static Terraria.ModLoader.ModContent; namespace CalamityMod.NPCs @@ -134,6 +132,7 @@ namespace CalamityMod.NPCs private static readonly string[] NurseNames = { "Farsni", + "Fanny", // <@!799749125720637460> (zombiewolf511#4581) }; private static readonly string[] PainterNames = { @@ -153,6 +152,7 @@ namespace CalamityMod.NPCs "Catalyst", // <@!156672312425316352> (xAqult#1122) "Nyapano", // <@!120976656826368003> (Emi - Nyapano She/Her#4040) "Jade", // <@!187395834625785869> (VeryMasterNinja#7728) + "Nyavi Aceso", // <@!270260920888852480> (Navigator#8739) }; private static readonly string[] SkeletonMerchantNames = { @@ -175,6 +175,7 @@ namespace CalamityMod.NPCs "Tim Lockwood", // <@!605839945483026434> (Deimelo#0001) "Sir Samuel Winchester Jenkins Kester II", // <@!107659695749070848> (Ryaegos#1661) "Brutus", // <@!591889650692521984> (Brutus#4337) + "Sloth", // <@!486265327387279391> (BossyPunch#4983) }; private static readonly string[] TaxCollectorNames = { @@ -207,7 +208,7 @@ namespace CalamityMod.NPCs "Chris Tallballs", // <@!770211589076418571> (Bewearium#1111) "Syethas", // <@!325413275066171393> (CosmicStarIight#4430) "Nextdoor Psycho", // <@!173261518572486656> (⋈-NextdoorPsycho-⋈#0001) - "Lacuna", // <@!790746689211203604> (Lacuna#8629) + "Lacuna", // <@!790746689211203604> (Lacuna#8629) }; private static readonly string[] ZoologistNames = { @@ -1509,7 +1510,12 @@ namespace CalamityMod.NPCs damageMult += 0.2f; defense += 12; } - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedExoMechs) + { + damageMult += 0.6f; + defense += 20; + } + if (DownedBossSystem.downedCalamitas) { damageMult += 0.6f; defense += 20; @@ -1522,20 +1528,25 @@ namespace CalamityMod.NPCs { int goldCost = NPC.downedMoonlord ? 8 : Main.hardMode ? 4 : 2; + bool happy = Main.LocalPlayer.currentShoppingSettings.PriceAdjustment <= 0.8999999761581421; + if (type == NPCID.Merchant) { - SetShopItem(ref shop, ref nextSlot, ItemID.Bottle, true, Item.buyPrice(0, 0, 0, 20)); - SetShopItem(ref shop, ref nextSlot, ItemID.WormholePotion, true, Item.buyPrice(0, 0, 25, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.ArcheryPotion, NPC.downedBoss1, Item.buyPrice(0, goldCost, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.HealingPotion, NPC.downedBoss2); - SetShopItem(ref shop, ref nextSlot, ItemID.ManaPotion, NPC.downedBoss2); - SetShopItem(ref shop, ref nextSlot, ItemID.TitanPotion, NPC.downedBoss3, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.Bottle, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 0, 0, 20)); + SetShopItem(ref shop, ref nextSlot, ItemID.WormholePotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 0, 25, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.ArcheryPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss1, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.HealingPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss2); + SetShopItem(ref shop, ref nextSlot, ItemID.ManaPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss2); + SetShopItem(ref shop, ref nextSlot, ItemID.TitanPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss3, Item.buyPrice(0, 2, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.Flare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.BlueFlare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.ApprenticeBait, NPC.downedBoss1); SetShopItem(ref shop, ref nextSlot, ItemID.JourneymanBait, NPC.downedBoss3); SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedPlantBoss); SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(NPCType()) != -1, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.Burger, happy && NPC.downedBoss3, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.Hotdog, happy && Main.hardMode, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.CoffeeCup, happy, Item.buyPrice(0, 2)); } if (type == NPCID.DyeTrader) @@ -1546,30 +1557,26 @@ namespace CalamityMod.NPCs if (type == NPCID.Demolitionist) { - SetShopItem(ref shop, ref nextSlot, ItemID.MiningPotion, NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.IronskinPotion, NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.ShinePotion, NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.SpelunkerPotion, NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.ObsidianSkinPotion, NPC.downedBoss3, Item.buyPrice(0, 2, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.EndurancePotion, NPC.downedBoss3, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.MiningPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.IronskinPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.ShinePotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.SpelunkerPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.ObsidianSkinPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss3, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.EndurancePotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss3, Item.buyPrice(0, goldCost, 0, 0)); } if (type == NPCID.ArmsDealer) { SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode, Item.buyPrice(gold: 25)); - bool hasMagnum = Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType()); - SetShopItem(ref shop, ref nextSlot, ItemType(), hasMagnum, Item.buyPrice(0, 3 * goldCost, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.HasItem(ItemType()), Item.buyPrice(0, 5 * goldCost, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.HasItem(ItemType()), Item.buyPrice(0, 7 * goldCost, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.Boomstick, NPC.downedQueenBee, price: Item.buyPrice(gold: 20)); SetShopItem(ref shop, ref nextSlot, ItemID.AmmoBox, Main.hardMode, Item.buyPrice(gold: 25)); SetShopItem(ref shop, ref nextSlot, ItemID.Uzi, NPC.downedPlantBoss, Item.buyPrice(gold: 45)); SetShopItem(ref shop, ref nextSlot, ItemID.TacticalShotgun, NPC.downedGolemBoss, Item.buyPrice(gold: 60)); SetShopItem(ref shop, ref nextSlot, ItemID.SniperRifle, NPC.downedGolemBoss, Item.buyPrice(gold: 60)); SetShopItem(ref shop, ref nextSlot, ItemID.RifleScope, NPC.downedGolemBoss, Item.buyPrice(gold: 60)); - SetShopItem(ref shop, ref nextSlot, ItemID.AmmoReservationPotion, true, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.HunterPotion, true, Item.buyPrice(0, 2, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.BattlePotion, NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.AmmoReservationPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.HunterPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.BattlePotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); } if (type == NPCID.Stylist) @@ -1580,6 +1587,7 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge); SetShopItem(ref shop, ref nextSlot, ItemID.StylistKilLaKillScissorsIWish, true, Item.buyPrice(0, 15)); SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.Calamity().alcoholPoisoning && NPC.FindFirstNPC(NPCType()) != -1); + SetShopItem(ref shop, ref nextSlot, ItemID.ChocolateChipCookie, happy && NPC.FindFirstNPC(NPCType()) != -1, Item.buyPrice(0, 3)); } if (type == NPCID.Cyborg) @@ -1591,24 +1599,26 @@ namespace CalamityMod.NPCs if (type == NPCID.Dryad) { - SetShopItem(ref shop, ref nextSlot, ItemID.ThornsPotion, true, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.FeatherfallPotion, true, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.RegenerationPotion, NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.SwiftnessPotion, NPC.downedBoss2, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.ThornsPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.FeatherfallPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.RegenerationPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.SwiftnessPotion, CalamityConfig.Instance.PotionSelling && NPC.downedBoss2, Item.buyPrice(0, goldCost, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.JungleRose, price: Item.buyPrice(0, 2)); SetShopItem(ref shop, ref nextSlot, ItemID.NaturesGift, price: Item.buyPrice(0, 10)); SetShopItem(ref shop, ref nextSlot, ItemType()); + SetShopItem(ref shop, ref nextSlot, ItemID.Grapes, happy && NPC.downedBoss3, Item.buyPrice(0, 2, 50)); } if (type == NPCID.GoblinTinkerer) { - SetShopItem(ref shop, ref nextSlot, ItemID.StinkPotion, true, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.StinkPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType()); + SetShopItem(ref shop, ref nextSlot, ItemID.Spaghetti, happy && NPC.downedBoss3, Item.buyPrice(0, 5)); } if (type == NPCID.Mechanic) { - SetShopItem(ref shop, ref nextSlot, ItemID.BuilderPotion, true, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.BuilderPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.CombatWrench, true, Item.buyPrice(0, 10, 0, 0)); } @@ -1646,10 +1656,10 @@ namespace CalamityMod.NPCs if (type == NPCID.Wizard) { - SetShopItem(ref shop, ref nextSlot, ItemID.ManaRegenerationPotion, true, Item.buyPrice(0, goldCost, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.MagicPowerPotion, true, Item.buyPrice(0, goldCost, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.GravitationPotion, true, Item.buyPrice(0, 2, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.PotionOfReturn, true, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.ManaRegenerationPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.MagicPowerPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.GravitationPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.PotionOfReturn, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, goldCost, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemID.MagicMissile, price: Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemID.RodofDiscord, Main.hardMode && Main.LocalPlayer.ZoneHallow, price: Item.buyPrice(10)); @@ -1661,33 +1671,54 @@ namespace CalamityMod.NPCs if (type == NPCID.WitchDoctor) { - SetShopItem(ref shop, ref nextSlot, ItemID.SummoningPotion, true, Item.buyPrice(0, goldCost, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.CalmingPotion, true, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.RagePotion, true, Item.buyPrice(0, goldCost, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.WrathPotion, true, Item.buyPrice(0, goldCost, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.InfernoPotion, true, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.SummoningPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.CalmingPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.RagePotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.WrathPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.InfernoPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 2, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode); SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode); SetShopItem(ref shop, ref nextSlot, ItemID.ButterflyDust, NPC.downedGolemBoss, Item.buyPrice(0, 10)); + SetShopItem(ref shop, ref nextSlot, ItemID.FriedEgg, happy, Item.buyPrice(0, 2, 50)); } if (type == NPCID.PartyGirl) { - SetShopItem(ref shop, ref nextSlot, ItemID.GenderChangePotion, true, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.GenderChangePotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.Pizza, happy && NPC.downedBoss3, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.CreamSoda, happy, Item.buyPrice(0, 2, 50)); } if (type == NPCID.Princess) { SetShopItem(ref shop, ref nextSlot, ItemID.PrincessWeapon, true, Item.buyPrice(0, 50, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemType()); + SetShopItem(ref shop, ref nextSlot, ItemID.AppleJuice, NPC.FindFirstNPC(NPCType()) != -1); + SetShopItem(ref shop, ref nextSlot, ItemID.FruitJuice, NPC.FindFirstNPC(NPCType()) != -1); + SetShopItem(ref shop, ref nextSlot, ItemID.Lemonade, NPC.FindFirstNPC(NPCType()) != -1); + SetShopItem(ref shop, ref nextSlot, ItemID.PrismaticPunch, NPC.FindFirstNPC(NPCType()) != -1); + SetShopItem(ref shop, ref nextSlot, ItemID.SmoothieofDarkness, NPC.FindFirstNPC(NPCType()) != -1); + SetShopItem(ref shop, ref nextSlot, ItemID.TropicalSmoothie, NPC.FindFirstNPC(NPCType()) != -1); } if (type == NPCID.SkeletonMerchant) { - SetShopItem(ref shop, ref nextSlot, ItemType(), true, Item.buyPrice(0, 0, 20, 0)); + SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 0, 20, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.MilkCarton); SetShopItem(ref shop, ref nextSlot, ItemID.Marrow, Main.hardMode, Item.buyPrice(0, 36)); } + + if (type == NPCID.Golfer) + { + SetShopItem(ref shop, ref nextSlot, ItemID.PotatoChips, happy, Item.buyPrice(0, 1)); + } + + if (type == NPCID.BestiaryGirl) + { + SetShopItem(ref shop, ref nextSlot, ItemID.Steak, happy && Main.hardMode, Item.buyPrice(0, 5)); + } } public override void SetupTravelShop(int[] shop, ref int nextSlot) diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index a96795fc80..0f9ff97990 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Scale = 0.55f, }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -76,8 +76,8 @@ namespace CalamityMod.NPCs.CeaselessVoid bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("When the fabric of the universe is meddled with, especially by inexperienced beings, the risk of irreparable damage is very, very high.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("A mysterious entity that acts as a portal to elsewhere. Little is known about its origins, other than that it was sealed away by the cultists.") }); } @@ -192,8 +192,6 @@ namespace CalamityMod.NPCs.CeaselessVoid return false; } - public static bool LastSentinelKilled() => !DownedBossSystem.downedCeaselessVoid && DownedBossSystem.downedStormWeaver && DownedBossSystem.downedSignus; - public override void OnKill() { CalamityGlobalNPC.SetNewBossJustDowned(NPC); @@ -225,10 +223,10 @@ namespace CalamityMod.NPCs.CeaselessVoid // Vanity normalOnly.Add(ModContent.ItemType(), 7); - var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - normalOnly.Add(godSlayerVanity); + var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(godSlayerVanity); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } @@ -238,7 +236,7 @@ namespace CalamityMod.NPCs.CeaselessVoid npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCeaselessVoid, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -256,7 +254,12 @@ namespace CalamityMod.NPCs.CeaselessVoid if (NPC.soundDelay == 0 && NPC.life >= NPC.lifeMax * 0.05f) { NPC.soundDelay = 8; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound, NPC.Center); + float pitchVar = 0; + if (CalamityWorld.getFixedBoi) + { + pitchVar = Main.rand.Next(-60, 41) * 0.01f; + } + SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound with { Pitch = CommonCalamitySounds.OtherwordlyHitSound.Pitch + pitchVar}, NPC.Center); } for (int k = 0; k < 5; k++) diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 507c7dd8db..4a1ca6c647 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -15,12 +15,14 @@ namespace CalamityMod.NPCs.CeaselessVoid { public class DarkEnergy : ModNPC { - private int invinceTime = 180; private bool start = true; private const double minDistance = 10D; private double distance = minDistance; private const double minMaxDistance = 800D; + public const int MaxHP = 12000; + public const int MaxBossRushHP = 20000; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Energy"); @@ -39,19 +41,17 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.width = 80; NPC.height = 80; NPC.defense = 50; - NPC.lifeMax = BossRushEvent.BossRushActive ? 4400 : 12000; + NPC.lifeMax = BossRushEvent.BossRushActive ? MaxBossRushHP : MaxHP; double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; + NPC.Opacity = 0f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; - - if (Main.getGoodWorld) - NPC.scale *= 0.5f; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -69,20 +69,20 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SendExtraAI(BinaryWriter writer) { - writer.Write(invinceTime); writer.Write(start); writer.Write(distance); writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.Opacity); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - invinceTime = reader.ReadInt32(); start = reader.ReadBoolean(); distance = reader.ReadDouble(); NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.Opacity = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -104,21 +104,43 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.ai[3] = NPC.ai[0]; } - // Stay invincible for 3 seconds to avoid being instantly killed - if (invinceTime > 0) + // Stay invincible for 200 frames to avoid being instantly killed and don't deal damage to avoid unfair hits + if (NPC.Opacity < 1f && NPC.dontTakeDamage) { NPC.damage = 0; - invinceTime--; + + NPC.Opacity += 0.005f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; + + NPC.scale = MathHelper.Lerp(0.05f, Main.getGoodWorld ? 0.5f : 1f, NPC.Opacity); } else { + if (NPC.dontTakeDamage) + { + for (int k = 0; k < 15; k++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0, 0, 0, default, 1f); + Main.dust[dust].noGravity = true; + } + } + NPC.damage = NPC.defDamage; NPC.dontTakeDamage = false; + float scalar = (float)Math.Cos(NPC.Calamity().newAI[1] * 0.33f) / 2f + 0.5f; + NPC.scale = MathHelper.Lerp(0.8f, 1f, scalar); + NPC.Opacity = MathHelper.Lerp(0.5f, 1f, scalar); + NPC.Calamity().newAI[1] += 1f; } + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.8f * NPC.Opacity, 0f, 1.2f * NPC.Opacity); + // Force despawn if Ceaseless Void isn't active if (CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -172,28 +194,6 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.position.X = parent.Center.X - (int)(Math.Cos(radians) * distance) - NPC.width / 2; NPC.position.Y = parent.Center.Y - (int)(Math.Sin(radians) * distance) - NPC.height / 2; NPC.ai[3] += minRotationVelocity + rotationVelocityIncrease; - - // Flash and pulse effect - if (NPC.ai[2] == 0f) - { - NPC.scale -= 0.01f; - NPC.alpha += 15; - if (NPC.alpha >= 125) - { - NPC.alpha = 130; - NPC.ai[2] = 1f; - } - } - else - { - NPC.scale += 0.01f; - NPC.alpha -= 15; - if (NPC.alpha <= 0) - { - NPC.alpha = 0; - NPC.ai[2] = 0f; - } - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -205,7 +205,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow2").Value; Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; + Color color36 = Color.White * NPC.Opacity; float amount9 = 0.5f; int num153 = 5; @@ -230,9 +230,12 @@ namespace CalamityMod.NPCs.CeaselessVoid spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + if (NPC.dontTakeDamage) + return false; + texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - Color color42 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); + Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f) * NPC.Opacity; + Color color42 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) { @@ -271,8 +274,10 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void OnHitPlayer(Player player, int damage, bool crit) { + int debufftype = CalamityWorld.getFixedBoi ? BuffID.Obstructed : BuffID.VortexDebuff; + int duration = CalamityWorld.getFixedBoi ? 30 : 60; if (damage > 0) - player.AddBuff(BuffID.VortexDebuff, 60, true); + player.AddBuff(debufftype, duration, true); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index d9ab79d2d0..b3268eca2c 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.Crabulon BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundMushroom, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Mushrooms that grow only on Crabulon’s shell, feasting off the nutrients in the husk. By jolting its body, it flings these off in defense.") + new FlavorTextBestiaryInfoElement("Mushrooms that grow only on Crabulon's shell, feasting off the nutrients in the husk. By jolting its body, it flings these off in defense.") }); } @@ -101,24 +101,30 @@ namespace CalamityMod.NPCs.Crabulon NPC.rotation = NPC.velocity.X * 0.1f; } + public override Color? GetAlpha(Color drawColor) => CalamityWorld.getFixedBoi ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, NPC.alpha) : new Color(255, 255, 255, NPC.alpha); + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Texture2D glow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabShroomGlow").Value; + Color colorToShift = CalamityWorld.getFixedBoi ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Color.Cyan; + Color glowColor = Color.Lerp(Color.White, colorToShift, 0.5f); + + int ClonesAroundShroom = CalamityWorld.getFixedBoi ? 4 : 0; + for (int c = 0; c < 1 + ClonesAroundShroom; c++) + { + Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 drawPos = NPC.Center - screenPos + (Vector2.UnitX * texture.Width * c).RotatedByRandom(c); + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - - texture2D15 = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabShroomGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(glow, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); + } return false; } diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 9382127cd6..6d996b42ac 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.Alcohol; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -224,7 +224,7 @@ namespace CalamityMod.NPCs.Crabulon } float num353 = 10f; int type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item42, NPC.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (phase2) { num353 += 1f; @@ -463,14 +463,14 @@ namespace CalamityMod.NPCs.Crabulon { if (NPC.velocity.Y == 0f) { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); if (NPC.ai[2] % 2f == 0f && phase2 && revenge) { - SoundEngine.PlaySound(SoundID.Item42, NPC.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 12f : 10f; @@ -494,7 +494,7 @@ namespace CalamityMod.NPCs.Crabulon { if (revenge && !phase2) { - SoundEngine.PlaySound(SoundID.Item42, NPC.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 12f : 10f; @@ -538,6 +538,28 @@ namespace CalamityMod.NPCs.Crabulon int num624 = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f); Main.dust[num624].velocity *= 0.2f; } + if (CalamityWorld.getFixedBoi) + { + int x = num622 / 16; + int y = (int)(NPC.position.Y + NPC.height) / 16; + Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + if (!walkTile.HasTile && walkTile.LiquidAmount == 0 && groundTile != null && WorldGen.SolidTile(groundTile)) + { + walkTile.TileFrameY = 0; + walkTile.Get().Slope = SlopeType.Solid; + walkTile.Get().IsHalfBlock = false; + if (groundTile.TileType == TileID.MushroomGrass || groundTile.TileType == TileID.Mud) + { + walkTile.Get().HasTile = true; + walkTile.TileType = TileID.MushroomPlants; + walkTile.TileFrameX = (short)(Main.rand.Next(5) * 18); + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendTileSquare(-1, x, y - 1, 1, TileChangeType.None); + } + } + } } } else @@ -745,67 +767,58 @@ namespace CalamityMod.NPCs.Crabulon } } + public override Color? GetAlpha(Color drawColor) => CalamityWorld.getFixedBoi ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, NPC.alpha) : null; + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D glow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonGlow").Value; - Texture2D texture = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAlt").Value; - Texture2D textureGlow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAltGlow").Value; + Texture2D textureIdle = TextureAssets.Npc[NPC.type].Value; + Texture2D glowIdle = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonGlow").Value; + Texture2D textureWalk = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAlt").Value; + Texture2D glowWalk = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAltGlow").Value; Texture2D textureAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttack").Value; - Texture2D textureAttackGlow = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttackGlow").Value; + Texture2D glowAttack = ModContent.Request("CalamityMod/NPCs/Crabulon/CrabulonAttackGlow").Value; + Color colorToShift = CalamityWorld.getFixedBoi ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Color.Cyan; + Color glowColor = Color.Lerp(Color.White, colorToShift, 0.5f); - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(TextureAssets.Npc[NPC.type].Value.Width, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - - // Jumping - if (NPC.ai[0] > 1f) + int ClonesOnEachSide = CalamityWorld.getFixedBoi ? 2 : 0; + for (int c = 0 - ClonesOnEachSide; c < 1 + ClonesOnEachSide; c++) { - if (NPC.velocity.Y == 0f && NPC.ai[1] >= 0f && NPC.ai[0] == 2f) + Vector2 drawOrigin = new Vector2(textureIdle.Width / 2, textureIdle.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 drawPos = NPC.Center - screenPos + (Vector2.UnitX * textureIdle.Width * c * 1.6f); + // Jumping + if (NPC.ai[0] > 2f && NPC.velocity.Y != 0f) { - spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + drawOrigin = new Vector2(textureAttack.Width / 2, textureAttack.Height / 2); + drawPos -= new Vector2(textureAttack.Width, textureAttack.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(glow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(textureAttack, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(glowAttack, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } + // Walking + else if (NPC.ai[0] == 1f) + { + drawOrigin = new Vector2(textureWalk.Width / 2, textureWalk.Height / 2); + drawPos -= new Vector2(textureWalk.Width, textureWalk.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + + spriteBatch.Draw(textureWalk, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(glowWalk, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); + } + // Standing still else { - vector11 = new Vector2(textureAttack.Width / 2, textureAttack.Height / 2); - vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(textureAttack.Width, textureAttack.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + drawPos -= new Vector2(textureIdle.Width, textureIdle.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(textureAttack, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - - spriteBatch.Draw(textureAttackGlow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(textureIdle, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(glowIdle, drawPos, NPC.frame, glowColor, NPC.rotation, drawOrigin, NPC.scale, spriteEffects, 0f); } } - - // Walking - else if (NPC.ai[0] == 1f) - { - vector11 = new Vector2(texture.Width / 2, texture.Height / 2); - vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - - spriteBatch.Draw(texture, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - - spriteBatch.Draw(textureGlow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - } - - // Standing still - else - { - spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - - spriteBatch.Draw(glow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - } - return false; } @@ -842,7 +855,7 @@ namespace CalamityMod.NPCs.Crabulon npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCrabulon, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCrabulon, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -852,6 +865,14 @@ namespace CalamityMod.NPCs.Crabulon // Mark Crabulon as dead DownedBossSystem.downedCrabulon = true; CalamityNetcode.SyncWorld(); + + if (CalamityWorld.getFixedBoi && Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < Main.rand.Next(10, 23); i++) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-NPC.width / 2, NPC.width / 2), (int)NPC.Center.Y + Main.rand.Next(-NPC.height / 2, NPC.height / 2), NPCID.Crab); + } + } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index 78fdb5c85d..19f8d55f4c 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { NPC.lavaImmune = true; - NPC.aiStyle = 2; + NPC.aiStyle = NPCAIStyleID.DemonEye; NPC.damage = 40; NPC.width = 30; NPC.height = 30; @@ -57,49 +57,6 @@ namespace CalamityMod.NPCs.Crags public override void AI() { - if (NPC.life < NPC.lifeMax * 0.5) - { - if (NPC.direction == -1 && NPC.velocity.X > -6f) - { - NPC.velocity.X -= 0.1f; - if (NPC.velocity.X > 6f) - NPC.velocity.X -= 0.1f; - else if (NPC.velocity.X > 0f) - NPC.velocity.X += 0.05f; - if (NPC.velocity.X < -6f) - NPC.velocity.X = -6f; - } - else if (NPC.direction == 1 && NPC.velocity.X < 6f) - { - NPC.velocity.X += 0.1f; - if (NPC.velocity.X < -6f) - NPC.velocity.X += 0.1f; - else if (NPC.velocity.X < 0f) - NPC.velocity.X -= 0.05f; - if (NPC.velocity.X > 6f) - NPC.velocity.X = 6f; - } - if (NPC.directionY == -1 && NPC.velocity.Y > -4f) - { - NPC.velocity.Y -= 0.1f; - if (NPC.velocity.Y > 4f) - NPC.velocity.Y -= 0.1f; - else if (NPC.velocity.Y > 0f) - NPC.velocity.Y += 0.05f; - if (NPC.velocity.Y < -4f) - NPC.velocity.Y = -4f; - } - else if (NPC.directionY == 1 && NPC.velocity.Y < 4f) - { - NPC.velocity.Y += 0.1f; - if (NPC.velocity.Y < -4f) - NPC.velocity.Y += 0.1f; - else if (NPC.velocity.Y < 0f) - NPC.velocity.Y -= 0.05f; - if (NPC.velocity.Y > 4f) - NPC.velocity.Y = 4f; - } - } if (Main.rand.NextBool(40)) { int index = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f), NPC.width, (int)(NPC.height * 0.5), DustID.Blood, NPC.velocity.X, 2f, 0, new Color(), 1f); @@ -120,6 +77,11 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CalamityEye").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CalamityEye2").Type, 1f); + } } } @@ -139,7 +101,7 @@ namespace CalamityMod.NPCs.Crags npcLoot.Add(ItemID.Lens, 2); LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); - hardmode.Add(ModContent.ItemType(), 3); + hardmode.Add(ModContent.ItemType(), 3); postProv.Add(ModContent.ItemType(), 4); } } diff --git a/NPCs/Crags/CharredSlime.cs b/NPCs/Crags/CharredSlime.cs index c4bc8227a7..95d2c0e153 100644 --- a/NPCs/Crags/CharredSlime.cs +++ b/NPCs/Crags/CharredSlime.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; AIType = NPCID.LavaSlime; NPC.damage = 40; NPC.width = 40; @@ -92,8 +92,8 @@ namespace CalamityMod.NPCs.Crags public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 10, 26); - npcLoot.Add(ModContent.ItemType(), 3); + npcLoot.Add(ModContent.ItemType(), 1, 10, 26); + npcLoot.Add(ModContent.ItemType(), 3); LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); postProv.Add(ModContent.ItemType(), 4); } diff --git a/NPCs/Crags/CultistAssassin.cs b/NPCs/Crags/CultistAssassin.cs index 113ea51a09..d629072267 100644 --- a/NPCs/Crags/CultistAssassin.cs +++ b/NPCs/Crags/CultistAssassin.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -20,7 +21,7 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { NPC.lavaImmune = true; - NPC.aiStyle = 3; + NPC.aiStyle = NPCAIStyleID.Fighter; NPC.damage = 50; NPC.width = 18; NPC.height = 40; @@ -82,16 +83,20 @@ namespace CalamityMod.NPCs.Crags } if (Main.netMode != NetmodeID.Server) { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CultistAssassin").Type, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CultistAssassin2").Type, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CultistAssassin3").Type, NPC.scale); + int count = CalamityWorld.getFixedBoi ? 20 : 1; // remember that old oversight in the draedon update? + for (int g = 0; g < count; g++) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CultistAssassin").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CultistAssassin2").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CultistAssassin3").Type, NPC.scale); + } } } } public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 3); + npcLoot.Add(ModContent.ItemType(), 3); LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); postProv.Add(ModContent.ItemType(), 4); } diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index 7c69dc2584..0510373229 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -1,18 +1,31 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Particles; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; +using ReLogic.Utilities; +using System; +using CalamityMod.Items.Placeables; + namespace CalamityMod.NPCs.Crags { public class DespairStone : ModNPC { + public SlotId ChainsawSoundSlot; + + public static readonly SoundStyle ChainsawStartSound = new("CalamityMod/Sounds/Custom/ChainsawStart") { Volume = 0.15f }; + + public static readonly SoundStyle ChainsawEndSound = new("CalamityMod/Sounds/Custom/ChainsawEnd") { Volume = 0.15f }; + public override void SetStaticDefaults() { DisplayName.SetDefault("Despair Stone"); @@ -59,7 +72,84 @@ namespace CalamityMod.NPCs.Crags public override void AI() { - CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); + float buzzsawStartTime = 480f; + NPC.ai[1]++; + if (NPC.ai[2] != 0f) BuzzsawMode(); + if (NPC.ai[1] > buzzsawStartTime) //time needed for buzzsaw mode to be able to be started + { + if (NPC.ai[2] == 0f) + { + NPC.ai[1] = buzzsawStartTime + 1f; //freeze buzzsaw timer until buzzsaw mode is initiated. + NPC.rotation += NPC.velocity.X * 0.01f; + NPC.spriteDirection = -NPC.direction; + if (NPC.velocity.Y == 0f || NPC.lavaWet) BuzzsawMode(); //initiate Buzzsaw mode once the npc hits the ground + } + } + else //run regular ai if buzzsaw mode isn't available + { + NPC.ai[2] = 0f; + CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); + } + if (NPC.lavaWet) //float on lava + NPC.velocity.Y += -0.8f; + } + + public void BuzzsawMode() + { + float distance; + float speedCap = 10f; + //Choose Direction + if (NPC.ai[2] == 0f) + { + ChainsawSoundSlot = SoundEngine.PlaySound(ChainsawStartSound, NPC.Center); + if (NPC.velocity.X < 0f) //left + { + NPC.ai[2] = -1f; + } + else if (NPC.velocity.X > 0f) //right + { + NPC.ai[2] = 1f; + } + else //if npc is stationary when selecting direction, go towards target. + { + distance = Main.player[NPC.target].Center.X - NPC.Center.X; + if (distance != 0f) + { + NPC.ai[2] = distance / Math.Abs(distance); + } + else NPC.ai[2] = 1f; + } + } + if (SoundEngine.TryGetActiveSound(ChainsawSoundSlot, out var chainsawSound) && chainsawSound.IsPlaying) + chainsawSound.Position = NPC.Center; + if (NPC.velocity.X == 0f) //go up if against wall + { + if (NPC.velocity.Y > -speedCap) //Accelerate to top speed + NPC.velocity.Y += -1.66f; + if (NPC.velocity.Y < -speedCap) //Cap top speed + NPC.velocity.Y = -speedCap; + } + + if (NPC.velocity.X == 0f || NPC.velocity.Y == 0f) //check if on solid ground + SpawnSparks(); + else if (Main.player[NPC.target].Center.Y - NPC.Center.Y < 0f && NPC.velocity.Y < 0f && !NPC.lavaWet) //if not on solid ground and target player is above the NPC, reduce gravity + NPC.velocity.Y += -0.03f; + + if (Math.Abs(NPC.velocity.X) < speedCap) //Accelerate to top speed + NPC.velocity.X += 1.66f * NPC.ai[2]; + if (Math.Abs(NPC.velocity.X) > speedCap) //Cap top speed + NPC.velocity.X = speedCap * NPC.ai[2]; + + NPC.rotation += speedCap * 0.03f * NPC.ai[2]; //rotate sprite in chosen direction + NPC.spriteDirection = -NPC.direction; + //stop buzzsaw mode + if (NPC.ai[1] > Main.rand.Next(670, 740)) + { + NPC.ai[1] = 0f; + NPC.velocity.Y += -3f; + chainsawSound?.Stop(); + SoundEngine.PlaySound(ChainsawEndSound, NPC.Center); + } } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -69,9 +159,10 @@ namespace CalamityMod.NPCs.Crags public override void ModifyNPCLoot(NPCLoot npcLoot) { + npcLoot.Add(ModContent.ItemType(), 5, 10, 30); LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); - hardmode.Add(ModContent.ItemType(), 3); + hardmode.Add(ModContent.ItemType(), 3); postProv.Add(ModContent.ItemType(), 4); } @@ -100,5 +191,48 @@ namespace CalamityMod.NPCs.Crags } } } + public override bool PreKill() + { + if (SoundEngine.TryGetActiveSound(ChainsawSoundSlot, out var chainsawSound) && chainsawSound.IsPlaying) + chainsawSound?.Stop(); + return true; + } + public void SpawnSparks() + { + Vector2 particleSpawnDisplacement; + Vector2 splatterDirection; + if (NPC.velocity.X == 0f) + { + particleSpawnDisplacement = new Vector2 (24f * NPC.ai[2], 20f); + splatterDirection = new Vector2(0f, 1f); + } + else + { + particleSpawnDisplacement = new Vector2(20f * -NPC.ai[2], 24f); + splatterDirection = new Vector2(-NPC.ai[2], 0f); + } + + //Color impactColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.5f)); + Vector2 bloodSpawnPosition = NPC.Center + particleSpawnDisplacement; + + if (NPC.ai[1] % 4 == 0) + { + for (int i = 0; i < 2; i++) + { + int sparkLifetime = Main.rand.Next(14, 21); + float sparkScale = Main.rand.NextFloat(0.8f, 1f) + 1f * 0.05f; + Color sparkColor = Color.Lerp(Color.DarkGray, Color.DarkRed, Main.rand.NextFloat(0.7f)); + sparkColor = Color.Lerp(sparkColor, Color.OrangeRed, Main.rand.NextFloat()); + + if (Main.rand.NextBool(10)) + sparkScale *= 1.4f; + + Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.45f) * Main.rand.NextFloat(6f, 13f); + sparkVelocity.Y -= 6f; + SparkParticle spark = new SparkParticle(bloodSpawnPosition, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } } } diff --git a/NPCs/Crags/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs index ecc5ef093a..b318bba5be 100644 --- a/NPCs/Crags/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Crags public override void SetDefaults() { - NPC.aiStyle = 86; + NPC.aiStyle = NPCAIStyleID.AncientVision; NPC.damage = 33; NPC.width = 40; NPC.height = 40; @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.Crags public override void ModifyNPCLoot(NPCLoot npcLoot) { LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); - hardmode.Add(ModContent.ItemType(), 3); + hardmode.Add(ModContent.ItemType(), 3); } } } diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 865d254326..0adc6789c6 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.Crags { LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); - hardmode.Add(ModContent.ItemType(), 3); + hardmode.Add(ModContent.ItemType(), 3); postProv.Add(ModContent.ItemType(), 4); postProv.Add(ModContent.ItemType(), 20); } diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 5997366271..9a08e4f0fb 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.Crags bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("The remnants of a soul which has feasted, been feasted upon, and torn into the souls of others. No one knows how the cycle begins, but you don’t want to find out yourself.") + new FlavorTextBestiaryInfoElement("The remnants of a soul which has feasted, been feasted upon, and torn into the souls of others. No one knows how the cycle begins, but you don't want to find out yourself.") }); } @@ -297,7 +297,7 @@ namespace CalamityMod.NPCs.Crags LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode()); LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv()); - hardmode.Add(ModContent.ItemType(), 3); + hardmode.Add(ModContent.ItemType(), 3); postProv.Add(ModContent.ItemType(), 4); } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index d4ec3a4e0a..3523e5b9f2 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,4 +1,6 @@ -using CalamityMod.Events; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Effects; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Armor.Vanity; @@ -14,6 +16,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Ores; @@ -29,6 +32,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using Terraria.GameContent.ItemDropRules; +using Terraria.Graphics.Shaders; namespace CalamityMod.NPCs.Cryogen { @@ -39,8 +43,32 @@ namespace CalamityMod.NPCs.Cryogen private int currentPhase = 1; private int teleportLocationX = 0; + public static Color BackglowColor => new Color(24, 100, 255, 80) * 0.6f; + public override string Texture => "CalamityMod/NPCs/Cryogen/Cryogen_Phase1"; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/CryogenHit", 3); + public static readonly SoundStyle TransitionSound = new("CalamityMod/Sounds/NPCHit/CryogenPhaseTransitionCrack"); + public static readonly SoundStyle ShieldRegenSound = new("CalamityMod/Sounds/Custom/CryogenShieldRegenerate"); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/CryogenDeath"); + + public FireParticleSet FireDrawer = null; + + public static int cryoIconIndex; + public static int pyroIconIndex; + + internal static void LoadHeadIcons() + { + string cryoIconPath = "CalamityMod/NPCs/Cryogen/Cryogen_Phase1_Head_Boss"; + string pyroIconPath = "CalamityMod/NPCs/Cryogen/Pyrogen_Head_Boss"; + + CalamityMod.Instance.AddBossHeadTexture(cryoIconPath, -1); + cryoIconIndex = ModContent.GetModBossHeadSlot(cryoIconPath); + + CalamityMod.Instance.AddBossHeadTexture(pyroIconPath, -1); + pyroIconIndex = ModContent.GetModBossHeadSlot(pyroIconPath); + } + public override void SetStaticDefaults() { DisplayName.SetDefault("Cryogen"); @@ -68,14 +96,32 @@ namespace CalamityMod.NPCs.Cryogen NPC.noGravity = true; NPC.noTileCollide = true; NPC.coldDamage = true; - NPC.HitSound = SoundID.NPCHit5; - NPC.DeathSound = SoundID.NPCDeath15; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = false; - NPC.Calamity().VulnerableToSickness = false; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; if (Main.getGoodWorld) NPC.scale *= 0.8f; + + if (CalamityWorld.getFixedBoi) + { + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; + } + else + { + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; + } + } + + public override void BossHeadSlot(ref int index) + { + if (CalamityWorld.getFixedBoi) + index = pyroIconIndex; + else + index = cryoIconIndex; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -112,6 +158,9 @@ namespace CalamityMod.NPCs.Cryogen Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 1f, 1f); + if (FireDrawer != null) + FireDrawer.Update(); + // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); @@ -162,6 +211,16 @@ namespace CalamityMod.NPCs.Cryogen bool phase6 = lifeRatio < (death ? 0.35f : 0.25f) && revenge; bool phase7 = lifeRatio < (death ? 0.25f : 0.15f) && revenge; + // Projectile and sound variables + int iceBlast = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int iceBomb = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int iceRain = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int dustType = CalamityWorld.getFixedBoi ? 235 : 67; + + SoundStyle frostSound = CalamityWorld.getFixedBoi ? SoundID.Item20 : SoundID.Item28; + NPC.HitSound = CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound; + NPC.DeathSound = CalamityWorld.getFixedBoi ? SoundID.NPCDeath14 : DeathSound; + // Reset damage NPC.damage = NPC.defDamage; @@ -170,6 +229,7 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (NPC.ai[0] < 3f || bossRush || (death && NPC.ai[0] > 3f))) //spawn shield for phase 0 1 2, not 3 4 5 { + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); int num6 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); NPC.ai[2] = num6 + 1; NPC.localAI[1] = -1f; @@ -194,7 +254,10 @@ namespace CalamityMod.NPCs.Cryogen NPC.localAI[1] -= 1f; } - CalamityMod.StopRain(); + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); + else if (!Main.raining) + CalamityUtils.StartRain(); if (!player.active || player.dead) { @@ -247,10 +310,10 @@ namespace CalamityMod.NPCs.Cryogen if (calamityGlobalNPC.newAI[3] >= (bossRush ? 660f : 900f)) { calamityGlobalNPC.newAI[3] = 0f; - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); int totalProjectiles = 3; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = iceBomb; int damage = NPC.GetProjectileDamage(type); float velocity = 2f + NPC.ai[0]; double angleA = radians * 0.5; @@ -278,10 +341,10 @@ namespace CalamityMod.NPCs.Cryogen NPC.TargetClosest(); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); int totalProjectiles = bossRush ? 24 : 16; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -velocity); @@ -338,10 +401,10 @@ namespace CalamityMod.NPCs.Cryogen NPC.TargetClosest(); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); int totalProjectiles = bossRush ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity2 = 9f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -velocity2); @@ -412,8 +475,8 @@ namespace CalamityMod.NPCs.Cryogen { if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); - int type = ModContent.ProjectileType(); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); + int type = iceRain; int damage = NPC.GetProjectileDamage(type); float maxVelocity = 9f + enrageScale; float velocity = maxVelocity - (calamityGlobalNPC.newAI[0] * maxVelocity * 0.5f); @@ -512,10 +575,10 @@ namespace CalamityMod.NPCs.Cryogen NPC.TargetClosest(); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); int totalProjectiles = bossRush ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -velocity); @@ -558,8 +621,8 @@ namespace CalamityMod.NPCs.Cryogen { if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); - int type = ModContent.ProjectileType(); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); + int type = iceRain; int damage = NPC.GetProjectileDamage(type); float maxVelocity = 9f + enrageScale; float velocity = maxVelocity - (calamityGlobalNPC.newAI[0] * maxVelocity * 0.5f); @@ -660,10 +723,10 @@ namespace CalamityMod.NPCs.Cryogen NPC.localAI[0] = 0f; if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); int totalProjectiles = bossRush ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity = 10f + enrageScale; Vector2 spinningPoint = new Vector2(0f, -velocity); @@ -749,7 +812,7 @@ namespace CalamityMod.NPCs.Cryogen Vector2 position = new Vector2(teleportLocationX * 16f - (NPC.width / 2), calamityGlobalNPC.newAI[2] * 16f - (NPC.height / 2)); for (int m = 0; m < 5; m++) { - int dust = Dust.NewDust(position, NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); + int dust = Dust.NewDust(position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[dust].noGravity = true; } @@ -761,7 +824,7 @@ namespace CalamityMod.NPCs.Cryogen for (int n = 0; n < 15; n++) { - int num39 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, 0f, 0f, 100, default, 3f); + int num39 = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num39].noGravity = true; } @@ -770,8 +833,8 @@ namespace CalamityMod.NPCs.Cryogen if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { NPC.localAI[0] = 0f; - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); - int type = ModContent.ProjectileType(); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); + int type = iceRain; int damage = NPC.GetProjectileDamage(type); float velocity = 9f + enrageScale; for (int i = 0; i < 3; i++) @@ -830,11 +893,13 @@ namespace CalamityMod.NPCs.Cryogen int chance = 100; if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) chance = 20; + if (CalamityWorld.getFixedBoi) + chance = 1; if (Main.rand.NextBool(chance)) { - string key = "Mods.CalamityMod.CryogenBossText"; - Color messageColor = Color.Cyan; + string key = CalamityWorld.getFixedBoi ? "Mods.CalamityMod.PyrogenBossText" : "Mods.CalamityMod.CryogenBossText"; + Color messageColor = CalamityWorld.getFixedBoi ? Color.Orange : Color.Cyan; CalamityUtils.DisplayLocalizedText(key, messageColor); } } @@ -851,8 +916,8 @@ namespace CalamityMod.NPCs.Cryogen { if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); - int type = ModContent.ProjectileType(); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); + int type = iceBlast; int damage = NPC.GetProjectileDamage(type); float velocity = 1.5f + enrageScale * 0.5f; int totalSpreads = phase7 ? 3 : 2; @@ -862,6 +927,7 @@ namespace CalamityMod.NPCs.Cryogen float radians = MathHelper.TwoPi / totalProjectiles; float newVelocity = velocity - (velocity * (phase7 ? 0.25f : 0.5f) * i); float velocityX = 0f; + float ai = CalamityWorld.getFixedBoi ? 2f : NPC.target; if (i > 0) { double angleA = radians * (phase7 ? 0.25 : 0.5) * (totalSpreads - i); @@ -872,7 +938,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, NPC.target, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, ai, 1f); } } } @@ -964,10 +1030,10 @@ namespace CalamityMod.NPCs.Cryogen if (calamityGlobalNPC.newAI[3] >= (bossRush ? 50f : 75f)) { calamityGlobalNPC.newAI[3] = 0f; - SoundEngine.PlaySound(SoundID.Item28, NPC.Center); + SoundEngine.PlaySound(CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : HitSound, NPC.Center); int totalProjectiles = 2; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = iceBomb; int damage = NPC.GetProjectileDamage(type); float velocity2 = 6f; double angleA = radians * 0.5; @@ -1043,8 +1109,9 @@ namespace CalamityMod.NPCs.Cryogen private void HandlePhaseTransition(int newPhase) { - SoundEngine.PlaySound(SoundID.NPCDeath15, NPC.Center); - if (Main.netMode != NetmodeID.Server) + SoundStyle sound = CalamityWorld.getFixedBoi ? SoundID.NPCDeath14 : TransitionSound; + SoundEngine.PlaySound(sound, NPC.Center); + if (Main.netMode != NetmodeID.Server && !CalamityWorld.getFixedBoi) { int chipGoreAmount = newPhase >= 5 ? 3 : newPhase >= 3 ? 2 : 1; for (int i = 1; i < chipGoreAmount; i++) @@ -1080,23 +1147,45 @@ namespace CalamityMod.NPCs.Cryogen public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - if (currentPhase > 1) + if (CalamityWorld.getFixedBoi) { - string phase = "CalamityMod/NPCs/Cryogen/Cryogen_Phase" + currentPhase; - Texture2D texture = ModContent.Request(phase).Value; + float compactness = NPC.width * 0.6f; + if (compactness < 10f) + compactness = 10f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; + float power = NPC.height / 100f; + if (power > 2.75f) + power = 2.75f; - Vector2 origin = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Vector2 drawPos = NPC.Center - screenPos; - drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - return false; + if (FireDrawer is null) + { + FireDrawer = new FireParticleSet(int.MaxValue, 1, Color.Red * 1.25f, Color.Red, compactness, power); + } + else + { + FireDrawer.DrawSet(NPC.Bottom - Vector2.UnitY * (12f - NPC.gfxOffY)); + } } - return true; + else + FireDrawer = null; + + string phase = "CalamityMod/NPCs/Cryogen/Cryogen_Phase" + currentPhase; + Texture2D texture = ModContent.Request(phase).Value; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + NPC.DrawBackglow(BackglowColor, 4f, spriteEffects, NPC.frame, screenPos); + + Vector2 origin = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 drawPos = NPC.Center - screenPos; + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color overlay = CalamityWorld.getFixedBoi ? Color.Red : drawColor; + spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(overlay), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -1105,17 +1194,26 @@ namespace CalamityMod.NPCs.Cryogen NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Pyrogen"; + } + } + public override void HitEffect(int hitDirection, double damage) { + int dusttype = CalamityWorld.getFixedBoi ? 235 : 67; for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, hitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -1125,13 +1223,13 @@ namespace CalamityMod.NPCs.Cryogen } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (Main.netMode != NetmodeID.Server && !CalamityWorld.getFixedBoi) { float randomSpread = Main.rand.Next(-200, 201) / 100f; for (int i = 1; i < 4; i++) @@ -1160,7 +1258,7 @@ namespace CalamityMod.NPCs.Cryogen int[] weapons = new int[] { ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType() }; @@ -1189,7 +1287,7 @@ namespace CalamityMod.NPCs.Cryogen npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCryogen, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCryogen, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -1241,8 +1339,16 @@ namespace CalamityMod.NPCs.Cryogen { if (damage > 0) { - player.AddBuff(BuffID.Frostburn, 240, true); - player.AddBuff(BuffID.Chilled, 120, true); + if (CalamityWorld.getFixedBoi) + { + player.AddBuff(ModContent.BuffType(), 240, true); + player.AddBuff(ModContent.BuffType(), 120, true); + } + else + { + player.AddBuff(BuffID.Frostburn, 240, true); + player.AddBuff(BuffID.Chilled, 120, true); + } } } } diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index d23f730837..f062741dee 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -1,9 +1,12 @@ -using CalamityMod.Events; -using CalamityMod.Projectiles.Boss; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +14,8 @@ namespace CalamityMod.NPCs.Cryogen { public class CryogenShield : ModNPC { + public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/NPCKilled/CryogenShieldBreak"); + public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -35,19 +40,31 @@ namespace CalamityMod.NPCs.Cryogen { NPC.lifeMax = 10000; } - NPC.alpha = 255; - NPC.HitSound = SoundID.NPCHit5; - NPC.DeathSound = SoundID.NPCDeath7; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = false; - NPC.Calamity().VulnerableToSickness = false; + NPC.Opacity = 0f; + NPC.HitSound = Cryogen.HitSound; + NPC.DeathSound = BreakSound; + if (CalamityWorld.getFixedBoi) + { + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToWater = true; + } + else + { + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToSickness = false; + } } public override void AI() { - NPC.alpha -= 3; - if (NPC.alpha < 0) - NPC.alpha = 0; + NPC.HitSound = CalamityWorld.getFixedBoi ? SoundID.NPCHit41 : Cryogen.HitSound; + NPC.DeathSound = CalamityWorld.getFixedBoi ? SoundID.NPCDeath14 : BreakSound; + + NPC.Opacity += 0.012f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; NPC.rotation += 0.15f; @@ -66,8 +83,9 @@ namespace CalamityMod.NPCs.Cryogen return; } NPC.life = 0; - NPC.HitEffect(0, 10.0); + NPC.HitEffect(); NPC.active = false; + NPC.netUpdate = true; } } @@ -89,34 +107,66 @@ namespace CalamityMod.NPCs.Cryogen if (dist4 < minDist) minDist = dist4; - return minDist <= 100f * NPC.scale && NPC.alpha == 0; + return minDist <= (100f * NPC.scale) && NPC.Opacity == 1f; } public override void OnHitPlayer(Player player, int damage, bool crit) { if (damage > 0) { - player.AddBuff(BuffID.Frostburn, 240, true); - player.AddBuff(BuffID.Chilled, 120, true); + if (CalamityWorld.getFixedBoi) + { + player.AddBuff(ModContent.BuffType(), 240, true); + player.AddBuff(ModContent.BuffType(), 120, true); + } + else + { + player.AddBuff(BuffID.Frostburn, 240, true); + player.AddBuff(BuffID.Chilled, 120, true); + } } } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D texture = ModContent.Request("CalamityMod/NPCs/Cryogen/CryogenShield").Value; + + NPC.DrawBackglow(Cryogen.BackglowColor, 4f, SpriteEffects.None, NPC.frame, screenPos); + + Vector2 origin = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 drawPos = NPC.Center - screenPos; + drawPos -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Color overlay = CalamityWorld.getFixedBoi ? Color.Red : drawColor; + spriteBatch.Draw(texture, drawPos, NPC.frame, NPC.GetAlpha(overlay), NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); + return false; + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { NPC.lifeMax = (int)(NPC.lifeMax * 0.5f * bossLifeScale); } + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Pyrogen's Shield"; + } + } + public override void HitEffect(int hitDirection, double damage) { + int dusttype = CalamityWorld.getFixedBoi ? 235 : 67; for (int k = 0; k < 3; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, 67, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, hitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int num621 = 0; num621 < 25; num621++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -127,14 +177,14 @@ namespace CalamityMod.NPCs.Cryogen for (int num623 = 0; num623 < 50; num623++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (Main.netMode != NetmodeID.Server && !CalamityWorld.getFixedBoi) { int totalGores = 16; double radians = MathHelper.TwoPi / totalGores; diff --git a/NPCs/Cryogen/Pyrogen_Head_Boss.png b/NPCs/Cryogen/Pyrogen_Head_Boss.png new file mode 100644 index 0000000000..09ee44e931 Binary files /dev/null and b/NPCs/Cryogen/Pyrogen_Head_Boss.png differ diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index b5da12680d..12e18fe089 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -1,4 +1,5 @@ using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -164,5 +165,15 @@ namespace CalamityMod.NPCs.DesertScourge if (damage > 0) player.AddBuff(BuffID.Bleeding, 60, true); } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } } } diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index 3f53bdf08e..2bb721f085 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -1,11 +1,12 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.NPCs.DesertScourge { @@ -61,6 +62,9 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; + + if (CalamityWorld.getFixedBoi) + NPC.scale *= 2; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -275,7 +279,7 @@ namespace CalamityMod.NPCs.DesertScourge num24 = 20f; } NPC.soundDelay = (int)num24; - SoundEngine.PlaySound(SoundID.WormDig, NPC.position); + SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); @@ -447,5 +451,15 @@ namespace CalamityMod.NPCs.DesertScourge if (damage > 0) player.AddBuff(BuffID.Bleeding, 180, true); } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } } } diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index c896b37c71..a2fc6e5cbb 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -1,4 +1,5 @@ using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -161,5 +162,15 @@ namespace CalamityMod.NPCs.DesertScourge if (damage > 0) player.AddBuff(BuffID.Bleeding, 30, true); } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } } } diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 7662af6ef6..8956ad1b22 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -1,4 +1,5 @@ using CalamityMod.Events; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -168,6 +169,19 @@ namespace CalamityMod.NPCs.DesertScourge Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } } + public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) + { + // Sometimes "Deflect" projectiles in gfb into water blasts. + if (Main.rand.NextBool(20) && CalamityWorld.getFixedBoi) + { + if (Main.netMode != NetmodeID.Server) + { + Vector2 velocity = new Vector2(-projectile.velocity.X, -projectile.velocity.Y); + velocity.Normalize(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity * 4, ModContent.ProjectileType(), projectile.damage, 1f, Main.myPlayer); + } + } + } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { @@ -179,5 +193,15 @@ namespace CalamityMod.NPCs.DesertScourge if (damage > 0) player.AddBuff(BuffID.Bleeding, 240, true); } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.MediumBlue * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } } } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 6dc8f3f71c..d58249c98d 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -13,7 +13,9 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.AquaticScourge; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -95,6 +97,10 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.getGoodWorld) NPC.scale *= 0.4f; + if (CalamityWorld.getFixedBoi) + NPC.scale *= 4f; + + NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; @@ -209,6 +215,16 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.alpha < 0) NPC.alpha = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // become moist if in an aquatic biome + if (CalamityWorld.getFixedBoi && (player.ZoneBeach || player.Calamity().ZoneAbyss || player.Calamity().ZoneSunkenSea || player.Calamity().ZoneSulphur) && NPC.CountNPCS(ModContent.NPCType()) < 1) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType()); + NPC.active = false; + } + } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned && NPC.ai[0] == 0f) @@ -253,6 +269,7 @@ namespace CalamityMod.NPCs.DesertScourge SoundEngine.PlaySound(SoundID.Item21, NPC.Center); float velocity = bossRush ? 6f : death ? 5.5f : 5f; int type = ModContent.ProjectileType(); + int type2 = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * velocity; int baseProjectileAmt = bossRush ? 6 : death ? 4 : revenge ? 3 : 2; @@ -263,6 +280,8 @@ namespace CalamityMod.NPCs.DesertScourge { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + if (CalamityWorld.getFixedBoi) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 3f, perturbedSpeed, type2, damage, 0f, Main.myPlayer); } } @@ -508,7 +527,7 @@ namespace CalamityMod.NPCs.DesertScourge num24 = 20f; } NPC.soundDelay = (int)num24; - SoundEngine.PlaySound(SoundID.WormDig, NPC.position); + SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); @@ -732,7 +751,7 @@ namespace CalamityMod.NPCs.DesertScourge npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDesertScourge, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDesertScourge, ModContent.ItemType(), desc: DropHelper.FirstKillText); } #endregion @@ -774,5 +793,15 @@ namespace CalamityMod.NPCs.DesertScourge if (damage > 0) player.AddBuff(BuffID.Bleeding, 600, true); } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.MediumBlue * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } } } diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index a2da51ad5d..cbae94e6c8 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -179,5 +179,15 @@ namespace CalamityMod.NPCs.DesertScourge if (damage > 0) player.AddBuff(BuffID.Bleeding, 180, true); } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.MediumBlue * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index f9f6b7347f..15d3810cb6 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -49,8 +50,13 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.height = 56; NPC.defense = 70; CalamityGlobalNPC global = NPC.Calamity(); - global.DR = 0.925f; - global.unbreakableDR = true; + if (!CalamityWorld.getFixedBoi) + { + global.DR = 0.925f; + global.unbreakableDR = true; + NPC.chaseable = false; + NPC.canGhostHeal = false; + } NPC.LifeMaxNERB(888750, 1066500, 1500000); // Phase 1 is 371250, Phase 2 is 517500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); @@ -61,8 +67,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.chaseable = false; - NPC.canGhostHeal = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; @@ -223,7 +227,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (!AnyTeleportRifts()) { NPC.TargetClosest(); - SoundEngine.PlaySound(SoundID.Item12, player.position); + SoundEngine.PlaySound(SoundID.Item12, player.Center); float maxProjectileVelocity = bossRush ? 8f : death ? 7.5f : revenge ? 7.25f : expertMode ? 7f : 6.5f; float minProjectileVelocity = maxProjectileVelocity * 0.25f; float projectileVelocity = MathHelper.Clamp(Vector2.Distance(player.Center, NPC.Center) * 0.01f, minProjectileVelocity, maxProjectileVelocity); @@ -248,7 +252,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.localAI[0] >= laserBarrageGateValue * (Main.getGoodWorld ? 0.1f : 0.2f) && NPC.ai[0] % (expertMode ? 10f : 20f) == 0f) { NPC.TargetClosest(); - SoundEngine.PlaySound(SoundID.Item12, player.position); + SoundEngine.PlaySound(SoundID.Item12, player.Center); NPC.localAI[0] = 0f; float maxProjectileVelocity = bossRush ? 7.5f : death ? 7f : revenge ? 6.75f : expertMode ? 6.5f : 6f; float minProjectileVelocity = maxProjectileVelocity * 0.25f; @@ -308,42 +312,18 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; } - Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num191 = player.position.X + (player.width / 2); - float num192 = player.position.Y + (player.height / 2); - num191 = (int)(num191 / 16f) * 16; - num192 = (int)(num192 / 16f) * 16; - vector18.X = (int)(vector18.X / 16f) * 16; - vector18.Y = (int)(vector18.Y / 16f) * 16; - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + NPC aheadSegment = Main.npc[(int)NPC.ai[1]]; + Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center; + if (aheadSegment.rotation != NPC.rotation) { - try - { - vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y; - } catch - { - } - - NPC.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; - num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = NPC.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + num191; - NPC.position.Y = NPC.position.Y + num192; - - if (num191 < 0f) - NPC.spriteDirection = -1; - else if (num191 > 0f) - NPC.spriteDirection = 1; + directionToNextSegment = directionToNextSegment.RotatedBy(MathHelper.WrapAngle(aheadSegment.rotation - NPC.rotation) * 0.08f); + directionToNextSegment = directionToNextSegment.MoveTowards((aheadSegment.rotation - NPC.rotation).ToRotationVector2(), 1f); } + + // Decide segment offset stuff. + NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; + NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * NPC.width; + NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); } private bool AnyTeleportRifts() @@ -449,6 +429,15 @@ namespace CalamityMod.NPCs.DevourerofGods return true; } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + // viable???, done here since it's conditional + if (CalamityWorld.getFixedBoi && projectile.type == ModContent.ProjectileType()) + { + damage *= 40; + } + } + public override bool CheckDead() { if (NPC.realLife >= 0) diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 1e5fca38fa..26e930e3ff 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -18,9 +18,9 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.World; using CalamityMod.Sounds; using Microsoft.Xna.Framework; @@ -73,9 +73,9 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser spread variables - private const int shotSpacingMax = 1050; + private const int shotSpacingMax = 1470; private int shotSpacing = shotSpacingMax; - private const int totalShots = 10; + private const int totalShots = 14; private const int spacingVar = shotSpacingMax / totalShots * 2; private int laserWallType = 0; private const float laserWallSpacingOffset = 16f; @@ -86,8 +86,8 @@ namespace CalamityMod.NPCs.DevourerofGods // Spawn variables private bool tail = false; - private const int minLength = 100; - private const int maxLength = 101; + private int minLength = 100; + private int maxLength = 101; // Phase variables private bool spawnedGuardians = false; @@ -116,17 +116,17 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser wall variables - private const int shotSpacingMax_Phase2 = 1050; + private const int shotSpacingMax_Phase2 = 1470; private int[] shotSpacing_Phase2 = new int[4] { shotSpacingMax_Phase2, shotSpacingMax_Phase2, shotSpacingMax_Phase2, shotSpacingMax_Phase2 }; private const int spacingVar_Phase2 = 105; - private const int totalShots_Phase2 = 20; - private const int totalDiagonalShots = 6; + private const int totalShots_Phase2 = 28; + private const int totalDiagonalShots = 8; private const int diagonalSpacingVar = shotSpacingMax_Phase2 / totalDiagonalShots * 2; private int laserWallType_Phase2 = 0; public int laserWallPhase = 0; // Phase variables - private const int idleCounterMax = 240; + private const int idleCounterMax = 300; private int idleCounter = idleCounterMax; private int postTeleportTimer = 0; private int teleportTimer = -1; @@ -136,15 +136,20 @@ namespace CalamityMod.NPCs.DevourerofGods private const int TimeBeforeTeleport_Normal = 180; private bool spawnedGuardians3 = false; private const float alphaGateValue = 669f; + public const float SkyColorTransitionTime = 90f; // Death animation variables public bool Dying; public int DeathAnimationTimer; public int DestroyedSegmentCount; - //Sounds + // Sounds public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/DevourerSpawn"); public static readonly SoundStyle AttackSound = new("CalamityMod/Sounds/Custom/DevourerAttack"); + public static readonly SoundStyle DeathAnimationSound = new("CalamityMod/Sounds/NPCKilled/DevourerDeath"); + public static readonly SoundStyle DeathExplosionSound = new("CalamityMod/Sounds/NPCKilled/DevourerDeathImpact"); + public static readonly SoundStyle DeathSegmentSound = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak", 4); + public float extrapitch = 0; public override void SetStaticDefaults() { @@ -242,6 +247,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Phase 2 syncs writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); writer.Write(shotSpacing_Phase2[0]); writer.Write(shotSpacing_Phase2[1]); writer.Write(shotSpacing_Phase2[2]); @@ -264,6 +270,9 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(NPC.frame.Width); writer.Write(NPC.frame.Height); + // Misc syncs + writer.Write(extrapitch); + // Be sure to inform clients of the fact that The Devourer of Gods is dying if only the server recieved this packet. if (Main.netMode == NetmodeID.Server && !wasDyingBefore && Dying) { @@ -294,6 +303,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Phase 2 syncs NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); shotSpacing_Phase2[0] = reader.ReadInt32(); shotSpacing_Phase2[1] = reader.ReadInt32(); shotSpacing_Phase2[2] = reader.ReadInt32(); @@ -310,6 +320,9 @@ namespace CalamityMod.NPCs.DevourerofGods DeathAnimationTimer = reader.ReadInt32(); DestroyedSegmentCount = reader.ReadInt32(); + // Misc syncs + extrapitch = reader.ReadSingle(); + // Frame syncs Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); if (frame.Width > 0 && frame.Height > 0) @@ -325,7 +338,8 @@ namespace CalamityMod.NPCs.DevourerofGods CalamityGlobalNPC.DoGP2 = -1; // Stop rain - CalamityMod.StopRain(); + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -338,8 +352,9 @@ namespace CalamityMod.NPCs.DevourerofGods Player player = Main.player[NPC.target]; // Variables - Vector2 vector = NPC.Center; - bool flies = NPC.ai[3] == 0f; + bool flyUpDuringLaserWalls = laserWallPhase == (int)LaserWallPhase.FireLaserWalls || (laserWallPhase == (int)LaserWallPhase.End && teleportTimer > 0); + bool flies = NPC.ai[3] == 0f || flyUpDuringLaserWalls; + Vector2 destination = flyUpDuringLaserWalls ? (player.Center - Vector2.UnitY * 480f) : player.Center; bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -359,6 +374,24 @@ namespace CalamityMod.NPCs.DevourerofGods bool phase6 = lifeRatio < 0.2f; bool phase7 = lifeRatio < 0.15f; + // Black sky timer + if (!death) + { + if (phase7) + { + if (NPC.localAI[3] < SkyColorTransitionTime) + NPC.localAI[3] += 1f; + } + else if (summonSentinels) + { + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + } + } + + // Sound pitch + extrapitch = CalamityWorld.getFixedBoi ? 0.3f : 0f; + // Velocity variables float fallSpeed = bossRush ? 19f : death ? 17.5f : 16f; if (expertMode) @@ -382,7 +415,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (expertMode) groundPhaseTurnSpeed += 0.1f * (1f - lifeRatio); - groundPhaseTurnSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.0002f; + groundPhaseTurnSpeed += Vector2.Distance(destination, NPC.Center) * 0.0002f; if (Main.getGoodWorld) { @@ -438,7 +471,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - float distanceFromTarget = Vector2.Distance(player.Center, vector); + float distanceFromTarget = Vector2.Distance(destination, NPC.Center); bool increaseSpeed = distanceFromTarget > CalamityGlobalNPC.CatchUpDistance200Tiles; bool increaseSpeedMore = distanceFromTarget > CalamityGlobalNPC.CatchUpDistance350Tiles; @@ -534,7 +567,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Adjust movement speed. Direction is unaltered unless DoG is close to the top of the world, in which case he moves horizontally. // A portal will be created ahead of where DoG is moving that he will enter before Phase 2 begins. - float idealFlySpeed = 14f; + float idealFlySpeed = 28f; float oldVelocity = NPC.velocity.Length(); float horizontalInterpolant = Utils.GetLerpValue(1200f, 600f, NPC.Center.Y, true); @@ -647,8 +680,13 @@ namespace CalamityMod.NPCs.DevourerofGods } else if (laserWallPhase == (int)LaserWallPhase.End) { - // End laser wall phase after 4.25 seconds - NPC.Opacity += 0.004f; + // End laser wall phase after 4.1667 seconds + float totalTimeBeforeFullOpacity = 250f; + float timeBeforeTeleportHappens = death ? TimeBeforeTeleport_Death : CalamityWorld.revenge ? TimeBeforeTeleport_Revengeance : Main.expertMode ? TimeBeforeTeleport_Expert : TimeBeforeTeleport_Normal; + float opacityIncrement = 1f / (totalTimeBeforeFullOpacity - timeBeforeTeleportHappens); + if (teleportTimer == 0) + NPC.Opacity += opacityIncrement; + if (NPC.Opacity >= 1f) { NPC.Opacity = 1f; @@ -667,10 +705,9 @@ namespace CalamityMod.NPCs.DevourerofGods CalamityUtils.DisplayLocalizedText(key, messageColor); // Summon Cosmic Guardians + SoundEngine.PlaySound(AttackSound with { Pitch = AttackSound.Pitch + extrapitch }, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(AttackSound, player.position); - for (int i = 0; i < 3; i++) NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } @@ -696,189 +733,219 @@ namespace CalamityMod.NPCs.DevourerofGods } } - // Spawn segments and fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) + // Fireballs + // Check angle and distance to make sure it's realistic that they'd be fired + if (NPC.Opacity >= 1f && distanceFromTarget > 480f && NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f)) { - // Fireballs - if (NPC.Opacity >= 1f && distanceFromTarget > 500f) + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= 150f && calamityGlobalNPC.newAI[0] % (phase7 ? 30f : 60f) == 0f) { - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 150f && calamityGlobalNPC.newAI[0] % (phase7 ? 30f : 60f) == 0f) - { - Vector2 vector44 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num427 = player.position.X + (player.width / 2) - vector44.X; - float num428 = player.position.Y + (player.height / 2) - vector44.Y; - float num430 = 8f; - float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); - num429 = num430 / num429; - num427 *= num429; - num428 *= num429; - num428 += NPC.velocity.Y * 0.5f; - num427 += NPC.velocity.X * 0.5f; - vector44.X -= num427; - vector44.Y -= num428; + float fireballSpeed = 8f; + Vector2 fireballVelocity = Vector2.Normalize(player.Center - NPC.Center) * fireballSpeed + NPC.velocity * 0.5f; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector44.X, vector44.Y, num427, num428, type, damage, 0f, Main.myPlayer); - } + Vector2 dustVelocity = fireballVelocity * 2f; + for (int k = 0; k < 50; k++) + Dust.NewDust(NPC.Center, 52, 52, (int)CalamityDusts.PurpleCosmilite, dustVelocity.X, dustVelocity.Y, 0, default, 1f); + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, fireballVelocity, type, damage, 0f, Main.myPlayer); } - else if (distanceFromTarget < 250f) - calamityGlobalNPC.newAI[0] = 0f; + } + else if (distanceFromTarget < 240f) + calamityGlobalNPC.newAI[0] = 0f; - // Laser walls - if (!spawnedGuardians3 && laserWallPhase == (int)LaserWallPhase.FireLaserWalls) + // Laser walls + if (!spawnedGuardians3 && laserWallPhase == (int)LaserWallPhase.FireLaserWalls) + { + float spawnOffset = 2100f; + float divisor = bossRush ? 100f : 150f; + + if (calamityGlobalNPC.newAI[1] % divisor == 0f) { - float spawnOffset = 1500f; - float divisor = bossRush ? 80f : 120f; + SoundEngine.PlaySound(SoundID.Item12, player.Center); - if (calamityGlobalNPC.newAI[1] % divisor == 0f) + // Side walls + float targetPosY = player.position.Y; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int halfTotalDiagonalShots = totalDiagonalShots / 2; + Vector2 start = default; + Vector2 velocity = default; + Vector2 aim = expertMode ? player.Center + player.velocity * 20f : Vector2.Zero; + + switch (laserWallType_Phase2) { - SoundEngine.PlaySound(SoundID.Item12, player.position); + case (int)LaserWallType_Phase2.Normal: - // Side walls - float targetPosY = player.position.Y; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - int halfTotalDiagonalShots = totalDiagonalShots / 2; - Vector2 start = default; - Vector2 velocity = default; - Vector2 aim = expertMode ? player.Center + player.velocity * 20f : Vector2.Zero; - - switch (laserWallType_Phase2) - { - case (int)LaserWallType_Phase2.Normal: - - for (int x = 0; x < totalShots_Phase2; x++) + for (int x = 0; x < totalShots_Phase2; x++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - shotSpacing_Phase2[0] -= spacingVar_Phase2; } - if (expertMode) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - } + shotSpacing_Phase2[0] -= spacingVar_Phase2; + } - break; + if (expertMode && Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + } - case (int)LaserWallType_Phase2.Offset: + break; - targetPosY += 50f; - for (int x = 0; x < totalShots_Phase2; x++) + case (int)LaserWallType_Phase2.Offset: + + targetPosY += 50f; + for (int x = 0; x < totalShots_Phase2; x++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - shotSpacing_Phase2[0] -= spacingVar_Phase2; } - if (expertMode) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - } + shotSpacing_Phase2[0] -= spacingVar_Phase2; + } - break; + if (expertMode && Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + } - case (int)LaserWallType_Phase2.DiagonalHorizontal: + break; - for (int x = 0; x < totalDiagonalShots + 1; x++) - { - start = new Vector2(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0]); - aim.Y += laserWallSpacingOffset * (x - halfTotalDiagonalShots); - velocity = Vector2.Normalize(aim - start) * laserVelocity; + case (int)LaserWallType_Phase2.DiagonalHorizontal: + + for (int x = 0; x < totalDiagonalShots + 1; x++) + { + start = new Vector2(player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0]); + aim.Y += laserWallSpacingOffset * (x - halfTotalDiagonalShots); + velocity = Vector2.Normalize(aim - start) * laserVelocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - start = new Vector2(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0]); - velocity = Vector2.Normalize(aim - start) * laserVelocity; + start = new Vector2(player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0]); + velocity = Vector2.Normalize(aim - start) * laserVelocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - shotSpacing_Phase2[0] -= diagonalSpacingVar; - } + shotSpacing_Phase2[0] -= diagonalSpacingVar; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X, targetPosY + spawnOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X, targetPosY - spawnOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); + } - break; + break; - case (int)LaserWallType_Phase2.MultiLayered: + case (int)LaserWallType_Phase2.MultiLayered: - for (int x = 0; x < totalShots_Phase2; x++) + for (int x = 0; x < totalShots_Phase2; x++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[0], -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[0], laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - shotSpacing_Phase2[0] -= spacingVar_Phase2; } - int totalBonusLasers = totalShots_Phase2 / 2; - for (int x = 0; x < totalBonusLasers; x++) + shotSpacing_Phase2[0] -= spacingVar_Phase2; + } + + int totalBonusLasers = totalShots_Phase2 / 2; + for (int x = 0; x < totalBonusLasers; x++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, targetPosY + shotSpacing_Phase2[3], -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[3], laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - shotSpacing_Phase2[3] -= Main.rand.NextBool(2) ? 180 : 200; } + shotSpacing_Phase2[3] -= Main.rand.NextBool(2) ? 180 : 200; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + } - break; + break; - case (int)LaserWallType_Phase2.DiagonalVertical: + case (int)LaserWallType_Phase2.DiagonalVertical: - for (int x = 0; x < totalDiagonalShots + 1; x++) - { - start = new Vector2(player.position.X + shotSpacing_Phase2[0], targetPosY + spawnOffset); - aim.X += laserWallSpacingOffset * (x - halfTotalDiagonalShots); - velocity = Vector2.Normalize(aim - start) * laserVelocity; + for (int x = 0; x < totalDiagonalShots + 1; x++) + { + start = new Vector2(player.position.X + shotSpacing_Phase2[0], targetPosY + spawnOffset); + aim.X += laserWallSpacingOffset * (x - halfTotalDiagonalShots); + velocity = Vector2.Normalize(aim - start) * laserVelocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - start = new Vector2(player.position.X + shotSpacing_Phase2[0], targetPosY - spawnOffset); - velocity = Vector2.Normalize(aim - start) * laserVelocity; + start = new Vector2(player.position.X + shotSpacing_Phase2[0], targetPosY - spawnOffset); + velocity = Vector2.Normalize(aim - start) * laserVelocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - shotSpacing_Phase2[0] -= diagonalSpacingVar; - } + shotSpacing_Phase2[0] -= diagonalSpacingVar; + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + } - break; - } - - // Pick a random laser wall phase in expert+ - if (expertMode) - { - int laserWallPhase; - int choices = revenge ? 5 : 3; - do laserWallPhase = Main.rand.Next(choices); - while (laserWallPhase == laserWallType_Phase2); - laserWallType_Phase2 = laserWallPhase; - } - else - laserWallType_Phase2 = laserWallType_Phase2 == (int)LaserWallType_Phase2.Normal ? (int)LaserWallType_Phase2.Offset : (int)LaserWallType_Phase2.Normal; - - // Lower wall - for (int x = 0; x < totalShots_Phase2; x++) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + shotSpacing_Phase2[1], player.position.Y + spawnOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); - shotSpacing_Phase2[1] -= spacingVar_Phase2; - } - - // Upper wall - for (int x = 0; x < totalShots_Phase2; x++) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + shotSpacing_Phase2[2], player.position.Y - spawnOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); - shotSpacing_Phase2[2] -= spacingVar_Phase2; - } - - for (int i = 0; i < shotSpacing_Phase2.Length; i++) - shotSpacing_Phase2[i] = shotSpacingMax_Phase2; + break; } - calamityGlobalNPC.newAI[1] += 1f; + // Pick a random laser wall phase in expert+ + if (expertMode) + { + int laserWallPhase; + int choices = revenge ? 5 : 3; + do laserWallPhase = Main.rand.Next(choices); + while (laserWallPhase == laserWallType_Phase2); + laserWallType_Phase2 = laserWallPhase; + } + else + laserWallType_Phase2 = laserWallType_Phase2 == (int)LaserWallType_Phase2.Normal ? (int)LaserWallType_Phase2.Offset : (int)LaserWallType_Phase2.Normal; + + // Lower wall + for (int x = 0; x < totalShots_Phase2; x++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + shotSpacing_Phase2[1], player.position.Y + spawnOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); + + shotSpacing_Phase2[1] -= spacingVar_Phase2; + } + + // Upper wall + for (int x = 0; x < totalShots_Phase2; x++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + shotSpacing_Phase2[2], player.position.Y - spawnOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); + + shotSpacing_Phase2[2] -= spacingVar_Phase2; + } + + for (int i = 0; i < shotSpacing_Phase2.Length; i++) + shotSpacing_Phase2[i] = shotSpacingMax_Phase2; } + + calamityGlobalNPC.newAI[1] += 1f; } // Set flight time to max during laser walls @@ -886,7 +953,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) { if (Main.player[Main.myPlayer].wingTime < Main.player[Main.myPlayer].wingTimeMax) Main.player[Main.myPlayer].wingTime = Main.player[Main.myPlayer].wingTimeMax; @@ -919,7 +986,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } @@ -948,11 +1015,11 @@ namespace CalamityMod.NPCs.DevourerofGods float num188 = speed; float num189 = turnSpeed; Vector2 vector18 = NPC.Center; - float num191 = player.Center.X; - float num192 = player.Center.Y; + float num191 = destination.X; + float num192 = destination.Y; int num42 = -1; - int num43 = (int)(player.Center.X / 16f); - int num44 = (int)(player.Center.Y / 16f); + int num43 = (int)(destination.X / 16f); + int num44 = (int)(destination.Y / 16f); // Charge at target for 1.5 seconds bool flyAtTarget = (!phase4 || spawnedGuardians3) && calamityGlobalNPC.newAI[2] > phaseLimit - 90 && revenge; @@ -971,7 +1038,7 @@ namespace CalamityMod.NPCs.DevourerofGods break; } - if (!flyAtTarget) + if (!flyAtTarget && destination == player.Center) { if (num42 > 0) { @@ -980,12 +1047,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (player.position.Y > num47) { num192 = num47; - if (Math.Abs(NPC.Center.X - player.Center.X) < 500f) + if (Math.Abs(NPC.Center.X - destination.X) < 500f) { if (NPC.velocity.X > 0f) - num191 = player.Center.X + 600f; + num191 = destination.X + 600f; else - num191 = player.Center.X - 600f; + num191 = destination.X - 600f; } } } @@ -996,8 +1063,8 @@ namespace CalamityMod.NPCs.DevourerofGods num189 = homingTurnSpeed; } - num188 += Vector2.Distance(player.Center, NPC.Center) * 0.005f; - num189 += Vector2.Distance(player.Center, NPC.Center) * 0.00025f; + num188 += Vector2.Distance(destination, NPC.Center) * 0.005f; + num189 += Vector2.Distance(destination, NPC.Center) * 0.00025f; float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; @@ -1125,7 +1192,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } @@ -1208,8 +1275,8 @@ namespace CalamityMod.NPCs.DevourerofGods float num189 = groundPhaseTurnSpeed; Vector2 vector18 = NPC.Center; - float num191 = player.Center.X; - float num192 = player.Center.Y; + float num191 = destination.X; + float num192 = destination.Y; num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -1383,6 +1450,12 @@ namespace CalamityMod.NPCs.DevourerofGods // Spawn Guardians if (phase3) { + if (!death) + { + if (NPC.localAI[3] < SkyColorTransitionTime) + NPC.localAI[3] += 1f; + } + if (!spawnedGuardians) { if (revenge) @@ -1399,12 +1472,14 @@ namespace CalamityMod.NPCs.DevourerofGods if (spawnDoGCountdown > 0) { spawnDoGCountdown--; - if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) + if (spawnDoGCountdown == 0) { - SoundEngine.PlaySound(AttackSound, player.position); - - for (int i = 0; i < 2; i++) - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + SoundEngine.PlaySound(AttackSound with { Pitch = AttackSound.Pitch + extrapitch }, player.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 2; i++) + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + } } } } @@ -1421,11 +1496,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (spawnDoGCountdown > 0) { spawnDoGCountdown--; - if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) + if (spawnDoGCountdown == 0) { - SoundEngine.PlaySound(AttackSound, player.position); + SoundEngine.PlaySound(AttackSound with { Pitch = AttackSound.Pitch + extrapitch }, player.Center); - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } } } @@ -1441,6 +1517,11 @@ namespace CalamityMod.NPCs.DevourerofGods if (!tail && NPC.ai[0] == 0f) { int Previous = NPC.whoAmI; + if (CalamityWorld.getFixedBoi) + { + maxLength = 2; + minLength = 1; + } for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) { int segment; @@ -1461,141 +1542,157 @@ namespace CalamityMod.NPCs.DevourerofGods } tail = true; } + } - if (phase2) + if (phase2) + { + float spawnOffset = 2100f; + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= laserBarragePhaseGateValue) { - float spawnOffset = 1500f; + if (calamityGlobalNPC.newAI[1] >= laserBarrageGateValue) + calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[1] += 1f; - if (calamityGlobalNPC.newAI[1] >= laserBarragePhaseGateValue) + if (calamityGlobalNPC.newAI[1] % (laserBarrageShootGateValue * 0.5f) == 0f && calamityGlobalNPC.newAI[1] > 0f) { - if (calamityGlobalNPC.newAI[1] >= laserBarrageGateValue) - calamityGlobalNPC.newAI[1] = 0f; + SoundEngine.PlaySound(SoundID.Item12, player.Center); - if (calamityGlobalNPC.newAI[1] % (laserBarrageShootGateValue * 0.5f) == 0f && calamityGlobalNPC.newAI[1] > 0f) + // Side walls + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 start = default; + Vector2 velocity = default; + Vector2 aim = expertMode ? player.Center + player.velocity * 20f : Vector2.Zero; + Vector2 aimClone = aim; + + switch (laserWallType) { - SoundEngine.PlaySound(SoundID.Item12, player.position); + case (int)LaserWallType.DiagonalRight: - // Side walls - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Vector2 start = default; - Vector2 velocity = default; - Vector2 aim = expertMode ? player.Center + player.velocity * 20f : Vector2.Zero; - Vector2 aimClone = aim; + for (int x = 0; x < totalShots + 1; x++) + { + start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing); + aim.Y += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aim - start) * laserVelocity; - switch (laserWallType) - { - case (int)LaserWallType.DiagonalRight: + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - for (int x = 0; x < totalShots + 1; x++) + shotSpacing -= spacingVar; + } + + if (expertMode && Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + + break; + + case (int)LaserWallType.DiagonalLeft: + + for (int x = 0; x < totalShots + 1; x++) + { + start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing); + aim.Y += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aim - start) * laserVelocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); + + shotSpacing -= spacingVar; + } + + if (expertMode && Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + + break; + + case (int)LaserWallType.DiagonalHorizontal: + + for (int x = 0; x < totalShots + 1; x++) + { + start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing); + aim.Y += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aim - start) * laserVelocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); + + start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing); + velocity = Vector2.Normalize(aim - start) * laserVelocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); + + shotSpacing -= spacingVar; + } + + if (expertMode && Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + } + + break; + + case (int)LaserWallType.DiagonalCross: + + int randomLaserGap = Main.rand.Next(3) + 3; // 3, 4, 5, 6 + for (int x = 0; x < totalShots + 1; x++) + { + if (x != randomLaserGap && x != randomLaserGap + 1) { start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing); aim.Y += laserWallSpacingOffset * (x - 3); velocity = Vector2.Normalize(aim - start) * laserVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - shotSpacing -= spacingVar; - } - - if (expertMode) - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - - break; - - case (int)LaserWallType.DiagonalLeft: - - for (int x = 0; x < totalShots + 1; x++) - { - start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing); - aim.Y += laserWallSpacingOffset * (x - 3); - velocity = Vector2.Normalize(aim - start) * laserVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - - shotSpacing -= spacingVar; - } - - if (expertMode) - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - - break; - - case (int)LaserWallType.DiagonalHorizontal: - - for (int x = 0; x < totalShots + 1; x++) - { - start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing); - aim.Y += laserWallSpacingOffset * (x - 3); - velocity = Vector2.Normalize(aim - start) * laserVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing); velocity = Vector2.Normalize(aim - start) * laserVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - shotSpacing -= spacingVar; - } - - if (expertMode) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - } - - break; - - case (int)LaserWallType.DiagonalCross: - - int randomLaserGap = Main.rand.Next(3) + 3; // 3, 4, 5, 6 - for (int x = 0; x < totalShots + 1; x++) - { - if (x != randomLaserGap && x != randomLaserGap + 1) - { - start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing); - aim.Y += laserWallSpacingOffset * (x - 3); - velocity = Vector2.Normalize(aim - start) * laserVelocity; + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing); - velocity = Vector2.Normalize(aim - start) * laserVelocity; + start = new Vector2(player.position.X + shotSpacing, player.position.Y + spawnOffset); + aimClone.X += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aimClone - start) * laserVelocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - start = new Vector2(player.position.X + shotSpacing, player.position.Y + spawnOffset); - aimClone.X += laserWallSpacingOffset * (x - 3); - velocity = Vector2.Normalize(aimClone - start) * laserVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); + start = new Vector2(player.position.X + shotSpacing, player.position.Y - spawnOffset); + velocity = Vector2.Normalize(aimClone - start) * laserVelocity; - start = new Vector2(player.position.X + shotSpacing, player.position.Y - spawnOffset); - velocity = Vector2.Normalize(aimClone - start) * laserVelocity; + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), start, velocity, type, damage, 0f, Main.myPlayer); - } - - shotSpacing -= spacingVar; } - if (expertMode) - { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); - } + shotSpacing -= spacingVar; + } - break; - } + if (expertMode && Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + spawnOffset, player.Center.Y, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, player.Center.Y, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + } - // Pick a random laser wall phase in expert+ - if (expertMode) - { - int laserWallPhase; - int choices = revenge ? 4 : 3; - do laserWallPhase = Main.rand.Next(choices); - while (laserWallPhase == laserWallType); - laserWallType = laserWallPhase; - } - else - laserWallType = laserWallType == (int)LaserWallType.DiagonalRight ? (int)LaserWallType.DiagonalLeft : (int)LaserWallType.DiagonalRight; - - shotSpacing = shotSpacingMax; + break; } + + // Pick a random laser wall phase in expert+ + if (expertMode) + { + int laserWallPhase; + int choices = revenge ? 4 : 3; + do laserWallPhase = Main.rand.Next(choices); + while (laserWallPhase == laserWallType); + laserWallType = laserWallPhase; + } + else + laserWallType = laserWallType == (int)LaserWallType.DiagonalRight ? (int)LaserWallType.DiagonalLeft : (int)LaserWallType.DiagonalRight; + + shotSpacing = shotSpacingMax; } } } @@ -1608,7 +1705,8 @@ namespace CalamityMod.NPCs.DevourerofGods } else { - NPC.Opacity += 0.047f; + // 2 seconds to become fully visible again + NPC.Opacity += 0.0083f; if (NPC.Opacity > 1f) NPC.Opacity = 1f; } @@ -1638,7 +1736,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } @@ -1659,8 +1757,8 @@ namespace CalamityMod.NPCs.DevourerofGods float num191 = player.position.X + (player.width / 2); float num192 = player.position.Y + (player.height / 2); int num42 = -1; - int num43 = (int)(player.Center.X / 16f); - int num44 = (int)(player.Center.Y / 16f); + int num43 = (int)(destination.X / 16f); + int num44 = (int)(destination.Y / 16f); for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) { @@ -1683,12 +1781,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (player.position.Y > num47) { num192 = num47; - if (Math.Abs(NPC.Center.X - player.Center.X) < 500f) + if (Math.Abs(NPC.Center.X - destination.X) < 500f) { if (NPC.velocity.X > 0f) - num191 = player.Center.X + 600f; + num191 = destination.X + 600f; else - num191 = player.Center.X - 600f; + num191 = destination.X - 600f; } } } @@ -1830,7 +1928,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } @@ -1901,8 +1999,8 @@ namespace CalamityMod.NPCs.DevourerofGods float num189 = groundPhaseTurnSpeed; Vector2 vector18 = NPC.Center; - float num191 = player.Center.X; - float num192 = player.Center.Y; + float num191 = destination.X; + float num192 = destination.Y; num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -2082,13 +2180,14 @@ namespace CalamityMod.NPCs.DevourerofGods if (!phase2Transition) teleportTimer = (CalamityWorld.death || BossRushEvent.BossRushActive) ? TimeBeforeTeleport_Death : CalamityWorld.revenge ? TimeBeforeTeleport_Revengeance : Main.expertMode ? TimeBeforeTeleport_Expert : TimeBeforeTeleport_Normal; - + + SoundEngine.PlaySound(SoundID.Item109, player.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { int randomRange = 48; float distance = 500f; Vector2 targetVector = player.Center + player.velocity.SafeNormalize(Vector2.UnitX) * distance + new Vector2(Main.rand.Next(-randomRange, randomRange + 1), Main.rand.Next(-randomRange, randomRange + 1)); - SoundEngine.PlaySound(SoundID.Item109, player.Center); Projectile.NewProjectile(NPC.GetSource_FromAI(), targetVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, NPC.whoAmI); } } @@ -2136,7 +2235,9 @@ namespace CalamityMod.NPCs.DevourerofGods postTeleportTimer = (int)Math.Round(maxChargeDistance / chargeVelocity); AwaitingPhase2Teleport = false; NPC.Opacity = 1f - (postTeleportTimer / 255f); - NPC.velocity = Vector2.Normalize(player.Center + player.velocity * 40f - NPC.Center) * chargeVelocity; + // Prediction is Death Mode only for now because it's weird without the line telegraph that Shayy spoke about + Vector2 predictionVector = death ? player.velocity * 40f : Vector2.Zero; + NPC.velocity = Vector2.Normalize(player.Center + predictionVector - NPC.Center) * chargeVelocity; NPC.netUpdate = true; for (int i = 0; i < Main.maxNPCs; i++) @@ -2152,7 +2253,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - SoundEngine.PlaySound(AttackSound, player.Center); + SoundEngine.PlaySound(AttackSound with { Pitch = AttackSound.Pitch + extrapitch }, player.Center); } public void DoDeathAnimation() @@ -2160,7 +2261,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Play a sound at the start. if (DeathAnimationTimer == 1f) { - SoundEngine.PlaySound(AttackSound with { Volume = AttackSound.Volume * 1.6f}, NPC.Center); + SoundEngine.PlaySound(DeathExplosionSound, NPC.Center); } // Close the health bar, fade in, and stop doing contact damage. @@ -2172,7 +2273,7 @@ namespace CalamityMod.NPCs.DevourerofGods void destroySegment(int index, ref int destroyedSegments) { if (Main.rand.NextBool(5)) - SoundEngine.PlaySound(SoundID.Item94, NPC.Center); + SoundEngine.PlaySound(DeathSegmentSound, NPC.Center); List segments = new List() { @@ -2226,11 +2327,11 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.Server) { - SoundEngine.PlaySound(AttackSound with { Volume = AttackSound.Volume * 1.6f}, NPC.Center); + SoundEngine.PlaySound(DeathAnimationSound, NPC.Center); for (int i = 0; i < 3; i++) { - SoundEngine.PlaySound(TeslaCannon.FireSound with { Volume = TeslaCannon.FireSound.Volume * 1.4f, Pitch = TeslaCannon.FireSound.Pitch -MathHelper.Lerp(0.1f, 0.4f, i / 3f) }, NPC.Center); + SoundEngine.PlaySound(DeathExplosionSound, NPC.Center); } } } @@ -2393,7 +2494,7 @@ namespace CalamityMod.NPCs.DevourerofGods normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 35)); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 45, 55)); normalOnly.Add(ModContent.ItemType(), 1, 150, 250); // Equipment @@ -2407,7 +2508,7 @@ namespace CalamityMod.NPCs.DevourerofGods npcLoot.Add(ModContent.ItemType(), 10); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDoG, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDoG, ModContent.ItemType(), desc: DropHelper.FirstKillText); } // Can only hit the target if within certain distance @@ -2445,6 +2546,15 @@ namespace CalamityMod.NPCs.DevourerofGods return true; } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + // viable???, done here since it's conditional + if (CalamityWorld.getFixedBoi && projectile.type == ModContent.ProjectileType()) + { + damage *= 40; + } + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { scale = 2f; @@ -2474,7 +2584,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.soundDelay == 0) { NPC.soundDelay = 8; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound with { Pitch = CommonCalamitySounds.OtherwordlyHitSound.Pitch + extrapitch }, NPC.Center); } if (NPC.life <= 0) { diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index a570624843..89776ad721 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -1,17 +1,18 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Sounds; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.DevourerofGods { @@ -365,7 +366,8 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.soundDelay == 0) { NPC.soundDelay = 8; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound, NPC.Center); + float extrapitch = CalamityWorld.getFixedBoi ? 0.3f : 0f; + SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound with { Pitch = CommonCalamitySounds.OtherwordlyHitSound.Pitch + extrapitch }, NPC.Center); } if (NPC.life <= 0) { @@ -425,6 +427,15 @@ namespace CalamityMod.NPCs.DevourerofGods return true; } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + // viable???, done here since it's conditional + if (CalamityWorld.getFixedBoi && projectile.type == ModContent.ProjectileType()) + { + damage *= 40; + } + } + public override bool CheckDead() { if (NPC.realLife >= 0) diff --git a/NPCs/DevourerofGods/DoGSky.cs b/NPCs/DevourerofGods/DoGSky.cs index 3f4d412c3e..e6a5f12315 100644 --- a/NPCs/DevourerofGods/DoGSky.cs +++ b/NPCs/DevourerofGods/DoGSky.cs @@ -82,16 +82,22 @@ namespace CalamityMod.NPCs.DevourerofGods float intensity = GetIntensity(); float lifeRatio = Main.npc[DoGIndex].life / (float)Main.npc[DoGIndex].lifeMax; double blackScreenLife_GateValue = (lifeRatio < 0.6f && Main.npc[DoGIndex].localAI[2] <= 2f) ? 0.15 : 0.75; - if (Main.npc[DoGIndex].life < Main.npc[DoGIndex].lifeMax * blackScreenLife_GateValue || CalamityWorld.death || BossRushEvent.BossRushActive) + + float timeToReachNextColor = DevourerofGodsHead.SkyColorTransitionTime; + float phaseTimer = Main.npc[DoGIndex].Calamity().newAI[2]; + float colorChangeProgress = phaseTimer / timeToReachNextColor; + if (colorChangeProgress > 1f) + colorChangeProgress = 1f; + + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + Color regularSkyColor = (Main.npc[DoGIndex].ai[3] == 0f ? Color.Lerp(Color.Fuchsia, Color.Cyan, colorChangeProgress) : Color.Lerp(Color.Cyan, Color.Fuchsia, colorChangeProgress)) * intensity; + if (Main.npc[DoGIndex].life < Main.npc[DoGIndex].lifeMax * blackScreenLife_GateValue || death || Main.npc[DoGIndex].localAI[3] > 0f) { - spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), - Color.Black * (intensity + 0.5f)); + float blackSkyTransitionProgress = death ? 1f : Main.npc[DoGIndex].localAI[3] / timeToReachNextColor; + spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), Color.Lerp(regularSkyColor, Color.Black * (intensity + 0.5f), blackSkyTransitionProgress)); } else - { - spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), - (Main.npc[DoGIndex].ai[3] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); - } + spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth * 2, Main.screenHeight * 2), regularSkyColor); } } } diff --git a/NPCs/DraedonLabThings/Androomba.cs b/NPCs/DraedonLabThings/Androomba.cs index 2c11d21c6c..d55030734f 100644 --- a/NPCs/DraedonLabThings/Androomba.cs +++ b/NPCs/DraedonLabThings/Androomba.cs @@ -1,5 +1,6 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -37,6 +38,8 @@ namespace CalamityMod.NPCs.DraedonLabThings NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath44; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.rarity = 2; NPC.catchItem = (short)ModContent.ItemType(); SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index a22735ebf7..7450dca1d3 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -1,6 +1,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -72,6 +73,8 @@ namespace CalamityMod.NPCs.DraedonLabThings NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath44; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); NPC.catchItem = (short)ModContent.ItemType(); SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } diff --git a/NPCs/ExoMechs/AergiaNeuron.png b/NPCs/ExoMechs/AergiaNeuron.png new file mode 100644 index 0000000000..cb5e357bd7 Binary files /dev/null and b/NPCs/ExoMechs/AergiaNeuron.png differ diff --git a/NPCs/ExoMechs/AergiaNeuron_Glow.png b/NPCs/ExoMechs/AergiaNeuron_Glow.png new file mode 100644 index 0000000000..8944e4c44d Binary files /dev/null and b/NPCs/ExoMechs/AergiaNeuron_Glow.png differ diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 70ce7b217f..81a99ece0f 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -19,6 +19,7 @@ using CalamityMod.Skies; using Terraria.Audio; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Sounds; +using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; namespace CalamityMod.NPCs.ExoMechs.Apollo { @@ -105,6 +106,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Variable to pick a different location after each attack private bool pickNewLocation = false; + // Marks Apollo as a component of the Exo Mechdusa + public bool exoMechdusa = false; + // Charge locations during the charge combo private const int maxCharges = 4; public Vector2[] chargeLocations = new Vector2[maxCharges] { default, default, default, default }; @@ -119,7 +123,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Primitive trail drawer for the ribbon things public PrimitiveTrail RibbonTrail = null; - public const string NameToDisplay = "XS-03 Apollo"; + public static string NameToDisplay = "XS-03 Apollo"; + + public static readonly SoundStyle MissileLaunchSound = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloMissileLaunch") { Volume = 1.3f }; public override void SetStaticDefaults() { @@ -190,6 +196,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo writer.Write(velocityBoostMult); writer.Write(frameX); writer.Write(frameY); + writer.Write(exoMechdusa); writer.Write(pickNewLocation); writer.Write(NPC.dontTakeDamage); writer.Write(NPC.localAI[0]); @@ -209,6 +216,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); pickNewLocation = reader.ReadBoolean(); + exoMechdusa = reader.ReadBoolean(); NPC.dontTakeDamage = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); @@ -251,11 +259,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo bool exoWormAlive = false; bool exoPrimeAlive = false; bool exoMechTwinRedAlive = false; + bool artemisUsingDeathray = false; if (CalamityGlobalNPC.draedonExoMechTwinRed != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active) { exoMechTwinRedAlive = true; + artemisUsingDeathray = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[0] == 3f; // Link the HP of both twins if (NPC.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life) @@ -364,6 +374,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { if (!NPC.AnyNPCs(ModContent.NPCType())) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; } @@ -405,7 +417,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo float berserkAttackTime = lastMechAlive ? 225f - reducedTimeForGateValue_Berserk : 270f - reducedTimeForGateValue_Berserk; float attackPhaseGateValue = shouldGetBuffedByBerserkPhase ? berserkAttackTime : normalAttackTime; float timeToLineUpAttack = 30f; - float timeToLineUpCharge = bossRush ? 30f : death ? 40f : revenge ? 45f : expertMode ? 50f : 60f; + float timeToLineUpCharge = bossRush ? 45f : death ? 60f : revenge ? 68f : expertMode ? 75f : 90f; if (Main.getGoodWorld) { @@ -456,11 +468,11 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo bool flyRight = NPC.ai[0] % 2f == 0f || NPC.ai[0] < 10f || !revenge; float destinationX = flyRight ? 750f : -750f; float destinationY = player.Center.Y; - float chargeComboXOffset = flyRight ? -500f : 500f; - float chargeComboYOffset = NPC.ai[2] % 2f == 0f ? 400f : -400f; + float chargeComboXOffset = flyRight ? -600f : 600f; + float chargeComboYOffset = NPC.ai[2] % 2f == 0f ? 480f : -480f; Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + destinationX * 1.6f, destinationY) : SecondaryAIState == (float)SecondaryPhase.Passive ? new Vector2(player.Center.X + destinationX, destinationY + 360f) : - AIState == (float)Phase.LineUpChargeCombo ? new Vector2(player.Center.X + destinationX, destinationY + chargeComboYOffset) : + AIState == (float)Phase.LineUpChargeCombo ? new Vector2(player.Center.X + destinationX * 1.2f, destinationY + chargeComboYOffset) : new Vector2(player.Center.X + destinationX, destinationY); // Add some random distance to the destination after certain attacks @@ -468,8 +480,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { pickNewLocation = false; - int randomLocationVarianceX = 50; - int randomLocationVarianceY = 250; + int randomLocationVarianceX = shouldGetBuffedByBerserkPhase ? 50 : 20; + int randomLocationVarianceY = shouldGetBuffedByBerserkPhase ? 250 : 100; if (Main.getGoodWorld) { @@ -510,7 +522,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo baseVelocity *= 1f + velocityBoostMult; // If Apollo can fire projectiles, cannot fire if too close to the target - bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f; + bool canFire = distanceFromDestination.Length() <= 320f; // Rotation Vector2 aimedVector = player.Center - NPC.Center; @@ -614,7 +626,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo case (int)SecondaryPhase.Nothing: // Spawn the other mechs if Artemis and Apollo are first - if (otherExoMechsAlive == 0) + if (otherExoMechsAlive == 0 && !exoMechdusa) { if (spawnOtherExoMechs) { @@ -721,7 +733,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Go passive and immune if one of the other mechs is berserk // This is only called if two exo mechs are alive in ideal scenarios // This is not called if Artemis and Apollo and another one or two mechs are berserk - if (otherMechIsBerserk && !berserk) + if (otherMechIsBerserk && !berserk && !exoMechdusa) { // Despawn projectile bullshit for (int x = 0; x < Main.maxProjectiles; x++) @@ -791,7 +803,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo AIState = (float)Phase.Normal; // Enter passive and invincible phase if one of the other exo mechs is berserk - if (otherMechIsBerserk) + if (otherMechIsBerserk && !exoMechdusa) { // Despawn projectile bullshit for (int x = 0; x < Main.maxProjectiles; x++) @@ -888,7 +900,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Artemis does nothing while immune if (exoMechTwinRedAlive) - Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[0] = (float)Artemis.Artemis.Phase.Normal; + Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[0] = (float)ArtemisBoss.Phase.Normal; // Do nothing while immune AIState = (float)Phase.Normal; @@ -1007,7 +1019,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { if (firingPlasma) { - // Fire plasma + // Fire plasma. float divisor = nerfedAttacks ? 60f : lastMechAlive ? 40f : 45f; float plasmaTimer = calamityGlobalNPC.newAI[3] - 2f; if (plasmaTimer % divisor == 0f && canFire) @@ -1018,7 +1030,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - SoundEngine.PlaySound(PlasmaCaster.FireSound, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaShootSound, NPC.Center); Vector2 plasmaVelocity = Vector2.Normalize(aimedVector) * projectileVelocity; Vector2 offset = Vector2.Normalize(plasmaVelocity) * 70f; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); @@ -1043,6 +1055,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo chargeLocations[i] = default; NPC.TargetClosest(); + PlayTargetingSound(); } else if (doBigAttack) { @@ -1051,7 +1064,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo calamityGlobalNPC.newAI[3] = 0f; if (phase2) - AIState = NPC.localAI[2] == 1f ? (float)Phase.LineUpChargeCombo : (float)Phase.RocketBarrage; + AIState = (NPC.localAI[2] == 1f && !artemisUsingDeathray) ? (float)Phase.LineUpChargeCombo : (float)Phase.RocketBarrage; else AIState = (float)Phase.RocketBarrage; } @@ -1066,15 +1079,19 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Smooth movement towards the location Apollo is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); - calamityGlobalNPC.newAI[2] += 1f; + if (canFire || calamityGlobalNPC.newAI[2] > 0f) + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] % (rocketPhaseDuration / numRockets) == 0f && canFire) { + // Play a missile firing sound. + SoundEngine.PlaySound(MissileLaunchSound, NPC.Center); + pickNewLocation = true; if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - SoundEngine.PlaySound(SoundID.Item36, NPC.Center); Vector2 rocketVelocity = Vector2.Normalize(aimedVector) * projectileVelocity * 1.2f; Vector2 offset = Vector2.Normalize(rocketVelocity) * 70f; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, rocketVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); @@ -1088,6 +1105,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo AIState = (float)Phase.Normal; NPC.localAI[2] = shouldGetBuffedByBerserkPhase ? 1f : 0f; calamityGlobalNPC.newAI[2] = 0f; + PlayTargetingSound(); + NPC.TargetClosest(); } @@ -1152,6 +1171,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Don't move NPC.velocity = Vector2.Zero; + // Play a sound to accompany the telegraph. + SoundEngine.PlaySound(ArtemisBoss.ChargeTelegraphSound with { Volume = 1.6f }, NPC.Center); + // Go to charge phase, create lightning bolts in the sky, and reset calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] >= timeToLineUpCharge) @@ -1169,19 +1191,24 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Charge to several locations almost instantly (Apollo doesn't teleport here, he's just moving very fast :D) case (int)Phase.ChargeCombo: + // Tell Artemis to not fire lasers for a short time + NPC.ai[3] = 61f; + // Set charge velocity and fire halos of plasma bolts if (NPC.localAI[2] == 0f) { - SoundEngine.PlaySound(CommonCalamitySounds.ELRFireSound, NPC.Center); + // Play a charge sound. + SoundEngine.PlaySound(ArtemisBoss.ChargeSound, NPC.Center); + NPC.velocity = Vector2.Normalize(chargeLocations[(int)calamityGlobalNPC.newAI[2] + 1] - chargeLocations[(int)calamityGlobalNPC.newAI[2]]) * chargeVelocity; NPC.localAI[2] = 1f; NPC.netUpdate = true; NPC.netSpam -= 5; // Plasma bolts on charge - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !(CalamityWorld.getFixedBoi && !exoMechdusa)) // I'm not that evil { - int totalProjectiles = bossRush ? 12 : 8; + int totalProjectiles = bossRush ? 16 : death ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage = (int)(NPC.GetProjectileDamage(ModContent.ProjectileType()) * 0.8); @@ -1241,8 +1268,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Dust dust2 = Main.dust[dust1]; dust2.velocity *= 0.5f; - dust2.velocity.X = dust2.velocity.X + dustVelX; - dust2.velocity.Y = dust2.velocity.Y + dustVelY; + dust2.velocity.X += dustVelX; + dust2.velocity.Y += dustVelY; dust2.scale = scale; dust2.noGravity = true; } @@ -1267,26 +1294,35 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Reset phase and variables if (calamityGlobalNPC.newAI[2] >= maxCharges - 1) { - pickNewLocation = true; - AIState = (float)Phase.Normal; + if (CalamityWorld.getFixedBoi && !exoMechdusa) + { + pickNewLocation = NPC.localAI[2] == 0f; + calamityGlobalNPC.newAI[3] = 0f; + AIState = (float)Phase.LineUpChargeCombo; + } + else + { + pickNewLocation = true; + AIState = (float)Phase.Normal; + + // Tell Apollo and Artemis to swap positions + if (NPC.ai[0] < 10f) + NPC.ai[0] = 10f; + NPC.ai[0] += 1f; + } + NPC.localAI[2] = 0f; - calamityGlobalNPC.newAI[2] = 0f; for (int i = 0; i < maxCharges; i++) chargeLocations[i] = default; ChargeComboFlash = 0f; - - // Tell Apollo and Artemis to swap positions - if (NPC.ai[0] < 10f) - NPC.ai[0] = 10f; - NPC.ai[0] += 1f; + calamityGlobalNPC.newAI[2] = 0f; // Change Y offset for the next charge combo NPC.ai[2] = Main.rand.Next(2); - // Tell Artemis to not fire lasers for a short time while swapping positions - NPC.ai[3] = 61f; - NPC.TargetClosest(); + PlayTargetingSound(); + NPC.netUpdate = true; } @@ -1320,10 +1356,43 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; NPC.TargetClosest(); + PlayTargetingSound(); } break; } + + // Exo Mechdusa behavior + if (exoMechdusa) + { + int twinoffset = 300; + int extratwinoffset = 100; + int twinheight = 300; + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ModNPC().exoMechdusa) + { + NPC aresin = Main.npc[CalamityGlobalNPC.draedonExoMechPrime]; + if (NPC.Calamity().newAI[0] != (float)Phase.ChargeCombo && NPC.Calamity().newAI[0] != (float)Phase.LineUpChargeCombo) + { + Vector2 pos = new Vector2(aresin.Center.X - twinoffset - extratwinoffset, aresin.Center.Y - twinheight); + NPC.position = pos; + } + } + } + } + } + + // Plays the targeting sound from both Exo Twins, indicating that they're syncing up. + public static void PlayTargetingSound() + { + // Play for Artemis. + if (CalamityGlobalNPC.draedonExoMechTwinRed >= 0 && Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active) + SoundEngine.PlaySound(ArtemisBoss.AttackSelectionSound, Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Center); + + // Play for Apollo. + if (CalamityGlobalNPC.draedonExoMechTwinGreen >= 0 && Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + SoundEngine.PlaySound(ArtemisBoss.AttackSelectionSound, Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Center); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -1440,7 +1509,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public float FlameTrailWidthFunctionBig(float completionRatio) => MathHelper.SmoothStep(34f, 12f, completionRatio) * ChargeComboFlash; - public float RibbonTrailWidthFunction(float completionRatio) + public static float RibbonTrailWidthFunction(float completionRatio) { float baseWidth = Utils.GetLerpValue(1f, 0.54f, completionRatio, true) * 5f; float endTipWidth = CalamityUtils.Convert01To010(Utils.GetLerpValue(0.96f, 0.89f, completionRatio, true)) * 2.4f; @@ -1687,6 +1756,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void ModifyNPCLoot(NPCLoot npcLoot) => AresBody.DefineExoMechLoot(NPC, npcLoot, (int)AresBody.MechType.ArtemisAndApollo); + public override void ModifyTypeName(ref string typeName) + { + if (exoMechdusa) + { + typeName = NameToDisplay = "Corrosive Eye of XB-∞ Hekate"; + } + } + // Needs edits public override void HitEffect(int hitDirection, double damage) { @@ -1735,9 +1812,10 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (nPC.active && nPC.type == ModContent.NPCType() && nPC.life > 0) { nPC.life = 0; - nPC.HitEffect(0, 10.0); + nPC.HitEffect(); nPC.checkDead(); nPC.active = false; + nPC.netUpdate = true; } } return true; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 7e22f9e234..320d13384c 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -32,6 +32,7 @@ using Terraria.Audio; using Terraria.GameContent.ItemDropRules; using CalamityMod.Sounds; using CalamityMod.Items.Weapons.Summon; +using ReLogic.Utilities; namespace CalamityMod.NPCs.ExoMechs.Ares { @@ -91,6 +92,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Drawers for arm segments. + public PrimitiveTrail LightningDrawer; + public PrimitiveTrail LightningBackgroundDrawer; + + // This stores the sound slot of the deathray sound Ares makes, so it may be properly updated in terms of position and looped. + public SlotId DeathraySoundSlot; + // Spawn rate for enrage steam public const int ventCloudSpawnRate = 3; @@ -117,6 +125,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Variable used to stop the arm spawning loop private bool armsSpawned = false; + // Exo Mechdusa stuff + public bool exoMechdusa = false; + public int neurontimer = 0; + // Total duration of the deathray telegraph public const float deathrayTelegraphDuration_Normal = 150f; public const float deathrayTelegraphDuration_Expert = 120f; @@ -134,12 +146,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public const float plasmaArmStartTimer = 260f; public const float teslaArmStartTimer = 80f; - // Drawers for arm segments. - public PrimitiveTrail LightningDrawer; - public PrimitiveTrail LightningBackgroundDrawer; + public static readonly SoundStyle EnragedSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresEnraged"); - public static readonly SoundStyle EnragedSound = new("CalamityMod/Sounds/Custom/AresEnraged"); + public static readonly SoundStyle LaserStartSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserStart"); + public static readonly SoundStyle LaserLoopSound = new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserLoop") with { IsLooped = true }; + + public static readonly SoundStyle LaserEndSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresCircleLaserEnd"); public override void SetStaticDefaults() { DisplayName.SetDefault("XF-09 Ares"); @@ -186,7 +199,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Exo, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("While it is the most flamboyant of Draedon’s machines, it appears to be lacking some finish, though this trait does not compromise its killing potential whatsoever.") + new FlavorTextBestiaryInfoElement("While it is the most flamboyant of Draedon's machines, it appears to be lacking some finish, though this trait does not compromise its killing potential whatsoever.") }); } @@ -201,12 +214,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares writer.Write(frameX); writer.Write(frameY); writer.Write(armsSpawned); + writer.Write(exoMechdusa); writer.Write(NPC.dontTakeDamage); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); + writer.Write(neurontimer); } public override void ReceiveExtraAI(BinaryReader reader) @@ -214,12 +229,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); armsSpawned = reader.ReadBoolean(); + exoMechdusa = reader.ReadBoolean(); NPC.dontTakeDamage = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); + neurontimer = reader.ReadInt32(); } public override void AI() @@ -276,10 +293,91 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } + if (exoMechdusa) + { + NPC apolloNPC = CalamityUtils.SpawnBossBetter(NPC.Center, ModContent.NPCType()); + apolloNPC.ModNPC().exoMechdusa = true; + NPC artemisNPC = CalamityUtils.SpawnBossBetter(NPC.Center, ModContent.NPCType()); + artemisNPC.ModNPC().exoMechdusa = true; + NPC thanosNPC = CalamityUtils.SpawnBossBetter(NPC.Center, ModContent.NPCType()); + thanosNPC.ModNPC().exoMechdusa = true; + } armsSpawned = true; } } + if (exoMechdusa) + { + int yoffset = 180; + int xoffset = 180; + Vector2 NeuronRight = new Vector2(NPC.Center.X + xoffset, NPC.Center.Y + yoffset); + Vector2 NeuronLeft = new Vector2(NPC.Center.X - xoffset, NPC.Center.Y + yoffset); + NPC.alpha = 0; + NPC.dontTakeDamage = true; + neurontimer++; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (neurontimer >= 180) + { + float variance = MathHelper.TwoPi / 6; + for (int i = 0; i < 6; i++) + { + Vector2 velocity = new Vector2(0f, 6f); + velocity = velocity.RotatedBy(variance * i); + velocity.Normalize(); + + Vector2 betweenR = NeuronRight + velocity * 650; + Vector2 betweenL = NeuronLeft + velocity * 650; + + Terraria.Audio.SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = CommonCalamitySounds.LaserCannonSound.Volume - 0.2f, Pitch = CommonCalamitySounds.LaserCannonSound.Pitch + 0.2f }, NeuronRight); + Projectile.NewProjectile(NPC.GetSource_FromAI(), betweenL, betweenL + velocity, ModContent.ProjectileType(), 222, 0f, Main.myPlayer, 7, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), betweenR, betweenR + velocity, ModContent.ProjectileType(), 222, 0f, Main.myPlayer, 7, NPC.whoAmI); + + } + neurontimer = 0; + } + } + if (NPC.CountNPCS(ModContent.NPCType()) > 0 || NPC.CountNPCS(ModContent.NPCType()) > 0) + { + NPC.TargetClosest(); + Vector2 where2 = new Vector2(Main.player[NPC.target].Center.X + 600, Main.player[NPC.target].Center.Y - 200); + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].Calamity().newAI[0] == (float)ThanatosHead.Phase.Deathray) + { + where2 = new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechWorm].position.X, Main.npc[CalamityGlobalNPC.draedonExoMechWorm].position.Y - 40); + NPC.position = where2; + } + else + { + CalamityUtils.SmoothMovement(NPC, 100, where2 - NPC.Center, 8, 1.4f, true); + } + } + else if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[0] == (float)Artemis.Artemis.Phase.Deathray) + { + where2 = new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].position.X, Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].position.Y); + NPC.position = where2; + } + else if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[0] == (float)Apollo.Apollo.Phase.ChargeCombo || Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[0] == (float)Apollo.Apollo.Phase.LineUpChargeCombo) + { + where2 = new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].position.X, Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].position.Y); + NPC.position = where2; + } + else + { + CalamityUtils.SmoothMovement(NPC, 100, where2 - NPC.Center, 8, 1.4f, true); + } + } + else + { + CalamityUtils.SmoothMovement(NPC, 100, where2 - NPC.Center, 8, 1.4f, true); + } + return; + } + } + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) NPC.life = Main.npc[(int)NPC.ai[0]].life; @@ -510,8 +608,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { case (int)SecondaryPhase.Nothing: - // Spawn the other mechs if Ares is first - if (otherExoMechsAlive == 0) + // Spawn the other mechs if Ares is first and not Exo Mechdusa + if (otherExoMechsAlive == 0 && !exoMechdusa) { if (spawnOtherExoMechs) { @@ -727,12 +825,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Play enrage sound if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < soundDistance) { - SoundEngine.PlaySound(EnragedSound, Main.player[Main.myPlayer].position); + SoundEngine.PlaySound(EnragedSound, Main.player[Main.myPlayer].Center); } // Draedon comments on how foolish it is to run if (Main.netMode != NetmodeID.MultiplayerClient) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonAresEnrageText", new Color(155, 255, 255)); + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonAresEnrageText", Draedon.TextColor); // Enrage EnragedState = (float)Enraged.Yes; @@ -820,9 +918,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fire deathrays if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) { + DeathraySoundSlot = SoundEngine.PlaySound(LaserStartSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(TeslaCannon.FireSound, NPC.Center); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 spawnPoint = NPC.Center + new Vector2(-1f, 23f); @@ -835,33 +934,93 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } + // Update the deathray sound if it's being played. + if (SoundEngine.TryGetActiveSound(DeathraySoundSlot, out var deathraySound) && deathraySound.IsPlaying) + deathraySound.Position = NPC.Center; + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration) + { + // Start the loop sound if the start sound finished. + if (deathraySound is null || !deathraySound.IsPlaying || calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration + 180f) + { + if (deathraySound is null || deathraySound.Style == LaserStartSound) + { + deathraySound?.Stop(); + DeathraySoundSlot = SoundEngine.PlaySound(LaserLoopSound, NPC.Center); + } + else if (deathraySound is not null) + deathraySound.Resume(); + } + } + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) { - AIState = (float)Phase.Normal; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; + if (!CalamityWorld.getFixedBoi || exoMechdusa) + { + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; - /* Normal positions: Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3 - * 0 = Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3 - * 1 = Laser = 3, Tesla = 1, Plasma = 2, Gauss = 0 - * 2 = Laser = 3, Tesla = 2, Plasma = 1, Gauss = 0 - * 3 = Laser = 0, Tesla = 2, Plasma = 1, Gauss = 3 - * 4 = Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3 - * 5 = Laser = 3, Tesla = 1, Plasma = 2, Gauss = 0 - */ - if (revenge) - { - NPC.ai[3] += 1f + Main.rand.Next(2); - if (NPC.ai[3] > 5f) - NPC.ai[3] -= 4f; + /* Normal positions: Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3 + * 0 = Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3 + * 1 = Laser = 3, Tesla = 1, Plasma = 2, Gauss = 0 + * 2 = Laser = 3, Tesla = 2, Plasma = 1, Gauss = 0 + * 3 = Laser = 0, Tesla = 2, Plasma = 1, Gauss = 3 + * 4 = Laser = 0, Tesla = 1, Plasma = 2, Gauss = 3 + * 5 = Laser = 3, Tesla = 1, Plasma = 2, Gauss = 0 + */ + if (revenge) + { + NPC.ai[3] += 1f + Main.rand.Next(2); + if (NPC.ai[3] > 5f) + NPC.ai[3] -= 4f; + } + else if (expertMode) + { + NPC.ai[3] += Main.rand.Next(2); + if (NPC.ai[3] > 3f) + NPC.ai[3] -= 2f; + } } - else if (expertMode) + else { - NPC.ai[3] += Main.rand.Next(2); - if (NPC.ai[3] > 3f) - NPC.ai[3] -= 2f; + // Despawn stupid fucking dog shit to avoid screaming the word "cunt" + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 15) + projectile.timeLeft = 15; + + if (projectile.type == ModContent.ProjectileType()) + { + projectile.ai[0] = -1f; + projectile.ai[1] = -1f; + } + else if (projectile.type == ModContent.ProjectileType()) + projectile.ai[0] = -1f; + } + else if (projectile.type == ModContent.ProjectileType()) + projectile.Kill(); + } + } + + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + // Cancel enrage state if Ares is enraged + if (EnragedState == (float)Enraged.Yes) + EnragedState = (float)Enraged.No; } + // Stop the laser loop and play the end sound. + deathraySound?.Stop(); + SoundEngine.PlaySound(LaserEndSound, NPC.Center); + NPC.localAI[0] += 1f; NPC.TargetClosest(); NPC.netUpdate = true; @@ -1071,6 +1230,20 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(texture, center, frame, afterimageBaseColor * NPC.Opacity, NPC.rotation, vector, NPC.scale, SpriteEffects.None, 0f); + // Draw Aergia Neuron boobs if Exo Mechdusa + if (exoMechdusa) + { + Texture2D neurontexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/AergiaNeuron").Value; + Texture2D glowtexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/AergiaNeuron_Glow").Value; + Vector2 NeuronRight = new Vector2(NPC.Center.X + 40, NPC.Center.Y + 50); + Vector2 NeuronLeft = new Vector2(NPC.Center.X - 40, NPC.Center.Y + 50); + Vector2 origin = new Vector2((float)(neurontexture.Width / 2), (float)(neurontexture.Height / 2)); + spriteBatch.Draw(neurontexture, NeuronRight - Main.screenPosition, null, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(neurontexture, NeuronLeft - Main.screenPosition, null, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(glowtexture, NeuronRight - Main.screenPosition, null, Color.White, NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(glowtexture, NeuronLeft - Main.screenPosition, null, Color.White, NPC.rotation, origin, NPC.scale, SpriteEffects.None, 0f); + } + return false; } internal float WidthFunction(float completionRatio) @@ -1245,6 +1418,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares spriteBatch.Draw(armTexture2Glowmask, arm2DrawPosition, arm2Frame, glowmaskAlphaColor, arm2Rotation, arm2Origin, NPC.scale, spriteDirection ^ SpriteEffects.FlipHorizontally, 0f); } } + public override void ModifyTypeName(ref string typeName) + { + if (exoMechdusa) + { + typeName = "XB-∞ Hekate"; + } + } public override void BossLoot(ref string name, ref int potionType) { @@ -1256,6 +1436,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Check if the other exo mechs are alive bool exoWormAlive = false; bool exoTwinsAlive = false; + if (SoundEngine.TryGetActiveSound(DeathraySoundSlot, out var deathraySound) && deathraySound.IsPlaying) + deathraySound?.Stop(); if (CalamityGlobalNPC.draedonExoMechWorm != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) @@ -1349,11 +1531,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).AddIf(CanDropLoot, ModContent.ItemType()); // Lore item - mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(() => !DownedBossSystem.downedExoMechs, desc: DropHelper.FirstKillText), ModContent.ItemType())); + mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(() => !DownedBossSystem.downedExoMechs, desc: DropHelper.FirstKillText), ModContent.ItemType())); + + // Cynosure: If SCal has been defeated and this is the first kill of the Exo Mechs, drop the special lore item + mainDrops.Add(ItemDropRule.ByCondition( + DropHelper.If( + () => !DownedBossSystem.downedExoMechs && DownedBossSystem.downedCalamitas, + desc: DropHelper.CynosureText), + ModContent.ItemType() + )); // Treasure bag npcLoot.Add(ItemDropRule.BossBagByCondition(DropHelper.If(CanDropLoot), ModContent.ItemType())); + // Legendary seed soup + //mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().exoMechdusa), ModContent.ItemType()), hideLootReport: true); + // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index c6de59a3c4..d0d65790f5 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -66,7 +66,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public const float gaussNukeReloadDuration = 360f; // Telegraph sound. - public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresGaussNukeArmCharge") { Volume = 1.1f}; + public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresGaussNukeArmCharge") { Volume = 1.1f }; + + public static readonly SoundStyle NukeExplosionSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresGaussNukeExplosion") { Volume = 1.45f }; public override void SetStaticDefaults() { @@ -129,9 +131,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { NPC.life = 0; - NPC.HitEffect(0, 10.0); + NPC.HitEffect(); NPC.checkDead(); NPC.active = false; + NPC.netUpdate = true; return; } @@ -197,6 +200,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; + AresBody aresBody = Main.npc[(int)NPC.ai[2]].ModNPC(); CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)NPC.ai[2]].Calamity(); // Passive phase check @@ -207,7 +211,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; - NPC.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase || Main.npc[(int)NPC.ai[2]].dontTakeDamage; if (!invisiblePhase) { NPC.Opacity += 0.2f; @@ -367,6 +371,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares SmokeDrawer.Update(); EnergyDrawer.ParticleSpawnRate = 9999999; + // Attacking phases switch ((int)AIState) { @@ -423,7 +428,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); // Recoil - NPC.velocity -= gaussNukeVelocity; + NPC.velocity -= gaussNukeVelocity * 2f; } } @@ -474,10 +479,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Smooth movement towards the location Ares Gauss Nuke is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); - //Update the telegraph sound if it's being done. - if (TelegraphSoundSlot != null && SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) + // Update the telegraph sound if it's being played. Immediately stop it if Ares just begun transitioning to his laserbeam attack, since that automatically resets all impending cannon shots. + if (SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) { telSound.Position = NPC.Center; + if (aresBody.AIState == (int)AresBody.Phase.Deathrays && calamityGlobalNPC_Body.newAI[2] <= 10f) + telSound.Stop(); } } @@ -639,6 +646,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.instance.DrawCacheNPCProjectiles.Add(index); } + public override void ModifyTypeName(ref string typeName) + { + int index = CalamityGlobalNPC.draedonExoMechPrime; + + if (index < 0 || index >= Main.maxNPCs || Main.npc[index] is null) + return; + + if (Main.npc[index].ModNPC().exoMechdusa) + { + typeName = "XB-∞ Hekate Gauss Nuke"; + } + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index b472cc6e32..bfb4d88cf6 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -62,10 +62,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public const float deathrayDuration = 60f; // This stores the sound slot of the telegraph sound it makes, so it may be properly updated in terms of position. + public SlotId TelegraphSoundSlot; + + // This stores the sound slot of the deathray sound it makes, so it may be properly updated in terms of position. public SlotId DeathraySoundSlot; // Telegraph sound. - public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresLaserArmCharge") { Volume = 1.1f}; + public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresLaserArmCharge") { Volume = 1.1f }; + + public static readonly SoundStyle LaserbeamShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresLaserArmShoot") { Volume = 1.1f }; public override void SetStaticDefaults() { @@ -128,9 +133,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { NPC.life = 0; - NPC.HitEffect(0, 10.0); + NPC.HitEffect(); NPC.checkDead(); NPC.active = false; + NPC.netUpdate = true; return; } @@ -196,6 +202,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; + AresBody aresBody = Main.npc[(int)NPC.ai[2]].ModNPC(); CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)NPC.ai[2]].Calamity(); // Passive phase check @@ -206,7 +213,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; - NPC.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase || Main.npc[(int)NPC.ai[2]].dontTakeDamage; if (!invisiblePhase) { NPC.Opacity += 0.2f; @@ -379,6 +386,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares SmokeDrawer.Update(); EnergyDrawer.ParticleSpawnRate = 9999999; + // Attacking phases switch ((int)AIState) { @@ -405,7 +413,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { // Play a charge up sound so that the player knows when it's about to fire the deathray if (calamityGlobalNPC.newAI[2] == 1 && !fireNormalLasers) - DeathraySoundSlot = SoundEngine.PlaySound(TelSound, NPC.Center); + TelegraphSoundSlot = SoundEngine.PlaySound(TelSound, NPC.Center); // Smooth movement towards the location Ares Laser Cannon is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); @@ -441,11 +449,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (calamityGlobalNPC.newAI[2] % divisor == 0f && canFire) { + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); Vector2 laserVelocity = Vector2.Normalize(player.Center - NPC.Center); Vector2 offset = laserVelocity * 70f + Vector2.UnitY * 16f; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, player.Center, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); @@ -472,6 +480,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fire deathray if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) { + // Play the deathray sound. + DeathraySoundSlot = SoundEngine.PlaySound(LaserbeamShootSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); @@ -479,7 +490,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float offset = 84f; float offset2 = 16f; Vector2 source = horizontalLaserSweep ? new Vector2(NPC.Center.X - offset2 * NPC.direction, NPC.Center.Y + offset) : new Vector2(NPC.Center.X + offset * NPC.direction, NPC.Center.Y + offset2); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, source); Vector2 laserVelocity = Vector2.Normalize(lookAt - source); if (laserVelocity.HasNaNs()) laserVelocity = -Vector2.UnitY; @@ -513,10 +523,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnergyDrawer.Update(); - //Update the deathray sound if it's being done. - if (DeathraySoundSlot != null && SoundEngine.TryGetActiveSound(DeathraySoundSlot, out var deathraySound) && deathraySound.IsPlaying) - { + // Update the deathray and telegraph sound if they're being played. + if (SoundEngine.TryGetActiveSound(DeathraySoundSlot, out var deathraySound) && deathraySound.IsPlaying) deathraySound.Position = NPC.Center; + + // Immediately stop the telegraph sound if Ares just begun transitioning to his laserbeam attack, since that automatically resets all impending cannon shots. + if (SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) + { + telSound.Position = NPC.Center; + if (aresBody.AIState == (int)AresBody.Phase.Deathrays && calamityGlobalNPC_Body.newAI[2] <= 10f) + telSound.Stop(); } } @@ -679,6 +695,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.instance.DrawCacheNPCProjectiles.Add(index); } + public override void ModifyTypeName(ref string typeName) + { + int index = CalamityGlobalNPC.draedonExoMechPrime; + + if (index < 0 || index >= Main.maxNPCs || Main.npc[index] is null) + return; + + if (Main.npc[index].ModNPC().exoMechdusa) + { + typeName = "XB-∞ Hekate Laser Cannon"; + } + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 44858f30c7..841485cfe9 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public SlotId TelegraphSoundSlot; // Telegraph sound. - public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresPlasmaArmCharge"); + public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresPlasmaArmCharge"); public override void SetStaticDefaults() { @@ -130,9 +130,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { NPC.life = 0; - NPC.HitEffect(0, 10.0); + NPC.HitEffect(); NPC.checkDead(); NPC.active = false; + NPC.netUpdate = true; return; } @@ -198,6 +199,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; + AresBody aresBody = Main.npc[(int)NPC.ai[2]].ModNPC(); CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)NPC.ai[2]].Calamity(); // Passive phase check @@ -208,7 +210,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; - NPC.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase || Main.npc[(int)NPC.ai[2]].dontTakeDamage; if (!invisiblePhase) { NPC.Opacity += 0.2f; @@ -386,6 +388,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares EnergyDrawer.ParticleSpawnRate = 9999999; + // Attacking phases switch ((int)AIState) { @@ -439,7 +442,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.ai[3] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(PlasmaCaster.FireSound, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaShootSound, NPC.Center); Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -449,6 +452,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); else Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + + // Recoil + NPC.velocity -= plasmaBoltVelocity; } } } @@ -473,10 +479,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Smooth movement towards the location Ares Plasma Flamethrower is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); - //Update the telegraph sound if it's being done. - if (TelegraphSoundSlot != null && SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) + // Update the telegraph sound if it's being played. Immediately stop it if Ares just begun transitioning to his laserbeam attack, since that automatically resets all impending cannon shots. + if (SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) { telSound.Position = NPC.Center; + if (aresBody.AIState == (int)AresBody.Phase.Deathrays && calamityGlobalNPC_Body.newAI[2] <= 10f) + telSound.Stop(); } } @@ -637,6 +645,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.instance.DrawCacheNPCProjectiles.Add(index); } + public override void ModifyTypeName(ref string typeName) + { + int index = CalamityGlobalNPC.draedonExoMechPrime; + + if (index < 0 || index >= Main.maxNPCs || Main.npc[index] is null) + return; + + if (Main.npc[index].ModNPC().exoMechdusa) + { + typeName = "XB-∞ Hekate Plasma Flamethrower"; + } + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 602cc65fc4..c486428a6a 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -64,7 +64,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public SlotId TelegraphSoundSlot; // Telegraph sound. - public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/AresTeslaArmCharge") { Volume = 1.1f}; + public static readonly SoundStyle TelSound = new("CalamityMod/Sounds/Custom/ExoMechs/AresTeslaArmCharge") { Volume = 1.1f }; + + public static readonly SoundStyle TeslaOrbShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot", 2) { Volume = 1.1f }; public override void SetStaticDefaults() { @@ -127,9 +129,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) { NPC.life = 0; - NPC.HitEffect(0, 10.0); + NPC.HitEffect(); NPC.checkDead(); NPC.active = false; + NPC.netUpdate = true; return; } @@ -195,6 +198,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; + AresBody aresBody = Main.npc[(int)NPC.ai[2]].ModNPC(); CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)NPC.ai[2]].Calamity(); // Passive phase check @@ -205,7 +209,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Adjust opacity bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; - NPC.dontTakeDamage = invisiblePhase; + NPC.dontTakeDamage = invisiblePhase || Main.npc[(int)NPC.ai[2]].dontTakeDamage; if (!invisiblePhase) { NPC.Opacity += 0.2f; @@ -381,6 +385,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares SmokeDrawer.Update(); EnergyDrawer.ParticleSpawnRate = 9999999; + // Attacking phases switch ((int)AIState) { @@ -434,13 +439,16 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(CommonCalamitySounds.PlasmaBoltSound, NPC.Center); + SoundEngine.PlaySound(TeslaOrbShootSound, NPC.Center); Vector2 teslaOrbVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 offset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f; float identity = fireMoreOrbs ? -2f : calamityGlobalNPC.newAI[3] + (calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) / divisor; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); + + // Recoil + NPC.velocity -= teslaOrbVelocity; } } } @@ -466,10 +474,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Smooth movement towards the location Ares Tesla Cannon is meant to be at CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, 0f, false); - //Update the telegraph sound if it's being done. - if (TelegraphSoundSlot != null && SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) + // Update the telegraph sound if it's being played. Immediately stop it if Ares just begun transitioning to his laserbeam attack, since that automatically resets all impending cannon shots. + if (SoundEngine.TryGetActiveSound(TelegraphSoundSlot, out var telSound) && telSound.IsPlaying) { telSound.Position = NPC.Center; + if (aresBody.AIState == (int)AresBody.Phase.Deathrays && calamityGlobalNPC_Body.newAI[2] <= 10f) + telSound.Stop(); } } @@ -629,6 +639,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.instance.DrawCacheNPCProjectiles.Add(index); } + public override void ModifyTypeName(ref string typeName) + { + int index = CalamityGlobalNPC.draedonExoMechPrime; + + if (index < 0 || index >= Main.maxNPCs || Main.npc[index] is null) + return; + + if (Main.npc[index].ModNPC().exoMechdusa) + { + typeName = "XB-∞ Hekate Tesla Cannon"; + } + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index d6c3423541..6aa86a6e9d 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -27,7 +27,17 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public static int phase1IconIndex; public static int phase2IconIndex; - public static readonly SoundStyle LensSound = new("CalamityMod/Sounds/Custom/ExoTwinsEject") { Volume = 1.2f}; + public static readonly SoundStyle AttackSelectionSound = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection") { Volume = 1.3f }; + + public static readonly SoundStyle ChargeSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisApolloDash") { Volume = 1.2f }; + + public static readonly SoundStyle ChargeTelegraphSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisApolloDashTelegraph") { Volume = 1.2f }; + + public static readonly SoundStyle LensSound = new("CalamityMod/Sounds/Custom/ExoMechs/ExoTwinsEject") { Volume = 1.2f }; + + public static readonly SoundStyle LaserShotgunSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisShotgunLaser") { Volume = 1.2f }; + + public static readonly SoundStyle SpinLaserbeamSound = new("CalamityMod/Sounds/Custom/ExoMechs/ArtemisSpinLaserbeam") { Volume = 1.3f }; internal static void LoadHeadIcons() { @@ -110,12 +120,21 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Total duration of the deathray telegraph private const float deathrayTelegraphDuration = 60f; + // The amount of time Artemis pauses for before shooting + private const float PauseDurationBeforeLaserActuallyFires = ArtemisLaser.TelegraphTotalTime; + + // Vector to look at after a laser has been fired + private Vector2 pointToLookAt = default; + // Total duration of the deathray private const float deathrayDuration = 180f; // Variable to pick a different location after each attack private bool pickNewLocation = false; + // Mark Artemis as a component of the Exo Mechdusa + public bool exoMechdusa = false; + // The direction to spin in during spin phases private int rotationDirection = 0; @@ -138,7 +157,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis //This stores the sound slot of the ML laser sound it makes, so it may be properly updated in terms of position. private SlotId DeathraySoundSlot; - public const string NameToDisplay = "XS-01 Artemis"; + public static string NameToDisplay = "XS-01 Artemis"; public override void SetStaticDefaults() { @@ -185,8 +204,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - //We'll probably want a custom background for Exos like ML has. - //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Exo, + // We'll probably want a custom background for Exos like ML has. + // BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Exo, // Will move to localization whenever that is cleaned up. new FlavorTextBestiaryInfoElement("The Exo Twins are the ultimate recon units. Capable of detecting various wavelengths of light unknown to us, nothing can hide.") @@ -206,11 +225,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void SendExtraAI(BinaryWriter writer) { writer.Write(velocityBoostMult); + writer.WriteVector2(pointToLookAt); writer.WriteVector2(spinVelocity); writer.WriteVector2(chargeVelocityNormalized); writer.Write(frameX); writer.Write(frameY); writer.Write(pickNewLocation); + writer.Write(exoMechdusa); writer.Write(rotationDirection); writer.WriteVector2(spinningPoint); writer.Write(NPC.dontTakeDamage); @@ -225,11 +246,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void ReceiveExtraAI(BinaryReader reader) { velocityBoostMult = reader.ReadSingle(); + pointToLookAt = reader.ReadVector2(); spinVelocity = reader.ReadVector2(); chargeVelocityNormalized = reader.ReadVector2(); frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); pickNewLocation = reader.ReadBoolean(); + exoMechdusa = reader.ReadBoolean(); rotationDirection = reader.ReadInt32(); spinningPoint = reader.ReadVector2(); NPC.dontTakeDamage = reader.ReadBoolean(); @@ -271,6 +294,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis bool exoTwinGreenAlive = false; bool exoWormAlive = false; bool exoPrimeAlive = false; + bool apolloUsingChargeCombo = false; if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) @@ -283,6 +307,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis NPC.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life; exoTwinGreenAlive = true; + apolloUsingChargeCombo = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[0] == 2f || Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[0] == 3f; } } if (CalamityGlobalNPC.draedonExoMechWorm != -1) @@ -391,6 +416,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { if (!NPC.AnyNPCs(ModContent.NPCType())) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; } @@ -425,15 +452,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Berserk, final phase of Artemis and Apollo // Phase 7 - 0, 1, 2 - // Predictiveness - float predictionAmt = bossRush ? 50f : death ? 40f : revenge ? 35f : expertMode ? 30f : 20f; - if (AIState == (float)Phase.LaserShotgun) - predictionAmt *= 1.5f; - if (nerfedAttacks) - predictionAmt *= 0.5f; - if (SecondaryAIState == (float)SecondaryPhase.Passive) - predictionAmt *= 0.5f; - // Gate values float reducedTimeForGateValue = bossRush ? 48f : death ? 32f : revenge ? 24f : expertMode ? 16f : 0f; float reducedTimeForGateValue_Berserk = reducedTimeForGateValue * 0.5f; @@ -479,16 +497,28 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float movementDistanceGateValue = 100f; // Charge variables - float chargeVelocity = nerfedAttacks ? 75f : bossRush ? 100f : death ? 90f : revenge ? 86.25f : expertMode ? 82.5f : 75f; + float chargeVelocity = nerfedAttacks ? 60f : bossRush ? 81f : death ? 74f : revenge ? 70.5f : expertMode ? 67f : 60f; if (Main.getGoodWorld) chargeVelocity *= 1.15f; float chargeDistance = 2000f; float chargeDuration = chargeDistance / chargeVelocity; + bool aimTowardsChargeTarget = calamityGlobalNPC.newAI[3] >= (attackPhaseGateValue - 30f + 2f) && !phase2 && AIState == (float)Phase.Normal; bool lineUpAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; bool doBigAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; + // Predictiveness + float predictionAmt = 20f; + if (aimTowardsChargeTarget) + predictionAmt *= 2f; + if (AIState == (float)Phase.LaserShotgun) + predictionAmt *= 1.5f; + if (nerfedAttacks) + predictionAmt *= 0.5f; + if (SecondaryAIState == (float)SecondaryPhase.Passive) + predictionAmt *= 0.5f; + // Velocity and acceleration values float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = ((AIState == (int)Phase.Deathray || lineUpAttack || AIState == (int)Phase.LaserShotgun) ? 40f : 20f) * baseVelocityMult; @@ -500,16 +530,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Laser shotgun variables float laserShotgunDuration = lastMechAlive ? 120f : 90f; - // If Artemis can fire projectiles, cannot fire if too close to the target - bool canFire = Vector2.Distance(NPC.Center, player.Center) > 320f && canFireLasers; - // Add some random distance to the destination after certain attacks if (pickNewLocation) { pickNewLocation = false; - int randomLocationVarianceX = 50; - int randomLocationVarianceY = 250; + int randomLocationVarianceX = shouldGetBuffedByBerserkPhase ? 50 : 20; + int randomLocationVarianceY = shouldGetBuffedByBerserkPhase ? 250 : 100; if (Main.getGoodWorld) { @@ -558,6 +585,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } baseVelocity *= 1f + velocityBoostMult; + // If Artemis can fire projectiles, cannot fire if too close to the target + bool canFire = distanceFromDestination.Length() <= 320f && canFireLasers; + // Rotation Vector2 predictionVector = AIState == (float)Phase.Deathray ? Vector2.Zero : player.velocity * predictionAmt; Vector2 aimedVector = player.Center + predictionVector - NPC.Center; @@ -578,6 +608,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float y = spinningPoint.Y - NPC.Center.Y; NPC.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; } + else if (pointToLookAt != default) + { + rateOfRotation = 0f; + float x = pointToLookAt.X - NPC.Center.X; + float y = pointToLookAt.Y - NPC.Center.Y; + NPC.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; + } else { float x = player.Center.X + predictionVector.X - NPC.Center.X; @@ -729,27 +766,38 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { if (firingLasers) { - // Fire lasers - float divisor = nerfedAttacks ? 60f : lastMechAlive ? 35f : 45f; + // Fire lasers or swap to a new location + float divisor = nerfedAttacks ? 45f : lastMechAlive ? 25f : 30f; float laserTimer = calamityGlobalNPC.newAI[3] - 2f; if (laserTimer % divisor == 0f && canFire) { - pickNewLocation = true; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (laserTimer % (divisor * 2f) == 0f) + { + pointToLookAt = default; + pickNewLocation = true; + } + else { - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); Vector2 laserVelocity = Vector2.Normalize(aimedVector); Vector2 projectileDestination = player.Center + predictionVector; - Vector2 offset = laserVelocity * 70f; - float setVelocityInAI = 7.5f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, projectileDestination, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); + pointToLookAt = projectileDestination; + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 offset = laserVelocity * 70f; + float setVelocityInAI = 7.5f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, projectileDestination, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); + } } } } else + { + pointToLookAt = default; calamityGlobalNPC.newAI[2] = 0f; + } // Enter charge phase after a certain time has passed // This is replaced by a laser shotgun in phase 2 @@ -758,6 +806,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (lineUpAttack) { // Return to normal laser phase if in passive state + pointToLookAt = default; if (SecondaryAIState == (float)SecondaryPhase.Passive) { pickNewLocation = true; @@ -773,10 +822,12 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // And allow the charge flash effect shouldDoChargeFlash = true; + // Play a sound to accompany the telegraph. + SoundEngine.PlaySound(ChargeTelegraphSound, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); Vector2 laserVelocity = Vector2.Normalize(aimedVector); Vector2 offset = laserVelocity * 50f; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); @@ -795,7 +846,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int spread = bossRush ? 30 : death ? 26 : expertMode ? 21 : 15; float rotation = MathHelper.ToRadians(spread); float distanceFromTarget = Vector2.Distance(NPC.Center, NPC.Center + chargeVelocityNormalized * chargeDistance); - float setVelocityInAI = 7.5f; + float setVelocityInAI = death ? 7f : revenge ? 6.75f : expertMode ? 6.5f : 6f; for (int i = 0; i < numLasersPerSpread + 1; i++) { @@ -815,12 +866,12 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[3] = 0f; if (phase2) { - AIState = NPC.localAI[2] == 1f ? (float)Phase.Deathray : (float)Phase.LaserShotgun; + AIState = (NPC.localAI[2] == 1f && !apolloUsingChargeCombo) ? (float)Phase.Deathray : (float)Phase.LaserShotgun; } else { // Charge until a certain distance is reached and then return to normal phase - SoundEngine.PlaySound(CommonCalamitySounds.ELRFireSound, NPC.Center); + SoundEngine.PlaySound(ChargeSound, NPC.Center); AIState = (float)Phase.Charge; // Set charge velocity @@ -867,46 +918,49 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fire lasers int numSpreads = lastMechAlive ? 3 : 2; float divisor2 = laserShotgunDuration / numSpreads; - if (calamityGlobalNPC.newAI[2] % divisor2 == 0f && canFire) + if (calamityGlobalNPC.newAI[2] % divisor2 == 0f && canFire && calamityGlobalNPC.newAI[2] < laserShotgunDuration) { - pickNewLocation = true; - if (Main.netMode != NetmodeID.MultiplayerClient) + SoundEngine.PlaySound(LaserShotgunSound, NPC.Center); + + Vector2 laserVelocity = Vector2.Normalize(aimedVector) * 10f; + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + /* Spread: + * lastMechAlive = 20, 25, 30 + * normal = 16, 20, 24 + * nerfedAttacks = 12, 15, 18 + */ + int numLasersAddedByDifficulty = bossRush ? 3 : death ? 2 : expertMode ? 1 : 0; + int numLasersPerSpread = ((nerfedAttacks || nerfedLaserShotgun) ? 3 : lastMechAlive ? 7 : 5) + numLasersAddedByDifficulty; + int baseSpread = ((nerfedAttacks || nerfedLaserShotgun) ? 9 : lastMechAlive ? 20 : 15) + numLasersAddedByDifficulty * 2; + int spread = baseSpread + (int)(calamityGlobalNPC.newAI[2] / divisor2) * (baseSpread / 4); + float rotation = MathHelper.ToRadians(spread); + float distanceFromTarget = Vector2.Distance(NPC.Center, player.Center + predictionVector); + float setVelocityInAI = death ? 6f : revenge ? 5.75f : expertMode ? 5.5f : 5f; + pointToLookAt = player.Center + predictionVector; + + for (int i = 0; i < numLasersPerSpread + 1; i++) { - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); + Vector2 perturbedSpeed = laserVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numLasersPerSpread - 1))); + Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); - Vector2 laserVelocity = Vector2.Normalize(aimedVector) * 10f; - /* Spread: - * lastMechAlive = 20, 25, 30 - * normal = 16, 20, 24 - * nerfedAttacks = 12, 15, 18 - */ - int numLasersAddedByDifficulty = bossRush ? 3 : death ? 2 : expertMode ? 1 : 0; - int numLasersPerSpread = ((nerfedAttacks || nerfedLaserShotgun) ? 3 : lastMechAlive ? 7 : 5) + numLasersAddedByDifficulty; - int baseSpread = ((nerfedAttacks || nerfedLaserShotgun) ? 9 : lastMechAlive ? 20 : 15) + numLasersAddedByDifficulty * 2; - int spread = baseSpread + (int)(calamityGlobalNPC.newAI[2] / divisor2) * (baseSpread / 4); - float rotation = MathHelper.ToRadians(spread); - float distanceFromTarget = Vector2.Distance(NPC.Center, player.Center + predictionVector); - float setVelocityInAI = 7.5f; - - for (int i = 0; i < numLasersPerSpread + 1; i++) - { - Vector2 perturbedSpeed = laserVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numLasersPerSpread - 1))); - Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); - - Vector2 offset = normalizedPerturbedSpeed * 70f; - Vector2 newCenter = NPC.Center + offset; + Vector2 offset = normalizedPerturbedSpeed * 70f; + Vector2 newCenter = NPC.Center + offset; + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); - } } } // Reset phase and variables - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] >= laserShotgunDuration) + if (canFire || calamityGlobalNPC.newAI[2] > 0f) + calamityGlobalNPC.newAI[2] += 1f; + + if (calamityGlobalNPC.newAI[2] >= (laserShotgunDuration + PauseDurationBeforeLaserActuallyFires)) { + pointToLookAt = default; pickNewLocation = true; AIState = (float)Phase.Normal; NPC.localAI[2] = shouldGetBuffedByBerserkPhase ? 1f : 0f; @@ -954,10 +1008,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis NPC.ai[1] = spinningPoint.X; NPC.ai[2] = spinningPoint.Y; + SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); Vector2 laserVelocity = Vector2.Normalize(spinningPoint - NPC.Center); Vector2 offset = laserVelocity * 70f; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); @@ -1024,8 +1078,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Fire deathray if (Main.netMode != NetmodeID.MultiplayerClient) { + DeathraySoundSlot = SoundEngine.PlaySound(SpinLaserbeamSound, NPC.Center); + int type = ModContent.ProjectileType(); - DeathraySoundSlot = SoundEngine.PlaySound(SoundID.Zombie104, NPC.Center); int damage = NPC.GetProjectileDamage(type); int laser = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, NPC.whoAmI); if (Main.projectile.IndexInRange(laser)) @@ -1037,8 +1092,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } else { + // This first variable is used to adjust how long it takes for the rotation rate to reach max + float rotationSpeedMult = bossRush ? 6.66f : death ? 4f : revenge ? 3f : expertMode ? 2.5f : 2f; + // This is used to adjust both the radians and the velocity of the spin moved per frame - float rotationMult = (calamityGlobalNPC.newAI[2] - deathrayTelegraphDuration) / deathrayDuration * 4f; + // At 15% progress it will be at max rotation in Boss Rush + // At 25% progress it will be at max rotation in Death Mode + // At 33% progress it will be at max rotation in Rev Mode + // At 40% progress it will be at max rotation in Expert Mode + // At 50% progress it will be at max rotation in Normal Mode + float rotationMult = (calamityGlobalNPC.newAI[2] - deathrayTelegraphDuration) / deathrayDuration * rotationSpeedMult; + + // Max rotation if (rotationMult > 1f) { // The radians moved per frame during the spin @@ -1065,11 +1130,27 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Reset phase and variables if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) { + if (CalamityWorld.getFixedBoi && !exoMechdusa) + { + calamityGlobalNPC.newAI[3] = 0f; + AIState = (float)Phase.Deathray; + for (int i = 0; i < Main.maxProjectiles; i ++) + { + if (Main.projectile[i].type == ModContent.ProjectileType()) + { + Main.projectile[i].active = false; + continue; + } + } + } + else + { + AIState = (float)Phase.Normal; + } spinVelocity = default; rotationDirection = 0; spinningPoint = default; pickNewLocation = true; - AIState = (float)Phase.Normal; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (revenge) @@ -1142,10 +1223,28 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Update the charge flash variable ChargeFlash = MathHelper.Clamp(ChargeFlash + shouldDoChargeFlash.ToDirectionInt() * 0.08f, 0f, 1f); - //Update the deathray sound if it's being done. + // Update the deathray sound position if it's being played. if (SoundEngine.TryGetActiveSound(DeathraySoundSlot, out var deathraySound) && deathraySound.IsPlaying) - { deathraySound.Position = NPC.Center; + + // Exo Mechdusa behavior + if (exoMechdusa) + { + int twinoffset = 300; + int extratwinoffset = 100; + int twinheight = 300; + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ModNPC().exoMechdusa) + { + NPC aresin = Main.npc[CalamityGlobalNPC.draedonExoMechPrime]; + if (NPC.Calamity().newAI[0] != (float)Phase.Charge && NPC.Calamity().newAI[0] != (float)Phase.Deathray) + { + Vector2 pos = new Vector2(aresin.Center.X + twinoffset - extratwinoffset, aresin.Center.Y - twinheight); + NPC.position = pos; + } + } + } } } @@ -1447,6 +1546,14 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis return false; } + public override void ModifyTypeName(ref string typeName) + { + if (exoMechdusa) + { + typeName = NameToDisplay = "Blazing Eye of XB-∞ Hekate"; + } + } + // Needs edits public override void HitEffect(int hitDirection, double damage) { @@ -1500,9 +1607,10 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (nPC.active && nPC.type == ModContent.NPCType() && nPC.life > 0) { nPC.life = 0; - nPC.HitEffect(0, 10.0); + nPC.HitEffect(); nPC.checkDead(); nPC.active = false; + nPC.netUpdate = true; } } return true; diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 7bc8733490..80a942bf07 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -29,6 +29,7 @@ namespace CalamityMod.NPCs.ExoMechs public float ProjFrameCounter; public float ProjFrameChangeCounter; public bool ShouldStartStandingUp; + public bool exoMechdusa; public Vector2 HoverDestinationOffset { get => new(NPC.ai[1], NPC.ai[2]); @@ -136,6 +137,7 @@ namespace CalamityMod.NPCs.ExoMechs writer.Write(ShouldStartStandingUp); writer.Write(HasBeenKilled); writer.Write(BossRushCounter); + writer.Write(exoMechdusa); } public override void ReceiveExtraAI(BinaryReader reader) @@ -150,6 +152,7 @@ namespace CalamityMod.NPCs.ExoMechs ShouldStartStandingUp = reader.ReadBoolean(); HasBeenKilled = reader.ReadBoolean(); BossRushCounter = reader.ReadSingle(); + exoMechdusa = reader.ReadBoolean(); } public override void AI() @@ -190,7 +193,9 @@ namespace CalamityMod.NPCs.ExoMechs if (PlayerToFollow.dead || !PlayerToFollow.active) { NPC.life = 0; + NPC.HitEffect(); NPC.active = false; + NPC.netUpdate = true; return; } } @@ -200,6 +205,13 @@ namespace CalamityMod.NPCs.ExoMechs NPC.spriteDirection = (PlayerToFollow.Center.X < NPC.Center.X).ToDirectionInt(); + // Exo Mechdusa bool setting + if (!exoMechdusa && CalamityWorld.DraedonMechdusa && CalamityWorld.getFixedBoi) + { + exoMechdusa = true; + CalamityWorld.DraedonMechdusa = false; + } + // Handle delays when re-appearing after being killed. if (KillReappearDelay > 0f) { @@ -238,78 +250,101 @@ namespace CalamityMod.NPCs.ExoMechs ShouldStartStandingUp = true; // Gloss over the arbitrary details and just get to the Exo Mech selection if Draedon has already been talked to. - if ((CalamityWorld.TalkedToDraedon || bossRush) && TalkTimer > 70 && TalkTimer < TalkDelay * 4f - 25f) + if ((CalamityWorld.TalkedToDraedon || bossRush) && TalkTimer > 70 && TalkTimer < TalkDelay * 4f - 25f && !exoMechdusa) { TalkTimer = TalkDelay * 4f - 25f; NPC.netUpdate = true; } - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay) + if (!exoMechdusa) { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText1", TextColor); - NPC.netUpdate = true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText2", TextColor); - NPC.netUpdate = true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 2f) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText3", TextColor); - NPC.netUpdate = true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 3f) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText4", TextColor); - NPC.netUpdate = true; - } - - // Inform the player who summoned draedon they may choose the first mech and cause a selection UI to appear over their head. - if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 4f) - { - if (bossRush) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonBossRushText", TextColorEdgy); - else if (CalamityWorld.TalkedToDraedon) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonResummonText", TextColorEdgy); - else - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText5", TextColorEdgy); - - // Mark Draedon as talked to. - if (!CalamityWorld.TalkedToDraedon) + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay) { - CalamityWorld.TalkedToDraedon = true; - CalamityNetcode.SyncWorld(); + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText1", TextColor); + NPC.netUpdate = true; } - NPC.netUpdate = true; + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText2", TextColor); + NPC.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 2f) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText3", TextColor); + NPC.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 3f) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText4", TextColor); + NPC.netUpdate = true; + } + + // Inform the player who summoned draedon they may choose the first mech and cause a selection UI to appear over their head. + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + DelayPerDialogLine * 4f) + { + if (bossRush) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonBossRushText", TextColorEdgy); + else if (CalamityWorld.TalkedToDraedon) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonResummonText", TextColorEdgy); + else + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonIntroductionText5", TextColorEdgy); + + // Mark Draedon as talked to. + if (!CalamityWorld.TalkedToDraedon) + { + CalamityWorld.TalkedToDraedon = true; + CalamityNetcode.SyncWorld(); + } + + NPC.netUpdate = true; + } + + // Wait for the player to select an exo mech. + if (TalkTimer >= ExoMechChooseDelay && TalkTimer < ExoMechChooseDelay + 8f && CalamityWorld.DraedonMechToSummon == ExoMech.None) + { + PlayerToFollow.Calamity().AbleToSelectExoMech = true; + TalkTimer = ExoMechChooseDelay; + if (bossRush) + { + // Summon a random exo mech if you wait too long + BossRushCounter++; + if (BossRushCounter > 1200 && CalamityWorld.DraedonMechToSummon == ExoMech.None) + { + CalamityWorld.DraedonMechToSummon = (ExoMech)Main.rand.Next(1, 4); + + if (Main.netMode != NetmodeID.SinglePlayer) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.ExoMechSelection); + netMessage.Write((int)CalamityWorld.DraedonMechToSummon); + netMessage.Send(); + } + } + } + } } - - // Wait for the player to select an exo mech. - if (TalkTimer >= ExoMechChooseDelay && TalkTimer < ExoMechChooseDelay + 8f && CalamityWorld.DraedonMechToSummon == ExoMech.None) + else { - PlayerToFollow.Calamity().AbleToSelectExoMech = true; - TalkTimer = ExoMechChooseDelay; - if (bossRush) - { - // Summon a random exo mech if you wait too long - BossRushCounter++; - if (BossRushCounter > 1200 && CalamityWorld.DraedonMechToSummon == ExoMech.None) - { - CalamityWorld.DraedonMechToSummon = (ExoMech)Main.rand.Next(1,4); + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay) + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonMechdusaBeginText", TextColorEdgy); + NPC.netUpdate = true; + } - if (Main.netMode != NetmodeID.SinglePlayer) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ExoMechSelection); - netMessage.Write((int)CalamityWorld.DraedonMechToSummon); - netMessage.Send(); - } - } - } + if (Main.netMode != NetmodeID.MultiplayerClient && TalkTimer == TalkDelay + 60) + { + // Mark Draedon as talked to. + if (!CalamityWorld.TalkedToDraedon) + { + CalamityWorld.TalkedToDraedon = true; + CalamityNetcode.SyncWorld(); + } + + NPC.netUpdate = true; + } } // Fly around once the exo mechs have been spawned. @@ -327,7 +362,7 @@ namespace CalamityMod.NPCs.ExoMechs } // Summon the selected exo mech. - if (TalkTimer == ExoMechChooseDelay + 10f) + if ((TalkTimer == ExoMechChooseDelay + 10f || (TalkTimer == TalkDelay + 60 && exoMechdusa)) && !ExoMechIsPresent) { if (Main.netMode != NetmodeID.MultiplayerClient) SummonExoMech(); @@ -335,11 +370,12 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.Server) { SoundEngine.PlaySound(CommonCalamitySounds.FlareSound with { Volume = CommonCalamitySounds.FlareSound.Volume * 1.55f}, PlayerToFollow.Center); + if (!exoMechdusa) SoundEngine.PlaySound(SelectionSound, PlayerToFollow.Center); } } - if (!bossRush) + if (!bossRush && !exoMechdusa) { // Dialogue lines depending on what phase the exo mechs are at. switch ((int)DialogueType) @@ -458,7 +494,7 @@ namespace CalamityMod.NPCs.ExoMechs break; } - } + } if (TalkTimer > ExoMechChooseDelay + 10f && !ExoMechIsPresent) { @@ -467,6 +503,22 @@ namespace CalamityMod.NPCs.ExoMechs } TalkTimer++; + + if (ExoMechIsPresent && CalamityWorld.getFixedBoi && GeneralTimer % 60 == 0 && !exoMechdusa) + { + SoundEngine.PlaySound(SoundID.Item33, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 shoot = PlayerToFollow.Center - NPC.Center; + shoot.Normalize(); + shoot *= 4; + int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center - Vector2.UnitY * 30, shoot, ModContent.ProjectileType(), 116, 0, Main.myPlayer); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].timeLeft *= 2; + } + } + } } // TODO -- Make this work in conjunction with exo mech transitions. This requires that the exo mech AIs be finished. @@ -475,7 +527,8 @@ namespace CalamityMod.NPCs.ExoMechs // Define a hover destination offset if one hasn't been decided yet. if (Main.netMode != NetmodeID.MultiplayerClient && HoverDestinationOffset == Vector2.Zero) { - HoverDestinationOffset = -Vector2.UnitY * 700f; + float factor = CalamityWorld.getFixedBoi && !exoMechdusa ? 300f : 700f; + HoverDestinationOffset = -Vector2.UnitY * factor; NPC.netUpdate = true; } @@ -492,7 +545,9 @@ namespace CalamityMod.NPCs.ExoMechs offsetDirection = Main.rand.NextVector2Unit(); while (Vector2.Dot(directionToTarget, offsetDirection) > 0.2f); - HoverDestinationOffset = offsetDirection * Main.rand.NextFloat(750f, 1100f); + float factormin = CalamityWorld.getFixedBoi && !exoMechdusa ? 300f : 750f; + float factormax = CalamityWorld.getFixedBoi && !exoMechdusa ? 700f : 1100f; + HoverDestinationOffset = offsetDirection * Main.rand.NextFloat(factormin, factormax); NPC.netUpdate = true; } @@ -525,29 +580,38 @@ namespace CalamityMod.NPCs.ExoMechs public void SummonExoMech() { - switch (CalamityWorld.DraedonMechToSummon) + if (exoMechdusa) { - // Summon Thanatos underground. - case ExoMech.Destroyer: - Vector2 thanatosSpawnPosition = PlayerToFollow.Center + Vector2.UnitY * 2100f; - NPC thanatos = CalamityUtils.SpawnBossBetter(thanatosSpawnPosition, ModContent.NPCType()); - if (thanatos != null) - thanatos.velocity = thanatos.SafeDirectionTo(PlayerToFollow.Center) * 40f; - break; + Vector2 aresSpawnPosition = PlayerToFollow.Center - Vector2.UnitY * 1400f; + NPC Ares = CalamityUtils.SpawnBossBetter(aresSpawnPosition, ModContent.NPCType()); + Ares.ModNPC().exoMechdusa = true; + } + else + { + switch (CalamityWorld.DraedonMechToSummon) + { + // Summon Thanatos underground. + case ExoMech.Destroyer: + Vector2 thanatosSpawnPosition = PlayerToFollow.Center + Vector2.UnitY * 2100f; + NPC thanatos = CalamityUtils.SpawnBossBetter(thanatosSpawnPosition, ModContent.NPCType()); + if (thanatos != null) + thanatos.velocity = thanatos.SafeDirectionTo(PlayerToFollow.Center) * 40f; + break; - // Summon Ares in the sky, directly above the player. - case ExoMech.Prime: - Vector2 aresSpawnPosition = PlayerToFollow.Center - Vector2.UnitY * 1400f; - CalamityUtils.SpawnBossBetter(aresSpawnPosition, ModContent.NPCType()); - break; + // Summon Ares in the sky, directly above the player. + case ExoMech.Prime: + Vector2 aresSpawnPosition = PlayerToFollow.Center - Vector2.UnitY * 1400f; + CalamityUtils.SpawnBossBetter(aresSpawnPosition, ModContent.NPCType()); + break; - // Summon Apollo and Artemis above the player to their sides. - case ExoMech.Twins: - Vector2 artemisSpawnPosition = PlayerToFollow.Center + new Vector2(-1100f, -1600f); - Vector2 apolloSpawnPosition = PlayerToFollow.Center + new Vector2(1100f, -1600f); - CalamityUtils.SpawnBossBetter(artemisSpawnPosition, ModContent.NPCType()); - CalamityUtils.SpawnBossBetter(apolloSpawnPosition, ModContent.NPCType()); - break; + // Summon Apollo and Artemis above the player to their sides. + case ExoMech.Twins: + Vector2 artemisSpawnPosition = PlayerToFollow.Center + new Vector2(-1100f, -1600f); + Vector2 apolloSpawnPosition = PlayerToFollow.Center + new Vector2(1100f, -1600f); + CalamityUtils.SpawnBossBetter(artemisSpawnPosition, ModContent.NPCType()); + CalamityUtils.SpawnBossBetter(apolloSpawnPosition, ModContent.NPCType()); + break; + } } } @@ -559,7 +623,7 @@ namespace CalamityMod.NPCs.ExoMechs NPC.Calamity().ShouldCloseHPBar = HasBeenKilled; NPC.chaseable = BossRushEvent.BossRushActive; - bool leaving = (DefeatTimer > DelayBeforeDefeatStandup + TalkDelay * 8f + 200f) || BossRushEvent.BossRushActive; + bool leaving = ((DefeatTimer > DelayBeforeDefeatStandup + TalkDelay * 8f + 200f) || BossRushEvent.BossRushActive) && !exoMechdusa; // Fade away and disappear when leaving. if (leaving) @@ -571,14 +635,13 @@ namespace CalamityMod.NPCs.ExoMechs if (HologramEffectTimer <= 0f) { Main.BestiaryTracker.Kills.RegisterKill(NPC); + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; + NPC.netUpdate = true; // Die you lil piece of shit stop creating endless loop in BR if (BossRushEvent.BossRushActive) - { - NPC.HitEffect(); NPC.NPCLoot(); - NPC.netUpdate = true; - } } } @@ -605,35 +668,48 @@ namespace CalamityMod.NPCs.ExoMechs if (DefeatTimer > DelayBeforeDefeatStandup && DefeatTimer < TalkDelay * 2f + 50f) ShouldStartStandingUp = true; - if (DefeatTimer == DelayBeforeDefeatStandup + 50f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText1", TextColor); + // Different text if Exo Mechdusa + if (exoMechdusa) + { + if (DefeatTimer == DelayBeforeDefeatStandup + 50f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonMechdusaEndText1", TextColor); - if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay + 50f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText2", TextColor); + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay + 50f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonMechdusaEndText2", TextColor); + } + // Otherwise do normal text + else + { + if (DefeatTimer == DelayBeforeDefeatStandup + 50f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText1", TextColor); - // After this point Draedon becomes vulnerable. - // He sits back down as well as he thinks for a bit. - // Killing him will cause gore to appear but also for Draedon to come back as a hologram. - if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 2f + 50f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText3", TextColor); + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay + 50f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText2", TextColor); - if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 3f + 165f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText4", TextColor); + // After this point Draedon becomes vulnerable. + // He sits back down as well as he thinks for a bit. + // Killing him will cause gore to appear but also for Draedon to come back as a hologram. + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 2f + 50f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText3", TextColor); - if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 4f + 165f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText5", TextColor); + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 3f + 165f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText4", TextColor); - if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 5f + 165f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText6", TextColor); + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 4f + 165f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText5", TextColor); - if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 6f + 165f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText7", TextColor); + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 5f + 165f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText6", TextColor); - if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 7f + 165f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText8", TextColor); + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 6f + 165f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText7", TextColor); - if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 8f + 165f) - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText9", TextColor); + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 7f + 165f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText8", TextColor); + + if (DefeatTimer == DelayBeforeDefeatStandup + TalkDelay * 8f + 165f) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DraedonEndText9", TextColor); + } } // Draedon should not manually despawn. @@ -661,7 +737,7 @@ namespace CalamityMod.NPCs.ExoMechs frame = 0; int frameChangeDelay = 7; - bool shouldNotSitDown = DefeatTimer > DelayBeforeDefeatStandup && DefeatTimer < TalkDelay * 2f + 10f; + bool shouldNotSitDown = (DefeatTimer > DelayBeforeDefeatStandup && DefeatTimer < TalkDelay * 2f + 10f) || (exoMechdusa && DefeatTimer > 0); NPC.frameCounter++; if (NPC.frameCounter >= frameChangeDelay) @@ -727,7 +803,7 @@ namespace CalamityMod.NPCs.ExoMechs public override bool CheckDead() { - if (BossRushEvent.BossRushActive) + if (BossRushEvent.BossRushActive || exoMechdusa) return true; if (!HasBeenKilled) @@ -763,18 +839,27 @@ namespace CalamityMod.NPCs.ExoMechs Texture2D glowmask = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonGlowmask").Value; Texture2D projector = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonProjector").Value; Texture2D projectorglow = ModContent.Request("CalamityMod/NPCs/ExoMechs/DraedonProjectorGlowmask").Value; + Texture2D gun = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifle").Value; Rectangle frame = NPC.frame; Vector2 drawPosition = NPC.Center - screenPos - Vector2.UnitY * 38f; + Vector2 gunDrawPosition = NPC.Center - screenPos - Vector2.UnitY * 48f - Vector2.UnitX * 30 * NPC.spriteDirection; Vector2 origin = frame.Size() * 0.5f; Vector2 projorigin = new Vector2(projector.Size().X, projector.Size().Y / 4) * 0.5f; + Vector2 gunorigin = new Vector2(gun.Size().X, gun.Size().Y / 4) * 0.5f; Color color = NPC.GetAlpha(drawColor); Color holoColor = new Color(color.R, color.B, color.G, 0); - SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + SpriteEffects direction = NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + SpriteEffects gunDirection = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float hoveroffset = 0; if (HasBeenKilled) hoveroffset = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2.5f) * 5f; + Vector2 playerToDrae = PlayerToFollow.Center - NPC.Center; + playerToDrae.Normalize(); + float extraRotation = PlayerToFollow.Center.X - NPC.Center.X < 0 ? -MathHelper.PiOver4 * 4 : 0; + float gunRotation = playerToDrae.ToRotation() + extraRotation; + if (!NPC.IsABestiaryIconDummy) { GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseOpacity(MathHelper.Clamp(1f - HologramEffectTimer / HologramFadeinTime, 0f, 1f) * 0.38f); @@ -795,6 +880,25 @@ namespace CalamityMod.NPCs.ExoMechs spriteBatch.Draw(glowmask, drawPosition, frame, Color.White * NPC.Opacity, NPC.rotation, origin, NPC.scale, direction, 0f); } + if (CalamityWorld.getFixedBoi && !HasBeenKilled && HologramEffectTimer >= HologramFadeinTime && !exoMechdusa) + { + CalamityUtils.EnterShaderRegion(spriteBatch); + Color outlineColor = Color.Lerp(Color.Magenta, Color.White, 0.4f); + Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it + float outlineThickness = MathHelper.Clamp(2f, 0f, 3f); + + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + + for (float i = 0; i < 1; i += 0.125f) + { + spriteBatch.Draw(gun, gunDrawPosition + (i * MathHelper.TwoPi + gunRotation).ToRotationVector2() * outlineThickness, null, outlineColor, gunRotation, gunorigin, NPC.scale, gunDirection, 0f); + } + CalamityUtils.ExitShaderRegion(spriteBatch); + spriteBatch.Draw(gun, gunDrawPosition, null, Color.White * NPC.Opacity, gunRotation, gunorigin, NPC.scale, gunDirection, 0f); + } + // Projector and beam if (HasBeenKilled) { @@ -808,7 +912,7 @@ namespace CalamityMod.NPCs.ExoMechs // Beam if (KillReappearDelay <= 0f && !leaving) { - Effect effect = Terraria.Graphics.Effects.Filters.Scene["SpreadTelegraph"].GetShader().Shader; + Effect effect = Terraria.Graphics.Effects.Filters.Scene["CalamityMod:SpreadTelegraph"].GetShader().Shader; effect.Parameters["centerOpacity"].SetValue(0.7f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.05f); effect.Parameters["mainOpacity"].SetValue(1f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.05f); effect.Parameters["halfSpreadAngle"].SetValue(MathHelper.PiOver4); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index a355a91ba9..64128e45e9 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -254,15 +254,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.Calamity().newAI[0] == 0f) NPC.ai[3] += 1f; - double numSegmentsAbleToFire = bossRush ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; + double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; if (shouldGetBuffedByBerserkPhase) - numSegmentsAbleToFire *= 1.5; + numSegmentsAbleToFire *= 1.25; float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { - float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f; + float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f; if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers @@ -301,7 +301,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = 0.1f * CommonCalamitySounds.LaserCannonSound.Volume}, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume}, NPC.Center); for (int i = 0; i < numProjectiles; i++) { @@ -371,7 +371,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); for (int i = 0; i < numProjectiles; i++) { // Fire normal lasers if head is in passive state @@ -610,20 +610,27 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool CheckActive() => false; + public override void ModifyTypeName(ref string typeName) + { + if (Main.npc[(int)NPC.ai[2]].ModNPC().exoMechdusa) + { + typeName = "Spine of XB-∞ Hekate"; + } + } + public override void HitEffect(int hitDirection, double damage) { if (NPC.soundDelay == 0) { - if (vulnerable) { NPC.soundDelay = 8; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound, NPC.Center); + SoundEngine.PlaySound(ThanatosHead.ThanatosHitSoundOpen, NPC.Center); } else { NPC.soundDelay = 3; - SoundEngine.PlaySound(CommonCalamitySounds.ExoHitSound, NPC.Center); + SoundEngine.PlaySound(ThanatosHead.ThanatosHitSoundClosed, NPC.Center); } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index ecbd57c65a..4d0ec2bb13 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -254,15 +254,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.Calamity().newAI[0] == 0f) NPC.ai[3] += 1f; - double numSegmentsAbleToFire = bossRush ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; + double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; if (shouldGetBuffedByBerserkPhase) - numSegmentsAbleToFire *= 1.5; + numSegmentsAbleToFire *= 1.25; float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { - float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f; + float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f; if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers @@ -301,7 +301,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = 0.1f * CommonCalamitySounds.LaserCannonSound.Volume }, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume }, NPC.Center); for (int i = 0; i < numProjectiles; i++) { @@ -371,7 +371,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); for (int i = 0; i < numProjectiles; i++) { // Fire normal lasers if head is in passive state @@ -611,20 +611,27 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool CheckActive() => false; + public override void ModifyTypeName(ref string typeName) + { + if (Main.npc[(int)NPC.ai[2]].ModNPC().exoMechdusa) + { + typeName = "Spine of XB-∞ Hekate"; + } + } + public override void HitEffect(int hitDirection, double damage) { if (NPC.soundDelay == 0) { - if (vulnerable) { NPC.soundDelay = 8; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound, NPC.Center); + SoundEngine.PlaySound(ThanatosHead.ThanatosHitSoundOpen, NPC.Center); } else { NPC.soundDelay = 3; - SoundEngine.PlaySound(CommonCalamitySounds.ExoHitSound, NPC.Center); + SoundEngine.PlaySound(ThanatosHead.ThanatosHitSoundClosed, NPC.Center); } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 7ef54c4bfa..c86a65bec2 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -25,8 +25,13 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public static int normalIconIndex; public static int vulnerableIconIndex; - public static readonly SoundStyle VentSound = new("CalamityMod/Sounds/Custom/ThanatosVent"); - public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/THanosLaser"); + public static readonly SoundStyle VentSound = new("CalamityMod/Sounds/Custom/ExoMechs/ThanatosVent"); + + public static readonly SoundStyle LaserSound = new("CalamityMod/Sounds/Custom/ExoMechs/THanosLaser"); + + public static readonly SoundStyle ThanatosHitSoundOpen = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen", 2) { Volume = 0.5f }; + + public static readonly SoundStyle ThanatosHitSoundClosed = new("CalamityMod/Sounds/NPCHit/ThanatosHitClosed", 3) { Volume = 0.4f }; public SlotId LaserSoundSlot; @@ -79,6 +84,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Whether the head is venting heat or not, it is vulnerable to damage during venting private bool vulnerable = false; + // Mark Thanatos as a component of the Exo Mechdusa + public bool exoMechdusa = false; + // Max time in vent phase public const float ventDuration = 180f; @@ -168,8 +176,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos //We'll probably want a custom background for Exos like ML has. //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Exo, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Under every armored plate on this machine lies an advanced weapon. This sacrifices the machine’s durability, but it makes it a very effective mass murderer.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("Under every armored plate on this machine lies an advanced weapon. This sacrifices the machine's durability, but it makes it a very effective mass murderer.") }); } @@ -195,6 +203,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos writer.Write(noContactDamageTimer); writer.Write(chargeVelocityScalar); writer.Write(vulnerable); + writer.Write(exoMechdusa); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); @@ -210,6 +219,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos noContactDamageTimer = reader.ReadInt32(); chargeVelocityScalar = reader.ReadSingle(); vulnerable = reader.ReadBoolean(); + exoMechdusa = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); @@ -219,7 +229,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } public float GetSlowdownAreaEdgeRadius(bool lastMechAlive) => - (BossRushEvent.BossRushActive ? 400f : CalamityWorld.death ? 600f : CalamityWorld.revenge ? 700f : Main.expertMode ? 800f : 1000f) * (lastMechAlive ? 0.6f : 1f) * (Main.getGoodWorld ? 0.5f : 1f); + (BossRushEvent.BossRushActive ? 400f : CalamityWorld.death ? 600f : CalamityWorld.revenge ? 700f : Main.expertMode ? 800f : 1000f) * (lastMechAlive ? 0.6f : 1f) * (CalamityWorld.getFixedBoi && !exoMechdusa ? 2 : Main.getGoodWorld ? 0.5f : 1f); public int CheckForOtherMechs(ref Player target, out bool exoPrimeAlive, out bool exoTwinsAlive) { @@ -402,8 +412,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Phase gate values float velocityAdjustTime = 20f; - float speedUpTime = lastMechAlive ? 180f : shouldGetBuffedByBerserkPhase ? 240f : 360f; - float slowDownTime = lastMechAlive ? 30f : shouldGetBuffedByBerserkPhase ? 40f : 60f; + float speedUpTime = lastMechAlive ? 180f : shouldGetBuffedByBerserkPhase ? 220f : 300f; + float slowDownTime = lastMechAlive ? 30f : shouldGetBuffedByBerserkPhase ? 40f : 50f; float chargePhaseGateValue = speedUpTime + slowDownTime; float laserBarrageDuration = lastMechAlive ? 270f : shouldGetBuffedByBerserkPhase ? 300f : 360f; @@ -483,7 +493,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float laserBarrageLocationDistance = turnDistance * 3f; // Velocity and turn speed values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); float baseVelocity = 10f * baseVelocityMult; // Increase top velocity if target is dead or if Thanatos is uncoiling @@ -495,7 +505,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.getGoodWorld) baseVelocity *= 1.15f; - float turnDegrees = baseVelocity * 0.1f * (shouldGetBuffedByBerserkPhase ? 1.25f : 1f); + float turnDegrees = baseVelocity * 0.1f * (shouldGetBuffedByBerserkPhase ? 1.25f : 1.1f); float turnSpeed = MathHelper.ToRadians(turnDegrees); float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); @@ -513,7 +523,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float deathrayVelocityScalarIncrement = 1f / deathrayDuration; // Scalar to use during laser barrage, passive and immune phases - float laserBarrageVelocityScalarIncrement = lastMechAlive ? 0.025f : shouldGetBuffedByBerserkPhase ? 0.02f : 0.015f; + float laserBarrageVelocityScalarIncrement = lastMechAlive ? 0.025f : shouldGetBuffedByBerserkPhase ? 0.0225f : 0.02f; float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime; // Passive and Immune phases @@ -522,7 +532,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos case (int)SecondaryPhase.Nothing: // Spawn the other mechs if Thanatos is first - if (otherExoMechsAlive == 0) + if (otherExoMechsAlive == 0 && !exoMechdusa) { if (spawnOtherExoMechs) { @@ -574,7 +584,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Go passive and immune if one of the other mechs is berserk // This is only called if two exo mechs are alive in ideal scenarios // This is not called if Thanatos and another one or two mechs are berserk - if (otherMechIsBerserk && !berserk) + if (otherMechIsBerserk && !berserk && !exoMechdusa) { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; @@ -603,7 +613,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIState = (float)Phase.UndergroundLaserBarrage; // Enter passive and invincible phase if one of the other exo mechs is berserk - if (otherMechIsBerserk) + if (otherMechIsBerserk && !exoMechdusa) { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; @@ -905,9 +915,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) { + if (CalamityWorld.getFixedBoi && !exoMechdusa) + { + AIState = (float)Phase.Deathray; + } + else + { + AIState = (float)Phase.Charge; + } NPC.localAI[0] = 0f; NPC.localAI[2] = 0f; - AIState = (float)Phase.Charge; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityScalar = 0f; @@ -988,6 +1005,24 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { laserSound.Position = NPC.Center; } + + if (exoMechdusa) + { + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ModNPC().exoMechdusa) + { + NPC.rotation = 0; + NPC aresin = Main.npc[CalamityGlobalNPC.draedonExoMechPrime]; + if (NPC.Calamity().newAI[0] != (float)Phase.Deathray) + { + Vector2 pos = new Vector2(aresin.Center.X - 80, aresin.Center.Y - 89); + NPC.position = pos; + NPC.Calamity().newAI[2]++; + } + } + } + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -1216,20 +1251,27 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ModifyNPCLoot(NPCLoot npcLoot) => AresBody.DefineExoMechLoot(NPC, npcLoot, (int)AresBody.MechType.Thanatos); + public override void ModifyTypeName(ref string typeName) + { + if (exoMechdusa) + { + typeName = "Spine of XB-∞ Hekate"; + } + } + public override void HitEffect(int hitDirection, double damage) { if (NPC.soundDelay == 0) { - if (vulnerable) { NPC.soundDelay = 8; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound, NPC.Center); + SoundEngine.PlaySound(ThanatosHitSoundOpen, NPC.Center); } else { NPC.soundDelay = 3; - SoundEngine.PlaySound(CommonCalamitySounds.ExoHitSound, NPC.Center); + SoundEngine.PlaySound(ThanatosHitSoundClosed, NPC.Center); } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 60187f01b8..c62205fa1e 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -254,15 +254,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.Calamity().newAI[0] == 0f) NPC.ai[3] += 1f; - double numSegmentsAbleToFire = bossRush ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; + double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; if (shouldGetBuffedByBerserkPhase) - numSegmentsAbleToFire *= 1.5; + numSegmentsAbleToFire *= 1.25; float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge) { - float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 90f; + float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f; if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers @@ -301,7 +301,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = 0.1f * CommonCalamitySounds.LaserCannonSound.Volume }, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume }, NPC.Center); for (int i = 0; i < numProjectiles; i++) { @@ -371,7 +371,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); for (int i = 0; i < numProjectiles; i++) { // Fire normal lasers if head is in passive state @@ -611,20 +611,27 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override bool CheckActive() => false; + public override void ModifyTypeName(ref string typeName) + { + if (Main.npc[(int)NPC.ai[2]].ModNPC().exoMechdusa) + { + typeName = "Spine of XB-∞ Hekate"; + } + } + public override void HitEffect(int hitDirection, double damage) { if (NPC.soundDelay == 0) { - if (vulnerable) { NPC.soundDelay = 8; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound, NPC.Center); + SoundEngine.PlaySound(ThanatosHead.ThanatosHitSoundOpen, NPC.Center); } else { NPC.soundDelay = 3; - SoundEngine.PlaySound(CommonCalamitySounds.ExoHitSound, NPC.Center); + SoundEngine.PlaySound(ThanatosHead.ThanatosHitSoundClosed, NPC.Center); } } diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 9e850f8e8d..24d911174d 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.NPCs.Astral; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -62,9 +64,17 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.DeathSound = SoundID.NPCDeath1; NPC.timeLeft = NPC.activeTime * 30; NPC.rarity = 2; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToWater = true; + if (CalamityWorld.getFixedBoi) + { + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = false; + } + else + { + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = true; + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -85,6 +95,7 @@ namespace CalamityMod.NPCs.GreatSandShark writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); + writer.Write(NPC.Calamity().newAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -94,6 +105,7 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); + NPC.Calamity().newAI[0] = reader.ReadSingle(); } public override void AI() @@ -322,7 +334,8 @@ namespace CalamityMod.NPCs.GreatSandShark if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 50, NPCID.SandShark, 0, 0f, 0f, 0f, 0f, 255); + int npcType = CalamityWorld.getFixedBoi ? ModContent.NPCType() : NPCID.SandShark; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 50, npcType, 0, 0f, 0f, 0f, 0f, 255); SoundEngine.PlaySound(RoarSound, NPC.position); } } @@ -435,9 +448,10 @@ namespace CalamityMod.NPCs.GreatSandShark Main.dust[num624].velocity.X *= 2f; } int spawnX = (int)(NPC.width / 2); + int projType = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); for (int sand = 0; sand < 5; sand++) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + (float)Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, - (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), ModContent.ProjectileType(), 40, 0f, Main.myPlayer); + (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), projType, 40, 0f, Main.myPlayer); } NPC.ai[2] = -30f; @@ -533,6 +547,26 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.rotation = NPC.velocity.Y * NPC.direction * 0.1f; NPC.rotation = MathHelper.Clamp(NPC.rotation, -0.1f, 0.1f); } + + if (CalamityWorld.getFixedBoi) + { + NPC.Calamity().newAI[0]++; + if (NPC.Calamity().newAI[0] >= 120) + { + SoundEngine.PlaySound(SoundID.Item105, Main.player[NPC.target].Center); + for (int i = 0; i < 5; i++) + { + float speedX = 2f + (float)Main.rand.Next(-8, 5); + float speedY = 2f + (float)Main.rand.Next(1, 6); + int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, Main.player[NPC.target].Center.Y - 800, speedX, speedY, ModContent.ProjectileType(), 40, 0, Main.myPlayer); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].timeLeft = 180; + } + } + NPC.Calamity().newAI[0] = 0; + } + } } public override void FindFrame(int frameHeight) @@ -556,6 +590,11 @@ namespace CalamityMod.NPCs.GreatSandShark } Color color24 = NPC.GetAlpha(drawColor); Color color25 = 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)); + if (CalamityWorld.getFixedBoi) + { + color24 = Color.Silver; + color25 = Color.Orange; + } Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value; int num156 = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; int y3 = num156 * (int)NPC.frameCounter; @@ -589,6 +628,7 @@ namespace CalamityMod.NPCs.GreatSandShark } var something = NPC.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; spriteBatch.Draw(texture2D3, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, color24, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0); + return false; } @@ -639,7 +679,7 @@ namespace CalamityMod.NPCs.GreatSandShark npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); } public override void OnKill() diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 9cf034dc37..59a1e78e2f 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -68,9 +68,13 @@ namespace CalamityMod.NPCs.HiveMind bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool getFuckedAI = CalamityWorld.getFixedBoi; + int num750 = CalamityGlobalNPC.hiveMind; if (num750 < 0 || !Main.npc[num750].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -81,19 +85,20 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.localAI[0] -= 1f; + NPC.localAI[0] -= getFuckedAI ? 10f : 1f; //Relocation rate + float RandomPositionMultiplier = getFuckedAI ? 4f : 1f; if (NPC.localAI[0] <= 0f) { NPC.localAI[0] = Main.rand.Next(180, 361); - NPC.ai[0] = Main.rand.Next(-100, 101); - NPC.ai[1] = Main.rand.Next(-100, 101); + NPC.ai[0] = Main.rand.Next(-100, 101) * RandomPositionMultiplier; //X position + NPC.ai[1] = Main.rand.Next(-100, 101) * RandomPositionMultiplier; //Y position NPC.netUpdate = true; } } NPC.TargetClosest(true); - float num751 = death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; + float num751 = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; float num752 = Main.getGoodWorld ? 256f : 128f; Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); float num189 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - vector22.X; @@ -135,7 +140,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.velocity.Y = NPC.velocity.Y * 0.8f; } - float velocityLimit = 8f; + float velocityLimit = getFuckedAI ? 32f : 8f; if (NPC.velocity.X > velocityLimit) NPC.velocity.X = velocityLimit; if (NPC.velocity.X < -velocityLimit) diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 7cc0f66249..49aaceff99 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -51,9 +51,13 @@ namespace CalamityMod.NPCs.HiveMind bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool getFuckedAI = CalamityWorld.getFixedBoi; + int num750 = CalamityGlobalNPC.hiveMind; if (num750 < 0 || !Main.npc[num750].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -64,19 +68,20 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.localAI[0] -= 1f; + NPC.localAI[0] -= getFuckedAI ? 10f : 1f; //Relocation rate + float RandomPositionMultiplier = getFuckedAI ? 2f : 1f; if (NPC.localAI[0] <= 0f) { NPC.localAI[0] = Main.rand.Next(180, 361); - NPC.ai[0] = Main.rand.Next(-100, 101); - NPC.ai[1] = Main.rand.Next(-100, 101); + NPC.ai[0] = Main.rand.Next(-100, 101) * RandomPositionMultiplier; //X position + NPC.ai[1] = Main.rand.Next(-100, 101) * RandomPositionMultiplier; //Y position NPC.netUpdate = true; } } NPC.TargetClosest(true); - float num751 = death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; + float num751 = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; float num752 = Main.getGoodWorld ? 192f : 96f; Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); float num189 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - vector22.X; @@ -118,7 +123,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.velocity.Y = NPC.velocity.Y * 0.8f; } - float velocityLimit = 8f; + float velocityLimit = getFuckedAI ? 32f : 8f; if (NPC.velocity.X > velocityLimit) NPC.velocity.X = velocityLimit; if (NPC.velocity.X < -velocityLimit) @@ -184,6 +189,15 @@ namespace CalamityMod.NPCs.HiveMind { Dust.NewDust(NPC.position, NPC.width, NPC.height, 14, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + //Spawn even more blobs on death + for (int i = 1; i < 3; i++) + { + Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); + NPC.NewNPC(NPC.GetSource_FromThis(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); + } + } } } } diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 21d34a2b71..92a9ef1e63 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -351,6 +351,10 @@ namespace CalamityMod.NPCs.HiveMind if (choice < 5) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(NPC.height), type); } + + //Spawn a Hive Cyst + if (CalamityWorld.getFixedBoi && NPC.CountNPCS(ModContent.NPCType()) < 3) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + Main.rand.Next(NPC.width), (int)NPC.position.Y + Main.rand.Next(NPC.height), ModContent.NPCType()); } private void ReelBack() @@ -509,6 +513,8 @@ namespace CalamityMod.NPCs.HiveMind int maxBlobs = death ? 15 : revenge ? 7 : expertMode ? 6 : 5; if (Main.getGoodWorld) maxBlobs *= 2; + if (CalamityWorld.getFixedBoi) + maxBlobs = 50; for (int i = 0; i < maxBlobs; i++) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); @@ -1047,7 +1053,7 @@ namespace CalamityMod.NPCs.HiveMind if (phase2) { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(15) && NPC.CountNPCS(ModContent.NPCType()) < 2) + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi ? NPC.CountNPCS(ModContent.NPCType()) < 10 : (Main.rand.NextBool(15) && NPC.CountNPCS(ModContent.NPCType()) < 2)) { Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); NPC.NewNPC(NPC.GetSource_FromThis(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); @@ -1121,7 +1127,7 @@ namespace CalamityMod.NPCs.HiveMind { string key = "Mods.CalamityMod.SkyOreText"; Color messageColor = Color.Cyan; - CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.5f, 0.7f, 3, 8); + AerialiteOreGen.Generate(true); CalamityUtils.DisplayLocalizedText(key, messageColor); } @@ -1171,7 +1177,7 @@ namespace CalamityMod.NPCs.HiveMind npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedHiveMind, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedHiveMind, ModContent.ItemType(), desc: DropHelper.FirstKillText); } } } diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveTumor.cs similarity index 69% rename from NPCs/HiveMind/HiveCyst.cs rename to NPCs/HiveMind/HiveTumor.cs index 865c16b17e..1f2e8a6f5f 100644 --- a/NPCs/HiveMind/HiveCyst.cs +++ b/NPCs/HiveMind/HiveTumor.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -6,11 +7,11 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.HiveMind { - public class HiveCyst : ModNPC + public class HiveTumor : ModNPC { public override void SetStaticDefaults() { - DisplayName.SetDefault("Hive Cyst"); + DisplayName.SetDefault("Hive Tumor"); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.BossBestiaryPriority.Add(Type); } @@ -42,7 +43,7 @@ namespace CalamityMod.NPCs.HiveMind BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCorruption, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("The blemish of a colonial superorganism, the mass of organic matter pulses like a heart. The growth is the result of the corruption’s beings forming together.") + new FlavorTextBestiaryInfoElement("The blemish of a colonial superorganism, the mass of organic matter pulses like a heart. The growth is the result of the corruption's beings forming together.") }); } @@ -54,6 +55,43 @@ namespace CalamityMod.NPCs.HiveMind NPC.frame.Y = frame * frameHeight; } + public override void AI() + { + float timeToSpawn = 120f; + + if (CalamityWorld.getFixedBoi && NPC.AnyNPCs(ModContent.NPCType())) + { + //Passively spawns random enemies + NPC.ai[0]++; + + if (NPC.ai[0] >= timeToSpawn) + { + int spawnRandomizer = Main.rand.Next(0, 5); + int type = NPCID.EaterofSouls; + + switch (spawnRandomizer) + { + case 0: + case 1: + break; + case 2: + type = NPCID.DevourerHead; + break; + case 3: + type = ModContent.NPCType(); + break; + case 4: + type = ModContent.NPCType(); + break; + default: + break; + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, type); + NPC.ai[0] = 0f; + } + } + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (CalamityGlobalNPC.AnyEvents(spawnInfo.Player)) @@ -61,7 +99,7 @@ namespace CalamityMod.NPCs.HiveMind if (spawnInfo.Player.Calamity().disableHiveCystSpawns) return 0f; - bool anyBossElements = NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); + bool anyBossElements = NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); bool corrupt = TileID.Sets.Corrupt[spawnInfo.SpawnTileType] || spawnInfo.SpawnTileType == TileID.Demonite && spawnInfo.Player.ZoneCorrupt; if (anyBossElements || spawnInfo.PlayerSafe || !corrupt) return 0f; diff --git a/NPCs/HiveMind/HiveCyst.png b/NPCs/HiveMind/HiveTumor.png similarity index 100% rename from NPCs/HiveMind/HiveCyst.png rename to NPCs/HiveMind/HiveTumor.png diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 4dabce363c..38a025d8fd 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -75,6 +75,9 @@ namespace CalamityMod.NPCs.Leviathan if (Main.getGoodWorld) NPC.scale *= 0.8f; + + if (CalamityWorld.getFixedBoi) + NPC.scale *= 4f; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -326,8 +329,9 @@ namespace CalamityMod.NPCs.Leviathan } // Play sound + float extrapitch = CalamityWorld.getFixedBoi ? -0.5f : 0; if (Main.rand.NextBool(300)) - SoundEngine.PlaySound(SoundID.Zombie35, NPC.position); + SoundEngine.PlaySound(SoundID.Zombie35 with { Pitch = SoundID.Zombie35.Pitch + extrapitch}, NPC.Center); // Time left if (NPC.timeLeft < 1800) @@ -499,7 +503,7 @@ namespace CalamityMod.NPCs.Leviathan if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103) { - SoundEngine.PlaySound(SoundID.Item85, NPC.position); + SoundEngine.PlaySound(SoundID.Item85, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, NPCID.DetonatingBubble); @@ -574,7 +578,8 @@ namespace CalamityMod.NPCs.Leviathan { NPC.rotation = NPC.velocity.X * 0.02f; - Vector2 targetVector = player.Center + new Vector2(0f, -350f) * NPC.scale; + float basey = CalamityWorld.getFixedBoi ? -100 : -350; + Vector2 targetVector = player.Center + new Vector2(0f, basey) * NPC.scale; float velocity = death ? 13.5f : 12f; velocity += 6f * enrageScale; @@ -612,19 +617,19 @@ namespace CalamityMod.NPCs.Leviathan switch ((int)NPC.localAI[3]) { case 0: - SoundEngine.PlaySound(SoundID.Item21, player.position); + SoundEngine.PlaySound(SoundID.Item21, player.Center); break; case 1: totalProjectiles = 3; type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item30, player.position); + SoundEngine.PlaySound(SoundID.Item30, player.Center); break; case 2: totalProjectiles = 6; type = ModContent.ProjectileType(); float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; Main.musicPitch = soundPitch; - SoundEngine.PlaySound(SoundID.Item26, player.position); + SoundEngine.PlaySound(SoundID.Item26, player.Center); break; } NPC.localAI[3] += 1f; diff --git a/NPCs/Leviathan/AnahitasIceShield.cs b/NPCs/Leviathan/AnahitasIceShield.cs index 891ca785a5..a488dbf1b4 100644 --- a/NPCs/Leviathan/AnahitasIceShield.cs +++ b/NPCs/Leviathan/AnahitasIceShield.cs @@ -83,8 +83,9 @@ namespace CalamityMod.NPCs.Leviathan NPC.dontTakeDamage = false; NPC.life = 0; - NPC.HitEffect(0, 10.0); + NPC.HitEffect(); NPC.active = false; + NPC.netUpdate = true; } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 938fc639cf..0378f9ac19 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -77,6 +77,8 @@ namespace CalamityMod.NPCs.Leviathan { if (CalamityGlobalNPC.leviathan < 0 || !Main.npc[CalamityGlobalNPC.leviathan].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -252,6 +254,22 @@ namespace CalamityMod.NPCs.Leviathan int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + // Explode into bubbles on gfb + if (CalamityWorld.getFixedBoi) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < Main.rand.Next(1, 5); i++) + { + int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.DetonatingBubble); + Main.npc[spawn].target = NPC.target; + Main.npc[spawn].velocity = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); + Main.npc[spawn].netUpdate = true; + Main.npc[spawn].ai[3] = Main.rand.Next(80, 121) / 100f; + } + } + } } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 8f9f0cf04a..79362ae977 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -37,6 +37,7 @@ namespace CalamityMod.NPCs.Leviathan private int counter = 0; private bool initialised = false; private int soundDelay = 0; + private float extrapitch = 0; public static Texture2D AttackTexture = null; public static readonly SoundStyle RoarMeteorSound = new("CalamityMod/Sounds/Custom/LeviathanRoarMeteor"); @@ -83,6 +84,9 @@ namespace CalamityMod.NPCs.Leviathan if (Main.getGoodWorld) NPC.scale *= 1.3f; + + if (CalamityWorld.getFixedBoi) + NPC.scale *= 0.3f; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -91,7 +95,7 @@ namespace CalamityMod.NPCs.Leviathan BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Ocean, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A gargantuan marine reptile that has lurked the ocean depths for almost a millennium. It is unknown if she is the last of her kind, and as despicable as it is, let us pray that she is.") + new FlavorTextBestiaryInfoElement("A gargantuan marine reptile that lurks the ocean depths along with the Water Elemental, Anahita. It is unknown if she is the last of her kind, or was simply manifested into existence like her master.") }); } @@ -164,8 +168,10 @@ namespace CalamityMod.NPCs.Leviathan if (soundDelay > 0) soundDelay--; + extrapitch = CalamityWorld.getFixedBoi ? 0.3f : 0f; + if (Main.rand.NextBool(600) && !spawnAnimation) - SoundEngine.PlaySound((sirenAlive && !death) ? soundChoice : soundChoiceRage, vector); + SoundEngine.PlaySound(((sirenAlive && !death) ? soundChoice : soundChoiceRage) with { Pitch = soundChoice.Pitch + extrapitch }, vector); // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -207,7 +213,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; @@ -264,7 +270,7 @@ namespace CalamityMod.NPCs.Leviathan if (calamityGlobalNPC.newAI[3] == 10f) { SoundEngine.PlaySound(EmergeSound, vector); - SoundEngine.PlaySound(soundChoiceRage, vector); + SoundEngine.PlaySound(soundChoiceRage with { Pitch = soundChoiceRage.Pitch + extrapitch }, vector); } NPC.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); @@ -384,11 +390,17 @@ namespace CalamityMod.NPCs.Leviathan num416 *= num417; vector40.X += num415 * 4f; vector40.Y += num416 * 4f; + if (CalamityWorld.getFixedBoi) + { + type = ProjectileID.Boulder; + vector40.Y -= 5; //Shoot a bit more up since boulders are affected by gravity + damage *= 2; + } Projectile.NewProjectile(NPC.GetSource_FromAI(), vector40.X, vector40.Y, num415, num416, type, damage, 0f, Main.myPlayer); if (soundDelay <= 0) { soundDelay = 120; - SoundEngine.PlaySound(RoarMeteorSound, vector); + SoundEngine.PlaySound(RoarMeteorSound with { Pitch = RoarMeteorSound.Pitch + extrapitch }, vector); } } } @@ -423,7 +435,7 @@ namespace CalamityMod.NPCs.Leviathan int spawnLimit = (sirenAlive && !phase4) ? 1 : (death ? 2 : 3); if (flag103 && NPC.CountNPCS(ModContent.NPCType()) < spawnLimit) { - SoundEngine.PlaySound(soundChoice, vector); + SoundEngine.PlaySound(soundChoice with { Pitch = soundChoice.Pitch + extrapitch }, vector); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, ModContent.NPCType()); } @@ -495,7 +507,8 @@ namespace CalamityMod.NPCs.Leviathan return; } - float chargeDistance = ((sirenAlive && !phase4) ? 1100f : 900f) * NPC.scale; + float gfbchargeboost = CalamityWorld.getFixedBoi ? 1100 : 0; + float chargeDistance = ((sirenAlive && !phase4) ? 1100f : 900f) * NPC.scale + gfbchargeboost; chargeDistance -= 50f * enrageScale; if (!sirenAlive || phase4) chargeDistance -= 250f * (1f - lifeRatio); @@ -540,7 +553,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - SoundEngine.PlaySound(RoarChargeSound, vector); + SoundEngine.PlaySound(RoarChargeSound with { Pitch = RoarChargeSound.Pitch + extrapitch }, vector); return; } @@ -810,8 +823,8 @@ namespace CalamityMod.NPCs.Leviathan // Lore bool shouldDropLore(DropAttemptInfo info) => !DownedBossSystem.downedLeviathan && LastAnLStanding(); - npcLoot.AddConditionalPerPlayer(shouldDropLore, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(shouldDropLore, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(shouldDropLore, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(shouldDropLore, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 02373e1f0e..76544e180b 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -143,7 +143,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || spawnInfo.Player.Calamity().ZoneSulphur || - NPC.LunarApocalypseIsUp) + spawnInfo.Player.PillarZone()) { return 0f; } @@ -151,7 +151,7 @@ namespace CalamityMod.NPCs.Leviathan if (!Main.hardMode) return SpawnCondition.OceanMonster.Chance * 0.025f; - if (!NPC.downedPlantBoss && !DownedBossSystem.downedCalamitas) + if (!NPC.downedPlantBoss && !DownedBossSystem.downedCalamitasClone) return SpawnCondition.OceanMonster.Chance * 0.1f; return SpawnCondition.OceanMonster.Chance * 0.4f; diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index cba026c87a..9d4d5cff7e 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -18,7 +19,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.aiStyle = 14; + NPC.aiStyle = NPCAIStyleID.Bat; NPC.damage = 18; NPC.width = 40; NPC.height = 30; @@ -42,7 +43,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, // Will move to localization whenever that is cleaned up. new FlavorTextBestiaryInfoElement("Slimes take on the qualities of their environments and after feasting on aerialite ore, this slime has grown wings.") @@ -51,12 +52,12 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || (!DownedBossSystem.downedHiveMind && !DownedBossSystem.downedPerforator) || spawnInfo.Player.Calamity().ZoneAbyss || - spawnInfo.Player.Calamity().ZoneSunkenSea) + if (spawnInfo.PlayerSafe || (!DownedBossSystem.downedHiveMind && !DownedBossSystem.downedPerforator)) { return 0f; } - return SpawnCondition.Cavern.Chance * 0.05f; + + return SpawnCondition.Sky.Chance * 0.2f; } public override void HitEffect(int hitDirection, double damage) @@ -75,5 +76,13 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 10, 26); + + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "YuH"; + } + } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index a54dabc885..f68bc7e805 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -1,4 +1,6 @@ using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using System; using Terraria; @@ -46,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - if (NPC.ai[3] > 0f) + if (NPC.ai[3] > 0f && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()) { NPC.realLife = (int)NPC.ai[3]; } @@ -65,9 +67,33 @@ namespace CalamityMod.NPCs.NormalNPCs } if (flag) { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); + if (!CalamityWorld.getFixedBoi) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + } + else + { + // find a new npc to attatch to in gfb, it's not a bug, it's a feature:tm: + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC host = Main.npc[i]; + if (host.active && !host.friendly && !host.dontTakeDamage && host.type != ModContent.NPCType() && host.type != ModContent.NPCType() && host.type != ModContent.NPCType()) + { + NPC.ai[1] = host.whoAmI; + NPC.ai[3] = host.whoAmI; + break; + } + } + // if it goes through the loop withuot finding an npc to attatch to (aka, ai[1] never changes and the head is still dead) kill as normal + if (Main.npc[(int)NPC.ai[1]].life <= 0) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + } + } } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -88,7 +114,7 @@ namespace CalamityMod.NPCs.NormalNPCs num6 *= num8; num7 *= num8; int num9 = 30; - int num10 = ProjectileID.SaucerScrap; + int num10 = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ProjectileID.SaucerScrap; vector.X += num6 * 5f; vector.Y += num7 * 5f; Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f); @@ -140,6 +166,11 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerBody").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerBody2").Type, 1f); + } } } @@ -147,5 +178,23 @@ namespace CalamityMod.NPCs.NormalNPCs { return false; } + + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Mechanized Serpent"; + } + } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 35b0ee17f4..9d92b927de 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -8,6 +9,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using Terraria.GameContent.ItemDropRules; namespace CalamityMod.NPCs.NormalNPCs { @@ -67,6 +69,20 @@ namespace CalamityMod.NPCs.NormalNPCs 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, 204, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + bool death = CalamityWorld.death; if (NPC.ai[3] > 0f) { @@ -174,7 +190,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.localAI[1] = 0f; } float num17 = death ? 13.5f : 10f; - if (Main.player[NPC.target].dead || (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0) + if (Main.player[NPC.target].dead || (!CalamityWorld.getFixedBoi && (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0)) { flag2 = false; NPC.velocity.Y = NPC.velocity.Y + 1f; @@ -263,7 +279,7 @@ namespace CalamityMod.NPCs.NormalNPCs num24 = 20f; } NPC.soundDelay = (int)num24; - SoundEngine.PlaySound(SoundID.WormDig, NPC.position); + SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); @@ -421,6 +437,11 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerHead").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerHead2").Type, 1f); + } } } @@ -439,6 +460,26 @@ namespace CalamityMod.NPCs.NormalNPCs npcLoot.Add(ModContent.ItemType(), 1, 2, 4); npcLoot.Add(ModContent.ItemType(), 1, 4, 8); npcLoot.Add(ModContent.ItemType(), 1, 4, 8); + npcLoot.AddIf(() => CalamityWorld.getFixedBoi, ModContent.ItemType(), 1, 3, 6); + npcLoot.AddIf(() => CalamityWorld.getFixedBoi, ModContent.ItemType(), 10); + } + + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Mechanized Serpent"; + } + } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; } } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index eda4a8aadb..e37362a946 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.Placeables.Banners; +using System; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -46,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - if (NPC.ai[3] > 0f) + if (NPC.ai[3] > 0f && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()) { NPC.realLife = (int)NPC.ai[3]; } @@ -63,7 +64,7 @@ namespace CalamityMod.NPCs.NormalNPCs { flag = true; } - if (flag) + if (flag && !CalamityWorld.getFixedBoi) { NPC.life = 0; NPC.HitEffect(0, 10.0); @@ -118,7 +119,30 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerTail").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerTail2").Type, 1f); + } } } + + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "Mechanized Serpent"; + } + } + + public override Color? GetAlpha(Color drawColor) + { + if (CalamityWorld.getFixedBoi) + { + Color lightColor = Color.Orange * drawColor.A; + return lightColor * NPC.Opacity; + } + else return null; + } } } diff --git a/NPCs/NormalNPCs/AuroraSpirit.cs b/NPCs/NormalNPCs/AuroraSpirit.cs index b97d47781a..b20482385e 100644 --- a/NPCs/NormalNPCs/AuroraSpirit.cs +++ b/NPCs/NormalNPCs/AuroraSpirit.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.aiStyle = 86; + NPC.aiStyle = NPCAIStyleID.AncientVision; NPC.damage = 40; NPC.width = 40; NPC.height = 24; @@ -93,7 +93,7 @@ namespace CalamityMod.NPCs.NormalNPCs !spawnInfo.Player.PillarZone() && !spawnInfo.Player.ZoneDungeon && !spawnInfo.Player.InSunkenSea() && - Main.hardMode && !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.01f : 0f; + Main.hardMode && !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.03f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index 24e21cff08..c241c39384 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -18,7 +18,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; AIType = NPCID.ToxicSludge; NPC.damage = 80; NPC.width = 40; @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.NormalNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("With the solar energy released from the profaned goddess’ destruction, uelibloom has sprouted in the jungle’s mud, and in the slimes which inhabit the biome.") + new FlavorTextBestiaryInfoElement("With the solar energy released from the profaned goddess' destruction, uelibloom has sprouted in the jungle's mud, and in the slimes which inhabit the biome.") }); } diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index bc16d7c0ef..8910a10d6e 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); + CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -71,6 +71,12 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 155, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bohldohr").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bohldohr2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bohldohr3").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index 6bc1046c32..0e8c842b3f 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -1,10 +1,11 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; @@ -22,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { NPC.npcSlots = 0.5f; - NPC.aiStyle = 91; + NPC.aiStyle = NPCAIStyleID.GraniteElemental; NPC.damage = 20; NPC.width = NPC.height = 30; NPC.defense = 10; @@ -95,8 +96,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { + int debuffType = CalamityWorld.getFixedBoi ? ModContent.BuffType() : BuffID.Confused; if (damage > 0) - player.AddBuff(BuffID.Confused, 180, true); + player.AddBuff(debuffType, 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index c77631eae0..a74ba5b01b 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -113,6 +113,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 32, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmber").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmber2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler2").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 98a00c4e28..27e615ac5e 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -112,6 +112,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 70, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmethyst").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmethyst2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler2").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 6ebc72b49f..827aae25cd 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -113,6 +113,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerCrystal").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerCrystal2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler2").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index dfa2e03f30..0e29b1acc4 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -113,6 +113,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 91, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerDiamond").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerDiamond2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler2").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 2a2a54f0b0..bea4d5dd02 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -113,6 +113,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 89, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerEmerald").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerEmerald2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler2").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 3cc9ccee11..7a4e209d0a 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -113,6 +113,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 12, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerRuby").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerRuby2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler2").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 0b4f932123..20ce82a3c6 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -113,6 +113,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerSapphire").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerSapphire2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler2").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index 9bb26400e1..97a56458c4 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -113,6 +113,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 147, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerTopaz").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerTopaz2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Crawler2").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index f108311403..afd835dd90 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; AIType = NPCID.DungeonSlime; NPC.damage = 30; NPC.width = 60; diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 8f64bcb39b..77c478972d 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; AIType = NPCID.DungeonSlime; NPC.damage = 30; NPC.width = 40; @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundSnow, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("When the release of Cryogen’s magic slightly thawed the frozen metal which rested underground, the resulting meltwater formed these. Remnants of the ore still reside within them.") + new FlavorTextBestiaryInfoElement("When the release of Cryogen's magic slightly thawed the frozen metal which rested underground, the resulting meltwater formed these. Remnants of the ore still reside within them.") }); } diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 2c418a2654..b117d4b13e 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 6f : 4f, 5f, CalamityWorld.death ? 0.15f : 0.1f); + CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, CalamityWorld.death ? 0.2f : CalamityWorld.revenge ? 0.15f : 0.1f); } public override void FindFrame(int frameHeight) @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.NormalNPCs !spawnInfo.Player.PillarZone() && !spawnInfo.Player.ZoneDungeon && !spawnInfo.Player.InSunkenSea() && - Main.hardMode && !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.015f : 0f; + Main.hardMode && !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.045f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index cb25ea6287..f682cb0baa 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; AIType = NPCID.DungeonSlime; NPC.damage = 30; NPC.width = 60; diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index d5eb2da337..ebe360e15d 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -167,8 +167,12 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 value53 = NPC.Center + new Vector2((float)(NPC.direction * 20), 6f); Vector2 vector251 = Main.player[NPC.target].Center - value53; bool flag104 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1); + + if (NPC.justHit) + NPC.localAI[0] = -90f; + NPC.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= Main.rand.Next(90, 601)) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 150f) { NPC.localAI[0] = -90f; NPC.netUpdate = true; @@ -190,8 +194,7 @@ namespace CalamityMod.NPCs.NormalNPCs } else { - Vector2 vec = Vector2.Normalize(Main.player[NPC.target].Center - NPC.Center); - vec = Vector2.Normalize(Main.player[NPC.target].Center - NPC.Center + Main.player[NPC.target].velocity * 20f); + Vector2 vec = Vector2.Normalize(Main.player[NPC.target].Center - NPC.Center + Main.player[NPC.target].velocity * 20f); if (vec.HasNaNs()) { vec = new Vector2((float)NPC.direction, 0f); @@ -316,7 +319,11 @@ namespace CalamityMod.NPCs.NormalNPCs } if (spawnInfo.Player.Calamity().ZoneAbyssLayer3 && spawnInfo.Water) { - return 0.05f; + return 0.25f; + } + if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.Water) + { + return 0.5f; } return 0f; } diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 9a8ff50d0e..5a316e6fe9 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -126,13 +126,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.velocity.X = 0f; return; } - float num65 = CalamityWorld.death ? 3f : 1f; - float num66 = CalamityWorld.death ? 0.28f : 0.08f; - if (!CalamityWorld.death) - { - num65 += (1f - (float)NPC.life / (float)NPC.lifeMax) * 2f; - num66 += (1f - (float)NPC.life / (float)NPC.lifeMax) * 0.2f; - } + float num65 = CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2f : 1f; + float num66 = CalamityWorld.death ? 0.28f : CalamityWorld.revenge ? 0.18f : 0.08f; + num65 += (1f - (float)NPC.life / (float)NPC.lifeMax) * 2f; + num66 += (1f - (float)NPC.life / (float)NPC.lifeMax) * 0.2f; if (NPC.velocity.X < -num65 || NPC.velocity.X > num65) { if (NPC.velocity.Y == 0f) diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 7aba30530a..55d71540a1 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -137,6 +137,11 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Frogfish").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Frogfish2").Type, 1f); + } } } } diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index bc064aaf59..a0fbf3581d 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -1,17 +1,18 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using System.IO; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { @@ -63,7 +64,7 @@ namespace CalamityMod.NPCs.NormalNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("It is civilization’s goal to wrest nature under its control. This is the result of one such conquest, an artificial elemental, run by clockwork gears.") + new FlavorTextBestiaryInfoElement("It is civilization's goal to wrest nature under its control. This is the result of one such conquest, an artificial elemental, run by clockwork gears.") }); } @@ -119,7 +120,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (NPC.life <= 0) { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); NPC.position.X = NPC.position.X + (NPC.width / 2); NPC.position.Y = NPC.position.Y + (NPC.height / 2); NPC.width = 160; @@ -201,6 +202,10 @@ namespace CalamityMod.NPCs.NormalNPCs { if (NPC.ai[0] == 0f) { + if (CalamityWorld.getFixedBoi) + { + SoundEngine.PlaySound(SoundID.ScaryScream, Main.player[NPC.target].Center); + } NPC.ai[0] = 1f; NPC.dontTakeDamage = false; } diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index a4d95e6cbc..0faec74453 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -141,6 +141,10 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.velocity.Y = NPC.velocity.Y - num2; } + + if (NPC.justHit) + NPC.localAI[0] = 0f; + NPC.localAI[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= 150f) { @@ -255,7 +259,7 @@ namespace CalamityMod.NPCs.NormalNPCs !spawnInfo.Player.PillarZone() && !spawnInfo.Player.ZoneDungeon && !spawnInfo.Player.InSunkenSea() && - Main.hardMode && !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.007f : 0f; + Main.hardMode && !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.02f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -279,6 +283,12 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 92, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("IceClasper").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("IceClasper2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("IceClasper3").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index e9357ff3bc..7f77a232f5 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; @@ -54,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A burning spirit, with no regard or acknowledgment for its surroundings. Anyone who intrudes upon the Profaned Goddess’ holy grounds will be turned to ash.") + new FlavorTextBestiaryInfoElement("A burning spirit, with no regard or acknowledgment for its surroundings. Anyone who intrudes upon the Profaned Goddess' holy grounds will be turned to ash.") }); } @@ -121,7 +122,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.TargetClosest(true); NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.2f; NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * 0.2f; - float velocityMax = CalamityWorld.death ? 16f : 12f; + float velocityMax = CalamityWorld.death ? 16f : CalamityWorld.revenge ? 14f : 12f; if (NPC.velocity.X > velocityMax) { NPC.velocity.X = velocityMax; @@ -138,8 +139,12 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.velocity.Y = -velocityMax; } + + if (NPC.justHit) + NPC.localAI[0] = 0f; + NPC.localAI[0] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= (CalamityWorld.death ? 60f : 90f)) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] >= (CalamityWorld.death ? 50f : CalamityWorld.revenge ? 70f : 90f)) { NPC.localAI[0] = 0f; if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) @@ -265,7 +270,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 2, 4); - npcLoot.Add(ModContent.ItemType(), 15); + npcLoot.Add(ModContent.ItemType(), 15); + npcLoot.Add(ModContent.ItemType(), 20); } public override void HitEffect(int hitDirection, double damage) @@ -280,6 +286,12 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ImpiousImmolator").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ImpiousImmolator2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ImpiousImmolator3").Type, 1f); + } } } } diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index eeb395f0c7..702bae1886 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -45,6 +45,8 @@ namespace CalamityMod.NPCs.NormalNPCs // Despawn if (!NPC.AnyNPCs(NPCID.KingSlime)) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -138,7 +140,7 @@ namespace CalamityMod.NPCs.NormalNPCs } } - SoundEngine.PlaySound(SoundID.Item8, NPC.position); + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); int damage = NPC.GetProjectileDamage(type); if (CalamityWorld.death || BossRushEvent.BossRushActive) { diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index cb1c640ccc..4e278eaa5c 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 10; NPC.DR_NERD(0.1f); NPC.lifeMax = 30; - NPC.aiStyle = 3; + NPC.aiStyle = NPCAIStyleID.Fighter; AIType = NPCID.Crab; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit1; @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.NormalNPCs { num78 = 2.5f - num79; } - num78 *= (CalamityWorld.death ? 1.2f : 0.8f); + num78 *= (CalamityWorld.death ? 1.2f : CalamityWorld.revenge ? 1f : 0.8f); if (NPC.velocity.X < -num78 || NPC.velocity.X > num78) { if (NPC.velocity.Y == 0f) @@ -120,7 +120,10 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.OceanMonster.Chance * 0.2f; } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.AddIf(() => NPC.downedPlantBoss, ModContent.ItemType(), 5); + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.AddIf(() => NPC.downedPlantBoss, ModContent.ItemType(), 5); + } public override void HitEffect(int hitDirection, double damage) { @@ -134,6 +137,12 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MantisShrimp").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MantisShrimp2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MantisShrimp3").Type, 1f); + } } } } diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 6d6f8af240..6d92a055a2 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) < 400f) { - num65 += (CalamityWorld.death ? 6f : 4f) - ((Main.player[NPC.target].Center - NPC.Center).Length() * 0.01f); + num65 += (CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f) - ((Main.player[NPC.target].Center - NPC.Center).Length() * 0.01f); } if (NPC.velocity.X < -num65 || NPC.velocity.X > num65) { diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index eb431e4b69..da1214e3ac 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; AIType = NPCID.ToxicSludge; NPC.damage = 35; NPC.width = 40; diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 8a83df625f..fc64d080b6 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - float speed = CalamityWorld.death ? 22f : 17f; + float speed = CalamityWorld.death ? 22f : CalamityWorld.revenge ? 19.5f : 17f; CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); int num822 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index 13d9ac3f4e..9ff54d76ab 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - float speed = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 16f : 12f; + float speed = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 16f : CalamityWorld.revenge ? 14f : 12f; CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); int num822 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; @@ -73,39 +73,21 @@ namespace CalamityMod.NPCs.NormalNPCs float num147 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2) - vector17.X; float num148 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2) - vector17.Y; float num149 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); - if (num149 > 800f) + + if (NPC.justHit) + NPC.ai[2] = 0f; + + NPC.ai[2] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] >= 150f) { NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - return; - } - NPC.ai[2] += 1f; - if (NPC.ai[3] == 0f) - { - if (NPC.ai[2] > 120f) - { - NPC.ai[2] = 0f; - NPC.ai[3] = 1f; - NPC.netUpdate = true; - return; - } - } - else - { - if (NPC.ai[2] > 40f) - { - NPC.ai[3] = 0f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 20f) - { - float num151 = 10f; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - num149 = num151 / num149; - num147 *= num149; - num148 *= num149; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector17.X, vector17.Y, num147, num148, type, damage, 0f, Main.myPlayer, 0f, 0f); - } + float num151 = 10f; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + num149 = num151 / num149; + num147 *= num149; + num148 *= num149; + Projectile.NewProjectile(NPC.GetSource_FromAI(), vector17.X, vector17.Y, num147, num148, type, damage, 0f, Main.myPlayer, 0f, 0f); } } diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index d8ffffda9c..efbc8375f9 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - float speed = CalamityWorld.death ? 18f : 13.5f; + float speed = CalamityWorld.death ? 18f : CalamityWorld.revenge ? 15.75f : 13.5f; CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); int num822 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 0181a4f2ca..293ff2f4f5 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - float speed = CalamityWorld.death ? 20f : 15f; + float speed = CalamityWorld.death ? 20f : CalamityWorld.revenge ? 17.5f : 15f; CalamityAI.DungeonSpiritAI(NPC, Mod, speed, -MathHelper.PiOver2); int num822 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Phantoplasm, 0f, 0f, 0, default, 1f); Dust dust = Main.dust[num822]; diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 95357c79b4..6c39262cbc 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 26; NPC.height = 26; NPC.lifeMax = 2000; - NPC.aiStyle = 7; + NPC.aiStyle = NPCAIStyleID.Passive; AIType = NPCID.Squirrel; NPC.knockBackResist = 0.99f; NPC.value = Item.buyPrice(0, 2, 0, 0); diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index 39ec13c759..5c37ed85bc 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -100,6 +100,12 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedEnergyBody").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedEnergyBody2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedEnergyBody3").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index 278267eda4..ba8f8715ee 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -78,7 +78,10 @@ namespace CalamityMod.NPCs.NormalNPCs } if (!Main.npc[num750].active || CalamityGlobalNPC.energyFlame < 0) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; + NPC.netUpdate = true; return; } Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f); diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index 00597e0a31..3d81daf5b6 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -83,9 +83,9 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.rand.NextBool(900)) { - SoundEngine.PlaySound(GrowlSound, NPC.position); + SoundEngine.PlaySound(GrowlSound, NPC.Center); } - bool phase2 = (double)NPC.life <= (double)NPC.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); + bool phase2 = (double)NPC.life <= (double)NPC.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); if (phase2) { if (!reset) @@ -99,10 +99,10 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.ai[1] += 1f; } - CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); + CalamityAI.UnicornAI(NPC, Mod, true, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 5f, 0.2f); return; } - CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 6f : 4f, 6f, CalamityWorld.death ? 0.1f : 0.07f); + CalamityAI.UnicornAI(NPC, Mod, false, CalamityWorld.death ? 8f : CalamityWorld.revenge ? 6f : 4f, 6f, CalamityWorld.death ? 0.1f : CalamityWorld.revenge ? 0.085f : 0.07f); } public override void FindFrame(int frameHeight) @@ -146,7 +146,7 @@ namespace CalamityMod.NPCs.NormalNPCs !spawnInfo.Player.PillarZone() && !spawnInfo.Player.ZoneDungeon && !spawnInfo.Player.InSunkenSea() && - !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.012f : 0f; + !spawnInfo.PlayerInTown && !spawnInfo.Player.ZoneOldOneArmy && !Main.snowMoon && !Main.pumpkinMoon ? 0.03f : 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -167,6 +167,13 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AngryDog").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AngryDog2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AngryDog3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AngryDog4").Type, 1f); + } } } diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index ea741f902d..d472a6e309 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.aiStyle = 26; + NPC.aiStyle = NPCAIStyleID.Unicorn; NPC.damage = 18; NPC.width = 46; NPC.height = 30; diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index a1187770c1..a55ae13fd4 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.NormalNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("The brute force of the Profaned Goddess’ creations and devotees. Their jaws are filled to the brim with razor-sharp crystals and scorching holy flames.") + new FlavorTextBestiaryInfoElement("The brute force of the Profaned Goddess' creations and devotees. Their jaws are filled to the brim with razor-sharp crystals and scorching holy flames.") }); } @@ -83,9 +83,13 @@ namespace CalamityMod.NPCs.NormalNPCs { num321 = 12; } + if (CalamityWorld.revenge) + { + num321 /= 2; + } if (CalamityWorld.death) { - num321 /= 4; + num321 /= 2; } if (NPC.ai[2] < (float)num321) { @@ -124,6 +128,7 @@ namespace CalamityMod.NPCs.NormalNPCs else NPC.velocity.Y = 12f; } + if (!CalamityWorld.getFixedBoi) SoundEngine.PlaySound(JumpSound, NPC.Center); } NPC.netUpdate = true; diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs index f2a5f4dc96..6baa1b7601 100644 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ b/NPCs/NormalNPCs/SeaUrchin.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.OceanMonster.Chance * 0.2f; } - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 15, 25); + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 30, 50); public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 2d13083219..daae2edd71 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -55,6 +55,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { + if (NPC.justHit) + NPC.localAI[0] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.localAI[0] += 1f; @@ -85,13 +88,14 @@ namespace CalamityMod.NPCs.NormalNPCs } npcPos.X += velocity.X; npcPos.Y += velocity.Y; - for (int num186 = 0; num186 < 2; num186++) + int spread = Main.getGoodWorld ? 100 : 20; + for (int num186 = 0; num186 < (Main.getGoodWorld ? 10 : 2); num186++) { velocity = Main.player[NPC.target].Center - npcPos; targetDist = velocity.Length(); targetDist = projSpeed / targetDist; - velocity.X += Main.rand.Next(-20, 21); - velocity.Y += Main.rand.Next(-20, 21); + velocity.X += Main.rand.Next(-spread, spread + 1); + velocity.Y += Main.rand.Next(-spread, spread + 1); velocity.X *= targetDist; velocity.Y *= targetDist; Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, velocity, projType, projDmg, 0f, Main.myPlayer, 0f, 0f); @@ -391,6 +395,12 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 234, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ShockstormShuttle").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ShockstormShuttle2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ShockstormShuttle3").Type, 1f); + } } } @@ -400,7 +410,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.Sky.Chance * 0.1f; + return SpawnCondition.Sky.Chance * (Main.getGoodWorld ? 0.5f : 0.1f); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index 43a9eef39f..f8eda0b762 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { NPC.damage = 20; - NPC.aiStyle = 3; + NPC.aiStyle = NPCAIStyleID.Fighter; NPC.width = 33; NPC.height = 31; NPC.defense = 8; @@ -103,6 +103,8 @@ namespace CalamityMod.NPCs.NormalNPCs { npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType(), 5); + npcLoot.Add(ItemID.ThunderSpear, 25); + npcLoot.Add(ItemID.ThunderStaff, 25); } } } diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index 3aabe1d59b..0e1946869f 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -1,15 +1,17 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { @@ -39,7 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs AIType = -1; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit50; - NPC.DeathSound = DeathSound; + NPC.DeathSound = CalamityWorld.getFixedBoi ? AresGaussNuke.NukeExplosionSound : DeathSound; NPC.knockBackResist = 0.7f; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -55,7 +57,7 @@ namespace CalamityMod.NPCs.NormalNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Some creatures which skirt the edges of our atmosphere tend to absorb and channel the sun’s rays better than others. At any rate, this is a passive creature that means you no harm. You should return the favor.") + new FlavorTextBestiaryInfoElement("Some creatures which skirt the edges of our atmosphere tend to absorb and channel the sun's rays better than others. At any rate, this is a passive creature that means you no harm. You should return the favor.") }); } @@ -242,6 +244,12 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, 64, hitDirection, -1f, 0, default, 1f); } + if (CalamityWorld.getFixedBoi) + { + float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } } } } diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index 1450ba70fc..09e0394f0c 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -1,15 +1,15 @@ -using Microsoft.Xna.Framework; +using System.IO; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; -using System; -using ReLogic.Utilities; -using Terraria; namespace CalamityMod.NPCs.NormalNPCs { public class SuperDummyNPC : ModNPC { + public int deathCounter = 0; public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -30,7 +30,33 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.value = 0f; NPC.knockBackResist = 0f; NPC.netAlways = true; - NPC.aiStyle = 0; + NPC.aiStyle = NPCAIStyleID.FaceClosestPlayer; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(deathCounter); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + deathCounter = reader.ReadInt32(); + } + + public override bool PreAI() + { + if (CalamityWorld.getFixedBoi) + { + deathCounter++; + // If you don't attack the Dummy for a minute in gfb, it becomes sentient + if (deathCounter >= 6000) + { + NPC.damage = NPC.lifeMax; + CalamityGlobalAI.BuffedMimicAI(NPC, Mod); + return false; + } + } + return true; } public override void UpdateLifeRegen(ref int damage) @@ -47,6 +73,11 @@ namespace CalamityMod.NPCs.NormalNPCs { // Dummy AI, no way NPC.ai[0] = hitDirection * -NPC.direction; + // Reset hit timer if it isn't enraged + if (deathCounter > 0 && deathCounter < 6000) + { + deathCounter = 0; + } } public override void FindFrame(int frameHeight) @@ -63,9 +94,9 @@ namespace CalamityMod.NPCs.NormalNPCs } // Hit from behind - if (NPC.ai[0] == -1) + if (NPC.ai[0] == -1 || deathCounter > 6000) { - if (NPC.justHit && NPC.frame.Y > frameHeight * 2) + if ((NPC.justHit || deathCounter > 6000) && NPC.frame.Y > frameHeight * 2) { NPC.frame.Y = frameHeight; } diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 19ad751af2..94977b6d96 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -1,18 +1,19 @@ -using CalamityMod.Items.Accessories; +using System; +using System.Collections.Generic; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using Terraria.Audio; namespace CalamityMod.NPCs.NormalNPCs { @@ -395,6 +396,15 @@ namespace CalamityMod.NPCs.NormalNPCs texture = ModContent.Request(Texture).Value; Main.EntitySpriteDraw(texture, NPC.Center - screenPos, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, direction, 0); } + if (CalamityWorld.getFixedBoi) + { + // I ran out of ideas, so Cloud just gets a hat like how I wanted GSS to + Texture2D hattexture = ModContent.Request("CalamityMod/Particles/WulfrumHat").Value; + SpriteEffects hatdirection = NPC.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + int xoffset = NPC.direction == 1 ? 70 : 20; + Vector2 offset = new Vector2(xoffset, -10); + Main.EntitySpriteDraw(hattexture, NPC.Center - screenPos + offset, null, NPC.GetAlpha(Color.LightBlue), NPC.rotation, NPC.frame.Size() * 0.5f, NPC.scale, hatdirection, 0); + } return false; } diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs index c45f317dee..1ef28edff9 100644 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ b/NPCs/NormalNPCs/WildBumblefuck.cs @@ -1,7 +1,11 @@ using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +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; @@ -73,10 +77,29 @@ namespace CalamityMod.NPCs.NormalNPCs } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 5, 7); + public override void OnKill() + { + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + for (int i = 0; i < 5; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } public override void FindFrame(int frameHeight) { NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; + if (CalamityWorld.getFixedBoi) + { + NPC.frameCounter += 2D; + } if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base { NPC.frameCounter = 0D; diff --git a/NPCs/NormalNPCs/WulfrumAmplifier.cs b/NPCs/NormalNPCs/WulfrumAmplifier.cs index a04abe97b0..b035802526 100644 --- a/NPCs/NormalNPCs/WulfrumAmplifier.cs +++ b/NPCs/NormalNPCs/WulfrumAmplifier.cs @@ -88,7 +88,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.netMode != NetmodeID.MultiplayerClient && !Charging && NPC.Distance(player.Center) < ChargeRadiusMax * 0.667f) { // Spawn some off-screen enemies to act as threats if the player enters the field. - int enemiesToSpawn = CalamityWorld.death ? 2 : 1; + int enemiesToSpawn = CalamityWorld.death ? 3 : CalamityWorld.revenge ? 2 : 1; for (int i = 0; i < enemiesToSpawn; i++) { int tries = 0; diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index 905ebcc267..8d540aa1b9 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -1,14 +1,15 @@ -using CalamityMod.Items.Accessories; +using System; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Sounds; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; -using CalamityMod.Sounds; namespace CalamityMod.NPCs.NormalNPCs { @@ -79,6 +80,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { NPC.frameCounter++; + if (CalamityWorld.getFixedBoi) + { + NPC.frameCounter += 1; + } int frame = (int)(NPC.frameCounter / 5) % (Main.npcFrameCount[NPC.type] / 2); if (Supercharged) frame += Main.npcFrameCount[NPC.type] / 2; diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index 9102f35f25..fcd74f7473 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -197,7 +197,7 @@ namespace CalamityMod.NPCs.NormalNPCs float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + NPC.whoAmI * 0.2f)); float noiseScale = 0.6f; - Effect shieldEffect = Terraria.Graphics.Effects.Filters.Scene["RoverDriveShield"].GetShader().Shader; + Effect shieldEffect = Terraria.Graphics.Effects.Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.24f); shieldEffect.Parameters["blowUpPower"].SetValue(2.5f); shieldEffect.Parameters["blowUpSize"].SetValue(0.5f); diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index bacd6c58e1..020935d87e 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs.OldDuke bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Despite appearing old and decrepit, it clings to life. It does not seem native to the polluted sea, yet it has taken its place as its apex predator.") + new FlavorTextBestiaryInfoElement("One of the first descendants of the Dragons, its reign as the apex sea monster has been long forgotten. However, its power is still immense due to its heritage.") }); } @@ -125,6 +125,14 @@ namespace CalamityMod.NPCs.OldDuke NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + typeName = "The Boomer Duke"; + } + } + public override void FindFrame(int frameHeight) { bool tired = NPC.Calamity().newAI[1] == 1f; @@ -452,7 +460,7 @@ namespace CalamityMod.NPCs.OldDuke npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBoomerDuke, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedBoomerDuke, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 444aabb43a..3f03282aa2 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -1,23 +1,18 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using System; -using System.IO; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; using CalamityMod.Events; -using Terraria.Audio; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.NPCs.OldDuke { public class OldDukeToothBall : ModNPC { - bool spawnedProjectiles = false; public override void SetStaticDefaults() { this.HideFromBestiary(); @@ -33,12 +28,11 @@ namespace CalamityMod.NPCs.OldDuke NPC.width = 40; NPC.height = 40; NPC.defense = 0; - NPC.lifeMax = 3750; + NPC.lifeMax = 8000; if (BossRushEvent.BossRushActive) { - NPC.lifeMax = 7500; + NPC.lifeMax = 16000; } - NPC.alpha = 255; NPC.knockBackResist = 0f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath11; @@ -50,20 +44,10 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToWater = false; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.dontTakeDamage); - writer.Write(spawnedProjectiles); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.dontTakeDamage = reader.ReadBoolean(); - spawnedProjectiles = reader.ReadBoolean(); - } - public override void AI() { + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.65f, 0.55f, 0f); + bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -71,9 +55,6 @@ namespace CalamityMod.NPCs.OldDuke NPC.rotation += NPC.velocity.X * 0.05f; - if (NPC.alpha > 0) - NPC.alpha -= 15; - NPC.TargetClosest(false); Player player = Main.player[NPC.target]; if (!player.active || player.dead) @@ -92,68 +73,72 @@ namespace CalamityMod.NPCs.OldDuke NPC.timeLeft = 600; Vector2 vector = player.Center - NPC.Center; - if (vector.Length() < 40f || NPC.ai[3] >= 900f) - { - NPC.dontTakeDamage = false; - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - return; - } - + float cannonballMovementGateValue = 120f; + float slowDownGateValue = cannonballMovementGateValue + 300f; + float dieGateValue = slowDownGateValue + 60f; NPC.ai[3] += 1f; - NPC.dontTakeDamage = NPC.ai[3] >= 600f ? false : true; - if (NPC.ai[3] >= 480f) + if (vector.Length() < 40f || NPC.ai[3] >= dieGateValue) { - NPC.velocity *= 0.985f; + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); return; } - float num1372 = death ? 14f : revenge ? 13f : 12f; + if (NPC.ai[3] < cannonballMovementGateValue) + { + Vector2 finalCannonballVelocity = new Vector2(NPC.ai[0], NPC.ai[1]); + if (NPC.velocity.Length() < finalCannonballVelocity.Length()) + { + NPC.velocity *= 1.01f; + if (NPC.velocity.Length() > finalCannonballVelocity.Length()) + { + NPC.velocity.Normalize(); + NPC.velocity *= finalCannonballVelocity.Length(); + } + } + + return; + } + + if (NPC.ai[3] > slowDownGateValue) + { + NPC.velocity *= 0.95f; + return; + } + + float velocity = death ? 14f : revenge ? 13f : 12f; if (expertMode) { - float speedUpMult = bossRush ? 0.015f : 0.01f; - num1372 += Vector2.Distance(player.Center, NPC.Center) * speedUpMult; + float speedUpMult = bossRush ? 0.01f : 0.005f; + velocity += Vector2.Distance(player.Center, NPC.Center) * speedUpMult; } Vector2 vector167 = new Vector2(NPC.Center.X + NPC.direction * 20, NPC.Center.Y + 6f); float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); - float num1376 = num1372 / num1375; + float num1376 = velocity / num1375; num1373 *= num1376; num1374 *= num1376; - NPC.ai[0] -= Main.rand.Next(6); - if (num1375 < 300f || NPC.ai[0] > 0f) + + NPC.ai[2] -= Main.rand.Next(6); + if (num1375 < 300f || NPC.ai[2] > 0f) { if (num1375 < 300f) - { - NPC.ai[0] = 100f; - } + NPC.ai[2] = 100f; + if (NPC.velocity.X < 0f) - { NPC.direction = -1; - } else - { NPC.direction = 1; - } + return; } - NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f; - NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f; - if (num1375 < 350f) - { - NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f; - NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f; - } - if (num1375 < 300f) - { - NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f; - NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f; - } + float inertia = 50f; + NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f); + NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f); float num1247 = bossRush ? 0.65f : 0.5f; for (int num1248 = 0; num1248 < Main.maxNPCs; num1248++) @@ -184,6 +169,43 @@ namespace CalamityMod.NPCs.OldDuke int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = CalamityWorld.death ? 5 : CalamityWorld.revenge ? 4 : 3; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float velocity = 10f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255 * 0.1f, type, damage, 0f, Main.myPlayer, vector255.X, vector255.Y); + } + + if (Main.expertMode) + { + type = ModContent.ProjectileType(); + damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + } + } + + if (CalamityWorld.getFixedBoi) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spawnX = NPC.width / 2; + int type = ModContent.ProjectileType(); + for (int i = 0; i < 2; i++) + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center.X + Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, + Main.rand.Next(-1, 2), Main.rand.Next(-6, -3), type, NPC.damage / 2, 0f, Main.myPlayer); + } + } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -194,7 +216,7 @@ namespace CalamityMod.NPCs.OldDuke public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = ImmunityCooldownID.Bosses; - return NPC.alpha == 0; + return true; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -203,78 +225,48 @@ namespace CalamityMod.NPCs.OldDuke player.AddBuff(ModContent.BuffType(), 240); } - public override bool CheckDead() - { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); - - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = NPC.height = 96; - NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (NPC.height / 2); - - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - Main.dust[num622].noGravity = true; - } - - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles) - { - spawnedProjectiles = true; - int totalProjectiles = 6; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - for (int k = 0; k < totalProjectiles; k++) - { - float velocity = Main.rand.Next(7, 11); - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, damage, 0f, Main.myPlayer); - } - - type = ModContent.ProjectileType(); - damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); - } - - return true; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - NPC.Opacity = 1f; - return true; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + + NPC.position.X = NPC.position.X + NPC.width / 2; + NPC.position.Y = NPC.position.Y + NPC.height / 2; + NPC.width = NPC.height = 96; + NPC.position.X = NPC.position.X - NPC.width / 2; + NPC.position.Y = NPC.position.Y - NPC.height / 2; + + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + Main.dust[num622].noGravity = true; + } + + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OldDukeToothBallGore").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OldDukeToothBallGore2").Type, NPC.scale); } } } diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index 9e3fdf3d02..40189cc096 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -19,7 +19,6 @@ namespace CalamityMod.NPCs.OldDuke { public class SulphurousSharkron : ModNPC { - bool spawnedProjectiles = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Sharkron"); @@ -49,7 +48,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0f; - NPC.alpha = 255; + NPC.Opacity = 0f; NPC.noGravity = true; NPC.dontTakeDamage = true; NPC.noTileCollide = true; @@ -76,18 +75,18 @@ namespace CalamityMod.NPCs.OldDuke { writer.Write(NPC.dontTakeDamage); writer.Write(NPC.noGravity); - writer.Write(spawnedProjectiles); } public override void ReceiveExtraAI(BinaryReader reader) { NPC.dontTakeDamage = reader.ReadBoolean(); NPC.noGravity = reader.ReadBoolean(); - spawnedProjectiles = reader.ReadBoolean(); } public override void AI() { + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.7f * NPC.Opacity, 0.9f * NPC.Opacity, 0f); + bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -110,9 +109,9 @@ namespace CalamityMod.NPCs.OldDuke NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); } - NPC.alpha -= 6; - if (NPC.alpha < 0) - NPC.alpha = 0; + NPC.Opacity += 0.025f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; // Fly towards Old Duke bool normalAI = NPC.ai[3] == 0f; @@ -120,17 +119,12 @@ namespace CalamityMod.NPCs.OldDuke // Fly up bool upwardAI = NPC.ai[3] < 0f; - // Fly down - bool downwardAI = NPC.ai[3] > 0f; - float flyTowardTargetGateValue = bossRush ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; - float extraTime = bossRush ? 90f : death ? 100f : revenge ? 105f : expertMode ? 110f : 120f; + float extraTime = bossRush ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; float aiGateValue = flyTowardTargetGateValue + extraTime; - if (!normalAI) - aiGateValue -= extraTime * 0.3f; - float explodeIntoGoreGateValue = aiGateValue + extraTime; - float fallDownGateValue = aiGateValue + extraTime * 0.5f; - float maxVelocity = bossRush ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; + float dieGateValue = aiGateValue + extraTime * 4f; + float fallDownGateValue = aiGateValue + extraTime; + float maxVelocity = bossRush ? 22f : death ? 20f : revenge ? 19f : expertMode ? 18f : 16f; if (NPC.ai[0] == 0f) { @@ -138,11 +132,11 @@ namespace CalamityMod.NPCs.OldDuke if (NPC.ai[1] == 0f) { if (normalAI) - NPC.velocity = Vector2.Normalize(Main.npc[(int)NPC.ai[2]].Center - NPC.Center) * (maxVelocity - 6f); + NPC.velocity = Vector2.Normalize(Main.npc[(int)NPC.ai[2]].Center - NPC.Center) * (maxVelocity * 0.67f); else NPC.velocity = new Vector2(NPC.ai[2], NPC.ai[3]); - SoundEngine.PlaySound(SoundID.NPCDeath19, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath19, NPC.Center); } // Fly towards a target after a certain time has passed @@ -165,7 +159,7 @@ namespace CalamityMod.NPCs.OldDuke Vector2 vector17 = Main.player[NPC.target].Center - NPC.Center; vector17.Normalize(); vector17 *= scaleFactor2; - float inertia = bossRush ? 16f : death ? 18f : revenge ? 20f : expertMode ? 22f : 25f; + float inertia = bossRush ? 20f : death ? 23f : revenge ? 25f : expertMode ? 27f : 30f; NPC.velocity = (NPC.velocity * (inertia - 1f) + vector17) / inertia; NPC.velocity.Normalize(); NPC.velocity *= scaleFactor2; @@ -185,15 +179,14 @@ namespace CalamityMod.NPCs.OldDuke // Explode into gores if colliding with tiles or after a certain time has passed NPC.ai[1] += 1f; - if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height) || NPC.ai[1] >= explodeIntoGoreGateValue) + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height) || NPC.ai[1] >= dieGateValue) { if (NPC.DeathSound.HasValue) - SoundEngine.PlaySound(NPC.DeathSound.GetValueOrDefault(), NPC.position); + SoundEngine.PlaySound(NPC.DeathSound.GetValueOrDefault(), NPC.Center); NPC.life = 0; - NPC.HitEffect(0, 10.0); + NPC.HitEffect(); NPC.checkDead(); - NPC.active = false; return; } @@ -204,6 +197,29 @@ namespace CalamityMod.NPCs.OldDuke NPC.velocity.Y += 0.3f; } } + + float pushVelocity = 0.5f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) + { + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 160f) + { + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X -= pushVelocity; + else + NPC.velocity.X += pushVelocity; + + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y -= pushVelocity; + else + NPC.velocity.Y += pushVelocity; + } + } + } + } } public override void OnKill() @@ -211,6 +227,18 @@ namespace CalamityMod.NPCs.OldDuke int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) + { + int spawnX = NPC.width / 2; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < 10; i++) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, + Main.rand.Next(-3, 4), Main.rand.Next(-12, -6), type, damage, 0f, Main.myPlayer); + } + } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -259,7 +287,7 @@ namespace CalamityMod.NPCs.OldDuke public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = ImmunityCooldownID.Bosses; - return NPC.alpha == 0; + return NPC.Opacity == 1f; } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -268,62 +296,49 @@ namespace CalamityMod.NPCs.OldDuke player.AddBuff(ModContent.BuffType(), 240); } - public override bool CheckDead() - { - SoundEngine.PlaySound(SoundID.NPCDeath12, NPC.position); - - NPC.position.X = NPC.position.X + (NPC.width / 2); - NPC.position.Y = NPC.position.Y + (NPC.height / 2); - NPC.width = NPC.height = 96; - NPC.position.X = NPC.position.X - (NPC.width / 2); - NPC.position.Y = NPC.position.Y - (NPC.height / 2); - - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity.Y *= 6f; - Main.dust[num622].velocity.X *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity.X *= 2f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !spawnedProjectiles) - { - spawnedProjectiles = true; - int spawnX = NPC.width / 2; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - for (int i = 0; i < 2; i++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, - Main.rand.Next(-3, 4), Main.rand.Next(-12, -6), type, damage, 0f, Main.myPlayer); - } - - return true; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 20; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); + + SoundEngine.PlaySound(SoundID.NPCDeath12, NPC.Center); + + NPC.position.X = NPC.position.X + (NPC.width / 2); + NPC.position.Y = NPC.position.Y + (NPC.height / 2); + NPC.width = NPC.height = 96; + NPC.position.X = NPC.position.X - (NPC.width / 2); + NPC.position.Y = NPC.position.Y - (NPC.height / 2); + + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity.Y *= 6f; + Main.dust[num622].velocity.X *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity.Y *= 10f; + num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity.X *= 2f; + } + + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSharkronGore").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSharkronGore2").Type, NPC.scale); } } } diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 48e81dd963..b79b9f2b5a 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -198,6 +199,21 @@ namespace CalamityMod.NPCs.Perforator int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, damage, 0f, Main.myPlayer); + + for (int i = -1; i < 2; i++) //releases 3 Ichor Shots + { + int type2 = ModContent.ProjectileType(); + Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); + int spread = Main.rand.Next(16, 36); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, damage, 0f, Main.myPlayer); + } + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index a5c83fe2de..49d71cc819 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Perforator BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCrimson, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A pulsing patch of anarchistic eyes and teeth. It is the culmination of the crimson’s flesh and should be avoided at all costs.") + new FlavorTextBestiaryInfoElement("A pulsing patch of anarchistic eyes and teeth. It is the culmination of the crimson's flesh and should be avoided at all costs.") }); } diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 12f97db502..a7eb47ee07 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -301,6 +302,34 @@ namespace CalamityMod.NPCs.Perforator } } + //This is possibly the best or worst idea ever conceived + float laserOffset = 1500f; + float laserVelocity = 4f; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + if (CalamityWorld.getFixedBoi) + NPC.Calamity().newAI[3]++; + + if (NPC.Calamity().newAI[3] > 180f) //Effectively 10 seconds but give a little headstart in case players kill it too fast + { + if (NPC.Calamity().newAI[3] % 60 == 59) + { + SoundEngine.PlaySound(SoundID.Item12, player.Center); + for (int i = -7; i < 8; i++) //15 lasers + { + float laserGap = (i * 128f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - laserOffset, player.Center.Y + laserGap, laserVelocity, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + + if (NPC.Calamity().newAI[3] >= 300f) + NPC.Calamity().newAI[3] = -300f; + } + float num18 = speed; float num19 = turnSpeed; float burrowDistance = bossRush ? 500f : 800f; @@ -403,7 +432,7 @@ namespace CalamityMod.NPCs.Perforator num24 = 20f; } NPC.soundDelay = (int)num24; - SoundEngine.PlaySound(SoundID.WormDig, NPC.position); + SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); float num25 = Math.Abs(num20); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 64d3519743..4679cf2016 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -310,7 +311,7 @@ namespace CalamityMod.NPCs.Perforator num54 = 20f; NPC.soundDelay = (int)num54; - SoundEngine.PlaySound(SoundID.WormDig, NPC.position); + SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); @@ -469,6 +470,21 @@ namespace CalamityMod.NPCs.Perforator if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, damage, 0f, Main.myPlayer); + + for (int i = -1; i < 2; i++) //releases 3 Ichor Shots + { + int type2 = ModContent.ProjectileType(); + Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); + int spread = Main.rand.Next(16, 36); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, damage, 0f, Main.myPlayer); + } + } + for (int i = 0; i < Main.maxNPCs; i++) { if (i != NPC.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPC.type || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType())) diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 8fe9f753f2..c7be664939 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -273,184 +273,217 @@ namespace CalamityMod.NPCs.Perforator } } } - float num18 = speed; - float num19 = turnSpeed; - Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float num20 = player.position.X + (float)(player.width / 2); - float num21 = player.position.Y + (float)(player.height / 2); - num20 = (float)((int)(num20 / 16f) * 16); - num21 = (float)((int)(num21 / 16f) * 16); - vector3.X = (float)((int)(vector3.X / 16f) * 16); - vector3.Y = (float)((int)(vector3.Y / 16f) * 16); - num20 -= vector3.X; - num21 -= vector3.Y; - float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - if (!flag2) + + if (CalamityWorld.getFixedBoi && CalamityGlobalNPC.perfHive >= 0) + NPC.ai[0]++; + + //GFB movement + if (NPC.ai[0] >= 300f && CalamityGlobalNPC.perfHive >= 0) { - NPC.TargetClosest(true); - NPC.velocity.Y = NPC.velocity.Y + 0.15f; - if (NPC.velocity.Y > num17) + flag2 = false; + + NPC Hive = Main.npc[CalamityGlobalNPC.perfHive]; + Vector2 targetDistance = Hive.Center - NPC.Center; + float velocity = 16f; + float acceleration = 0.15f; + //Move towards the hive really quickly + if (targetDistance.Length() > 32f) + CalamityUtils.SmoothMovement(NPC, 0f, targetDistance, velocity, acceleration, true); + else { - NPC.velocity.Y = num17; + //Go and succ it + NPC.Center = Hive.Center + (Vector2.UnitY * 4f).RotatedBy(NPC.rotation); + Hive.localAI[1]++; } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) + + if (NPC.ai[0] >= 600f) { - if (NPC.velocity.X < 0f) - { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; - } - else - { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; - } - } - else if (NPC.velocity.Y == num17) - { - if (NPC.velocity.X < num20) - { - NPC.velocity.X = NPC.velocity.X + num18; - } - else if (NPC.velocity.X > num20) - { - NPC.velocity.X = NPC.velocity.X - num18; - } - } - else if (NPC.velocity.Y > 4f) - { - if (NPC.velocity.X < 0f) - { - NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; - } - else - { - NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; - } + NPC.ai[0] = 0f; + Hive.localAI[1] = 0f; } } + //Normal movement else { - if (NPC.soundDelay == 0) + float num18 = speed; + float num19 = turnSpeed; + Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float num20 = player.position.X + (float)(player.width / 2); + float num21 = player.position.Y + (float)(player.height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + if (!flag2) { - float num24 = num22 / 40f; - if (num24 < 10f) + NPC.TargetClosest(true); + NPC.velocity.Y = NPC.velocity.Y + 0.15f; + if (NPC.velocity.Y > num17) { - num24 = 10f; + NPC.velocity.Y = num17; } - if (num24 > 20f) + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4) { - num24 = 20f; - } - NPC.soundDelay = (int)num24; - SoundEngine.PlaySound(SoundID.WormDig, NPC.position); - } - num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); - float num25 = Math.Abs(num20); - float num26 = Math.Abs(num21); - float num27 = num17 / num22; - num20 *= num27; - num21 *= num27; - if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) - { - if (NPC.velocity.X < num20) - { - NPC.velocity.X = NPC.velocity.X + num19; - } - else if (NPC.velocity.X > num20) - { - NPC.velocity.X = NPC.velocity.X - num19; - } - if (NPC.velocity.Y < num21) - { - NPC.velocity.Y = NPC.velocity.Y + num19; - } - else if (NPC.velocity.Y > num21) - { - NPC.velocity.Y = NPC.velocity.Y - num19; - } - } - if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) - { - if (NPC.velocity.X < num20) - { - NPC.velocity.X = NPC.velocity.X + num18; - } - else if (NPC.velocity.X > num20) - { - NPC.velocity.X = NPC.velocity.X - num18; - } - if (NPC.velocity.Y < num21) - { - NPC.velocity.Y = NPC.velocity.Y + num18; - } - else if (NPC.velocity.Y > num21) - { - NPC.velocity.Y = NPC.velocity.Y - num18; - } - if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) - { - if (NPC.velocity.Y > 0f) + if (NPC.velocity.X < 0f) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; } else { - NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; } } - if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) + else if (NPC.velocity.Y == num17) { - if (NPC.velocity.X > 0f) + if (NPC.velocity.X < num20) { - NPC.velocity.X = NPC.velocity.X + num18 * 2f; + NPC.velocity.X = NPC.velocity.X + num18; + } + else if (NPC.velocity.X > num20) + { + NPC.velocity.X = NPC.velocity.X - num18; + } + } + else if (NPC.velocity.Y > 4f) + { + if (NPC.velocity.X < 0f) + { + NPC.velocity.X = NPC.velocity.X + num18 * 0.9f; } else { - NPC.velocity.X = NPC.velocity.X - num18 * 2f; - } - } - } - else if (num25 > num26) - { - if (NPC.velocity.X < num20) - { - NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; - } - else if (NPC.velocity.X > num20) - { - NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + num18; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - num18; + NPC.velocity.X = NPC.velocity.X - num18 * 0.9f; } } } else { - if (NPC.velocity.Y < num21) + if (NPC.soundDelay == 0) { - NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + NPC.soundDelay = (int)num24; + SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); } - else if (NPC.velocity.Y > num21) + num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); + float num25 = Math.Abs(num20); + float num26 = Math.Abs(num21); + float num27 = num17 / num22; + num20 *= num27; + num21 *= num27; + if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))) { - NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; + if (NPC.velocity.X < num20) + { + NPC.velocity.X = NPC.velocity.X + num19; + } + else if (NPC.velocity.X > num20) + { + NPC.velocity.X = NPC.velocity.X - num19; + } + if (NPC.velocity.Y < num21) + { + NPC.velocity.Y = NPC.velocity.Y + num19; + } + else if (NPC.velocity.Y > num21) + { + NPC.velocity.Y = NPC.velocity.Y - num19; + } } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)) { - if (NPC.velocity.X > 0f) + if (NPC.velocity.X < num20) { NPC.velocity.X = NPC.velocity.X + num18; } - else + else if (NPC.velocity.X > num20) { NPC.velocity.X = NPC.velocity.X - num18; } + if (NPC.velocity.Y < num21) + { + NPC.velocity.Y = NPC.velocity.Y + num18; + } + else if (NPC.velocity.Y > num21) + { + NPC.velocity.Y = NPC.velocity.Y - num18; + } + if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f))) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + num18 * 2f; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - num18 * 2f; + } + } + if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f))) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + num18 * 2f; + } + else + { + NPC.velocity.X = NPC.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (NPC.velocity.X < num20) + { + NPC.velocity.X = NPC.velocity.X + num18 * 1.1f; + } + else if (NPC.velocity.X > num20) + { + NPC.velocity.X = NPC.velocity.X - num18 * 1.1f; + } + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + num18; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - num18; + } + } + } + else + { + if (NPC.velocity.Y < num21) + { + NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f; + } + else if (NPC.velocity.Y > num21) + { + NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f; + } + if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + num18; + } + else + { + NPC.velocity.X = NPC.velocity.X - num18; + } + } } } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 264ca3e7b2..e1866fe2c4 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -82,7 +82,7 @@ namespace CalamityMod.NPCs.Perforator BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundCrimson, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Though birthed by the crimson, it is unknown whether they fully serve that creator. The worms of the hive frequently carve huge tunnels in the crimson’s flesh.") + new FlavorTextBestiaryInfoElement("Though birthed by the crimson, it is unknown whether they fully serve that creator. The worms of the hive frequently carve huge tunnels in the crimson's flesh.") }); } @@ -191,6 +191,33 @@ namespace CalamityMod.NPCs.Perforator else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; + //GFB seed shenanigans: Behavior during the suck + if (NPC.localAI[1] >= 6f) + { + //Leak projectiles everywhere and start healing + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int spread = Main.rand.Next(-45, 46); + Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread)), type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + + //Heals 10 times per second for 0.1% of its health each = 1% per second + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = (int)(NPC.lifeMax / 1000); + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; + + if (healAmt > 0) + { + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; + } + } + NPC.localAI[1] = 0f; + } + bool largeWormAlive = NPC.AnyNPCs(ModContent.NPCType()); bool mediumWormAlive = NPC.AnyNPCs(ModContent.NPCType()); bool smallWormAlive = NPC.AnyNPCs(ModContent.NPCType()); @@ -247,7 +274,7 @@ namespace CalamityMod.NPCs.Perforator NPC.TargetClosest(); - SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.Center); for (int num621 = 0; num621 < 16; num621++) { @@ -300,7 +327,7 @@ namespace CalamityMod.NPCs.Perforator { NPC.ai[2] = 0f; - SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.Center); for (int num621 = 0; num621 < 32; num621++) { @@ -361,7 +388,7 @@ namespace CalamityMod.NPCs.Perforator if (NPC.localAI[0] >= (revenge ? 200f : 250f) + wormsAlive * 150f && NPC.position.Y + NPC.height < player.position.Y && Vector2.Distance(player.Center, NPC.Center) > 80f) { NPC.localAI[0] = 0f; - SoundEngine.PlaySound(SoundID.NPCHit20, NPC.position); + SoundEngine.PlaySound(SoundID.NPCHit20, NPC.Center); for (int num621 = 0; num621 < 8; num621++) { @@ -494,7 +521,7 @@ namespace CalamityMod.NPCs.Perforator { string key = "Mods.CalamityMod.SkyOreText"; Color messageColor = Color.Cyan; - CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.5f, 0.7f, 3, 8); + AerialiteOreGen.Generate(true); CalamityUtils.DisplayLocalizedText(key, messageColor); } @@ -546,7 +573,7 @@ namespace CalamityMod.NPCs.Perforator npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPerforator, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPerforator, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 0b97787ed1..ae75dbe7ec 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -189,6 +190,21 @@ namespace CalamityMod.NPCs.Perforator int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, damage, 0f, Main.myPlayer); + + for (int i = -1; i < 2; i++) //releases 3 Ichor Shots + { + int type2 = ModContent.ProjectileType(); + Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); + int spread = Main.rand.Next(16, 36); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, damage, 0f, Main.myPlayer); + } + } } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index 7bfb6436e6..2675d0cc05 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetDefaults() { NPC.npcSlots = 0.5f; - NPC.aiStyle = 14; + NPC.aiStyle = NPCAIStyleID.Bat; AIType = NPCID.GiantFlyingFox; AnimationType = NPCID.GiantFlyingFox; NPC.damage = 55; @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.PlagueEnemies BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Its face is warped and softened by the corrosive effects of the plague nanobots, and it seeks to share that uncomfortable fate with others under both its own will, and the plague’s.") + new FlavorTextBestiaryInfoElement("Its face is warped and softened by the corrosive effects of the plague nanobots, and it seeks to share that uncomfortable fate with others under both its own will, and the plague's.") }); } @@ -81,6 +81,12 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Melter").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Melter2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Melter3").Type, 1f); + } } } diff --git a/NPCs/PlagueEnemies/PestilentSlime.cs b/NPCs/PlagueEnemies/PestilentSlime.cs index ba3ec2df9a..faeda5baf6 100644 --- a/NPCs/PlagueEnemies/PestilentSlime.cs +++ b/NPCs/PlagueEnemies/PestilentSlime.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; NPC.damage = 55; NPC.width = 40; NPC.height = 30; @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.PlagueEnemies } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { - SoundEngine.PlaySound(SoundID.Item42, NPC.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); for (int n = 0; n < 5; n++) { Vector2 vector4 = new Vector2((float)(n - 2), -4f); @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.PlagueEnemies } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { - SoundEngine.PlaySound(SoundID.Item42, NPC.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); num15 = Main.player[NPC.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); num16 = 6.5f / num16; diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index c748d9c36f..31a800c6ce 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.defense = 20; NPC.scale *= 0.5f; NPC.lifeMax = 200; - NPC.aiStyle = 5; + NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; NPC.knockBackResist = 0f; AnimationType = NPCID.Bee; @@ -147,6 +147,12 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger").Type, 0.5f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger2").Type, 0.5f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger3").Type, 0.5f); + } } } } diff --git a/NPCs/PlagueEnemies/PlagueChargerLarge.cs b/NPCs/PlagueEnemies/PlagueChargerLarge.cs index 63630cc804..21beb335d9 100644 --- a/NPCs/PlagueEnemies/PlagueChargerLarge.cs +++ b/NPCs/PlagueEnemies/PlagueChargerLarge.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.defense = 25; NPC.scale *= 0.75f; NPC.lifeMax = 300; - NPC.aiStyle = 5; + NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; NPC.knockBackResist = 0f; AnimationType = NPCID.Bee; @@ -147,6 +147,12 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger").Type, 0.75f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger2").Type, 0.75f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger3").Type, 0.75f); + } } } } diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index 28edae4408..ac60e0cb88 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -58,6 +58,10 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; + if (CalamityWorld.getFixedBoi) + { + NPC.scale = 2f; + } } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -184,7 +188,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.velocity.X = num1045 * num1047; NPC.velocity.Y = num1046 * num1047; NPC.spriteDirection = NPC.direction; - SoundEngine.PlaySound(SoundID.Roar, NPC.position); + SoundEngine.PlaySound(SoundID.Roar, NPC.Center); return; } NPC.localAI[0] = 0f; @@ -351,7 +355,7 @@ namespace CalamityMod.NPCs.PlagueEnemies } if (Collision.CanHit(vector119, 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && flag103) { - SoundEngine.PlaySound(SoundID.NPCHit8, NPC.position); + SoundEngine.PlaySound(SoundID.NPCHit8, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int num1061; @@ -449,7 +453,7 @@ namespace CalamityMod.NPCs.PlagueEnemies } if (flag104 && NPC.position.Y + (float)NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) { - SoundEngine.PlaySound(SoundID.Item42, NPC.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { float num1070 = 6f; diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index 47d5f9d3c6..009e264843 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { NPC.npcSlots = 2f; NPC.damage = 80; - NPC.aiStyle = 39; + NPC.aiStyle = NPCAIStyleID.GiantTortoise; NPC.width = 46; NPC.height = 32; NPC.defense = 32; @@ -66,6 +66,12 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Plagueshell").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Plagueshell2").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Plagueshell3").Type, 1f); + } } } diff --git a/NPCs/PlagueEnemies/Viruling.cs b/NPCs/PlagueEnemies/Viruling.cs index f543c2cebf..bec85a332e 100644 --- a/NPCs/PlagueEnemies/Viruling.cs +++ b/NPCs/PlagueEnemies/Viruling.cs @@ -69,12 +69,17 @@ namespace CalamityMod.NPCs.PlagueEnemies { NPC.TargetClosest(true); } - float num = 6f; //2 + float num = 6f; float num2 = 0.05f; + if (CalamityWorld.revenge) + { + num *= 1.25f; + num2 *= 1.25f; + } if (CalamityWorld.death) { - num *= 1.5f; - num2 *= 1.5f; + num *= 1.25f; + num2 *= 1.25f; } Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); float num4 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 0c85500cb8..2e2c810552 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -214,10 +215,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool CheckDead() { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); - NPC.width = NPC.height = 216; + NPC.width = NPC.height = CalamityWorld.getFixedBoi ? 300 : 216; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 15; num621++) @@ -246,7 +247,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void OnHitPlayer(Player player, int damage, bool crit) { if (damage > 0) + { + if (CalamityWorld.getFixedBoi) // it is the plague, you get very sick. + { + player.AddBuff(ModContent.BuffType(), 240, true); + player.AddBuff(BuffID.Poisoned, 240, true); + player.AddBuff(BuffID.Venom, 240, true); + } player.AddBuff(ModContent.BuffType(), 240, true); + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index b862944858..72561fed4c 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -131,15 +132,23 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void OnHitPlayer(Player player, int damage, bool crit) { if (damage > 0) + { + if (CalamityWorld.getFixedBoi) // it is the plague, you get very sick. + { + player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(BuffID.Poisoned, 300, true); + player.AddBuff(BuffID.Venom, 300, true); + } player.AddBuff(ModContent.BuffType(), 300, true); + } } public override bool CheckDead() { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); NPC.position.X = NPC.position.X + (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2); - NPC.width = NPC.height = 216; + NPC.width = NPC.height = CalamityWorld.getFixedBoi ? 300 : 216; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); for (int num621 = 0; num621 < 15; num621++) diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 74fde73556..d3438f5a4f 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -177,7 +177,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; @@ -624,7 +624,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (flag103) { - SoundEngine.PlaySound(SoundID.NPCHit8, NPC.position); + SoundEngine.PlaySound(SoundID.NPCHit8, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -704,7 +704,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (flag103) { - SoundEngine.PlaySound(SoundID.Item88,NPC.position); + SoundEngine.PlaySound(SoundID.Item88,NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -768,7 +768,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.ai[1] % num650 == (num650 - 1) && vectorCenter.Y < player.position.Y) { - SoundEngine.PlaySound(SoundID.Item42, NPC.position); + SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -798,6 +798,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath break; } + if (CalamityWorld.getFixedBoi) + { + type = ModContent.ProjectileType(); + } + int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), vector121.X, vector121.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, challengeAmt, player.position.Y); NPC.netUpdate = true; @@ -873,6 +878,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float speed = revenge ? 6f : 5f; speed += 2f * enrageScale; + bool gaussMode = false; + int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -880,14 +887,33 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath baseVelocity.Normalize(); baseVelocity *= speed; + if (Main.rand.NextBool(10) && CalamityWorld.getFixedBoi) + { + type = ModContent.ProjectileType(); + baseVelocity *= 0.75f; + gaussMode = true; + } + else if (Main.rand.NextBool(2) && CalamityWorld.getFixedBoi) + { + type = ModContent.ProjectileType(); + baseVelocity *= 0.4f; + } + int missiles = bossRush ? 16 : MissileProjectiles; int spread = bossRush ? 18 : 24; - for (int i = 0; i < missiles; i++) + if (!gaussMode) { - Vector2 spawn = vectorCenter; // Normal = 96, Boss Rush = 144 - spawn.X += i * (int)(spread * 1.125) - (missiles * (spread / 2)); // Normal = -96 to 93, Boss Rush = -144 to 156 - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / missiles))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), spawn, velocity, type, damage, 0f, Main.myPlayer, nukeBarrageChallengeAmt, player.position.Y); + for (int i = 0; i < missiles; i++) + { + Vector2 spawn = vectorCenter; // Normal = 96, Boss Rush = 144 + spawn.X += i * (int)(spread * 1.125) - (missiles * (spread / 2)); // Normal = -96 to 93, Boss Rush = -144 to 156 + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / missiles))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawn, velocity, type, damage, 0f, Main.myPlayer, nukeBarrageChallengeAmt, player.position.Y); + } + } + else + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, baseVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -1284,7 +1310,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPlaguebringer, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPlaguebringer, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -1296,7 +1322,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void OnHitPlayer(Player player, int damage, bool crit) { if (damage > 0) + { + if (CalamityWorld.getFixedBoi) // it is the plague, you get very sick. + { + player.AddBuff(ModContent.BuffType(), 480, true); + player.AddBuff(BuffID.Poisoned, 480, true); + player.AddBuff(BuffID.Venom, 480, true); + } player.AddBuff(ModContent.BuffType(), 480, true); + } } } } diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index 2020b73185..c84fbc4f94 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -39,6 +39,10 @@ namespace CalamityMod.NPCs.Polterghast NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.Calamity().VulnerableToSickness = false; + if (CalamityWorld.getFixedBoi) + { + NPC.dontTakeDamage = true; + } } public override void SendExtraAI(BinaryWriter writer) @@ -68,6 +72,8 @@ namespace CalamityMod.NPCs.Polterghast if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return false; diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 05780000ca..ec8d03b98a 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -94,6 +94,8 @@ namespace CalamityMod.NPCs.Polterghast if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -379,7 +381,7 @@ namespace CalamityMod.NPCs.Polterghast // Emit dust if (!reachedChargingPoint) { - SoundEngine.PlaySound(SoundID.Item125, NPC.position); + SoundEngine.PlaySound(SoundID.Item125, NPC.Center); for (int i = 0; i < 30; i++) { int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index bc90e19d4e..9f2e1bba8e 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -15,12 +15,14 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; +using System.Collections.Generic; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; @@ -50,20 +52,48 @@ namespace CalamityMod.NPCs.Polterghast } private int despawnTimer = 600; + private int soundTimer = 0; private bool reachedChargingPoint = false; + private bool threeAM = false; + private int nameStage = 1; public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/PolterghastHit"); public static readonly SoundStyle P2Sound = new("CalamityMod/Sounds/Custom/PolterghastP2Transition"); public static readonly SoundStyle P3Sound = new("CalamityMod/Sounds/Custom/PolterghastP3Transition"); public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/PolterghastSpawn"); public static readonly SoundStyle PhantomSound = new("CalamityMod/Sounds/Custom/PolterghastPhantomSpawn"); + public List creepySounds = new List + { + NPCs.DevourerofGods.DevourerofGodsHead.AttackSound, + NPCs.Providence.Providence.HolyRaySound, + NPCs.ExoMechs.Ares.AresBody.EnragedSound, + NPCs.ExoMechs.Ares.AresBody.LaserStartSound, + NPCs.ExoMechs.Thanatos.ThanatosHead.VentSound, + NPCs.SupremeCalamitas.SupremeCalamitas.SepulcherSummonSound, + NPCs.SupremeCalamitas.SupremeCalamitas.SpawnSound, + NPCs.Ravager.RavagerBody.LimbLossSound, + NPCs.HiveMind.HiveMind.RoarSound, + NPCs.Yharon.Yharon.RoarSound, + NPCs.DesertScourge.DesertScourgeHead.RoarSound, + NPCs.OldDuke.OldDuke.RoarSound, + NPCs.Abyss.ReaperShark.SearchRoarSound, + NPCs.Abyss.ReaperShark.EnragedRoarSound, + NPCs.Abyss.LuminousCorvina.ScreamSound, + NPCs.Abyss.DevilFish.MaskBreakSound, + NPCs.AdultEidolonWyrm.AdultEidolonWyrmHead.RoarSound, + NPCs.GreatSandShark.GreatSandShark.RoarSound, + NPCs.AcidRain.Mauler.RoarSound, + NPCs.AstrumDeus.AstrumDeusHead.DeathSound, + NPCs.AstrumAureus.AstrumAureus.HitSound + }; + public override void SetStaticDefaults() { DisplayName.SetDefault("Polterghast"); Main.npcFrameCount[NPC.type] = 12; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -96,11 +126,21 @@ namespace CalamityMod.NPCs.Polterghast bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Screaming and crying, a cacophony of spirits in anguish tear through the narrow hallways of the dungeon, searching for more—alive or dead—to add to their numbers.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("Screaming and crying, a cacophony of spirits in anguish tear through the narrow hallways of the dungeon, searching for more—alive or dead—to add to their numbers.") }); } + public override void ModifyTypeName(ref string typeName) + { + typeName = nameStage switch + { + 2 => "Necroghast", + 3 => "Necroplasm", + _ => "Polterghast", + }; + } + public override void BossHeadSlot(ref int index) { bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -126,6 +166,7 @@ namespace CalamityMod.NPCs.Polterghast { writer.Write(despawnTimer); writer.Write(reachedChargingPoint); + writer.Write(threeAM); CalamityGlobalNPC cgn = NPC.Calamity(); writer.Write(cgn.newAI[0]); writer.Write(cgn.newAI[1]); @@ -137,6 +178,7 @@ namespace CalamityMod.NPCs.Polterghast { despawnTimer = reader.ReadInt32(); reachedChargingPoint = reader.ReadBoolean(); + threeAM = reader.ReadBoolean(); CalamityGlobalNPC cgn = NPC.Calamity(); cgn.newAI[0] = reader.ReadSingle(); cgn.newAI[1] = reader.ReadSingle(); @@ -187,7 +229,11 @@ namespace CalamityMod.NPCs.Polterghast chargePhaseGateValue *= 0.5f; bool chargePhase = calamityGlobalNPC.newAI[0] >= chargePhaseGateValue; - int chargeAmt = getPissed ? 4 : phase3 ? 3 : phase2 ? 2 : 1; + int chargeAmt = getPissed ? 4 : phase3 ? 3 : phase2 ? 2 : 1; + if (CalamityWorld.getFixedBoi) + { + chargeAmt = phase4 ? int.MaxValue : getPissed ? 6 : phase3 ? 4 : phase2 ? 3 : 2; + } float chargeVelocity = getPissed ? 28f : phase3 ? 24f : phase2 ? 22f : 20f; float chargeAcceleration = getPissed ? 0.7f : phase3 ? 0.6f : phase2 ? 0.55f : 0.5f; float chargeDistance = 480f; @@ -195,6 +241,16 @@ namespace CalamityMod.NPCs.Polterghast bool reset = NPC.ai[2] >= chargePhaseGateValue + 120f; float speedUpDistance = 480f - 360f * (1f - lifeRatio); + if ((Main.time >= 27000 && Main.time < 30600 && Main.dayTime == false && CalamityWorld.getFixedBoi) || threeAM) + { + threeAM = true; + chargeVelocity *= 2; + chargeAcceleration *= 2; + chargeDistance *= 3; + if (!phase4) + chargeAmt *= 2; + } + // Only get a new target while not charging if (!chargePhase) { @@ -239,8 +295,22 @@ namespace CalamityMod.NPCs.Polterghast } } + // Play a random creepy sound every once in a while in the zenith seed + if (CalamityWorld.getFixedBoi) + { + soundTimer++; + int gate = threeAM ? 60 : phase4 ? 300 : phase3 ? 420 : phase2 ? 540 : 600; + if (soundTimer % gate == 0) + { + SoundStyle[] creepyArray = creepySounds.ToArray(); + SoundStyle selectedSound = creepyArray[Main.rand.Next(0, creepyArray.Length - 1)]; + SoundEngine.PlaySound(selectedSound with { Pitch = selectedSound.Pitch - 0.8f, Volume = selectedSound.Volume - 0.2f}, NPC.Center); + } + } + // Stop rain - CalamityMod.StopRain(); + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); // Set time left if (NPC.timeLeft < 1800) @@ -254,6 +324,16 @@ namespace CalamityMod.NPCs.Polterghast NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255); + + if (CalamityWorld.getFixedBoi) + { + for (int I = 0; I < 3; I++) + { + int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(vector.X + (Math.Sin(I * 120) * 500)), (int)(vector.Y + (Math.Cos(I * 120) * 500)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); + NPC npc2 = Main.npc[spawn]; + npc2.ai[0] = I * 120; + } + } } if (!player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0) @@ -581,7 +661,7 @@ namespace CalamityMod.NPCs.Polterghast // Emit dust if (!reachedChargingPoint) { - SoundEngine.PlaySound(SoundID.Item125, NPC.position); + SoundEngine.PlaySound(SoundID.Item125, NPC.Center); for (int i = 0; i < 30; i++) { int dust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Ectoplasm, 0f, 0f, 100, default, 3f); @@ -631,6 +711,7 @@ namespace CalamityMod.NPCs.Polterghast NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } + // Phase 1: "Polterghast" if (!phase2 && !phase3) { NPC.damage = NPC.defDamage; @@ -718,6 +799,8 @@ namespace CalamityMod.NPCs.Polterghast } } } + + // Phase 2: "Necroghast" else if (!phase3) { if (NPC.ai[0] == 0f) @@ -763,7 +846,8 @@ namespace CalamityMod.NPCs.Polterghast } } - NPC.GivenName = "Necroghast"; + // Actually changes name to Necroghast + nameStage = 2; NPC.damage = (int)(NPC.defDamage * 1.2f); NPC.defense = (int)(NPC.defDefense * 0.8f); @@ -852,6 +936,8 @@ namespace CalamityMod.NPCs.Polterghast } } } + + // Phase 3: "Necroplasm" else { NPC.HitSound = SoundID.NPCHit36; @@ -871,7 +957,7 @@ namespace CalamityMod.NPCs.Polterghast { NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType()); - if (expertMode) + if (expertMode && !CalamityWorld.getFixedBoi) { for (int I = 0; I < 3; I++) { @@ -914,7 +1000,8 @@ namespace CalamityMod.NPCs.Polterghast } } - NPC.GivenName = "Necroplasm"; + // Actually changes name to Necroplasm + nameStage = 3; NPC.damage = (int)(NPC.defDamage * 1.4f); NPC.defense = (int)(NPC.defDefense * 0.5f); @@ -981,6 +1068,11 @@ namespace CalamityMod.NPCs.Polterghast Main.npc[num762].netUpdate = true; } } + + if (CalamityWorld.getFixedBoi) + { + NPC.GivenName = "Polterplasm"; + } } } } @@ -1000,14 +1092,14 @@ namespace CalamityMod.NPCs.Polterghast if (!DownedBossSystem.downedPolterghast) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - SoundEngine.PlaySound(ReaperShark.SearchRoarSound, Main.player[Main.myPlayer].position); + SoundEngine.PlaySound(ReaperShark.SearchRoarSound, Main.player[Main.myPlayer].Center); string key = "Mods.CalamityMod.GhostBossText"; Color messageColor = Color.RoyalBlue; string sulfSeaBoostMessage = "Mods.CalamityMod.GhostBossText4"; Color sulfSeaBoostColor = AcidRainEvent.TextColor; - if (Main.rand.NextBool(20) && DateTime.Now.Month == 4 && DateTime.Now.Day == 1) + if ((Main.rand.NextBool(20) && DateTime.Now.Month == 4 && DateTime.Now.Day == 1) || CalamityWorld.getFixedBoi) { sulfSeaBoostMessage = "Mods.CalamityMod.AprilFools2"; // Goddamn boomer duke moments } @@ -1059,11 +1151,51 @@ namespace CalamityMod.NPCs.Polterghast npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPolterghast, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (threeAM) + { + int bloodBase = 120 - NPC.life / NPC.lifeMax; + float roughBloodCount = (float)Math.Sqrt(0.8f * bloodBase); + int exactBloodCount = (int)roughBloodCount; + // Chance for the final blood particle + if (Main.rand.NextFloat() < roughBloodCount - exactBloodCount) + ++exactBloodCount; + + // Velocity of the spurting blood also slightly increases with stacks. + float velStackMult = 1f + (float)Math.Log(bloodBase); + + // Code copied from Shred which was copied from Violence. + for (int i = 0; i < exactBloodCount; ++i) + { + int bloodLifetime = Main.rand.Next(22, 36); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, 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() * velStackMult * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(NPC.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i < exactBloodCount / 3; ++i) + { + float bloodScale = Main.rand.NextFloat(0.2f, 0.33f); + Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat(0.5f, 1f)); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * velStackMult * Main.rand.NextFloat(1f, 2f); + bloodVelocity.Y -= 2.3f; + BloodParticle2 blood = new BloodParticle2(NPC.Center, bloodVelocity, 20, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + } + SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -1101,6 +1233,12 @@ namespace CalamityMod.NPCs.Polterghast Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); Color lightRed = new Color(255, 100, 100, 255); + if (threeAM) + { + color37 = Color.Red; + lightRed = Color.DarkRed; + } + float chargePhaseGateValue = 480f; if (Main.getGoodWorld) chargePhaseGateValue *= 0.5f; diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index 380d2e1f26..282b2723a5 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -70,6 +70,8 @@ namespace CalamityMod.NPCs.Polterghast // Despawn if Polter is gone if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 6d01bf2743..85671d9cff 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -30,11 +30,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians private int spearType = 0; private int healTimer = 0; private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private const float TimeForShieldDespawn = 120f; + public static readonly SoundStyle HolyRaySound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRay") { Volume = 1.25f }; + public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + public static readonly SoundStyle ShieldDeathSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); public override void SetStaticDefaults() { DisplayName.SetDefault("Guardian Commander"); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) @@ -55,11 +59,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.npcSlots = 20f; NPC.aiStyle = -1; NPC.GetNPCDamage(); - NPC.width = 100; - NPC.height = 80; + NPC.width = 228; + NPC.height = 186; NPC.defense = 40; NPC.DR_NERD(0.3f); - NPC.LifeMaxNERB(56250, 67500, 165000); // Old HP - 102500, 112500 + NPC.LifeMaxNERB(108000, 129600, 200000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; @@ -92,6 +96,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians writer.Write(spearType); writer.Write(healTimer); writer.Write(biomeEnrageTimer); + writer.Write(NPC.chaseable); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -99,11 +110,18 @@ namespace CalamityMod.NPCs.ProfanedGuardians spearType = reader.ReadInt32(); healTimer = reader.ReadInt32(); biomeEnrageTimer = reader.ReadInt32(); + NPC.chaseable = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; + NPC.frameCounter += 0.12f + NPC.velocity.Length() / 120f; NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -113,6 +131,17 @@ namespace CalamityMod.NPCs.ProfanedGuardians { CalamityGlobalNPC.doughnutBoss = NPC.whoAmI; + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.1f, 0.9f, 0f); + + // Projectile and dust spawn location variables + Vector2 dustAndProjectileOffset = new Vector2(40f * NPC.direction, 20f); + Vector2 shootFrom = NPC.Center + dustAndProjectileOffset; + + // Rotation + NPC.rotation = NPC.velocity.X * 0.005f; + bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -121,12 +150,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - Vector2 vectorCenter = NPC.Center; - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[1] == 0f) + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] == 0f) { - NPC.localAI[1] = 1f; - NPC.NewNPC(NPC.GetSource_FromAI(), (int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); - NPC.NewNPC(NPC.GetSource_FromAI(), (int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); + NPC.localAI[0] = 1f; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); } bool defenderAlive = false; @@ -156,28 +184,97 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.Calamity().CurrentlyIncreasingDefenseOrDR = false; } - // Healing + // Healing and laser + bool hasDoneLaser = calamityGlobalNPC.newAI[2] == 1f; + if (healerAlive) { - float healGateValue = 60f; - healTimer++; - if (healTimer >= healGateValue) + // Laser attack when the healer is at or below 50% HP + bool shouldDoLaser = (Main.npc[CalamityGlobalNPC.doughnutBossHealer].life / (float)Main.npc[CalamityGlobalNPC.doughnutBossHealer].lifeMax) <= 0.5f; + if (!hasDoneLaser && shouldDoLaser && NPC.ai[0] != 5f) + { + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.localAI[3] = 0f; + NPC.netUpdate = true; + } + + float distanceFromHealer = Vector2.Distance(Main.npc[CalamityGlobalNPC.doughnutBossHealer].Center, NPC.Center); + bool dontHeal = distanceFromHealer > 2000f || Main.npc[CalamityGlobalNPC.doughnutBossHealer].justHit || NPC.life == NPC.lifeMax; + if (dontHeal) { healTimer = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) + } + else + { + float healGateValue = 60f; + healTimer++; + if (healTimer >= healGateValue) { - int healAmt = NPC.lifeMax / 20; - if (healAmt > NPC.lifeMax - NPC.life) - healAmt = NPC.lifeMax - NPC.life; + SoundEngine.PlaySound(SoundID.Item8, shootFrom); - if (healAmt > 0) + int maxHealDustIterations = (int)distanceFromHealer; + int maxDust = 100; + int dustDivisor = maxHealDustIterations / maxDust; + if (dustDivisor < 2) + dustDivisor = 2; + + Vector2 healDustOffset = new Vector2(40f * Main.npc[CalamityGlobalNPC.doughnutBossHealer].direction, 20f); + Vector2 dustLineStart = Main.npc[CalamityGlobalNPC.doughnutBossHealer].Center + healDustOffset; + Vector2 dustLineEnd = shootFrom; + Vector2 currentDustPos = default; + Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); + Vector2 value5 = new Vector2(2.1f, 2f); + int dustSpawned = 0; + for (int i = 0; i < maxHealDustIterations; i++) { - NPC.life += healAmt; - NPC.HealEffect(healAmt, true); - NPC.netUpdate = true; + if (i % dustDivisor == 0) + { + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(new Color(255, 200, Math.Abs(Main.DiscoB - (int)(dustSpawned * 2.55f)))).X, 1f, 0.5f); + dustColor.A = 255; + int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Main.dust[dust].position = currentDustPos; + Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1f; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale /= 2f; + dust3 = dust2; + dust3.fadeIn /= 2f; + dust2.color = new Color(255, 255, 255, 255); + dustSpawned++; + } + } + + healTimer = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = NPC.lifeMax / 10; + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; + + if (healAmt > 0) + { + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; + } } } } + + if (Main.npc[CalamityGlobalNPC.doughnutBossHealer].ai[0] == 599 && CalamityWorld.getFixedBoi && Main.netMode != NetmodeID.MultiplayerClient) + { + // gain more health once the healer's channel heal is done + NPC.lifeMax += 7500; + NPC.life += NPC.lifeMax - NPC.life; + NPC.HealEffect(NPC.lifeMax - NPC.life, true); + NPC.netUpdate = true; + } } // Get a target @@ -190,11 +287,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians Player player = Main.player[NPC.target]; - if (!Main.dayTime || !player.active || player.dead) + if ((!Main.dayTime && !CalamityWorld.getFixedBoi) || !player.active || player.dead || Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!Main.dayTime || !player.active || player.dead) + if ((!Main.dayTime && !CalamityWorld.getFixedBoi) || !player.active || player.dead || Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) { if (NPC.velocity.Y > 3f) NPC.velocity.Y = 3f; @@ -213,12 +310,20 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.ai[3] = 0f; NPC.netUpdate = true; } + + // Tells the other Guardians that it's time to despawn + NPC.ai[3] = -1f; + return; } } else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; + // Reset the despawn variable to be used for spear attacks + if (NPC.ai[3] < 0f) + NPC.ai[3] = 0f; + // Become immune over time if target isn't in hell or hallow bool isHoly = player.ZoneHallow; bool isHell = player.ZoneUnderworldHeight; @@ -234,196 +339,388 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool biomeEnraged = biomeEnrageTimer <= 0; - bool phase1 = false; - for (int i = 0; i < Main.maxNPCs; i++) + bool phase1 = healerAlive || defenderAlive; + + NPC.chaseable = !phase1; + + if (!phase1) { - if ((Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) || (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType())) - phase1 = true; + if (NPC.localAI[1] < TimeForShieldDespawn) + { + // Star Wrath use sound + if (NPC.localAI[1] == 0f) + SoundEngine.PlaySound(ShieldDeathSound, NPC.Center); + + NPC.localAI[1] += 1f; + } } - float inertia = (bossRush || biomeEnraged) ? 45f : death ? 50f : revenge ? 52f : expertMode ? 55f : 60f; + // Side swap variables for Phase 1 + float moveToOtherSideInPhase1GateValue = 900f; + float timeBeforeMoveToOtherSideInPhase1Reset = moveToOtherSideInPhase1GateValue * 2f; + float totalGoLowDuration = 240f; + float goLowDuration = totalGoLowDuration * 0.5f; + float goLowOrHighDistance = 540f; + + // Side swap variables for Phase 2 + float defenderCommanderGuardPhase2Duration = (bossRush || biomeEnraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float moveToOtherSideInPhase2GateValue = defenderCommanderGuardPhase2Duration - 120f; + float timeBeforeMoveToOtherSideInPhase2Reset = moveToOtherSideInPhase2GateValue * 2f; + float totalGoLowDurationPhase2 = 210f; + float goLowDurationPhase2 = totalGoLowDurationPhase2 * 0.5f; + + // Charge variables + float chargeVelocityMult = 0.25f; + float maxChargeVelocity = (bossRush || biomeEnraged) ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; + if (Main.getGoodWorld) + maxChargeVelocity *= 1.15f; + + float inertia = (bossRush || biomeEnraged) ? 40f : death ? 45f : revenge ? 47f : expertMode ? 50f : 55f; if (lifeRatio < 0.5f) inertia *= 0.8f; if (!phase1) - inertia *= 0.8f; + inertia *= 0.75f; if (Main.getGoodWorld) inertia *= 0.8f; float num1006 = 0.111111117f * inertia; + int totalDustPerProjectile = 15; + if (NPC.ai[0] == 0f) { + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0f ? 1 : -1; NPC.spriteDirection = NPC.direction; } + // Dictates when the commander and defender will swap to the other side in phase 1 + if (healerAlive) + NPC.localAI[3] += 1f; + else + NPC.localAI[3] = 0f; + + // Go low just before moving to the other side to avoid bullshit hits + float roundedGoLowCheck = (float)Math.Round(goLowDuration * 0.5); + bool goLow = (NPC.localAI[3] > (moveToOtherSideInPhase1GateValue - goLowDuration) && NPC.localAI[3] <= (moveToOtherSideInPhase1GateValue + roundedGoLowCheck)) || + NPC.localAI[3] > (timeBeforeMoveToOtherSideInPhase1Reset - goLowDuration) || NPC.localAI[3] <= (-roundedGoLowCheck); + + // Swap sides while going low + if (NPC.localAI[3] == (moveToOtherSideInPhase1GateValue - roundedGoLowCheck) || NPC.localAI[3] == (timeBeforeMoveToOtherSideInPhase1Reset - roundedGoLowCheck)) + calamityGlobalNPC.newAI[0] *= -1f; + + // Reset the timer to a negative value + if (NPC.localAI[3] > timeBeforeMoveToOtherSideInPhase1Reset) + NPC.localAI[3] = -goLowDuration; + + bool canSwapPlacesWithDefender = false; + bool defenderCharging = false; + if (defenderAlive) + { + if (Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[0] == 1f && Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[1] < -120f) + canSwapPlacesWithDefender = true; + + if ((Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[0] == 0f && Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[3] > 0f) || + (Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[0] == 1f && Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[1] >= -60f) || + Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[0] == 2f || Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[0] == 3f) + defenderCharging = true; + } + + // Dictates when the commander and defender will swap sides in phase 2 + if (!healerAlive && defenderAlive) + { + if (canSwapPlacesWithDefender) + calamityGlobalNPC.newAI[1] += 1f; + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Go low or high just before moving to the other side in phase 2 to avoid bullshit hits + float roundedGoLowPhase2Check = (float)Math.Round(goLowDurationPhase2 * 0.5); + bool goLowPhase2 = calamityGlobalNPC.newAI[1] > (moveToOtherSideInPhase2GateValue - goLowDurationPhase2) && calamityGlobalNPC.newAI[1] <= (moveToOtherSideInPhase2GateValue + roundedGoLowPhase2Check); + bool goHigh = calamityGlobalNPC.newAI[1] > (timeBeforeMoveToOtherSideInPhase2Reset - goLowDurationPhase2) || calamityGlobalNPC.newAI[1] <= (-roundedGoLowPhase2Check); + + // Swap sides while going low or high + if (calamityGlobalNPC.newAI[1] == (moveToOtherSideInPhase2GateValue - roundedGoLowPhase2Check) || calamityGlobalNPC.newAI[1] == (timeBeforeMoveToOtherSideInPhase2Reset - roundedGoLowPhase2Check)) + calamityGlobalNPC.newAI[0] *= -1f; + + // Reset the timer to a negative value + if (calamityGlobalNPC.newAI[1] > timeBeforeMoveToOtherSideInPhase2Reset) + calamityGlobalNPC.newAI[1] = -goLowDurationPhase2; + + // Set side to stay on while not going low or high + if (!goLow && !goLowPhase2 && !goHigh) + calamityGlobalNPC.newAI[0] = -NPC.direction; + float velocity = (bossRush || biomeEnraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) velocity *= 1.25f; + if (healerAlive) + velocity *= 0.8f; - Vector2 targetVector = player.Center - vectorCenter; - targetVector = Vector2.Normalize(targetVector) * velocity; - float phaseGateValue = (bossRush || biomeEnraged) ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; - if (defenderAlive) - phaseGateValue *= 1.5f; - - if (NPC.ai[3] < phaseGateValue || healerAlive) + // Reduce inertia and boost velocity while far away from target or swapping sides + float distanceToStayAwayFromTarget = defenderAlive ? 800f : 600f; + bool speedUp = Vector2.Distance(NPC.Center, player.Center) > (distanceToStayAwayFromTarget + 160f); + if (speedUp) { - NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector) / inertia; - NPC.ai[3] += 1f; + inertia *= 0.5f; + velocity *= 2f; + } + if (goLowPhase2 || goHigh) + { + inertia *= 0.5f; + velocity *= 2f; + } + else if (goLow) + { + inertia *= 0.66f; + velocity *= 1.66f; + } - if (Main.netMode != NetmodeID.MultiplayerClient) + // Slow down while close enough to the player and the defender is charging + if (defenderCharging && !speedUp) + { + inertia *= 1.5f; + velocity *= 0.75f; + } + + Vector2 destination = player.Center + Vector2.UnitX * distanceToStayAwayFromTarget * calamityGlobalNPC.newAI[0]; + if (goLow || goLowPhase2 || goHigh) + destination.Y += goHigh ? -goLowOrHighDistance : goLowOrHighDistance; + + Vector2 targetVector = destination - NPC.Center; + Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; + float phaseGateValue = (bossRush || biomeEnraged) ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; + bool continueShootingProjectiles = phase1 || (NPC.ai[2] < (phaseGateValue * 5f)); + + if (continueShootingProjectiles) + { + // Move towards destination + if (Vector2.Distance(NPC.Center, destination) > 80f) + NPC.velocity = (NPC.velocity * (inertia - 1f) + desiredVelocity) / inertia; + else + NPC.velocity *= 0.98f; + + // Alternate between firing profaned spears and holy fire + // Shoot holy blasts in final phase + NPC.ai[2] += 1f; + float projectileShootGateValue = (bossRush || biomeEnraged) ? 40f : death ? 60f : revenge ? 90f : expertMode ? 100f : 150f; + if (NPC.ai[2] % projectileShootGateValue == 0f) { - float divisor = (bossRush || biomeEnraged) ? 30f : death ? 40f : revenge ? 44f : expertMode ? 50f : 60f; - if (!phase1) - divisor = (float)Math.Round(divisor * 0.8f); - - if (NPC.ai[3] % divisor == 0f) + if (phase1) { - SoundEngine.PlaySound(SoundID.Item20, NPC.position); - int type = ModContent.ProjectileType(); + // Fire a few extra spears and holy fires after the healer is dead and the defender is defending the commander + bool fireExtraProjectiles = false; + if (defenderAlive) + { + if (Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[0] == 2f) + fireExtraProjectiles = true; + } + + bool shootSpear = NPC.ai[2] % (projectileShootGateValue * 2f) == 0f; + float projectileVelocity = (bossRush || biomeEnraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + Vector2 finalProjectileVelocity = Vector2.Normalize(player.Center - shootFrom) * projectileVelocity; + int type = shootSpear ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 projectileVelocity = Vector2.Normalize(player.Center - vectorCenter); - int numProj = death ? 3 : 2; - int spread = !phase1 ? 15 : death ? 30 : 20; - if (Main.getGoodWorld) + if (type == ModContent.ProjectileType()) + finalProjectileVelocity *= 0.5f; + + for (int k = 0; k < totalDustPerProjectile; k++) + Dust.NewDust(shootFrom, 30, 30, (int)CalamityDusts.ProfanedFire, finalProjectileVelocity.X, finalProjectileVelocity.Y, 0, default, 1f); + + if (fireExtraProjectiles) { - numProj *= 2; - spread *= 3; + int baseProjectileAmt = (bossRush || biomeEnraged) ? 4 : 2; + int spread = (bossRush || biomeEnraged) ? 18 : 10; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < baseProjectileAmt; i++) + { + Vector2 perturbedSpeed = finalProjectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(baseProjectileAmt - 1))); + + for (int k = 0; k < totalDustPerProjectile; k++) + Dust.NewDust(shootFrom, 30, 30, (int)CalamityDusts.ProfanedFire, perturbedSpeed.X, perturbedSpeed.Y, 0, default, 1f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, finalProjectileVelocity, type, damage, 0f, Main.myPlayer); + } + else + { + // Shoot holy blasts + float holyBlastVelocity = (bossRush || biomeEnraged) ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; + int projTimeLeft = (int)(2000f / holyBlastVelocity); + Vector2 finalHolyBlastVelocity = Vector2.Normalize(player.Center - shootFrom) * holyBlastVelocity; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, finalHolyBlastVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Main.projectile[proj].timeLeft = projTimeLeft; + } } - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) + // Dust for blasting out the holy blasts + for (int i = 0; i < 100; i++) { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter, normalizedPerturbedSpeed * NPC.velocity.Length() * 1.25f, type, damage, 0f, Main.myPlayer, 3f, 0f); + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.ProfanedFire; + break; + default: + dustID = DustID.OrangeTorch; + break; + } + + // Choose a random speed and angle to blast the fire out + float dustSpeed = Main.rand.NextFloat(holyBlastVelocity * 0.5f, holyBlastVelocity); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(finalHolyBlastVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the fire particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the fire + int idx = Dust.NewDust(shootFrom, 180, 180, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; } + + NPC.velocity = -finalHolyBlastVelocity * 0.5f; } } } else { - NPC.ai[0] = 1f; - NPC.ai[2] = targetVector.X; - NPC.ai[3] = targetVector.Y; - NPC.netUpdate = true; + // Slow down and transition to charge phase + NPC.velocity *= 0.98f; + if (NPC.ai[1] >= phaseGateValue) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + else + NPC.ai[1] += 1f; } } else if (NPC.ai[0] == 1f) { + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0f ? 1 : -1; NPC.spriteDirection = NPC.direction; } - NPC.velocity *= 0.8f; - if (Main.getGoodWorld) - NPC.velocity *= 0.5f; + NPC.ai[0] = 2f; + NPC.netUpdate = true; + Vector2 targetVector = player.Center - NPC.Center; + Vector2 velocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)); + velocity *= maxChargeVelocity; - float chargeGateValue = 12f; - if (Main.getGoodWorld) - chargeGateValue *= 0.25f; + // Start slow and accelerate + NPC.velocity = velocity * chargeVelocityMult; - NPC.ai[1] += 1f; - if (NPC.ai[1] >= chargeGateValue) + // Dust ring and sound right as charge begins + SoundEngine.PlaySound(DashSound, NPC.Center); + int totalDust = 36; + for (int k = 0; k < totalDust; k++) { - NPC.ai[0] = 2f; - NPC.ai[1] = 0f; - NPC.netUpdate = true; - Vector2 velocity = new Vector2(NPC.ai[2], NPC.ai[3]); - velocity.Normalize(); - velocity *= (bossRush || biomeEnraged) ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; - if (defenderAlive) - velocity *= 0.8f; - if (Main.getGoodWorld) - velocity *= 1.15f; - - NPC.velocity = velocity; + Vector2 dustSpawnPos = NPC.velocity.SafeNormalize(Vector2.UnitY) * new Vector2(160f, 160f); + dustSpawnPos = dustSpawnPos.RotatedBy((double)((k - (totalDust / 2 - 1)) * MathHelper.TwoPi / totalDust), default) + shootFrom; + Vector2 dustVelocity = dustSpawnPos - shootFrom; + int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, (int)CalamityDusts.ProfanedFire, dustVelocity.X, dustVelocity.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].scale = 3f; + Main.dust[dust].velocity = dustVelocity * 0.3f; } } else if (NPC.ai[0] == 2f) { + // Face the direction of the charge if (Math.Sign(NPC.velocity.X) != 0) NPC.spriteDirection = -Math.Sign(NPC.velocity.X); NPC.spriteDirection = Math.Sign(NPC.velocity.X); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[0] += 1f; - float projectileGateValue = (bossRush || biomeEnraged) ? 30f : death ? 35f : revenge ? 37f : expertMode ? 40f : 45f; - if (NPC.localAI[0] >= projectileGateValue && Vector2.Distance(vectorCenter, player.Center) > 160f) - { - NPC.localAI[0] = 0f; - - SoundEngine.PlaySound(SoundID.Item20, NPC.position); - - int totalProjectiles = phase1 ? 6 : 10; - float velocity = phase1 ? 5f : 6f; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - switch (spearType) - { - case 0: - break; - case 1: - totalProjectiles = phase1 ? 10 : 15; - velocity = phase1 ? 4f : 5f; - break; - case 2: - totalProjectiles = phase1 ? 5 : 7; - velocity = phase1 ? 6f : 7f; - break; - default: - break; - } - - if (bossRush || biomeEnraged) - totalProjectiles *= 2; - - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - - spearType++; - if (spearType > 2) - spearType = 0; - } - } - NPC.ai[1] += 1f; - float phaseGateValue = (bossRush || biomeEnraged) ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; + float phaseGateValue = (bossRush || biomeEnraged) ? 90f : death ? 100f : revenge ? 110f : expertMode ? 120f : 135f; if (NPC.ai[1] >= phaseGateValue) { NPC.ai[0] = 3f; - NPC.ai[1] = phase1 ? 24f : 6f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; + + // Slown down duration ranges from 20 to 40 frames in rev, otherwise it's always 40 frames + float slowDownDurationAfterCharge = revenge ? Main.rand.Next(20, 41) : 40f; + NPC.ai[1] = slowDownDurationAfterCharge; + NPC.localAI[2] = 0f; NPC.velocity /= 2f; NPC.netUpdate = true; } else { - Vector2 targetVector = player.Center - vectorCenter; - targetVector.Normalize(); - if (targetVector.HasNaNs()) - targetVector = new Vector2(NPC.direction, 0f); + Vector2 targetVector = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)); - NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + num1006)) / inertia; + if (NPC.localAI[2] == 0f) + { + // Accelerate + if (NPC.velocity.Length() < maxChargeVelocity) + { + float velocityMult = (bossRush || biomeEnraged) ? 1.053333f : death ? 1.05037f : revenge ? 1.047407f : expertMode ? 1.044444f : 1.04f; + 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 + { + inertia *= 1.5f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + num1006)) / inertia; + } + + // Throw down holy fire while charging + int projectileGateValue = (int)(phaseGateValue * 0.4f); + if (NPC.ai[1] % projectileGateValue == 0f) + { + float projectileVelocityY = NPC.velocity.Y; + if (projectileVelocityY < 0f) + projectileVelocityY = 0f; + + projectileVelocityY += expertMode ? 3f : 2f; + Vector2 projectileVelocity = new Vector2(NPC.velocity.X * 0.2f, projectileVelocityY); + + for (int k = 0; k < totalDustPerProjectile; k++) + Dust.NewDust(shootFrom, 30, 30, (int)CalamityDusts.ProfanedFire, projectileVelocity.X, projectileVelocity.Y, 0, default, 1f); + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, damage, 0f, Main.myPlayer); + } } } else if (NPC.ai[0] == 3f) { + // Face the direction of the charge if (Math.Sign(NPC.velocity.X) != 0) NPC.spriteDirection = -Math.Sign(NPC.velocity.X); NPC.spriteDirection = Math.Sign(NPC.velocity.X); @@ -431,69 +728,399 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.ai[1] -= 1f; if (NPC.ai[1] <= 0f) { - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; + NPC.ai[2] += 1f; + + // Charges one to three times in a row in rev, otherwise it will always charge twice in a row + float totalCharges = revenge ? (Main.rand.Next(3) + 1f) : 2f; + bool dontCharge = NPC.ai[2] >= totalCharges; + bool useSpears = NPC.ai[3] % 2f == 0f; + NPC.ai[0] = dontCharge ? (useSpears ? 4f : 0f) : 1f; + if (dontCharge) + { + NPC.ai[2] = 0f; + NPC.ai[3] += 1f; + } + NPC.TargetClosest(); NPC.netUpdate = true; } - NPC.velocity *= phase1 ? 0.9f : 0.66f; + NPC.velocity *= 0.95f; + } + else if (NPC.ai[0] == 4f) + { + // Face the target + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) + { + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + } + + bool boostVelocityToCatchUp = NPC.ai[1] == 0f; + float velocity = (bossRush || biomeEnraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + if (Main.getGoodWorld) + velocity *= 1.25f; + if (boostVelocityToCatchUp) + velocity *= 2f; + + float distanceToStayAwayFromTarget = 400f; + Vector2 destination = player.Center + Vector2.UnitX * distanceToStayAwayFromTarget * -NPC.direction; + Vector2 targetVector = destination - NPC.Center; + Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; + + float totalSpears = 12f; + float shootDuration = (bossRush || biomeEnraged) ? 240f : death ? 280f : revenge ? 300f : expertMode ? 320f : 360f; + float dontShootTime = shootDuration * 0.3f; + float phaseGateValue = dontShootTime + shootDuration; + + // Don't attack until close enough to the target + if (NPC.ai[1] > 0f) + NPC.ai[1] += 1f; + + if (NPC.ai[1] < phaseGateValue) + { + // Move towards destination + if (Vector2.Distance(NPC.Center, destination) > 80f) + { + inertia *= 0.5f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + desiredVelocity) / inertia; + } + else + { + // Set the Commander to be able to attack + if (NPC.ai[1] == 0f) + NPC.ai[1] = 1f; + + NPC.velocity *= 0.96f; + } + } + + int spearShootDivisor = (int)(shootDuration / totalSpears); + float totalPhaseDuration = phaseGateValue + dontShootTime; + if (NPC.ai[1] >= dontShootTime) + { + if (NPC.ai[1] >= phaseGateValue) + { + // Slow down and transition to charge phase + NPC.velocity *= 0.98f; + + if (NPC.ai[1] >= totalPhaseDuration) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + } + else if (NPC.ai[1] % spearShootDivisor == 0f) + { + float spearVelocity = (bossRush || biomeEnraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + if (Main.getGoodWorld) + spearVelocity *= 1.25f; + if (boostVelocityToCatchUp) + spearVelocity *= 2f; + + Vector2 velocity2 = Vector2.Normalize(player.Center - shootFrom) * spearVelocity; + Vector2 knockbackVelocity = velocity2 * 0.1f; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, shootFrom); + for (int k = 0; k < totalDustPerProjectile; k++) + Dust.NewDust(shootFrom, 30, 30, (int)CalamityDusts.ProfanedFire, velocity2.X, velocity2.Y, 0, default, 1f); + + if (NPC.ai[1] % (spearShootDivisor * 3) == 0f) + { + knockbackVelocity *= 2f; + int baseProjectileAmt = (bossRush || biomeEnraged) ? 8 : expertMode ? 6 : 4; + int spread = (bossRush || biomeEnraged) ? 36 : expertMode ? 30 : 24; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < baseProjectileAmt; i++) + { + Vector2 perturbedSpeed = velocity2.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(baseProjectileAmt - 1))) * 0.3f; + + for (int k = 0; k < totalDustPerProjectile; k++) + Dust.NewDust(shootFrom, 30, 30, (int)CalamityDusts.ProfanedFire, perturbedSpeed.X, perturbedSpeed.Y, 0, default, 1f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, perturbedSpeed, type, damage, 0f, Main.myPlayer, -1f, -30f); + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity2 * 0.85f, type, damage, 0f, Main.myPlayer, 1f, 0f); + + NPC.velocity = -knockbackVelocity; + } + } + } + else if (NPC.ai[0] == 5f) + { + // Face the target + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) + { + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + } + + float laserGateValue = 120f; + float velocity = (bossRush || biomeEnraged) ? 4.5f : death ? 4f : revenge ? 3.75f : expertMode ? 3.5f : 3f; + if (NPC.ai[1] < laserGateValue) + velocity *= 6f; + if (Main.getGoodWorld) + velocity *= 1.25f; + + calamityGlobalNPC.newAI[0] = -NPC.direction; + float distanceToStayAwayFromTarget = 720f; + Vector2 destination = player.Center + Vector2.UnitX * distanceToStayAwayFromTarget * calamityGlobalNPC.newAI[0]; + Vector2 targetVector = destination - NPC.Center; + Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; + + // Move towards destination + if (Vector2.Distance(NPC.Center, destination) > 80f) + NPC.velocity = (NPC.velocity * (inertia - 1f) + desiredVelocity) / inertia; + else + NPC.velocity *= 0.98f; + + // Limit Y velocity while firing laser + if (NPC.ai[1] >= laserGateValue) + { + float speedCap = Main.getGoodWorld ? 4f : 2f; + if (NPC.velocity.Y > speedCap) + NPC.velocity.Y = speedCap; + if (NPC.velocity.Y < -speedCap) + NPC.velocity.Y = -speedCap; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] < laserGateValue) + { + Vector2 dustPosOffset = new Vector2(27f, 59f); + if (NPC.ai[2] >= 40f) + { + int extraDustAmt = 0; + if (NPC.ai[2] >= 80f) + extraDustAmt = 1; + + for (int d = 0; d < 1 + extraDustAmt; d++) + { + float scalar = 1.2f; + if (d % 2 == 1) + scalar = 2.8f; + + Vector2 dustPos = shootFrom + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * dustPosOffset / 2f; + int index = Dust.NewDust(dustPos - Vector2.One * 8f, 16, 16, (int)CalamityDusts.ProfanedFire, NPC.velocity.X / 2f, NPC.velocity.Y / 2f, 0, default, 1f); + Main.dust[index].velocity = Vector2.Normalize(NPC.Center - dustPos) * 3.5f * (10f - extraDustAmt * 2f) / 10f; + Main.dust[index].noGravity = true; + Main.dust[index].scale = scalar; + } + } + } + else if (NPC.ai[2] < (revenge ? 220f : 300f)) + { + if (NPC.ai[2] == laserGateValue) + { + float rotation = (bossRush || biomeEnraged) ? 435f : death ? 445f : revenge ? 450f : expertMode ? 455f : 465f; + + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) + SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 laserVelocity = player.Center - NPC.Center; + laserVelocity.Normalize(); + + float beamDirection = -1f; + if (laserVelocity.X < 0f) + beamDirection = 1f; + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + // 60 degrees offset + laserVelocity = laserVelocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 6f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, laserVelocity, type, damage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + + // -60 degrees offset + if (revenge) + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, -laserVelocity, type, damage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + + NPC.netUpdate = true; + } + } + } + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (revenge ? 235f : 315f)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + calamityGlobalNPC.newAI[2] = 1f; + NPC.netUpdate = true; + } } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; - if (NPC.ai[0] == 2f) - num153 = 10; - - if (CalamityConfig.Instance.Afterimages) + void drawGuardianInstance(Vector2 drawOffset, Color? colorOverride) { - for (int num155 = 1; num155 < num153; num155 += 2) + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Vector2 drawPos = NPC.Center - screenPos; + Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Color color36 = Color.White; + float amount9 = 0.5f; + int num153 = 5; + if (NPC.ai[0] == 2f) + num153 = 10; + + if (CalamityConfig.Instance.Afterimages) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = drawColor; + color38 = Color.Lerp(color38, color36, amount9); + color38 = NPC.GetAlpha(color38); + color38 *= (num153 - num155) / 15f; + if (colorOverride != null) + color38 = colorOverride.Value; + + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + } } + + Vector2 vector43 = drawPos; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector43, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; + Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + if (CalamityWorld.getFixedBoi) + { + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlowNight").Value; + color37 = Color.Cyan; + } + if (colorOverride != null) + color37 = colorOverride.Value; + + if (CalamityConfig.Instance.Afterimages) + { + for (int num163 = 1; num163 < num153; num163++) + { + Color color41 = color37; + color41 = Color.Lerp(color41, color36, amount9); + color41 = NPC.GetAlpha(color41); + color41 *= (num153 - num163) / 15f; + if (colorOverride != null) + color41 = colorOverride.Value; + + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + } + } + + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - - if (CalamityConfig.Instance.Afterimages) + // Draw laser effects + float useLaserGateValue = 120f; + float stopLaserGateValue = (CalamityWorld.revenge || BossRushEvent.BossRushActive) ? 235f : 315f; + float maxIntensity = 45f; + float increaseIntensityGateValue = useLaserGateValue - maxIntensity; + float decreaseIntensityGateValue = stopLaserGateValue - maxIntensity; + bool usingLaser = NPC.ai[0] == 5f; + bool increaseIntensity = NPC.ai[1] > increaseIntensityGateValue; + bool decreaseIntensity = NPC.ai[1] > decreaseIntensityGateValue; + if (usingLaser) { - for (int num163 = 1; num163 < num153; num163++) + float burnIntensity = decreaseIntensity ? Utils.GetLerpValue(0f, maxIntensity, maxIntensity - (NPC.ai[1] - decreaseIntensityGateValue), true) : Utils.GetLerpValue(0f, maxIntensity, NPC.ai[1], true); + int totalGuardiansToDraw = (int)MathHelper.Lerp(1f, 30f, burnIntensity); + for (int i = 0; i < totalGuardiansToDraw; i++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + float offsetAngle = MathHelper.TwoPi * i * 2f / totalGuardiansToDraw; + float drawOffsetFactor = (float)Math.Sin(offsetAngle * 6f + Main.GlobalTimeWrappedHourly * MathHelper.Pi); + drawOffsetFactor *= (float)Math.Pow(burnIntensity, 3f) * 50f; + + Vector2 drawOffset = offsetAngle.ToRotationVector2() * drawOffsetFactor; + Color baseColor = Color.White * (MathHelper.Lerp(0.4f, 0.8f, burnIntensity) / totalGuardiansToDraw * 1.5f); + baseColor.A = 0; + + baseColor = Color.Lerp(Color.White, baseColor, burnIntensity); + drawGuardianInstance(drawOffset, totalGuardiansToDraw == 1 ? null : baseColor); } } + else + drawGuardianInstance(Vector2.Zero, null); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + bool defenderAlive = false; + bool healerAlive = false; + if (CalamityGlobalNPC.doughnutBossDefender != -1) + { + if (Main.npc[CalamityGlobalNPC.doughnutBossDefender].active) + defenderAlive = true; + } + if (CalamityGlobalNPC.doughnutBossHealer != -1) + { + if (Main.npc[CalamityGlobalNPC.doughnutBossHealer].active) + healerAlive = true; + } + + // Draw shields while healer or defender are alive + if (NPC.localAI[1] < TimeForShieldDespawn) + { + float maxOscillation = 60f; + float minScale = 0.8f; + float maxPulseScale = 1f - minScale; + float minOpacity = 0.5f; + float maxOpacityScale = 1f - minOpacity; + float currentOscillation = MathHelper.Lerp(0f, maxOscillation, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi) + 1f) * 0.5f); + float shieldOpacity = minOpacity + maxOpacityScale * Utils.Remap(currentOscillation, 0f, maxOscillation, 1f, 0f); + float oscillationRatio = currentOscillation / maxOscillation; + float invertedOscillationRatio = 1f - (1f - oscillationRatio) * (1f - oscillationRatio); + float oscillationScale = 1f - (1f - invertedOscillationRatio) * (1f - invertedOscillationRatio); + float remappedOscillation = Utils.Remap(currentOscillation, maxOscillation - 15f, maxOscillation, 0f, 1f); + float twoOscillationsMultipliedTogetherForScaleCalculation = remappedOscillation * remappedOscillation; + float invertedOscillationUsedForScale = MathHelper.Lerp(minScale, 1f, 1f - twoOscillationsMultipliedTogetherForScaleCalculation); + float shieldScale = (minScale + maxPulseScale * oscillationScale) * invertedOscillationUsedForScale; + float smallerRemappedOscillation = Utils.Remap(currentOscillation, 20f, maxOscillation, 0f, 1f); + float invertedSmallerOscillationRatio = 1f - (1f - smallerRemappedOscillation) * (1f - smallerRemappedOscillation); + float smallerOscillationScale = 1f - (1f - invertedSmallerOscillationRatio) * (1f - invertedSmallerOscillationRatio); + float shieldScale2 = (minScale + maxPulseScale * smallerOscillationScale) * invertedOscillationUsedForScale; + Texture2D shieldTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value; + Rectangle shieldFrame = shieldTexture.Frame(); + Vector2 origin = shieldFrame.Size() * 0.5f; + Vector2 shieldDrawPos = NPC.Center - screenPos; + shieldDrawPos -= new Vector2(shieldTexture.Width, shieldTexture.Height) * NPC.scale / 2f; + shieldDrawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + float minHue = (defenderAlive && healerAlive) ? 0.18f : 0.06f; + float maxHue = minHue + 0.12f; + float opacityScaleDuringShieldDespawn = (TimeForShieldDespawn - NPC.localAI[1]) / TimeForShieldDespawn; + float scaleDuringShieldDespawnScale = 1.8f; + float scaleDuringShieldDespawn = (1f - opacityScaleDuringShieldDespawn) * scaleDuringShieldDespawnScale; + float colorScale = MathHelper.Lerp(0f, shieldOpacity, opacityScaleDuringShieldDespawn); + Color color = Main.hslToRgb(MathHelper.Lerp(maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + color2.A = 0; + color *= 0.6f; + color2 *= 0.6f; + float scaleMult = 1.2f + scaleDuringShieldDespawn; + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale2 * scaleMult, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale2 * scaleMult * 0.95f, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale * scaleMult, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale * scaleMult * 0.95f, SpriteEffects.None, 0f); + } return false; } @@ -519,7 +1146,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedGuardians, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedGuardians, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void OnKill() @@ -531,6 +1158,29 @@ namespace CalamityMod.NPCs.ProfanedGuardians CalamityNetcode.SyncWorld(); } + // Can only hit the target if within certain distance + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = ImmunityCooldownID.Bosses; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 80f; + } + public override void OnHitPlayer(Player player, int damage, bool crit) { if (damage > 0) @@ -546,9 +1196,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -558,10 +1207,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA3").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA4").Type, 1f); } + for (int k = 0; k < 50; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - } } } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png index d0559ae990..2eca7f5a61 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png and b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow.png b/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow.png index 70c460ee55..855641ba2a 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow.png and b/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlow.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlowNight.png b/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlowNight.png new file mode 100644 index 0000000000..5fbcd482cb Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedGuardianCommanderGlowNight.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 723f492023..991d777342 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -22,11 +22,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians { private int healTimer = 0; private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + private const float TimeForShieldDespawn = 120f; + public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash"); + public static readonly SoundStyle RockShieldSpawnSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate"); + public static readonly SoundStyle ShieldDeathSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate"); public override void SetStaticDefaults() { DisplayName.SetDefault("Guardian Defender"); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) @@ -46,11 +50,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.npcSlots = 3f; NPC.aiStyle = -1; NPC.GetNPCDamage(); - NPC.width = 100; - NPC.height = 80; + NPC.width = 228; + NPC.height = 164; NPC.defense = 50; NPC.DR_NERD(0.4f); - NPC.LifeMaxNERB(43750, 52500, 30000); // Old HP - 40000, 50000 + NPC.LifeMaxNERB(40000, 48000, 35000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; @@ -84,17 +88,27 @@ namespace CalamityMod.NPCs.ProfanedGuardians { writer.Write(healTimer); writer.Write(biomeEnrageTimer); + writer.Write(NPC.chaseable); + 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) { healTimer = reader.ReadInt32(); biomeEnrageTimer = reader.ReadInt32(); + NPC.chaseable = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; + NPC.frameCounter += 0.12f + NPC.velocity.Length() / 120f; NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -104,13 +118,24 @@ namespace CalamityMod.NPCs.ProfanedGuardians { CalamityGlobalNPC.doughnutBossDefender = NPC.whoAmI; + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.1f, 0.9f, 0f); + if (CalamityGlobalNPC.doughnutBoss < 0 || !Main.npc[CalamityGlobalNPC.doughnutBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; } + // Projectile and dust spawn location variables + Vector2 dustAndProjectileOffset = new Vector2(40f * NPC.direction, 20f); + Vector2 shootFrom = NPC.Center + dustAndProjectileOffset; + + // Rotation + NPC.rotation = NPC.velocity.X * 0.005f; + bool healerAlive = false; if (CalamityGlobalNPC.doughnutBossHealer != -1) { @@ -121,35 +146,91 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Healing if (healerAlive) { - float healGateValue = 60f; - healTimer++; - if (healTimer >= healGateValue) + float distanceFromHealer = Vector2.Distance(Main.npc[CalamityGlobalNPC.doughnutBossHealer].Center, NPC.Center); + bool dontHeal = distanceFromHealer > 2000f || Main.npc[CalamityGlobalNPC.doughnutBossHealer].justHit || NPC.life == NPC.lifeMax; + if (dontHeal) { healTimer = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) + } + else + { + float healGateValue = 60f; + healTimer++; + if (healTimer >= healGateValue) { - int healAmt = NPC.lifeMax / 20; - if (healAmt > NPC.lifeMax - NPC.life) - healAmt = NPC.lifeMax - NPC.life; + SoundEngine.PlaySound(SoundID.Item8, shootFrom); - if (healAmt > 0) + int maxHealDustIterations = (int)distanceFromHealer; + int maxDust = 100; + int dustDivisor = maxHealDustIterations / maxDust; + if (dustDivisor < 2) + dustDivisor = 2; + + Vector2 healDustOffset = new Vector2(40f * Main.npc[CalamityGlobalNPC.doughnutBossHealer].direction, 20f); + Vector2 dustLineStart = Main.npc[CalamityGlobalNPC.doughnutBossHealer].Center + healDustOffset; + Vector2 dustLineEnd = shootFrom; + Vector2 currentDustPos = default; + Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); + Vector2 value5 = new Vector2(2.1f, 2f); + int dustSpawned = 0; + for (int i = 0; i < maxHealDustIterations; i++) { - NPC.life += healAmt; - NPC.HealEffect(healAmt, true); - NPC.netUpdate = true; + if (i % dustDivisor == 0) + { + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(new Color(255, 200, Math.Abs(Main.DiscoB - (int)(dustSpawned * 2.55f)))).X, 1f, 0.5f); + dustColor.A = 255; + int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Main.dust[dust].position = currentDustPos; + Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1f; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale /= 2f; + dust3 = dust2; + dust3.fadeIn /= 2f; + dust2.color = new Color(255, 255, 255, 255); + dustSpawned++; + } + } + + healTimer = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = NPC.lifeMax / 10; + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; + + if (healAmt > 0) + { + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; + } } } } + + if (Main.npc[CalamityGlobalNPC.doughnutBossHealer].ai[0] == 599 && CalamityWorld.getFixedBoi && Main.netMode != NetmodeID.MultiplayerClient) + { + // gain more health once the healer's channel heal is done + NPC.lifeMax += 7500; + NPC.life += NPC.lifeMax - NPC.life; + NPC.HealEffect(NPC.lifeMax - NPC.life, true); + NPC.netUpdate = true; + } } - // 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(); + // Despawn + if (Main.npc[CalamityGlobalNPC.doughnutBoss].ai[3] == -1f) + { + NPC.velocity = Main.npc[CalamityGlobalNPC.doughnutBoss].velocity; + return; + } + // Get the Guardian Commander's target Player player = Main.player[Main.npc[CalamityGlobalNPC.doughnutBoss].target]; bool bossRush = BossRushEvent.BossRushActive; @@ -172,7 +253,141 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool biomeEnraged = biomeEnrageTimer <= 0; - if (NPC.ai[0] == 0f) + bool phase1 = healerAlive; + + NPC.chaseable = !phase1; + + // Phase durations + float commanderGuardPhase2Duration = (bossRush || biomeEnraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float timeBeforeRocksRespawnInPhase2 = 90f; + float throwRocksGateValue = 60f; + + // Distance + float distanceInFrontOfCommander = 160f; + + // Charge variables + float chargeVelocityMult = 0.25f; + float maxChargeVelocity = (bossRush || biomeEnraged) ? 25f : death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; + if (Main.getGoodWorld) + maxChargeVelocity *= 1.15f; + + // Whether the commander is calling all guardians together for the laser attack + bool commanderUsingLaser = Main.npc[CalamityGlobalNPC.doughnutBoss].ai[0] == 5f; + + // Go low just before moving to the other side to avoid bullshit hits + float moveToOtherSideInPhase1GateValue = 900f; + float timeBeforeMoveToOtherSideInPhase1Reset = moveToOtherSideInPhase1GateValue * 2f; + float totalGoLowDurationPhase1 = 240f; + float goLowDurationPhase1 = totalGoLowDurationPhase1 * 0.5f; + float roundedGoLowPhase1Check = (float)Math.Round(goLowDurationPhase1 * 0.5); + bool commanderGoingLowOrHighInPhase1 = (Main.npc[CalamityGlobalNPC.doughnutBoss].localAI[3] > (moveToOtherSideInPhase1GateValue - goLowDurationPhase1) && + Main.npc[CalamityGlobalNPC.doughnutBoss].localAI[3] <= (moveToOtherSideInPhase1GateValue + roundedGoLowPhase1Check)) || + Main.npc[CalamityGlobalNPC.doughnutBoss].localAI[3] > (timeBeforeMoveToOtherSideInPhase1Reset - goLowDurationPhase1) || + Main.npc[CalamityGlobalNPC.doughnutBoss].localAI[3] <= (-roundedGoLowPhase1Check); + + float moveToOtherSideInPhase2GateValue = commanderGuardPhase2Duration - 120f; + float timeBeforeMoveToOtherSideInPhase2Reset = moveToOtherSideInPhase2GateValue * 2f; + float totalGoLowDurationPhase2 = 210f; + float goLowDurationPhase2 = totalGoLowDurationPhase2 * 0.5f; + float roundedGoLowPhase2Check = (float)Math.Round(goLowDurationPhase2 * 0.5); + bool commanderGoingLowOrHighInPhase2 = (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().newAI[1] > (moveToOtherSideInPhase2GateValue - goLowDurationPhase2) && + Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().newAI[1] <= (moveToOtherSideInPhase2GateValue + roundedGoLowPhase2Check)) || + Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().newAI[1] > (timeBeforeMoveToOtherSideInPhase2Reset - goLowDurationPhase2) || + Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().newAI[1] <= (-roundedGoLowPhase2Check); + + // Tell rocks to fade out and shrink + if (commanderGoingLowOrHighInPhase1 || commanderGoingLowOrHighInPhase2) + NPC.localAI[3] = 1f; + else + NPC.localAI[3] = 0f; + + // Spawn rock shield + bool respawnRocksInPhase2 = NPC.ai[1] == (-commanderGuardPhase2Duration + timeBeforeRocksRespawnInPhase2) && !commanderGoingLowOrHighInPhase2; + int rockTypes = 6; + int maxRocks = respawnRocksInPhase2 ? 18 : 36; + int rockRings = 3; + int totalRocksPerRing = maxRocks / rockRings; + int spacing = 360 / totalRocksPerRing; + int distance2 = 200; + bool justSpawnedRocks = false; + if (NPC.localAI[0] == 0f || respawnRocksInPhase2) + { + justSpawnedRocks = true; + NPC.localAI[0] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < totalRocksPerRing; i++) + { + int rockType = Main.rand.Next(rockTypes) + 1; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), NPC.whoAmI, i * spacing, 0f, rockType, 0f); + rockType = Main.rand.Next(rockTypes) + 1; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), NPC.whoAmI, i * spacing, 1f, rockType, 0f); + rockType = Main.rand.Next(rockTypes) + 1; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), NPC.whoAmI, i * spacing, 2f, rockType, 0f); + } + } + } + + // Generate new rock shields if too many are broken in phase 1 + if (phase1) + { + int minRocks = maxRocks / 2; + int numRockShields = NPC.CountNPCS(ModContent.NPCType()); + if (numRockShields < minRocks) + { + justSpawnedRocks = true; + totalRocksPerRing = minRocks / rockRings; + spacing = 360 / totalRocksPerRing; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < totalRocksPerRing; i++) + { + int rockType = Main.rand.Next(rockTypes) + 1; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), NPC.whoAmI, i * spacing, 0f, rockType, 0f); + rockType = Main.rand.Next(rockTypes) + 1; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), NPC.whoAmI, i * spacing, 1f, rockType, 0f); + rockType = Main.rand.Next(rockTypes) + 1; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), NPC.whoAmI, i * spacing, 2f, rockType, 0f); + } + } + } + } + else + { + if (NPC.localAI[1] < TimeForShieldDespawn) + { + // Star Wrath use sound + if (NPC.localAI[1] == 0f) + SoundEngine.PlaySound(ShieldDeathSound, NPC.Center); + + NPC.localAI[1] += 1f; + } + } + + // Spawn three dust circles and play noise whenever rock shields are spawned + if (justSpawnedRocks) + { + // Meteor Staff use sound and dust circles + SoundEngine.PlaySound(RockShieldSpawnSound, NPC.Center); + int totalDust = maxRocks; + for (int j = 0; j < rockRings; j++) + { + for (int k = 0; k < totalDust; k++) + { + Vector2 dustSpawnPos = NPC.velocity.SafeNormalize(Vector2.UnitY) * new Vector2(distance2, distance2); + dustSpawnPos = dustSpawnPos.RotatedBy((double)((k - (totalDust / 2 - 1)) * MathHelper.TwoPi / totalDust), default) + NPC.Center; + Vector2 dustVelocity = dustSpawnPos - NPC.Center; + Color dustColor = Main.hslToRgb(Main.rgbToHsl(Color.Orange).X, 1f, 0.5f); + dustColor.A = 255; + int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, 267, dustVelocity.X, dustVelocity.Y, 0, dustColor, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = dustVelocity * (j * 0.1f + 0.1f); + } + } + } + + if (CalamityWorld.getFixedBoi) { if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -180,56 +395,101 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.direction = playerLocation < 0f ? 1 : -1; NPC.spriteDirection = NPC.direction; } + // Block the main guardian + Vector2 guardPos = Main.npc[CalamityGlobalNPC.doughnutBoss].Center; + Vector2 playerPos = player.Center; + Vector2 midPoint = ((guardPos - playerPos) / 1.25f) + playerPos; + NPC.position = midPoint; + return; + } - NPC.ai[3] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient) + float moveVelocity = (bossRush || biomeEnraged) ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; + if (Main.getGoodWorld) + moveVelocity *= 1.25f; + if (healerAlive) + moveVelocity *= 0.8f; + + float distanceToStayAwayFromTarget = 800f; + bool speedUp = Vector2.Distance(NPC.Center, player.Center) > (distanceToStayAwayFromTarget + 160f); + if (speedUp) + moveVelocity *= 2f; + if (commanderGoingLowOrHighInPhase2) + moveVelocity *= 2f; + else if (commanderGoingLowOrHighInPhase1) + moveVelocity *= 1.66f; + + if (NPC.ai[0] == 0f) + { + // Face the target + if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { - float divisor = (bossRush || biomeEnraged) ? 30f : death ? 40f : revenge ? 45f : expertMode ? 50f : 60f; - if (NPC.ai[3] % divisor == 0f) + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + } + + // Slow down and tell the Profaned Rocks to spin and fling themselves at the target by setting NPC.ai[0] = 1f + if (!phase1) + { + NPC.velocity *= 0.9f; + if (NPC.velocity.Length() <= 2f) + NPC.velocity = Vector2.Zero; + + NPC.ai[3] += 1f; + if (NPC.ai[3] >= throwRocksGateValue) { - SoundEngine.PlaySound(SoundID.Item20, NPC.position); - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * NPC.velocity.Length() * 0.5f, type, damage, 0f, Main.myPlayer, 3f, 0f); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; } - } - - Vector2 targetVector = player.Center - NPC.Center; - float phaseGateValue = (bossRush || biomeEnraged) ? 60f : death ? 80f : revenge ? 90f : expertMode ? 100f : 120f; - if (NPC.ai[3] >= phaseGateValue && !healerAlive) - { - NPC.ai[0] = 1f; - NPC.ai[2] = targetVector.X; - NPC.ai[3] = targetVector.Y; - NPC.netUpdate = true; - } - - Vector2 vector96 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt(num784 * num784 + num785 * num785); - - if (num786 > (healerAlive ? 160f : 80f)) - { - num786 = (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f) / num786; - num784 *= num786; - num785 *= num786; - - float inertia = 25f; - if (Main.getGoodWorld) - inertia *= 0.8f; - - NPC.velocity.X = (NPC.velocity.X * inertia + num784) / (inertia + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia + num785) / (inertia + 1f); return; } - if (NPC.velocity.Length() < Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f) - NPC.velocity *= 1.1f; + // Lay a holy bomb every once in a while in phase 1 and while not doing the laser attack + if (!commanderUsingLaser) + { + float projectileShootGateValue = (bossRush || biomeEnraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + NPC.ai[1] += 1f; + if (NPC.ai[1] >= projectileShootGateValue) + { + NPC.ai[1] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float projectileVelocityY = NPC.velocity.Y; + if (projectileVelocityY < 0f) + projectileVelocityY = 0f; + + projectileVelocityY += expertMode ? 4f : 3f; + Vector2 projectileVelocity = new Vector2(NPC.velocity.X * 0.25f, projectileVelocityY); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + + // Defend the commander + Vector2 distanceFromDestination = Main.npc[CalamityGlobalNPC.doughnutBoss].Center + Vector2.UnitX * ((commanderUsingLaser || commanderGoingLowOrHighInPhase1) ? 0f : distanceInFrontOfCommander) * Main.npc[CalamityGlobalNPC.doughnutBoss].direction - NPC.Center; + Vector2 desiredVelocity = distanceFromDestination.SafeNormalize(new Vector2(NPC.direction, 0f)) * moveVelocity; + if (distanceFromDestination.Length() > 40f) + { + float inertia = (commanderUsingLaser || commanderGoingLowOrHighInPhase1) ? 10f : 15f; + if (Main.getGoodWorld) + inertia *= 0.8f; + + NPC.velocity = (NPC.velocity * (inertia - 1) + desiredVelocity) / inertia; + } + else + NPC.velocity *= 0.9f; } + + // Phase 2 + // Throw rocks, charge, summon holy bombs and shoot molten blasts else if (NPC.ai[0] == 1f) { + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { float playerLocation = NPC.Center.X - player.Center.X; @@ -237,81 +497,186 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.spriteDirection = NPC.direction; } - NPC.velocity *= 0.8f; - if (Main.getGoodWorld) - NPC.velocity *= 0.5f; + // Do not increment the phase timer while swapping sides along with the commander in phase 2 + if (!commanderGoingLowOrHighInPhase2) + NPC.ai[1] += 1f; - float chargeGateValue = 18f; - if (Main.getGoodWorld) - chargeGateValue *= 0.25f; + // Slow down before throwing rock shields + if (NPC.ai[1] >= -throwRocksGateValue) + { + NPC.velocity *= 0.8f; + if (Main.getGoodWorld) + NPC.velocity *= 0.5f; + } - NPC.ai[1] += 1f; - if (NPC.ai[1] >= chargeGateValue) + // Defend the commander + else + { + // Shoot molten blasts + int moltenBlastsDivisor = 4; + float shootMoltenBlastsGateValue = commanderGuardPhase2Duration / moltenBlastsDivisor; + if (NPC.ai[1] % shootMoltenBlastsGateValue == 0f && !commanderGoingLowOrHighInPhase2) + { + float moltenBlastVelocity = (bossRush || biomeEnraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + int projTimeLeft = (int)(2400f / moltenBlastVelocity); + Vector2 velocity = Vector2.Normalize(player.Center - shootFrom) * moltenBlastVelocity; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Main.projectile[proj].timeLeft = projTimeLeft; + } + } + + // Dust for blasting out the molten blasts + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.ProfanedFire; + break; + default: + dustID = DustID.OrangeTorch; + break; + } + + // Choose a random speed and angle to blast the fire out + float dustSpeed = Main.rand.NextFloat(moltenBlastVelocity * 0.5f, moltenBlastVelocity); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the fire particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the fire + int idx = Dust.NewDust(shootFrom, 42, 42, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + + NPC.velocity = -velocity * 0.5f; + } + + Vector2 distanceFromDestination = Main.npc[CalamityGlobalNPC.doughnutBoss].Center + (commanderGoingLowOrHighInPhase2 ? Vector2.Zero : (Vector2.UnitX * distanceInFrontOfCommander * Main.npc[CalamityGlobalNPC.doughnutBoss].direction)) - NPC.Center; + Vector2 desiredVelocity = distanceFromDestination.SafeNormalize(new Vector2(NPC.direction, 0f)) * moveVelocity; + if (distanceFromDestination.Length() > 40f) + { + float inertia = commanderGoingLowOrHighInPhase2 ? 8f : 15f; + if (Main.getGoodWorld) + inertia *= 0.8f; + + NPC.velocity = (NPC.velocity * (inertia - 1) + desiredVelocity) / inertia; + } + else + NPC.velocity *= 0.9f; + } + + // Charge at target + if (NPC.ai[1] >= 0f) { NPC.ai[0] = 2f; NPC.ai[1] = 0f; NPC.netUpdate = true; - Vector2 velocity = new Vector2(NPC.ai[2], NPC.ai[3]); - velocity.Normalize(); - velocity *= (bossRush || biomeEnraged) ? 25f : death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; - if (Main.getGoodWorld) - velocity *= 1.15f; + Vector2 targetVector = player.Center - NPC.Center; + Vector2 velocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)); + velocity *= maxChargeVelocity; - NPC.velocity = velocity; + // Start slow and accelerate + NPC.velocity = velocity * chargeVelocityMult; + + // Dust ring and sound right as charge begins + SoundEngine.PlaySound(DashSound, NPC.Center); + int totalDust = 36; + for (int k = 0; k < totalDust; k++) + { + Vector2 dustSpawnPos = NPC.velocity.SafeNormalize(Vector2.UnitY) * new Vector2(160f, 160f); + dustSpawnPos = dustSpawnPos.RotatedBy((double)((k - (totalDust / 2 - 1)) * MathHelper.TwoPi / totalDust), default) + shootFrom; + Vector2 dustVelocity = dustSpawnPos - shootFrom; + int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, (int)CalamityDusts.ProfanedFire, dustVelocity.X, dustVelocity.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].scale = 3f; + Main.dust[dust].velocity = dustVelocity * 0.3f; + } } } + + // Charge at the target and spawn holy bombs else if (NPC.ai[0] == 2f) { if (Math.Sign(NPC.velocity.X) != 0) NPC.spriteDirection = -Math.Sign(NPC.velocity.X); NPC.spriteDirection = Math.Sign(NPC.velocity.X); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[0] += 1f; - float projectileGateValue = (bossRush || biomeEnraged) ? 30f : death ? 40f : revenge ? 45f : expertMode ? 50f : 60f; - if (NPC.localAI[0] >= projectileGateValue && Vector2.Distance(NPC.Center, player.Center) > 160f) - { - NPC.localAI[0] = 0f; - - SoundEngine.PlaySound(SoundID.Item20, NPC.position); - - float velocity = 5f; - int totalProjectiles = 6; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, damage, 0f, Main.myPlayer); - } - } - } - NPC.ai[1] += 1f; - float phaseGateValue = (bossRush || biomeEnraged) ? 60f : death ? 80f : revenge ? 90f : expertMode ? 100f : 120f; + float phaseGateValue = (bossRush || biomeEnraged) ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; if (NPC.ai[1] >= phaseGateValue) { NPC.ai[0] = 3f; - NPC.ai[1] = 24f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; + + // Slown down duration ranges from 30 to 60 frames in rev, otherwise it's always 60 frames + float slowDownDurationAfterCharge = revenge ? Main.rand.Next(30, 61) : 60f; + NPC.ai[1] = slowDownDurationAfterCharge; + NPC.localAI[2] = 0f; NPC.velocity /= 2f; NPC.netUpdate = true; } else { - Vector2 targetVector = player.Center - NPC.Center; - targetVector.Normalize(); - if (targetVector.HasNaNs()) - targetVector = new Vector2(NPC.direction, 0f); + Vector2 targetVector = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)); - float inertia = (bossRush || biomeEnraged) ? 35f : death ? 40f : revenge ? 42f : expertMode ? 45f : 50f; - float num1006 = 0.111111117f * inertia; - NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + num1006)) / inertia; + if (NPC.localAI[2] == 0f) + { + // Accelerate + if (NPC.velocity.Length() < maxChargeVelocity) + { + float velocityMult = (bossRush || biomeEnraged) ? 1.04f : death ? 1.036667f : revenge ? 1.035f : expertMode ? 1.033333f : 1.03f; + 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 + { + // Charge towards target + float inertia = (bossRush || biomeEnraged) ? 57f : death ? 63f : revenge ? 66f : expertMode ? 69f : 75f; + float num1006 = 0.111111117f * inertia; + NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + num1006)) / inertia; + } + + // Lay holy bombs while charging + int projectileGateValue = (int)(phaseGateValue * 0.4f); + if (NPC.ai[1] % projectileGateValue == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float projectileVelocityY = NPC.velocity.Y; + if (projectileVelocityY < 0f) + projectileVelocityY = 0f; + + projectileVelocityY += expertMode ? 4f : 3f; + Vector2 projectileVelocity = new Vector2(NPC.velocity.X * 0.25f, projectileVelocityY); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, damage, 0f, Main.myPlayer); + } + } } } + + // Slow down and pause for a bit else if (NPC.ai[0] == 3f) { if (Math.Sign(NPC.velocity.X) != 0) @@ -321,13 +686,21 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.ai[1] -= 1f; if (NPC.ai[1] <= 0f) { - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; + NPC.ai[0] = 1f; + NPC.ai[2] += 1f; + + // Charges either once or twice in a row in rev, otherwise it will always charge twice in a row + float totalCharges = revenge ? (Main.rand.Next(2) + 1f) : 2f; + bool dontCharge = NPC.ai[2] >= totalCharges; + NPC.ai[1] = dontCharge ? -commanderGuardPhase2Duration : 0f; + if (dontCharge) + NPC.ai[2] = 0f; + NPC.TargetClosest(); NPC.netUpdate = true; } - NPC.velocity *= 0.9f; + NPC.velocity *= 0.97f; } } @@ -335,57 +708,149 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; - if (NPC.ai[0] == 2f) - num153 = 10; - - if (CalamityConfig.Instance.Afterimages) + void drawGuardianInstance(Vector2 drawOffset, Color? colorOverride) { - for (int num155 = 1; num155 < num153; num155 += 2) + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Vector2 drawPos = NPC.Center - screenPos; + Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Color color36 = Color.White; + float amount9 = 0.5f; + int num153 = 5; + if (NPC.ai[0] == 2f) + num153 = 10; + + if (CalamityConfig.Instance.Afterimages) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = drawColor; + color38 = Color.Lerp(color38, color36, amount9); + color38 = NPC.GetAlpha(color38); + color38 *= (num153 - num155) / 15f; + if (colorOverride != null) + color38 = colorOverride.Value; + + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + } } + + Vector2 vector43 = drawPos; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector43, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; + Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + if (CalamityWorld.getFixedBoi) + { + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlowNight").Value; + color37 = Color.Cyan; + } + if (colorOverride != null) + color37 = colorOverride.Value; + + if (CalamityConfig.Instance.Afterimages) + { + for (int num163 = 1; num163 < num153; num163++) + { + Color color41 = color37; + color41 = Color.Lerp(color41, color36, amount9); + color41 = NPC.GetAlpha(color41); + color41 *= (num153 - num163) / 15f; + if (colorOverride != null) + color41 = colorOverride.Value; + + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + } + } + + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - - if (CalamityConfig.Instance.Afterimages) + // Draw laser effects + float useLaserGateValue = 120f; + float stopLaserGateValue = (CalamityWorld.revenge || BossRushEvent.BossRushActive) ? 235f : 315f; + float maxIntensity = 45f; + float increaseIntensityGateValue = useLaserGateValue - maxIntensity; + float decreaseIntensityGateValue = stopLaserGateValue - maxIntensity; + bool usingLaser = Main.npc[CalamityGlobalNPC.doughnutBoss].ai[0] == 5f; + bool increaseIntensity = Main.npc[CalamityGlobalNPC.doughnutBoss].ai[1] > increaseIntensityGateValue; + bool decreaseIntensity = Main.npc[CalamityGlobalNPC.doughnutBoss].ai[1] > decreaseIntensityGateValue; + if (usingLaser) { - for (int num163 = 1; num163 < num153; num163++) + float burnIntensity = decreaseIntensity ? Utils.GetLerpValue(0f, maxIntensity, maxIntensity - (Main.npc[CalamityGlobalNPC.doughnutBoss].ai[1] - decreaseIntensityGateValue), true) : Utils.GetLerpValue(0f, maxIntensity, Main.npc[CalamityGlobalNPC.doughnutBoss].ai[1], true); + int totalGuardiansToDraw = (int)MathHelper.Lerp(1f, 30f, burnIntensity); + for (int i = 0; i < totalGuardiansToDraw; i++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + float offsetAngle = MathHelper.TwoPi * i * 2f / totalGuardiansToDraw; + float drawOffsetFactor = (float)Math.Sin(offsetAngle * 6f + Main.GlobalTimeWrappedHourly * MathHelper.Pi); + drawOffsetFactor *= (float)Math.Pow(burnIntensity, 3f) * 50f; + + Vector2 drawOffset = offsetAngle.ToRotationVector2() * drawOffsetFactor; + Color baseColor = Color.White * (MathHelper.Lerp(0.4f, 0.8f, burnIntensity) / totalGuardiansToDraw * 1.5f); + baseColor.A = 0; + + baseColor = Color.Lerp(Color.White, baseColor, burnIntensity); + drawGuardianInstance(drawOffset, totalGuardiansToDraw == 1 ? null : baseColor); } } + else + drawGuardianInstance(Vector2.Zero, null); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + // Draw shields while healer is alive + if (NPC.localAI[1] < TimeForShieldDespawn) + { + float maxOscillation = 60f; + float minScale = 0.8f; + float maxPulseScale = 1f - minScale; + float minOpacity = 0.5f; + float maxOpacityScale = 1f - minOpacity; + float currentOscillation = MathHelper.Lerp(0f, maxOscillation, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi) + 1f) * 0.5f); + float shieldOpacity = minOpacity + maxOpacityScale * Utils.Remap(currentOscillation, 0f, maxOscillation, 1f, 0f); + float oscillationRatio = currentOscillation / maxOscillation; + float invertedOscillationRatio = 1f - (1f - oscillationRatio) * (1f - oscillationRatio); + float oscillationScale = 1f - (1f - invertedOscillationRatio) * (1f - invertedOscillationRatio); + float remappedOscillation = Utils.Remap(currentOscillation, maxOscillation - 15f, maxOscillation, 0f, 1f); + float twoOscillationsMultipliedTogetherForScaleCalculation = remappedOscillation * remappedOscillation; + float invertedOscillationUsedForScale = MathHelper.Lerp(minScale, 1f, 1f - twoOscillationsMultipliedTogetherForScaleCalculation); + float shieldScale = (minScale + maxPulseScale * oscillationScale) * invertedOscillationUsedForScale; + float smallerRemappedOscillation = Utils.Remap(currentOscillation, 20f, maxOscillation, 0f, 1f); + float invertedSmallerOscillationRatio = 1f - (1f - smallerRemappedOscillation) * (1f - smallerRemappedOscillation); + float smallerOscillationScale = 1f - (1f - invertedSmallerOscillationRatio) * (1f - invertedSmallerOscillationRatio); + float shieldScale2 = (minScale + maxPulseScale * smallerOscillationScale) * invertedOscillationUsedForScale; + Texture2D shieldTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value; + Rectangle shieldFrame = shieldTexture.Frame(); + Vector2 origin = shieldFrame.Size() * 0.5f; + Vector2 shieldDrawPos = NPC.Center - screenPos; + shieldDrawPos -= new Vector2(shieldTexture.Width, shieldTexture.Height) * NPC.scale / 2f; + shieldDrawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + float minHue = 0.06f; + float maxHue = 0.18f; + float opacityScaleDuringShieldDespawn = (TimeForShieldDespawn - NPC.localAI[1]) / TimeForShieldDespawn; + float scaleDuringShieldDespawnScale = 1.8f; + float scaleDuringShieldDespawn = (1f - opacityScaleDuringShieldDespawn) * scaleDuringShieldDespawnScale; + float colorScale = MathHelper.Lerp(0f, shieldOpacity, opacityScaleDuringShieldDespawn); + Color color = Main.hslToRgb(MathHelper.Lerp(maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + color2.A = 0; + color *= 0.6f; + color2 *= 0.6f; + float scaleMult = 1.2f + scaleDuringShieldDespawn; + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale2 * scaleMult, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale2 * scaleMult * 0.95f, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale * scaleMult, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale * scaleMult * 0.95f, SpriteEffects.None, 0f); + } return false; } @@ -398,18 +863,57 @@ namespace CalamityMod.NPCs.ProfanedGuardians potionType = ItemID.GreaterHealingPotion; } + // Can only hit the target if within certain distance + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = ImmunityCooldownID.Bosses; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 80f; + } + public override void OnHitPlayer(Player player, int damage, bool crit) { if (damage > 0) player.AddBuff(ModContent.BuffType(), 240, true); } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + // eat projectiles but take more damage based on piercing in the zenith seed + if (CalamityWorld.getFixedBoi && !projectile.minion) + { + if (projectile.penetrate <= -1 || projectile.penetrate > 5) + { + damage = (int)(damage * 2.5f); + } + else + { + damage *= projectile.penetrate / 2; + } + projectile.active = false; + } + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -417,11 +921,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT4").Type, 1f); } + for (int k = 0; k < 50; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - } } } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png index 55f5b7ec1c..fc376c8f91 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png and b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow.png b/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow.png index aca6952394..16ec8e08d5 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow.png and b/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlow.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlowNight.png b/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlowNight.png new file mode 100644 index 0000000000..502bddd9d4 Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedGuardianDefenderGlowNight.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index af56ad0379..d10f9003c2 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -2,11 +2,14 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -17,12 +20,30 @@ namespace CalamityMod.NPCs.ProfanedGuardians [AutoloadBossHead] public class ProfanedGuardianHealer : ModNPC { + private enum Phase + { + CrystalShards = 0, + Stars = 1 + } + + private float AIState + { + get => NPC.localAI[0]; + set => NPC.localAI[0] = value; + } + + private float AITimer + { + get => NPC.ai[3]; + set => NPC.ai[3] = value; + } + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; public override void SetStaticDefaults() { DisplayName.SetDefault("Guardian Healer"); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) @@ -42,11 +63,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.npcSlots = 3f; NPC.aiStyle = -1; NPC.GetNPCDamage(); - NPC.width = 100; - NPC.height = 80; + NPC.width = 228; + NPC.height = 164; NPC.defense = 30; NPC.DR_NERD(0.2f); - NPC.LifeMaxNERB(25000, 30000, 20000); // Old HP - 25000, 35000 + NPC.LifeMaxNERB(60000, 72000, 50000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); NPC.knockBackResist = 0f; @@ -76,19 +97,25 @@ namespace CalamityMod.NPCs.ProfanedGuardians }); } + public float GetStarShootSlowDownGateValue() => BossRushEvent.BossRushActive ? 180f : CalamityWorld.death ? 210f : CalamityWorld.revenge ? 225f : Main.expertMode ? 240f : 270f; + + public float GetStarShootGateValue() => GetStarShootSlowDownGateValue() + 60f; + public override void SendExtraAI(BinaryWriter writer) { writer.Write(biomeEnrageTimer); + writer.Write(NPC.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) { biomeEnrageTimer = reader.ReadInt32(); + NPC.localAI[0] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; + NPC.frameCounter += 0.12f + NPC.velocity.Length() / 120f; NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -98,26 +125,48 @@ namespace CalamityMod.NPCs.ProfanedGuardians { CalamityGlobalNPC.doughnutBossHealer = NPC.whoAmI; + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.1f, 0.9f, 0f); + if (CalamityGlobalNPC.doughnutBoss < 0 || !Main.npc[CalamityGlobalNPC.doughnutBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; } - // Get a target - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - NPC.TargetClosest(); + Vector2 dustAndProjectileOffset = new Vector2(40f * NPC.direction, 20f); + Vector2 shootFrom = NPC.Center + dustAndProjectileOffset; - // 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(); + // Rotation + NPC.rotation = NPC.velocity.X * 0.005f; + // Despawn + if (Main.npc[CalamityGlobalNPC.doughnutBoss].ai[3] == -1f) + { + NPC.velocity = Main.npc[CalamityGlobalNPC.doughnutBoss].velocity; + return; + } + + // Get the Guardian Commander's target Player player = Main.player[Main.npc[CalamityGlobalNPC.doughnutBoss].target]; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; bool isHoly = player.ZoneHallow; bool isHell = player.ZoneUnderworldHeight; + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + if (CalamityWorld.getFixedBoi) + NPC.ai[0]++; + if (NPC.ai[0] >= 300f) + NPC.ai[1] = 1f; + // Become immune over time if target isn't in hell or hallow if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { @@ -129,6 +178,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + bool biomeEnraged = biomeEnrageTimer <= 0; + + // Direction if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { float playerLocation = NPC.Center.X - player.Center.X; @@ -136,94 +188,355 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.spriteDirection = NPC.direction; } - Vector2 vector96 = new Vector2(NPC.Center.X, NPC.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.doughnutBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt(num784 * num784 + num785 * num785); - - if (num786 > 320f) + if (NPC.ai[1] == 1f && CalamityWorld.getFixedBoi) { - num786 = (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 3f) / num786; - num784 *= num786; - num785 *= num786; + NPC.ai[2]++; + NPC.velocity = Vector2.Zero; + // Spray out stars of healing stars in gfb + if (NPC.ai[2] >= 45f) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int totalProjectiles = 10; + float radians = MathHelper.TwoPi / totalProjectiles; + float projectileVelocity = 8f; + Vector2 spinningPoint = new Vector2(0f, -projectileVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity2, type, 0, 0f, Main.myPlayer, 0f, damage); + } + NPC.ai[2] = 0f; + } + if (NPC.ai[0] >= 600f) + { + SoundEngine.PlaySound(SoundID.Item10, player.Center); + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[0] = 0f; + } + return; + } - float inertia = 25f; - if (Main.getGoodWorld) - inertia *= 0.8f; + bool useCrystalShards = AIState == (float)Phase.CrystalShards; + float velocity = useCrystalShards ? ((bossRush || biomeEnraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) : (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); + if (Main.getGoodWorld) + velocity *= 1.25f; - NPC.velocity.X = (NPC.velocity.X * inertia + num784) / (inertia + 1f); - NPC.velocity.Y = (NPC.velocity.Y * inertia + num785) / (inertia + 1f); + float idealDistanceFromDestination = useCrystalShards ? 80f : 160f; + Vector2 destination = player.Center + (useCrystalShards ? Vector2.Zero : Vector2.UnitX * player.velocity.SafeNormalize(new Vector2(NPC.direction, 0f)).X * 400f) + Vector2.UnitY * -400f; + Vector2 distanceFromDestination = destination - NPC.Center; + Vector2 desiredVelocity = distanceFromDestination.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; + + // Whether the commander is calling all guardians together for the laser attack + bool commanderUsingLaser = Main.npc[CalamityGlobalNPC.doughnutBoss].ai[0] == 5f; + if (commanderUsingLaser) + { + NPC.Calamity().DR = 0.9f; + NPC.Calamity().unbreakableDR = true; + NPC.Calamity().CurrentlyIncreasingDefenseOrDR = true; + } + else + { + NPC.Calamity().DR = 0.2f; + NPC.Calamity().unbreakableDR = false; + NPC.Calamity().CurrentlyIncreasingDefenseOrDR = false; + } + + // Laser attack + if (commanderUsingLaser) + { + AITimer = 0f; + + // Move towards the commander + distanceFromDestination = Main.npc[CalamityGlobalNPC.doughnutBoss].Center - NPC.Center; + desiredVelocity = distanceFromDestination.SafeNormalize(new Vector2(NPC.direction, 0f)) * (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); + if (distanceFromDestination.Length() > 40f) + { + float inertia = 10f; + if (Main.getGoodWorld) + inertia *= 0.8f; + + NPC.velocity = (NPC.velocity * (inertia - 1) + desiredVelocity) / inertia; + } + else + NPC.velocity *= 0.9f; return; } - if (NPC.velocity.Length() < Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 3f) - NPC.velocity *= 1.1f; + // Fire crystal rain similar to Providence's Crystal attack + if (useCrystalShards) + { + // Increment timer + AITimer += 1f; + float crystalShootGateValue = bossRush ? 140f : death ? 180f : revenge ? 200f : expertMode ? 220f : 260f; + float crystalShootPhaseDuration = crystalShootGateValue + crystalShootGateValue * 0.25f; + + // Generate dust that scales with how close the crystals are to firing + float dustGateValue = crystalShootGateValue * 0.5f; + if (AITimer >= dustGateValue && AITimer < crystalShootGateValue) + { + int dustChance = (int)((crystalShootGateValue - AITimer) * 0.25f); + if (dustChance < 2) + dustChance = 2; + + int maxDust = 10; + for (int i = 0; i < maxDust; i++) + { + if (Main.rand.NextBool(dustChance)) + { + Color baseColor = new Color(250, 150, 0); + float brightness = 0.8f; + Color dustColor = Color.Lerp(baseColor, Color.White, brightness); + Dust dust = Main.dust[Dust.NewDust(NPC.Top, 0, 0, 267, 0f, 0f, 100, dustColor, 1f)]; + dust.velocity.X = 0f; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.position = shootFrom + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * (4f * Main.rand.NextFloat() + 26f); + dust.scale = 0.8f; + } + } + } + + // Fire crystals + if (AITimer == crystalShootGateValue) + { + SoundEngine.PlaySound(SoundID.Item109, shootFrom); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int totalProjectiles = biomeEnraged ? 18 : death ? 16 : revenge ? 14 : expertMode ? 12 : 10; + float speedX = -12f; + float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); + float speedY = -4f; + float randomVelocityMult = death ? 2f : 1f; + for (int i = 0; i < totalProjectiles; i++) + { + float x4 = Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X; + Vector2 randomizedVelocity = Vector2.Zero; + if (revenge) + { + float randomFloatX = Main.rand.NextFloat() - 0.5f; + float randomFloatY = Main.rand.NextFloat() - 0.5f; + randomizedVelocity = revenge ? (new Vector2(randomFloatX, randomFloatY) * randomVelocityMult) : Vector2.Zero; + } + Vector2 projectileVelocity = new Vector2(speedX + speedAdjustment * i + distanceFromDestination.SafeNormalize(Vector2.Zero).X * Math.Abs(player.velocity.X), speedY) + randomizedVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, damage, 0f, Main.myPlayer, x4); + } + } + } + + // Reset timer and use stars next + if (AITimer >= crystalShootPhaseDuration) + { + AITimer = 0f; + AIState = (float)Phase.Stars; + } + } + + // Fire spread of damage and healing stars + else + { + // Increment timer + AITimer += 1f; + float starShootPhaseDuration = GetStarShootGateValue() + 60f; + if (AITimer == GetStarShootGateValue()) + { + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, shootFrom); + + int totalFlameProjectiles = biomeEnraged ? 20 : 16; + int totalRings = revenge ? 3 : 2; + int healingStarChance = revenge ? 8 : expertMode ? 6 : 4; + double radians = MathHelper.TwoPi / totalFlameProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + for (int i = 0; i < totalRings; i++) + { + bool firstRing = i % 2 == 0; + float starVelocity = i + 2f; + float velocityX = (float)(starVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = firstRing ? new Vector2(-velocityX, -starVelocity) : new Vector2(0f, -starVelocity); + for (int j = 0; j < totalFlameProjectiles; j++) + { + Vector2 vector2 = spinningPoint.RotatedBy(radians * j); + + int type = ModContent.ProjectileType(); + int dmgAmt = NPC.GetProjectileDamage(type); + if (Main.rand.NextBool(healingStarChance) && !death) + { + type = ModContent.ProjectileType(); + dmgAmt = NPC.GetProjectileDamageNoScaling(type); + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, vector2, type, 0, 0f, Main.myPlayer, 0f, dmgAmt); + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, vector2, type, dmgAmt, 0f, Main.myPlayer); + + Color dustColor = Main.hslToRgb(Main.rgbToHsl(type == ModContent.ProjectileType() ? Color.Orange : Color.Green).X, 1f, 0.5f); + dustColor.A = 255; + int maxDust = 3; + for (int k = 0; k < maxDust; k++) + { + int dust = Dust.NewDust(shootFrom, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Main.dust[dust].position = shootFrom; + Main.dust[dust].velocity = vector2 * starVelocity * (k * 0.5f + 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1f + k; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale /= 2f; + dust3 = dust2; + dust3.fadeIn /= 2f; + dust2.color = new Color(255, 255, 255, 255); + } + } + } + } + + // Reset timer and use stars next + if (AITimer >= starShootPhaseDuration) + { + AITimer = 0f; + AIState = (float)Phase.CrystalShards; + } + } + + // Move towards a location above the player + if (distanceFromDestination.Length() > idealDistanceFromDestination) + { + float inertia = (bossRush || biomeEnraged) ? 28f : death ? 32f : revenge ? 34f : expertMode ? 36f : 40f; + if (lifeRatio < 0.5f) + inertia *= 0.8f; + if (Main.getGoodWorld) + inertia *= 0.8f; + + NPC.velocity = (NPC.velocity * (inertia - 1) + desiredVelocity) / inertia; + + return; + } + + // Slow down when close enough to destination or when firing stars + NPC.velocity *= 0.98f; } public override bool CheckActive() => false; public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; - - if (CalamityConfig.Instance.Afterimages) + void drawGuardianInstance(Vector2 drawOffset, Color? colorOverride) { - for (int num155 = 1; num155 < num153; num155 += 2) + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2").Value; + Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Color color36 = Color.White; + float amount9 = 0.5f; + int num153 = 5; + + if (CalamityConfig.Instance.Afterimages) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = drawColor; + color38 = Color.Lerp(color38, color36, amount9); + color38 = NPC.GetAlpha(color38); + color38 *= (num153 - num155) / 15f; + if (colorOverride != null) + color38 = colorOverride.Value; + + Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + } } + + Vector2 vector43 = NPC.Center - screenPos; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector43, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; + Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); + if (CalamityWorld.getFixedBoi) + { + texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlowNight").Value; + color37 = Color.Cyan; + } + Color color42 = Color.Lerp(Color.White, Color.Violet, 0.5f); + if (colorOverride != null) + { + color37 = colorOverride.Value; + color42 = colorOverride.Value; + } + + if (CalamityConfig.Instance.Afterimages) + { + for (int num163 = 1; num163 < num153; num163++) + { + Color color41 = color37; + color41 = Color.Lerp(color41, color36, amount9); + color41 = NPC.GetAlpha(color41); + color41 *= (num153 - num163) / 15f; + if (colorOverride != null) + color41 = colorOverride.Value; + + Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + + Color color43 = color42; + color43 = Color.Lerp(color43, color36, amount9); + color43 = NPC.GetAlpha(color43); + color43 *= (num153 - num163) / 15f; + if (colorOverride != null) + color43 = colorOverride.Value; + + spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + } + } + + spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + + spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - - texture2D15 = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f); - Color color42 = Color.Lerp(Color.White, Color.Violet, 0.5f); - - if (CalamityConfig.Instance.Afterimages) + // Draw laser effects + float useLaserGateValue = 120f; + float stopLaserGateValue = (CalamityWorld.revenge || BossRushEvent.BossRushActive) ? 235f : 315f; + float maxIntensity = 45f; + float increaseIntensityGateValue = useLaserGateValue - maxIntensity; + float decreaseIntensityGateValue = stopLaserGateValue - maxIntensity; + bool usingLaser = Main.npc[CalamityGlobalNPC.doughnutBoss].ai[0] == 5f; + bool increaseIntensity = Main.npc[CalamityGlobalNPC.doughnutBoss].ai[1] > increaseIntensityGateValue; + bool decreaseIntensity = Main.npc[CalamityGlobalNPC.doughnutBoss].ai[1] > decreaseIntensityGateValue; + if (usingLaser) { - for (int num163 = 1; num163 < num153; num163++) + float burnIntensity = decreaseIntensity ? Utils.GetLerpValue(0f, maxIntensity, maxIntensity - (Main.npc[CalamityGlobalNPC.doughnutBoss].ai[1] - decreaseIntensityGateValue), true) : Utils.GetLerpValue(0f, maxIntensity, Main.npc[CalamityGlobalNPC.doughnutBoss].ai[1], true); + int totalGuardiansToDraw = (int)MathHelper.Lerp(1f, 30f, burnIntensity); + for (int i = 0; i < totalGuardiansToDraw; i++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + float offsetAngle = MathHelper.TwoPi * i * 2f / totalGuardiansToDraw; + float drawOffsetFactor = (float)Math.Sin(offsetAngle * 6f + Main.GlobalTimeWrappedHourly * MathHelper.Pi); + drawOffsetFactor *= (float)Math.Pow(burnIntensity, 3f) * 50f; - Color color43 = color42; - color43 = Color.Lerp(color43, color36, amount9); - color43 = NPC.GetAlpha(color43); - color43 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2D16, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawOffset = offsetAngle.ToRotationVector2() * drawOffsetFactor; + Color baseColor = Color.White * (MathHelper.Lerp(0.4f, 0.8f, burnIntensity) / totalGuardiansToDraw * 1.5f); + baseColor.A = 0; + + baseColor = Color.Lerp(Color.White, baseColor, burnIntensity); + drawGuardianInstance(drawOffset, totalGuardiansToDraw == 1 ? null : baseColor); } } - - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); - - spriteBatch.Draw(texture2D16, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + else + drawGuardianInstance(Vector2.Zero, null); return false; } @@ -236,6 +549,29 @@ namespace CalamityMod.NPCs.ProfanedGuardians potionType = ItemID.GreaterHealingPotion; } + // Can only hit the target if within certain distance + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = ImmunityCooldownID.Bosses; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 80f; + } + public override void OnHitPlayer(Player player, int damage, bool crit) { if (damage > 0) @@ -245,9 +581,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) @@ -256,12 +591,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH3").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH4").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH5").Type, 1f); } + for (int k = 0; k < 50; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); - } } } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png index 7f02f8ab4b..c793ba7e51 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png and b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow.png b/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow.png index b8790af874..be4bafb605 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow.png and b/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2.png b/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2.png index 32aaed009f..a6543821c0 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2.png and b/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlow2.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlowNight.png b/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlowNight.png new file mode 100644 index 0000000000..502bddd9d4 Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedGuardianHealerGlowNight.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist.png b/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist.png index a03761a3a7..68aa8f12c9 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist.png and b/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs new file mode 100644 index 0000000000..0a6eb02e1f --- /dev/null +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -0,0 +1,377 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ProfanedGuardians +{ + public class ProfanedRocks : ModNPC + { + private bool start = true; + private const double MinDistance = 200D; + private double distance = MinDistance; + private const double MinMaxDistance = 300D; + + public const int MaxHP = 8000; + public const int MaxBossRushHP = 20000; + + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + DisplayName.SetDefault("Profaned Rocks"); + NPCID.Sets.TrailingMode[NPC.type] = 1; + } + + public override void SetDefaults() + { + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = -1; + AIType = -1; + NPC.GetNPCDamage(); + NPC.dontTakeDamage = true; + NPC.width = 50; + NPC.height = 50; + NPC.defense = 100; + NPC.lifeMax = BossRushEvent.BossRushActive ? MaxBossRushHP : MaxHP; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); + NPC.knockBackResist = 0f; + NPC.Opacity = 0f; + NPC.noGravity = true; + NPC.chaseable = false; + NPC.noTileCollide = true; + NPC.canGhostHeal = false; + NPC.HitSound = SoundID.NPCHit52; + NPC.DeathSound = SoundID.NPCDeath55; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(start); + writer.Write(distance); + writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.noGravity); + writer.Write(NPC.Opacity); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + start = reader.ReadBoolean(); + distance = reader.ReadDouble(); + NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.noGravity = reader.ReadBoolean(); + NPC.Opacity = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + // Set the degrees used for rotation + if (start) + { + // Generate dust on spawn + for (int k = 0; k < 15; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, 0, 0, 0, default, 1f); + + start = false; + NPC.ai[3] = NPC.ai[0]; + } + + // Force despawn if Defender Guardian isn't active + if (CalamityGlobalNPC.doughnutBossDefender < 0 || !Main.npc[CalamityGlobalNPC.doughnutBossDefender].active || CalamityGlobalNPC.doughnutBoss < 0 || !Main.npc[CalamityGlobalNPC.doughnutBoss].active) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; + return; + } + + // Stay invincile while the commander and defender are swapping sides and don't deal damage to avoid unfair hits + if (Main.npc[CalamityGlobalNPC.doughnutBossDefender].localAI[3] == 1f) + { + NPC.damage = 0; + NPC.dontTakeDamage = true; + + NPC.Opacity -= 0.01f; + if (NPC.Opacity < 0f) + NPC.Opacity = 0f; + + NPC.scale = MathHelper.Lerp(0.05f, 1f, NPC.Opacity); + } + + // Stay invincible for 100 frames to avoid being instantly killed and don't deal damage to avoid unfair hits + else if (NPC.Opacity < 1f) + { + NPC.damage = 0; + NPC.dontTakeDamage = true; + + NPC.Opacity += 0.01f; + if (NPC.Opacity > 1f) + NPC.Opacity = 1f; + + NPC.scale = MathHelper.Lerp(0.05f, 1f, NPC.Opacity); + } + else + { + NPC.damage = NPC.defDamage; + NPC.dontTakeDamage = false; + } + + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.7f * NPC.Opacity, 0.55f * NPC.Opacity, 0f); + + // Set time left just in case something dumb happens with despawning + if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Spin and fly at the target + if ((Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[0] != 0f && Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[1] >= -60f) || NPC.Calamity().newAI[0] < 0f) + { + // For safety, always remain in this section of code regardless of what the defender is currently doing + if (NPC.Calamity().newAI[0] > -1f) + NPC.Calamity().newAI[0] = -1f; + + // Get the Guardian Commander's target + Player player = Main.player[Main.npc[CalamityGlobalNPC.doughnutBoss].target]; + + // Distance the rock travels before it starts to fall down + float maxChargeDistance = 4800f; + float chargeSpeed = bossRush ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; + float fallDownGateValue = maxChargeDistance / chargeSpeed; + + // Fall down after some time and blow up if inside tiles + if (NPC.Calamity().newAI[0] == -3f) + { + // Accelerate towards final velocity + Vector2 finalVelocity = new Vector2(NPC.Calamity().newAI[2], NPC.Calamity().newAI[3]); + if (NPC.velocity.Length() < finalVelocity.Length()) + { + NPC.velocity *= 1.05f; + if (NPC.velocity.Length() > finalVelocity.Length()) + { + NPC.velocity.Normalize(); + NPC.velocity *= finalVelocity.Length(); + } + } + + NPC.rotation += 0.25f; + NPC.Calamity().newAI[1] += 1f; + if (NPC.Calamity().newAI[1] >= fallDownGateValue) + { + NPC.noGravity = false; + NPC.velocity.Y += 0.1f; + + // Die if insied any tiles + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + if (NPC.DeathSound.HasValue) + SoundEngine.PlaySound(NPC.DeathSound.GetValueOrDefault(), NPC.Center); + + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; + } + } + } + + // Charge + else if (NPC.Calamity().newAI[0] == -2f) + { + // Start off slow + Vector2 finalVelocity = NPC.SafeDirectionTo(player.Center, -Vector2.UnitY) * chargeSpeed; + NPC.Calamity().newAI[2] = finalVelocity.X; + NPC.Calamity().newAI[3] = finalVelocity.Y; + NPC.velocity = finalVelocity * 0.1f; + NPC.rotation += 0.25f; + NPC.Calamity().newAI[0] = -3f; + NPC.netUpdate = true; + } + + // Rotate + else + { + // Push away from each other in Death and Boss Rush + if (death) + { + float pushVelocity = bossRush ? 0.2f : 0.15f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) + { + if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 160f) + { + if (NPC.position.X < Main.npc[i].position.X) + NPC.velocity.X -= pushVelocity; + else + NPC.velocity.X += pushVelocity; + + if (NPC.position.Y < Main.npc[i].position.Y) + NPC.velocity.Y -= pushVelocity; + else + NPC.velocity.Y += pushVelocity; + } + + // Slow down so they don't push away from each other too far + else + NPC.velocity *= 0.95f; + } + } + } + } + else + NPC.velocity *= 0.95f; + + // Rotate faster and charge + NPC.Calamity().newAI[1] += 1f; + float chargeGateValue = bossRush ? 60f : death ? 80f : revenge ? 90f : expertMode ? 100f : 120f; + chargeGateValue += chargeGateValue * 0.5f * NPC.ai[1]; + float anglularSpeed = NPC.Calamity().newAI[1] / chargeGateValue; + anglularSpeed = 0.05f + anglularSpeed * 0.2f; + NPC.rotation += anglularSpeed; + + // Charge + if (NPC.Calamity().newAI[1] >= chargeGateValue) + { + NPC.netUpdate = true; + NPC.Calamity().newAI[0] = -2f; + NPC.Calamity().newAI[1] = 0f; + } + } + + return; + } + + // Distance from Defender Guardian + double maxDistance = bossRush ? 360D : death ? 340D : revenge ? 330D : expertMode ? 320D : MinMaxDistance; + double rateOfChangeIncrease = (maxDistance / MinMaxDistance) - 1D; + double rateOfChange = (NPC.ai[1] * 0.5f) + 2D + rateOfChangeIncrease; + if (NPC.Calamity().newAI[0] == 0f) + { + distance += rateOfChange; + if (distance >= maxDistance) + { + distance = maxDistance; + NPC.Calamity().newAI[0] = 1f; + } + } + else + { + distance -= rateOfChange; + if (distance <= MinDistance) + { + distance = MinDistance; + NPC.Calamity().newAI[0] = 0f; + } + } + + // Rotation velocity + float minRotationVelocity = 0.5f; + float rotationVelocityIncrease = death ? 0.2f : revenge ? 0.15f : expertMode ? 0.1f : 0f; + rotationVelocityIncrease += rotationVelocityIncrease * (NPC.ai[1] * 0.5f); + + // Rotate around Defender Guardian + NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; + double degrees = NPC.ai[3]; + double radians = degrees * (Math.PI / 180); + NPC.position.X = parent.Center.X - (int)(Math.Cos(radians) * distance) - NPC.width / 2; + NPC.position.Y = parent.Center.Y - (int)(Math.Sin(radians) * distance) - NPC.height / 2; + NPC.rotation = (float)radians; + NPC.ai[3] += minRotationVelocity + rotationVelocityIncrease; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + int npcType = (int)NPC.ai[2]; + Texture2D texture = ModContent.Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + npcType.ToString()).Value; + Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / 2); + Vector2 drawPos = NPC.Center - screenPos; + drawPos -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; + drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Rectangle frame = new Rectangle(0, 0, texture.Width, texture.Height); + + if (!NPC.dontTakeDamage) + NPC.DrawBackglow(Color.Orange, 4f, SpriteEffects.None, frame, screenPos, texture); + + spriteBatch.Draw(texture, drawPos, frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, SpriteEffects.None, 0f); + + return false; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.5f * bossLifeScale); + } + + public override bool CheckActive() => false; + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + if (damage > 0) + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= (NPC.ai[2] == 6f ? 16f : 22f); + } + + public override bool CheckDead() => false; + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + + if (NPC.life <= 0) + { + if (Main.netMode != NetmodeID.Server) + { + int npcType = (int)NPC.ai[2]; + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedRocksGore" + npcType.ToString()).Type, NPC.scale); + } + + for (int k = 0; k < 30; k++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hitDirection, -1f, 0, default, 1f); + } + } + } +} diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.png b/NPCs/ProfanedGuardians/ProfanedRocks.png new file mode 100644 index 0000000000..b04bbdf7c9 Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedRocks.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks1.png b/NPCs/ProfanedGuardians/ProfanedRocks1.png new file mode 100644 index 0000000000..b04bbdf7c9 Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedRocks1.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks2.png b/NPCs/ProfanedGuardians/ProfanedRocks2.png new file mode 100644 index 0000000000..89c21f7f9c Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedRocks2.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks3.png b/NPCs/ProfanedGuardians/ProfanedRocks3.png new file mode 100644 index 0000000000..bad23fe72d Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedRocks3.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks4.png b/NPCs/ProfanedGuardians/ProfanedRocks4.png new file mode 100644 index 0000000000..44421a5bc9 Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedRocks4.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks5.png b/NPCs/ProfanedGuardians/ProfanedRocks5.png new file mode 100644 index 0000000000..528073d491 Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedRocks5.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks6.png b/NPCs/ProfanedGuardians/ProfanedRocks6.png new file mode 100644 index 0000000000..a4fe8a2329 Binary files /dev/null and b/NPCs/ProfanedGuardians/ProfanedRocks6.png differ diff --git a/NPCs/Providence/ProvSky.cs b/NPCs/Providence/ProvSky.cs index 5e926863bd..b79a4af1bb 100644 --- a/NPCs/Providence/ProvSky.cs +++ b/NPCs/Providence/ProvSky.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; @@ -45,7 +47,7 @@ namespace CalamityMod.NPCs.Providence if (Main.npc[ProvIndex].Calamity().newAI[3] < spawnAnimationTimer) intensityScalar = MathHelper.Lerp(0f, intensityScalar, Main.npc[ProvIndex].Calamity().newAI[3] / spawnAnimationTimer); - return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar; + return (Main.player[Main.myPlayer].HasBuff(ModContent.BuffType()) ? 0.75f : (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar); } return 0f; } @@ -80,7 +82,7 @@ namespace CalamityMod.NPCs.Providence if (maxDepth >= 0 && minDepth < 0) { float intensity = GetIntensity(); - Color color = Main.dayTime ? new Color(255, 200, 100) : new Color(100, 150, 255); + Color color = CalamityWorld.getFixedBoi ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Main.dayTime ? new Color(255, 200, 100) : new Color(100, 150, 255); spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), color * intensity); } } diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 88a96a17a3..bbf528aaac 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -15,12 +15,13 @@ namespace CalamityMod.NPCs.Providence public class ProvSpawnDefense : ModNPC { private bool start = true; + public override string Texture => "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianDefender"; public override void SetStaticDefaults() { this.HideFromBestiary(); DisplayName.SetDefault("Providence Defender"); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; } @@ -30,8 +31,8 @@ namespace CalamityMod.NPCs.Providence NPC.npcSlots = 1f; NPC.aiStyle = -1; NPC.GetNPCDamage(); - NPC.width = 100; - NPC.height = 80; + NPC.width = 228; + NPC.height = 164; NPC.defense = 50; NPC.DR_NERD(0.4f); NPC.lifeMax = 18750; @@ -55,7 +56,11 @@ namespace CalamityMod.NPCs.Providence public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; + if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) + NPC.frameCounter += 0.2f; + else + NPC.frameCounter += 0.12f + Main.npc[CalamityGlobalNPC.holyBoss].velocity.Length() / 120f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -70,11 +75,16 @@ namespace CalamityMod.NPCs.Providence if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; } + // Rotation + NPC.rotation = Main.npc[CalamityGlobalNPC.holyBoss].velocity.X * 0.005f; + NPC parent = Main.npc[CalamityGlobalNPC.holyBoss]; if (start) { @@ -173,6 +183,7 @@ namespace CalamityMod.NPCs.Providence Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT3").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT4").Type, 1f); } for (int k = 0; k < 30; k++) diff --git a/NPCs/Providence/ProvSpawnDefense.png b/NPCs/Providence/ProvSpawnDefense.png deleted file mode 100644 index 55f5b7ec1c..0000000000 Binary files a/NPCs/Providence/ProvSpawnDefense.png and /dev/null differ diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 35e7daf209..c294bf0d35 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -15,12 +15,13 @@ namespace CalamityMod.NPCs.Providence public class ProvSpawnHealer : ModNPC { private bool start = true; + public override string Texture => "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianHealer"; public override void SetStaticDefaults() { this.HideFromBestiary(); DisplayName.SetDefault("Providence Healer"); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; } @@ -29,8 +30,8 @@ namespace CalamityMod.NPCs.Providence NPC.npcSlots = 1f; NPC.aiStyle = -1; NPC.damage = 20; - NPC.width = 100; - NPC.height = 80; + NPC.width = 228; + NPC.height = 164; NPC.defense = 30; NPC.DR_NERD(0.2f); NPC.lifeMax = 15000; @@ -54,7 +55,11 @@ namespace CalamityMod.NPCs.Providence public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; + if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) + NPC.frameCounter += 0.2f; + else + NPC.frameCounter += 0.12f + Main.npc[CalamityGlobalNPC.holyBoss].velocity.Length() / 120f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -69,11 +74,16 @@ namespace CalamityMod.NPCs.Providence if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; } + // Rotation + NPC.rotation = Main.npc[CalamityGlobalNPC.holyBoss].velocity.X * 0.005f; + NPC parent = Main.npc[CalamityGlobalNPC.holyBoss]; if (start) { @@ -183,7 +193,6 @@ namespace CalamityMod.NPCs.Providence Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH3").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH4").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH5").Type, 1f); } for (int k = 0; k < 50; k++) diff --git a/NPCs/Providence/ProvSpawnHealer.png b/NPCs/Providence/ProvSpawnHealer.png deleted file mode 100644 index 7f02f8ab4b..0000000000 Binary files a/NPCs/Providence/ProvSpawnHealer.png and /dev/null differ diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index e8ea84dde7..840a9c3fc4 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -15,12 +15,13 @@ namespace CalamityMod.NPCs.Providence public class ProvSpawnOffense : ModNPC { private bool start = true; + public override string Texture => "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommander"; public override void SetStaticDefaults() { this.HideFromBestiary(); DisplayName.SetDefault("Providence Offense"); - Main.npcFrameCount[NPC.type] = 6; + Main.npcFrameCount[NPC.type] = 10; NPCID.Sets.TrailingMode[NPC.type] = 1; } @@ -30,8 +31,8 @@ namespace CalamityMod.NPCs.Providence NPC.npcSlots = 1f; NPC.aiStyle = -1; NPC.GetNPCDamage(); - NPC.width = 100; - NPC.height = 80; + NPC.width = 228; + NPC.height = 186; NPC.defense = 40; NPC.DR_NERD(0.3f); NPC.lifeMax = 31875; @@ -55,7 +56,11 @@ namespace CalamityMod.NPCs.Providence public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; + if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) + NPC.frameCounter += 0.2f; + else + NPC.frameCounter += 0.12f + Main.npc[CalamityGlobalNPC.holyBoss].velocity.Length() / 120f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -70,11 +75,16 @@ namespace CalamityMod.NPCs.Providence if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; } + // Rotation + NPC.rotation = Main.npc[CalamityGlobalNPC.holyBoss].velocity.X * 0.005f; + NPC parent = Main.npc[CalamityGlobalNPC.holyBoss]; if (start) { diff --git a/NPCs/Providence/ProvSpawnOffense.png b/NPCs/Providence/ProvSpawnOffense.png deleted file mode 100644 index d0559ae990..0000000000 Binary files a/NPCs/Providence/ProvSpawnOffense.png and /dev/null differ diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index b38d583868..992d5edd05 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Dyes; using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; @@ -18,7 +19,6 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -27,18 +27,19 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; using System; using System.Collections.Generic; using System.IO; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; -using Terraria.GameContent.ItemDropRules; -using CalamityMod.Items.Materials; namespace CalamityMod.NPCs.Providence { @@ -64,6 +65,20 @@ namespace CalamityMod.NPCs.Providence set => NPC.ai[0] = value; } + public enum BossMode + { + Night = -1, + Day = 0, + Red = 1, + Orange = 2, + Yellow = 3, + Green = 4, + Blue = 5, + Violet = 6 + } + public int currentMode = (int)BossMode.Day; + public int colorShiftTimer = -1; + private bool text = false; private bool useDefenseFrames = false; private float bossLife; @@ -79,14 +94,25 @@ namespace CalamityMod.NPCs.Providence public int DeathAnimationTimer; //Sounds - public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/ProvidenceSpawn") { Volume = 1.2f }; - public static readonly SoundStyle HolyRaySound = new("CalamityMod/Sounds/Custom/ProvidenceHolyRay") { Volume = 1.25f }; //note : Volume gets clamped between 0 and 1. I don't think this does anything, but it was in the original ModSound so im keeping it just in case + public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceSpawn") { Volume = 1.2f }; + public static readonly SoundStyle HolyRaySound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyRay") { Volume = 1.25f }; //note : Volume gets clamped between 0 and 1. I don't think this does anything, but it was in the original ModSound so im keeping it just in case public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/ProvidenceHurt"); - public static readonly SoundStyle DeathAnimationSound = new("CalamityMod/Sounds/Custom/ProvidenceDeathAnimation"); + public static readonly SoundStyle DeathAnimationSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceDeathAnimation"); + + public static readonly SoundStyle NearBurnSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceSizzle"); + public static readonly SoundStyle BurnStartSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); + public static readonly SoundStyle BurnLoopSound = new SoundStyle("CalamityMod/Sounds/Custom/Providence/ProvidenceBurnLoop") with { IsLooped = true }; + //Sound slot for the burning damage over time effect + public SlotId BurningSoundSlot; + //Level of sound playing + public float SoundWarningLevel = -1f; public static float normalDR = 0.3f; public static float cocoonDR = 0.9f; + private const float TimeForStarDespawn = 120f; + private const float TimeForShieldDespawn = 120f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Providence, the Profaned Goddess"); @@ -101,7 +127,7 @@ namespace CalamityMod.NPCs.Providence }; value.Position.Y += 6f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -140,8 +166,8 @@ namespace CalamityMod.NPCs.Providence BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A deity of stone and fire. Her flame burns for one reason alone— to cleanse the world of its sinful existence, and to purify those who live upon it.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("A deity of stone and fire. Her flame burns for one reason alone— to cleanse the world of life, so that all may suffer no longer.") }); } @@ -150,6 +176,8 @@ namespace CalamityMod.NPCs.Providence writer.Write(text); writer.Write(useDefenseFrames); writer.Write(biomeType); + writer.Write(currentMode); + writer.Write(colorShiftTimer); writer.Write(phaseChange); writer.Write(biomeEnrageTimer); writer.Write(frameUsed); @@ -158,7 +186,11 @@ namespace CalamityMod.NPCs.Providence writer.Write(NPC.dontTakeDamage); writer.Write(NPC.chaseable); writer.Write(NPC.canGhostHeal); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); + writer.Write(SoundWarningLevel); writer.Write(Dying); writer.Write(DeathAnimationTimer); for (int i = 0; i < 4; i++) @@ -171,6 +203,8 @@ namespace CalamityMod.NPCs.Providence text = reader.ReadBoolean(); useDefenseFrames = reader.ReadBoolean(); biomeType = reader.ReadInt32(); + currentMode = reader.ReadInt32(); + colorShiftTimer = reader.ReadInt32(); phaseChange = reader.ReadInt32(); biomeEnrageTimer = reader.ReadInt32(); frameUsed = reader.ReadInt32(); @@ -179,7 +213,11 @@ namespace CalamityMod.NPCs.Providence NPC.dontTakeDamage = reader.ReadBoolean(); NPC.chaseable = reader.ReadBoolean(); NPC.canGhostHeal = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); + SoundWarningLevel = reader.ReadSingle(); Dying = reader.ReadBoolean(); DeathAnimationTimer = reader.ReadInt32(); for (int i = 0; i < 4; i++) @@ -203,27 +241,54 @@ namespace CalamityMod.NPCs.Providence // Rotation NPC.rotation = NPC.velocity.X * 0.004f; - Vector2 vector = NPC.Center; - // 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, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) NPC.TargetClosest(); // Target variable and boss center Player player = Main.player[NPC.target]; - // Night bool + // Night bool and Color shifting bool bossRush = BossRushEvent.BossRushActive; - bool nightTime = !Main.dayTime || bossRush; + + bool getFuckedAI = CalamityWorld.getFixedBoi; + int timeToShift = 30; //Switches color every half-second + if (getFuckedAI) + { + colorShiftTimer++; + + if (colorShiftTimer == -1) //Initiate + { + currentMode = (int)BossMode.Red; + colorShiftTimer = 0; + } + else if (colorShiftTimer >= timeToShift) + { + currentMode++; + if (currentMode > (int)BossMode.Violet) + currentMode = (int)BossMode.Red; + colorShiftTimer = 0; + } + } + else if (!Main.dayTime || bossRush) //Normal Night time activity + currentMode = (int)BossMode.Night; + else + currentMode = (int)BossMode.Day; + + //To allow syncing with her projectiles + NPC.localAI[1] = (float)currentMode; + + //Has Night AI if it's any color except day + bool nightAI = currentMode != (int)BossMode.Day; // Difficulty bools - bool death = CalamityWorld.death || nightTime; - bool revenge = CalamityWorld.revenge || nightTime; - bool expertMode = Main.expertMode || nightTime; + bool death = CalamityWorld.death || nightAI; + bool revenge = CalamityWorld.revenge || nightAI; + bool expertMode = Main.expertMode || nightAI; // Target's current biome bool isHoly = player.ZoneHallow; @@ -240,7 +305,7 @@ namespace CalamityMod.NPCs.Providence float lifeRatio = NPC.life / (float)NPC.lifeMax; // Play enrage animation if night starts - if (nightTime && calamityGlobalNPC.newAI[3] == spawnAnimationTime) + if (!getFuckedAI && nightAI && calamityGlobalNPC.newAI[3] == spawnAnimationTime) { AIState = (int)Phase.HolyBlast; NPC.ai[1] = 0f; @@ -252,12 +317,12 @@ namespace CalamityMod.NPCs.Providence NPC.netUpdate = true; } - // Increase all projectile damage at night + // Increase all projectile damage at night, but reduce to 0 for Zenith int projectileDamageMult = 1; - if (nightTime) + if (nightAI) projectileDamageMult = 2; - NPC.Calamity().CurrentlyEnraged = (!bossRush && nightTime) || biomeEnrageTimer <= 0; + NPC.Calamity().CurrentlyEnraged = (!bossRush && nightAI) || biomeEnrageTimer <= 0; // Projectile damage values int holyLaserDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; @@ -270,17 +335,18 @@ namespace CalamityMod.NPCs.Providence int holyStarDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; // Change dust type at night - int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(currentMode); // Phase times - float phaseTime = nightTime ? (240f - 60f * (1f - lifeRatio)) : 300f; - float crystalPhaseTime = nightTime ? (float)Math.Round(60f * lifeRatio) : death ? 60f : 120f; + float phaseTime = nightAI ? (240f - 60f * (1f - lifeRatio)) : 300f; + float crystalPhaseTime = nightAI ? (float)Math.Round(60f * lifeRatio) : death ? 60f : 120f; int nightCrystalTime = 210; + int gfbCrystalTime = 1500 + nightCrystalTime; float attackDelayAfterCocoon = phaseTime * 0.3f; // Phases bool ignoreGuardianAmt = lifeRatio < (death ? 0.2f : 0.15f); - bool phase2 = lifeRatio < 0.75f && !nightTime; + bool phase2 = lifeRatio < 0.75f && !nightAI; bool delayAttacks = NPC.localAI[2] > 0f; // Spear phase @@ -296,7 +362,7 @@ namespace CalamityMod.NPCs.Providence double attackRateMult = 1D; // Where projectiles are fired from during cocoon phases - Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f * NPC.scale); + Vector2 fireFrom = new Vector2(NPC.Center.X, NPC.Center.Y + 20f * NPC.scale); // Cocoon projectile initial velocity float cocoonProjVelocity = 3f + (death ? 2f * (1f - lifeRatio) : 0f); @@ -305,18 +371,60 @@ namespace CalamityMod.NPCs.Providence float distanceNeededToShoot = (death ? 300f : revenge ? 360f : 420f) * NPC.scale; // X distance from target - float distanceX = Math.Abs(vector.X - player.Center.X); + float distanceX = Math.Abs(NPC.Center.X - player.Center.X); // Inflict Holy Inferno if target is too far away - float baseDistance = 2800f; - float shorterFlameCocoonDistance = death ? 2200f : CalamityWorld.revenge ? 2400f : Main.expertMode ? 2600f : baseDistance; - float shorterSpearCocoonDistance = death ? 1800f : CalamityWorld.revenge ? 2150f : Main.expertMode ? 2500f : baseDistance; - float shorterDistance = AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance; - float maxDistance = (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) ? shorterDistance : baseDistance; - if (Vector2.Distance(player.Center, vector) > maxDistance) + float burnIntensity = CalculateBurnIntensity(); + + if (!player.dead && player.active && !player.creativeGodMode && !Dying) { - if (!player.dead && player.active && !player.creativeGodMode && !Dying) + //The debuff applies + if (burnIntensity >= 1f) + { + if (SoundWarningLevel < 2f) + { + //Initialize sound + SoundEngine.PlaySound(BurnStartSound, player.Center); + BurningSoundSlot = SoundEngine.PlaySound(BurnLoopSound, player.Center); + SoundWarningLevel = 2f; + } player.AddBuff(ModContent.BuffType(), 2); + } + //If the sound is still playing, make it go slowly kinda + else if (SoundWarningLevel > 1f) + { + SoundWarningLevel -= 1 / 100f; + if (SoundWarningLevel < 1f) + SoundWarningLevel = 1f; + } + //The player starts to get fire particles + else if (burnIntensity > 0.45f) + { + //If the player goes from 0 to 1, then play the sound. Doesn't play when descending. + if (SoundWarningLevel < 1f) + SoundEngine.PlaySound(NearBurnSound, player.Center); + + SoundWarningLevel = 1f; + } + //The player has sparks if intensity is above 0, otherwise nothing happens + else if (burnIntensity <= 0f) + { + //Reset the sound + SoundWarningLevel = 0f; + } + } + + // Updating the looping sound + if (SoundEngine.TryGetActiveSound(BurningSoundSlot, out var burningSound) && burningSound.IsPlaying) + burningSound.Position = player.Center; + + // Adjust the volume or break the loop accordingly + if (burningSound is not null) + { + if (SoundWarningLevel <= 1f) + burningSound?.Stop(); + else if(SoundWarningLevel < 2f) + burningSound.Volume = SoundWarningLevel - 1f; } // Count the remaining Guardians, healer especially because it allows the boss to heal @@ -349,6 +457,40 @@ namespace CalamityMod.NPCs.Providence } } + // Makes it so star shit can only happen if the attacker has spawned + if (attackerAlive && NPC.localAI[0] == 0f) + NPC.localAI[0] = 1f; + + // Can only run after the attacker has spawned and died + if (!attackerAlive && NPC.localAI[0] > 0f) + { + if (NPC.localAI[0] < TimeForStarDespawn) + { + // Star Wrath use sound + if (NPC.localAI[0] == 1f) + SoundEngine.PlaySound(SoundID.Item105, NPC.Center); + + NPC.localAI[0] += 1f; + } + } + + // Makes it so shield shit can only happen if the defender has spawned + if (defenderAlive && NPC.localAI[3] == 0f) + NPC.localAI[3] = 1f; + + // Can only run after the defender has spawned and died + if (!defenderAlive && NPC.localAI[3] > 0f) + { + if (NPC.localAI[3] < TimeForShieldDespawn) + { + // Star Wrath use sound + if (NPC.localAI[3] == 1f) + SoundEngine.PlaySound(SoundID.Item105, NPC.Center); + + NPC.localAI[3] += 1f; + } + } + // Change projectile fire rate depending on Guardian amount if (guardianAmt > 0) { @@ -373,19 +515,20 @@ namespace CalamityMod.NPCs.Providence } // Whether the boss can be homed in on or healed off of - NPC.chaseable = normalAttackRate && AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon && AIState != (int)Phase.Laser; + NPC.chaseable = normalAttackRate; NPC.canGhostHeal = NPC.chaseable; // Prevent lag by stopping rain - CalamityMod.StopRain(); + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); // Set target biome type if (biomeType == 0) { - if (isHoly) - biomeType = 1; - else if (isHell) + if (isHell) biomeType = 2; + else if (isHoly) + biomeType = 1; } // Become immune over time if target isn't in hell or hallow @@ -431,22 +574,66 @@ namespace CalamityMod.NPCs.Providence // Healing if (healerAlive) { - float healGateValue = revenge ? 60f : 90f; - healTimer++; - if (healTimer >= healGateValue) + float distanceFromHealer = Vector2.Distance(Main.npc[CalamityGlobalNPC.holyBossHealer].Center, NPC.Center); + bool dontHeal = Main.npc[CalamityGlobalNPC.holyBossHealer].justHit || NPC.life == NPC.lifeMax; + if (dontHeal) { healTimer = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) + } + else + { + float healGateValue = revenge ? 60f : 90f; + healTimer++; + if (healTimer >= healGateValue) { - int healAmt = NPC.lifeMax / 200; - if (healAmt > NPC.lifeMax - NPC.life) - healAmt = NPC.lifeMax - NPC.life; + SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - if (healAmt > 0) + int maxHealDustIterations = (int)distanceFromHealer; + int maxDust = 100; + int dustDivisor = maxHealDustIterations / maxDust; + if (dustDivisor < 2) + dustDivisor = 2; + + Vector2 dustLineStart = Main.npc[CalamityGlobalNPC.holyBossHealer].Center; + Vector2 dustLineEnd = NPC.Center; + Vector2 currentDustPos = default; + Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); + Vector2 value5 = new Vector2(2.1f, 2f); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X, 1f, 0.5f); + dustColor.A = 255; + for (int i = 0; i < maxHealDustIterations; i++) { - NPC.life += healAmt; - NPC.HealEffect(healAmt, true); - NPC.netUpdate = true; + if (i % dustDivisor == 0) + { + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxHealDustIterations); + int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Main.dust[dust].position = currentDustPos; + Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * i / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f) + NPC.velocity; + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1f; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale /= 2f; + dust3 = dust2; + dust3.fadeIn /= 2f; + dust2.color = new Color(255, 255, 255, 255); + } + } + + healTimer = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = NPC.lifeMax / 200; + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; + + if (healAmt > 0) + { + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; + } } } } @@ -479,21 +666,21 @@ namespace CalamityMod.NPCs.Providence else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - // Guardian spawn - if (!nightTime) + // Guardian spawn unless it's night time specifically (can still spawn on Zenith) + if (currentMode != (int)BossMode.Night) { if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; if (NPC.life > 0) { - if (Main.netMode != NetmodeID.MultiplayerClient) + int num660 = (int)(NPC.lifeMax * 0.66); + if ((NPC.life + num660) < bossLife) { - int num660 = (int)(NPC.lifeMax * 0.66); - if ((NPC.life + num660) < bossLife) + bossLife = NPC.life; + SoundEngine.PlaySound(SoundID.Item74, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) { - bossLife = NPC.life; - SoundEngine.PlaySound(SoundID.Item74, NPC.position); int guardianRingAmt = 3; int guardianSpread = 360 / guardianRingAmt; int guardianDistance = 400; @@ -516,108 +703,111 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon || AIState == (int)Phase.Laser || spawnAnimation; // Movement - if (AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon) + if (getFuckedAI || (AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon)) { - // Firing holy ray or not - bool firingLaser = AIState == (int)Phase.Laser; - - // Change X direction of movement - if (flightPath == 0) - { - if (vector.X < player.Center.X) - { - flightPath = 1; - calamityGlobalNPC.newAI[0] = 0f; - } - else - { - flightPath = -1; - calamityGlobalNPC.newAI[0] = 0f; - } - } - - // 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 num851 = 800f; - - // Increase distance from target when firing molten blasts or holy bombs - bool stayAwayFromTarget = AIState == (int)Phase.MoltenBlobs || AIState == (int)Phase.HolyBomb; - if (stayAwayFromTarget) - num851 += death ? 240f : revenge ? 180f : 120f; - - // Change X movement path if far enough away from target - if (vector.X < player.Center.X && flightPath < 0 && distanceX > num851) - flightPath = 0; - if (vector.X > player.Center.X && flightPath > 0 && distanceX > num851) - flightPath = 0; - - // Velocity and acceleration - float speedIncreaseTimer = nightTime ? 75f : death ? 120f : 150f; - bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer || biomeEnraged; - 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; - float velocity = (expertMode ? 16f : 15f) + velocityBoost; - if (nightTime) - { - acceleration = 1.5f; - velocity = 25f; - } - if (firingLaser) - { - acceleration *= 0.4f; - velocity *= 0.4f; - } - else if (increaseSpeed) - { - velocity += (calamityGlobalNPC.newAI[0] - speedIncreaseTimer) * 0.04f; - if (velocity > 30f || biomeEnraged) - velocity = 30f; - if (biomeEnraged) - acceleration = 2f; - } - - if (Main.getGoodWorld) - { - velocity *= 1.25f; - acceleration *= 1.25f; - } - - if (!targetDead) - { - NPC.velocity.X += flightPath * acceleration; - if (NPC.velocity.X > velocity) - NPC.velocity.X = velocity; - if (NPC.velocity.X < -velocity) - NPC.velocity.X = -velocity; - - float num855 = player.position.Y - (NPC.position.Y + NPC.height); - if (num855 < (firingLaser ? 150f : 200f)) // 150 - NPC.velocity.Y -= Main.getGoodWorld ? 0.4f : 0.2f; - if (num855 > (firingLaser ? 200f : 250f)) // 200 - NPC.velocity.Y += Main.getGoodWorld ? 0.4f : 0.2f; - - float speedVariance = firingLaser ? 2f : 6f; - if (Main.getGoodWorld) - speedVariance *= 1.5f; - - if (NPC.velocity.Y > speedVariance) - NPC.velocity.Y = speedVariance; - if (NPC.velocity.Y < -speedVariance) - NPC.velocity.Y = -speedVariance; - } - // Slowly drift down when spawning if (spawnAnimation) { + colorShiftTimer++; // Also double the shift speed in the mean time :) float minSpawnVelocity = 0.4f; float maxSpawnVelocity = 4f; float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime); NPC.velocity = new Vector2(0f, velocityY); } + else + { + // Slows down while firing Holy Rays. It would've not slowed down for the Zenith seed but apparently it was too fast (shockers). + bool laserPhaseSlow = AIState == (int)Phase.Laser; + + // Change X direction of movement + if (flightPath == 0) + { + if (NPC.Center.X < player.Center.X) + { + flightPath = 1; + calamityGlobalNPC.newAI[0] = 0f; + } + else + { + flightPath = -1; + calamityGlobalNPC.newAI[0] = 0f; + } + } + + // 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 num851 = 800f; + + // Increase distance from target when firing molten blasts or holy bombs + bool stayAwayFromTarget = AIState == (int)Phase.MoltenBlobs || AIState == (int)Phase.HolyBomb; + if (stayAwayFromTarget) + num851 += death ? 240f : revenge ? 180f : 120f; + + // Change X movement path if far enough away from target + if (NPC.Center.X < player.Center.X && flightPath < 0 && distanceX > num851) + flightPath = 0; + if (NPC.Center.X > player.Center.X && flightPath > 0 && distanceX > num851) + flightPath = 0; + + // Velocity and acceleration + float speedIncreaseTimer = nightAI ? 75f : death ? 120f : 150f; + bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer || biomeEnraged; + 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; + float velocity = (expertMode ? 16f : 15f) + velocityBoost; + if (nightAI) + { + acceleration = 1.5f; + velocity = 25f; + } + 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 || biomeEnraged) + velocity = 30f; + if (biomeEnraged) + acceleration = 2f; + } + + if (Main.getGoodWorld) + { + velocity *= 1.2f; + acceleration *= 1.2f; + } + + if (!targetDead) + { + NPC.velocity.X += flightPath * acceleration; + if (NPC.velocity.X > velocity) + NPC.velocity.X = velocity; + if (NPC.velocity.X < -velocity) + NPC.velocity.X = -velocity; + + float num855 = player.position.Y - (NPC.position.Y + NPC.height); + if (num855 < (laserPhaseSlow ? 150f : 200f)) // 150 + NPC.velocity.Y -= Main.getGoodWorld ? 0.4f : 0.2f; + if (num855 > (laserPhaseSlow ? 200f : 250f)) // 200 + NPC.velocity.Y += Main.getGoodWorld ? 0.4f : 0.2f; + + float speedCap = laserPhaseSlow ? 2f : 6f; + if (Main.getGoodWorld) + speedCap *= 1.5f; + + if (NPC.velocity.Y > speedCap) + NPC.velocity.Y = speedCap; + if (NPC.velocity.Y < -speedCap) + NPC.velocity.Y = -speedCap; + } + } } // Phase switch @@ -650,7 +840,7 @@ namespace CalamityMod.NPCs.Providence phase = (int)Phase.HolyBlast; break; case 3: - phase = (useCrystal || nightTime) ? (int)Phase.Crystal : (int)Phase.MoltenBlobs; + phase = (useCrystal || nightAI) ? (int)Phase.Crystal : (int)Phase.MoltenBlobs; break; case 4: phase = useCrystal ? (int)Phase.MoltenBlobs : (int)Phase.FlameCocoon; @@ -659,31 +849,31 @@ namespace CalamityMod.NPCs.Providence phase = useCrystal ? (int)Phase.FlameCocoon : (int)Phase.HolyFire; break; case 6: - phase = (useLaser || nightTime) ? (int)Phase.Laser : (int)Phase.HolyBomb; + phase = (useLaser || nightAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; break; case 7: - phase = (useLaser || nightTime) ? (int)Phase.HolyBomb : (int)Phase.MoltenBlobs; + phase = (useLaser || nightAI) ? (int)Phase.HolyBomb : (int)Phase.MoltenBlobs; break; case 8: - phase = (useLaser || nightTime) ? (int)Phase.MoltenBlobs : (int)Phase.SpearCocoon; + phase = (useLaser || nightAI) ? (int)Phase.MoltenBlobs : (int)Phase.SpearCocoon; break; case 9: phase = (int)Phase.HolyBlast; break; case 10: - phase = (useCrystal || nightTime) ? (int)Phase.Crystal : (int)Phase.FlameCocoon; + phase = (useCrystal || nightAI) ? (int)Phase.Crystal : (int)Phase.FlameCocoon; break; case 11: - phase = nightTime ? (int)Phase.FlameCocoon : (int)Phase.MoltenBlobs; + phase = nightAI ? (int)Phase.FlameCocoon : (int)Phase.MoltenBlobs; break; case 12: - phase = (useLaser || nightTime) ? (int)Phase.Laser : (int)Phase.HolyBomb; + phase = (useLaser || nightAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; break; case 13: phase = (int)Phase.SpearCocoon; break; case 14: - phase = (useLaser || nightTime) ? (int)Phase.HolyBomb : (int)Phase.HolyBlast; + phase = (useLaser || nightAI) ? (int)Phase.HolyBomb : (int)Phase.HolyBlast; break; default: break; @@ -744,7 +934,7 @@ namespace CalamityMod.NPCs.Providence } // If too far from target, set phase to 0 - if (Math.Abs(vector.X - player.Center.X) > 5600f) + if (Math.Abs(NPC.Center.X - player.Center.X) > 5600f) phase = (int)Phase.HolyBlast; // Reset attack delay for laser @@ -766,10 +956,10 @@ namespace CalamityMod.NPCs.Providence if (spawnAnimation) { if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[3] == 0f) - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector + new Vector2(0f, -80f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, biomeType, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + new Vector2(0f, -80f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, biomeType, 0f); - if (calamityGlobalNPC.newAI[3] == 10f && nightTime) - SoundEngine.PlaySound(HolyRaySound, NPC.position); + if (calamityGlobalNPC.newAI[3] == 10f) + SoundEngine.PlaySound(HolyRaySound, NPC.Center); if (calamityGlobalNPC.newAI[3] > 10f && calamityGlobalNPC.newAI[3] < 150f) { @@ -779,7 +969,7 @@ namespace CalamityMod.NPCs.Providence float fade = MathHelper.Lerp(1.3f, 0.7f, NPC.Opacity) * Utils.GetLerpValue(0f, 120f, calamityGlobalNPC.newAI[3], clamped: true); Color newColor = Main.hslToRgb(calamityGlobalNPC.newAI[3] / 180f, 1f, 0.5f); - if (!nightTime) + if (!nightAI) { newColor.R = 255; if (biomeType == 2) @@ -816,7 +1006,7 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.newAI[3] += 1f; - if (nightTime && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) + if (nightAI && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) calamityGlobalNPC.newAI[3] += 1f; return; @@ -834,18 +1024,19 @@ namespace CalamityMod.NPCs.Providence NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(5f * (1f - lifeRatio)) : (int)Math.Round(4f * (1f - lifeRatio)); - int num856 = (biomeEnraged ? 18 : expertMode ? 24 : 26) - shootBoost; + int projectileShootGateValue = (biomeEnraged ? 18 : expertMode ? 24 : 26) - shootBoost; - num856 = (int)(num856 * attackRateMult); + projectileShootGateValue = (int)(projectileShootGateValue * attackRateMult); - if (NPC.ai[3] >= num856) - NPC.ai[3] = -num856; + if (NPC.ai[3] >= projectileShootGateValue) + NPC.ai[3] = -projectileShootGateValue; if (NPC.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - vector.X += NPC.velocity.X * 7f; - float num857 = player.position.X + player.width * 0.5f - vector.X; - float num858 = player.Center.Y - vector.Y; + Vector2 npcCenter = NPC.Center; + npcCenter.X += NPC.velocity.X * 7f; + float num857 = player.position.X + player.width * 0.5f - npcCenter.X; + float num858 = player.Center.Y - npcCenter.Y; float num859 = (float)Math.Sqrt(num857 * num857 + num858 * num858); float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); @@ -858,7 +1049,7 @@ namespace CalamityMod.NPCs.Providence num857 *= num859; num858 *= num859; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y, num857, num858, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, num857, num858, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); } } else if (NPC.ai[3] < 0f) @@ -887,28 +1078,28 @@ namespace CalamityMod.NPCs.Providence NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(6f * (1f - lifeRatio)) : (int)Math.Round(5f * (1f - lifeRatio)); - int num864 = (expertMode ? 36 : 39) - shootBoost; + int projectileShootGateValue = (expertMode ? 36 : 39) - shootBoost; if (bossRush || biomeEnraged) - num864 = 27; + projectileShootGateValue = 27; - num864 = (int)(num864 * attackRateMult); + projectileShootGateValue = (int)(projectileShootGateValue * attackRateMult); - if (NPC.ai[3] >= num864) + if (NPC.ai[3] >= projectileShootGateValue) { NPC.ai[3] = 0f; - Vector2 vector113 = new Vector2(vector.X, NPC.position.Y + NPC.height - 64f * NPC.scale); + Vector2 shootFrom = new Vector2(NPC.Center.X, NPC.position.Y + NPC.height - 64f * NPC.scale); - float num865 = NPC.velocity.Y; - if (num865 < 0f) - num865 = 0f; + float projectileVelocityY = NPC.velocity.Y; + if (projectileVelocityY < 0f) + projectileVelocityY = 0f; - num865 += expertMode ? 4f : 3f; + projectileVelocityY += expertMode ? 4f : 3f; - if (nightTime) - num865 *= 2f; + if (nightAI) + projectileVelocityY *= 2f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector113.X, vector113.Y, NPC.velocity.X * 0.25f, num865, ModContent.ProjectileType(), holyFireDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom.X, shootFrom.Y, NPC.velocity.X * 0.25f, projectileVelocityY, ModContent.ProjectileType(), holyFireDamage, 0f, Main.myPlayer, 0f, 0f); } } @@ -923,7 +1114,7 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.FlameCocoon: - if (!targetDead) + if (!targetDead && !getFuckedAI) { if (NPC.velocity.Length() <= 2f) NPC.velocity = Vector2.Zero; @@ -942,89 +1133,146 @@ namespace CalamityMod.NPCs.Providence double patternInterval = Math.Floor(NPC.ai[3] / interval); int healingStarChance = revenge ? 8 : expertMode ? 6 : 4; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (patternInterval % 2 == 0) { - if (patternInterval % 2 == 0) + if (NPC.ai[3] % divisor == 0f) { - if (NPC.ai[3] % divisor == 0f) + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, NPC.Center); + bool normalSpread = calamityGlobalNPC.newAI[1] % 2f == 0f; + double radians = MathHelper.TwoPi / chains; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(cocoonProjVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -cocoonProjVelocity) : new Vector2(-velocityX, -cocoonProjVelocity); + for (int i = 0; i < chains; i++) { - SoundEngine.PlaySound(SoundID.Item20, NPC.Center); - bool normalSpread = calamityGlobalNPC.newAI[1] % 2f == 0f; - double radians = MathHelper.TwoPi / chains; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(cocoonProjVelocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -cocoonProjVelocity) : new Vector2(-velocityX, -cocoonProjVelocity); - for (int i = 0; i < chains; i++) - { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(NPC.ai[2])); + Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(NPC.ai[2])); - int projectileType = ModContent.ProjectileType(); - int dmgAmt = holyStarDamage; - if (Main.rand.NextBool(healingStarChance) && !death) - { - projectileType = ModContent.ProjectileType(); - dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); + int projectileType = ModContent.ProjectileType(); + int dmgAmt = holyStarDamage; + if (Main.rand.NextBool(healingStarChance) && !death) + { + projectileType = ModContent.ProjectileType(); + dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); - } - else - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); } + else if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); - // Radial offset - NPC.ai[2] += 10f; - } - NPC.netUpdate = true; - } - else - { - NPC.ai[2] = 0f; - - totalFlameProjectiles = biomeEnraged ? 20 : 16; - if (NPC.ai[3] % (divisor * totalFlameProjectiles) == 0f) - { - calamityGlobalNPC.newAI[1] += 1f; - double radians = MathHelper.TwoPi / totalFlameProjectiles; - SoundEngine.PlaySound(SoundID.Item20, NPC.position); - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(cocoonProjVelocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = NPC.ai[3] % (divisor * totalFlameProjectiles * 2f) == 0f ? new Vector2(-velocityX, -cocoonProjVelocity) : new Vector2(0f, -cocoonProjVelocity); - for (int i = 0; i < totalFlameProjectiles; i++) + Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : (projectileType == ModContent.ProjectileType() ? Color.Orange : Color.Green)).X, 1f, 0.5f); + dustColor.A = 255; + int maxDust = 3; + for (int j = 0; j < maxDust; j++) { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i); + int dust = Dust.NewDust(fireFrom, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Main.dust[dust].position = fireFrom; + Main.dust[dust].velocity = vector2 * cocoonProjVelocity * (j * 0.5f + 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1f + j; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale /= 2f; + dust3 = dust2; + dust3.fadeIn /= 2f; + dust2.color = new Color(255, 255, 255, 255); + } + } - int projectileType = ModContent.ProjectileType(); - int dmgAmt = holyStarDamage; - if (Main.rand.NextBool(healingStarChance) && !death) - { - projectileType = ModContent.ProjectileType(); - dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); + // Radial offset + NPC.ai[2] += 10f; + } + NPC.netUpdate = true; + } + else + { + NPC.ai[2] = 0f; + + totalFlameProjectiles = biomeEnraged ? 20 : 16; + if (NPC.ai[3] % (divisor * totalFlameProjectiles) == 0f) + { + calamityGlobalNPC.newAI[1] += 1f; + double radians = MathHelper.TwoPi / totalFlameProjectiles; + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, NPC.Center); + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(cocoonProjVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = NPC.ai[3] % (divisor * totalFlameProjectiles * 2f) == 0f ? new Vector2(-velocityX, -cocoonProjVelocity) : new Vector2(0f, -cocoonProjVelocity); + for (int i = 0; i < totalFlameProjectiles; i++) + { + Vector2 vector2 = spinningPoint.RotatedBy(radians * i); + + int projectileType = ModContent.ProjectileType(); + int dmgAmt = holyStarDamage; + if (Main.rand.NextBool(healingStarChance) && !death) + { + projectileType = ModContent.ProjectileType(); + dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); - } - else - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); + + Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : (projectileType == ModContent.ProjectileType() ? Color.Orange : Color.Green)).X, 1f, 0.5f); + dustColor.A = 255; + int maxDust = 3; + for (int j = 0; j < maxDust; j++) + { + int dust = Dust.NewDust(fireFrom, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Main.dust[dust].position = fireFrom; + Main.dust[dust].velocity = vector2 * cocoonProjVelocity * (j * 0.5f + 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1f + j; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale /= 2f; + dust3 = dust2; + dust3.fadeIn /= 2f; + dust2.color = new Color(255, 255, 255, 255); } } } + } - // Fire a flame towards every player, with a limit of 5 - if (NPC.ai[3] % 60f == 0f && expertMode) + // Fire a flame towards every player, with a limit of 5 + if (NPC.ai[3] % 60f == 0f && expertMode) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) { - List targets = new List(); - for (int p = 0; p < Main.maxPlayers; p++) - { - if (Main.player[p].active && !Main.player[p].dead) - targets.Add(p); + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); - if (targets.Count > 4) - break; - } - foreach (int t in targets) - { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireFrom) * cocoonProjVelocity * 1.5f; - int type = ModContent.ProjectileType(); + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireFrom) * cocoonProjVelocity * 1.5f; + int type = ModContent.ProjectileType(); + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); + + Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : Color.Orange).X, 1f, 0.5f); + dustColor.A = 255; + int maxDust = 3; + for (int j = 0; j < maxDust; j++) + { + int dust = Dust.NewDust(fireFrom, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Main.dust[dust].position = fireFrom; + Main.dust[dust].velocity = velocity2 * cocoonProjVelocity * 2f; + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 3f; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale /= 2f; + dust3 = dust2; + dust3.fadeIn /= 2f; + dust2.color = new Color(255, 255, 255, 255); } } } @@ -1051,9 +1299,9 @@ namespace CalamityMod.NPCs.Providence Player player2 = Main.player[Main.myPlayer]; bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; - if (!player2.dead && player2.active && Vector2.Distance(player2.Center, vector) < 2800f && !inLiquid) + if (!player2.dead && player2.active && Vector2.Distance(player2.Center, NPC.Center) < 2800f && !inLiquid) { - SoundEngine.PlaySound(SoundID.Item20, player2.position); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, player2.Center); player2.AddBuff(ModContent.BuffType(), 3000, true); for (int num621 = 0; num621 < 40; num621++) @@ -1061,6 +1309,7 @@ namespace CalamityMod.NPCs.Providence int num622 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), player2.width, player2.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -1077,6 +1326,7 @@ namespace CalamityMod.NPCs.Providence num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), player2.width, player2.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; } } } @@ -1103,20 +1353,21 @@ namespace CalamityMod.NPCs.Providence NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(5f * (1f - lifeRatio)) : (int)Math.Round(4f * (1f - lifeRatio)); - int num856 = (expertMode ? 24 : 26) - shootBoost; + int projectileShootGateValue = (expertMode ? 24 : 26) - shootBoost; if (bossRush || biomeEnraged) - num856 = 18; + projectileShootGateValue = 18; - num856 = (int)(num856 * attackRateMult); + projectileShootGateValue = (int)(projectileShootGateValue * attackRateMult); - if (NPC.ai[3] >= num856) - NPC.ai[3] = -num856; + if (NPC.ai[3] >= projectileShootGateValue) + NPC.ai[3] = -projectileShootGateValue; if (NPC.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - vector.X += NPC.velocity.X * 7f; - float num857 = player.position.X + player.width * 0.5f - vector.X; - float num858 = player.Center.Y - vector.Y; + Vector2 npcCenter = NPC.Center; + npcCenter.X += NPC.velocity.X * 7f; + float num857 = player.position.X + player.width * 0.5f - npcCenter.X; + float num858 = player.Center.Y - npcCenter.Y; float num859 = (float)Math.Sqrt(num857 * num857 + num858 * num858); float shootBoost2 = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); @@ -1131,7 +1382,7 @@ namespace CalamityMod.NPCs.Providence num857 *= num859; num858 *= num859; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y, num857 * 0.1f, num858, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, num857 * 0.1f, num858, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); } } else if (NPC.ai[3] < 0f) @@ -1160,23 +1411,23 @@ namespace CalamityMod.NPCs.Providence NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(12f * (1f - lifeRatio)) : (int)Math.Round(10f * (1f - lifeRatio)); - int num864 = (biomeEnraged ? 54 : expertMode ? 73 : 77) - shootBoost; + int projectileShootGateValue = (biomeEnraged ? 54 : expertMode ? 73 : 77) - shootBoost; - num864 = (int)(num864 * attackRateMult); + projectileShootGateValue = (int)(projectileShootGateValue * attackRateMult); - if (NPC.ai[3] >= num864) + if (NPC.ai[3] >= projectileShootGateValue) { NPC.ai[3] = 0f; - Vector2 vector113 = new Vector2(vector.X, NPC.position.Y + NPC.height - 14f * NPC.scale); + Vector2 shootFrom = new Vector2(NPC.Center.X, NPC.position.Y + NPC.height - 14f * NPC.scale); - float num865 = NPC.velocity.Y; - if (num865 < 0f) - num865 = 0f; + float projectileVelocityY = NPC.velocity.Y; + if (projectileVelocityY < 0f) + projectileVelocityY = 0f; - num865 += expertMode ? 4f : 3f; + projectileVelocityY += expertMode ? 4f : 3f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector113.X, vector113.Y, NPC.velocity.X * 0.25f, num865, ModContent.ProjectileType(), holyBombDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom.X, shootFrom.Y, NPC.velocity.X * 0.25f, projectileVelocityY, ModContent.ProjectileType(), holyBombDamage, 0f, Main.myPlayer, 0f, 0f); } } @@ -1191,7 +1442,7 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.SpearCocoon: - if (!targetDead) + if (!targetDead && !getFuckedAI) { if (NPC.velocity.Length() <= 2f) NPC.velocity = Vector2.Zero; @@ -1206,42 +1457,57 @@ namespace CalamityMod.NPCs.Providence if (NPC.ai[1] == 0f) DespawnSpecificProjectiles(); - if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.ai[2] += spearRate; + if (NPC.ai[2] >= (float)(baseSpearRate * attackRateMult)) { - NPC.ai[2] += spearRate; - if (NPC.ai[2] >= (float)(baseSpearRate * attackRateMult)) + NPC.ai[2] = 0f; + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, fireFrom); + + int projectileType = ModContent.ProjectileType(); + + int totalDustPerSpear = 15; + + if (calamityGlobalNPC.newAI[2] % 2f == 0f) { - NPC.ai[2] = 0f; + int totalSpearProjectiles = biomeEnraged ? 15 : 12; + double radians = MathHelper.TwoPi / totalSpearProjectiles; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-calamityGlobalNPC.newAI[1], -cocoonProjVelocity)); - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, fireFrom); - - int projectileType = ModContent.ProjectileType(); - - if (calamityGlobalNPC.newAI[2] % 2f == 0f) + for (int i = 0; i < totalSpearProjectiles; i++) { - int totalSpearProjectiles = biomeEnraged ? 15 : 12; - double radians = MathHelper.TwoPi / totalSpearProjectiles; - Vector2 spinningPoint = Vector2.Normalize(new Vector2(-calamityGlobalNPC.newAI[1], -cocoonProjVelocity)); + Vector2 vector2 = spinningPoint.RotatedBy(radians * i) * cocoonProjVelocity; - for (int i = 0; i < totalSpearProjectiles; i++) + for (int k = 0; k < totalDustPerSpear; k++) { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i) * cocoonProjVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, holySpearDamage, 0f, Main.myPlayer); + int dust = Dust.NewDust(fireFrom, 30, 30, dustType, vector2.X, vector2.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; } - if (spearRateIncrease > 1f) - spearRateIncrease = 1f; - - float radialOffset = MathHelper.Lerp(0.2f, 0.4f, spearRateIncrease); - calamityGlobalNPC.newAI[1] += radialOffset; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, holySpearDamage, 0f, Main.myPlayer); } - calamityGlobalNPC.newAI[2] += 1f; + if (spearRateIncrease > 1f) + spearRateIncrease = 1f; - cocoonProjVelocity = death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; - Vector2 velocity2 = Vector2.Normalize(player.Center - fireFrom) * cocoonProjVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, projectileType, holySpearDamage, 0f, Main.myPlayer, 1f, 0f); + float radialOffset = MathHelper.Lerp(0.2f, 0.4f, spearRateIncrease); + calamityGlobalNPC.newAI[1] += radialOffset; } + + calamityGlobalNPC.newAI[2] += 1f; + + cocoonProjVelocity = death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; + Vector2 velocity2 = Vector2.Normalize(player.Center - fireFrom) * cocoonProjVelocity; + + for (int k = 0; k < totalDustPerSpear; k++) + { + int dust = Dust.NewDust(fireFrom, 30, 30, dustType, velocity2.X, velocity2.Y, 0, default, 1f); + Main.dust[dust].noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, projectileType, holySpearDamage, 0f, Main.myPlayer, 1f, 0f); } NPC.ai[3] += 1f; @@ -1256,21 +1522,86 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.Crystal: - if (!targetDead) + if (!targetDead && !getFuckedAI) NPC.velocity *= 0.9f; NPC.ai[1] += 1f; if (NPC.ai[1] >= crystalPhaseTime) { - if (NPC.ai[1] == crystalPhaseTime && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.ai[1] == crystalPhaseTime) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X, player.Center.Y - 360f, 0f, 0f, ModContent.ProjectileType(), crystalDamage, 0f, player.whoAmI, lifeRatio, 0f); + Vector2 crystalSpawnPos = new Vector2(player.Center.X, player.Center.Y - 360f); + float distanceFromCrystalSpawnPos = Vector2.Distance(crystalSpawnPos, NPC.Center); - if (nightTime) - Main.projectile[proj].timeLeft = nightCrystalTime; + int maxHealDustIterations = (int)distanceFromCrystalSpawnPos; + int maxDust = 100; + int dustDivisor = maxHealDustIterations / maxDust; + if (dustDivisor < 2) + dustDivisor = 2; + + Vector2 dustLineStart = new Vector2(NPC.Center.X, NPC.Center.Y + 64f * NPC.scale); + Vector2 dustLineEnd = crystalSpawnPos; + Vector2 currentDustPos = default; + Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); + Vector2 value5 = new Vector2(2.1f, 2f); + int dustSpawned = 0; + int maxDustLines = 3; + int blue = Main.DiscoB; + for (int i = 0; i < maxDustLines; i++) + { + for (int j = 0; j < maxHealDustIterations; j++) + { + if (j % dustDivisor == 0) + { + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, j / (float)maxHealDustIterations); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : new Color(255, 200, Math.Abs(Math.Abs(blue) - (int)(dustSpawned * 2.55f)))).X, 1f, 0.5f); + dustColor.A = 255; + int dust = Dust.NewDust(currentDustPos, 0, 0, 267, 0f, 0f, 0, dustColor, 1f); + Main.dust[dust].position = currentDustPos + new Vector2(32f, 32f).RotatedByRandom(MathHelper.TwoPi) * i; + Main.dust[dust].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * j / maxHealDustIterations) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1f + i; + Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; + Dust dust2 = Dust.CloneDust(dust); + Dust dust3 = dust2; + dust3.scale /= 2f; + dust3 = dust2; + dust3.fadeIn /= 2f; + dust2.color = new Color(255, 255, 255, 255); + dustSpawned++; + } + } + + if (!nightAI) + blue -= 255 / (maxDustLines - 1); + } + + int totalDust = 36; + int circleDustSpawned = 0; + for (int k = 0; k < totalDust; k++) + { + Vector2 dustSpawnPos = Vector2.Normalize(NPC.velocity) * new Vector2(80f, 160f); + dustSpawnPos = dustSpawnPos.RotatedBy((double)((k - (totalDust / 2 - 1)) * MathHelper.TwoPi / totalDust), default) + dustLineEnd; + Vector2 dustVelocity = dustSpawnPos - dustLineEnd; + Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : new Color(255, 200, Math.Abs(Math.Abs(blue) - (int)(circleDustSpawned * 7.08f)))).X, 1f, 0.5f); + dustColor.A = 255; + int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, 267, dustVelocity.X, dustVelocity.Y, 0, dustColor, 1.4f); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = dustVelocity * 0.33f; + circleDustSpawned++; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), crystalDamage, 0f, player.whoAmI, lifeRatio, 0f); + + if (nightAI) + Main.projectile[proj].timeLeft = getFuckedAI ? gfbCrystalTime : nightCrystalTime; + } } - if (NPC.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightTime) + if (NPC.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightAI) { AIState = (int)Phase.PhaseChange; NPC.TargetClosest(); @@ -1281,28 +1612,28 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.Laser: - Vector2 value19 = new Vector2(27f, 59f); + Vector2 dustPosOffset = new Vector2(27f, 59f); - float rotation = (nightTime ? 435f : 450f) + (guardianAmt * 5); + float rotation = (nightAI ? 435f : 450f) + (guardianAmt * 5); NPC.ai[2] += 1f; if (NPC.ai[2] < 120f) { if (NPC.ai[2] >= 40f) { - int num1220 = 0; + int extraDustAmt = 0; if (NPC.ai[2] >= 80f) - num1220 = 1; + extraDustAmt = 1; - for (int d = 0; d < 1 + num1220; d++) + for (int d = 0; d < 1 + extraDustAmt; d++) { float scalar = 1.2f; if (d % 2 == 1) scalar = 2.8f; - Vector2 vector199 = new Vector2(vector.X, vector.Y + 32f * NPC.scale) + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * value19 / 2f; - int index = Dust.NewDust(vector199 - Vector2.One * 8f, 16, 16, dustType, NPC.velocity.X / 2f, NPC.velocity.Y / 2f, 0, default, 1f); - Main.dust[index].velocity = Vector2.Normalize(vector - vector199) * 3.5f * (10f - num1220 * 2f) / 10f; + Vector2 dustPos = new Vector2(NPC.Center.X, NPC.Center.Y + 64f * NPC.scale) + ((float)Main.rand.NextDouble() * MathHelper.TwoPi).ToRotationVector2() * dustPosOffset / 2f; + int index = Dust.NewDust(dustPos - Vector2.One * 8f, 16, 16, dustType, NPC.velocity.X / 2f, NPC.velocity.Y / 2f, 0, default, 1f); + Main.dust[index].velocity = Vector2.Normalize(NPC.Center - dustPos) * 3.5f * (10f - extraDustAmt * 2f) / 10f; Main.dust[index].noGravity = true; Main.dust[index].scale = scalar; } @@ -1312,36 +1643,36 @@ namespace CalamityMod.NPCs.Providence { if (NPC.ai[2] == 120f) { - if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 2800f) + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) { - SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.position); + SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.Center); } if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 velocity = player.Center - vector; + Vector2 velocity = player.Center - NPC.Center; velocity.Normalize(); - float num1225 = -1f; + float beamDirection = -1f; if (velocity.X < 0f) - num1225 = 1f; + beamDirection = 1f; // 60 degrees offset - velocity = velocity.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y + 32f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / rotation, NPC.whoAmI); + velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 6f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); // -60 degrees offset if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y + 32f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -num1225 * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); - if (nightTime && lifeRatio < 0.5f) + if (nightAI && lifeRatio < 0.5f) { rotation *= 0.33f; - velocity = velocity.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y + 32f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / rotation, NPC.whoAmI); + velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y + 32f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -num1225 * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); } NPC.netUpdate = true; @@ -1442,9 +1773,8 @@ namespace CalamityMod.NPCs.Providence float distanceToTarget = Vector2.Distance(Main.player[NPC.target].Center, NPC.Center); float aiTimer = NPC.ai[3]; - // Night bool - bool bossRush = BossRushEvent.BossRushActive; - bool nightTime = !Main.dayTime || bossRush; + // This bool is only relevant for non-Zenith night AI + bool nightTime = currentMode == (int)BossMode.Night; float baseDistance = 2800f; float shorterFlameCocoonDistance = (CalamityWorld.death || nightTime) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f; @@ -1467,7 +1797,8 @@ namespace CalamityMod.NPCs.Providence // It is determined based on how much time has elapsed during the attack thus far, specifically for the two cocoon attacks. // This shave-off does not happen when guardians are present. float shorterDistanceFade = Utils.GetLerpValue(0f, 120f, aiTimer, true); - if (!guardianAlive) + //Distance does not get shorter if in GFB / Guardians are alive + if (!guardianAlive && currentMode < (int)BossMode.Red) { maxDistance = baseDistance; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) @@ -1524,7 +1855,7 @@ namespace CalamityMod.NPCs.Providence string key3 = "Mods.CalamityMod.TreeOreText"; Color messageColor3 = Color.LightGreen; - CalamityUtils.SpawnOre(ModContent.TileType(), 17E-05, 0.55f, 0.85f, 5, 9, TileID.Mud); + CalamityUtils.SpawnOre(ModContent.TileType(), 17E-05, 0.55f, 0.9f, 8, 14, TileID.Mud); CalamityUtils.DisplayLocalizedText(key2, messageColor2); CalamityUtils.DisplayLocalizedText(key3, messageColor3); @@ -1606,7 +1937,7 @@ namespace CalamityMod.NPCs.Providence npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); } private void SpawnLootBox() @@ -1644,8 +1975,8 @@ namespace CalamityMod.NPCs.Providence { void drawProvidenceInstance(Vector2 drawOffset, Color? colorOverride) { - bool bossRush = BossRushEvent.BossRushActive; - bool nightTime = !Main.dayTime || bossRush; + //This night bool is used for any off-color activity + bool offColor = currentMode != (int)BossMode.Day; string baseTextureString = "CalamityMod/NPCs/Providence/"; string baseGlowTextureString = baseTextureString + "Glowmasks/"; @@ -1671,32 +2002,37 @@ namespace CalamityMod.NPCs.Providence } else { - if (frameUsed == 0) + switch (frameUsed) { - getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; - } - else if (frameUsed == 1) - { - getTextureString = baseTextureString + "ProvidenceAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAltGlow2"; - } - else if (frameUsed == 2) - { - getTextureString = baseTextureString + "ProvidenceAttack"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAttackGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackGlow2"; - } - else - { - getTextureString = baseTextureString + "ProvidenceAttackAlt"; - getTextureGlowString = baseGlowTextureString + "ProvidenceAttackAltGlow"; - getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackAltGlow2"; + case 0: + getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; + getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; + break; + + case 1: + getTextureString = baseTextureString + "ProvidenceAlt"; + getTextureGlowString = baseGlowTextureString + "ProvidenceAltGlow"; + getTextureGlow2String = baseGlowTextureString + "ProvidenceAltGlow2"; + break; + + case 2: + getTextureString = baseTextureString + "ProvidenceAttack"; + getTextureGlowString = baseGlowTextureString + "ProvidenceAttackGlow"; + getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackGlow2"; + break; + + case 3: + getTextureString = baseTextureString + "ProvidenceAttackAlt"; + getTextureGlowString = baseGlowTextureString + "ProvidenceAttackAltGlow"; + getTextureGlow2String = baseGlowTextureString + "ProvidenceAttackAltGlow2"; + break; + + default: + break; } } - if (nightTime) + if (offColor) { getTextureString += "Night"; getTextureGlowString += "Night"; @@ -1711,71 +2047,105 @@ namespace CalamityMod.NPCs.Providence if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + //Draw the main boss texture + its afterimages + Vector2 RotationCenter = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Color BaseColor = Color.White; + float Brightness = 0.5f; //Ranges from 0 (full vibrance) to 1 (pure white) + int maxAfterimages = 5; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int num155 = 1; num155 < maxAfterimages; num155 += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; + Color AfterimageColor = drawColor; + AfterimageColor = Color.Lerp(AfterimageColor, BaseColor, Brightness); + AfterimageColor = NPC.GetAlpha(AfterimageColor); + AfterimageColor *= (maxAfterimages - num155) / 15f; if (colorOverride != null) - color38 = colorOverride.Value; + AfterimageColor = colorOverride.Value; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 AfterimageBodyPosition = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + AfterimageBodyPosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + AfterimageBodyPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture, AfterimageBodyPosition, NPC.frame, AfterimageColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture, vector43, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 BasePosition = NPC.Center - screenPos; + BasePosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + BasePosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture, BasePosition, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - Color color37 = Color.Lerp(Color.White, nightTime ? Color.Cyan : Color.Yellow, 0.5f) * NPC.Opacity; - Color color42 = Color.Lerp(Color.White, nightTime ? Color.BlueViolet : Color.Violet, 0.5f) * NPC.Opacity; + //Draw the glowmask textures + their afterimages + //These are the colors at their strongest point. It'll shift towards white by the brightness value used earlier. + Color WingColor = Color.Yellow; //Default to day + Color CrystalColor = Color.Violet; + switch (currentMode) + { + case (int)BossMode.Red: + WingColor = Color.Red; + CrystalColor = Color.BlueViolet; + break; + case (int)BossMode.Orange: + WingColor = Color.Orange; + CrystalColor = Color.HotPink; + break; + case (int)BossMode.Yellow: //Same as day + break; + case (int)BossMode.Green: + WingColor = Color.Green; + CrystalColor = Color.Gold; + break; + case (int)BossMode.Blue: //Same as night + case (int)BossMode.Night: + WingColor = Color.Cyan; + CrystalColor = Color.BlueViolet; + break; + case (int)BossMode.Violet: + WingColor = Color.Magenta; + CrystalColor = Color.GreenYellow; + break; + default: + break; + } + + Color BaseWingColor = Color.Lerp(WingColor, BaseColor, Brightness) * NPC.Opacity; + Color BaseCrystalColor = Color.Lerp(CrystalColor, BaseColor, Brightness) * NPC.Opacity; if (colorOverride != null) { - color37 = colorOverride.Value; - color42 = colorOverride.Value; + BaseWingColor = colorOverride.Value; + BaseCrystalColor = colorOverride.Value; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int num163 = 1; num163 < maxAfterimages; num163++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; + Color AfterimageWingColor = BaseWingColor; + AfterimageWingColor = Color.Lerp(AfterimageWingColor, BaseColor, Brightness); + AfterimageWingColor = NPC.GetAlpha(AfterimageWingColor); + AfterimageWingColor *= (maxAfterimages - num163) / 15f; if (colorOverride != null) - color41 = colorOverride.Value; + AfterimageWingColor = colorOverride.Value; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(textureGlow, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 AfterimageGlowPosition = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + AfterimageGlowPosition -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + AfterimageGlowPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(textureGlow, AfterimageGlowPosition, NPC.frame, AfterimageWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - Color color43 = color42; - color43 = Color.Lerp(color43, color36, amount9); - color43 = NPC.GetAlpha(color43); - color43 *= (num153 - num163) / 15f; + Color AfterimageCrystalColor = BaseCrystalColor; + AfterimageCrystalColor = Color.Lerp(AfterimageCrystalColor, BaseColor, Brightness); + AfterimageCrystalColor = NPC.GetAlpha(AfterimageCrystalColor); + AfterimageCrystalColor *= (maxAfterimages - num163) / 15f; if (colorOverride != null) - color43 = colorOverride.Value; - spriteBatch.Draw(textureGlow2, vector44, NPC.frame, color43, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + AfterimageCrystalColor = colorOverride.Value; + spriteBatch.Draw(textureGlow2, AfterimageGlowPosition, NPC.frame, AfterimageCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(textureGlow, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(textureGlow, BasePosition, NPC.frame, BaseWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - spriteBatch.Draw(textureGlow2, vector43, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(textureGlow2, BasePosition, NPC.frame, BaseCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); } float burnIntensity = Utils.GetLerpValue(0f, 45f, DeathAnimationTimer, true); @@ -1794,25 +2164,106 @@ namespace CalamityMod.NPCs.Providence drawProvidenceInstance(drawOffset, totalProvidencesToDraw == 1 ? null : (Color?)baseColor); } + // Draw orange star while attacker is alive + if (NPC.localAI[0] > 0f && NPC.localAI[0] < TimeForStarDespawn) + { + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) / 2f + 1f); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; + float drawOffsetAmt = (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) ? 20f : 64f; + Vector2 drawPos = NPC.Center + Vector2.UnitY * drawOffsetAmt * NPC.scale - Main.screenPosition; + Color baseColor = Color.Lerp(Color.Yellow, Color.OrangeRed, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 1f); + baseColor *= 0.5f; + baseColor.A = 0; + Color colorA = baseColor; + Color colorB = baseColor * 0.5f; + float opacityScaleDuringStarDespawn = (TimeForStarDespawn - NPC.localAI[0]) / TimeForStarDespawn; + float scaleDuringStarDespawnScale = 1.8f; + float scaleDuringStarDespawn = (1f - opacityScaleDuringStarDespawn) * scaleDuringStarDespawnScale; + float colorScale = MathHelper.Lerp(0f, lerpMult, opacityScaleDuringStarDespawn); + colorA *= colorScale; + colorB *= colorScale; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(1.5f + scaleDuringStarDespawn, 2.5f + scaleDuringStarDespawn) * lerpMult; + float upRight = MathHelper.PiOver4 + NPC.rotation; + float up = MathHelper.PiOver2 + NPC.rotation; + float upLeft = 3f * MathHelper.PiOver4 + NPC.rotation; + float left = MathHelper.Pi + NPC.rotation; + Main.EntitySpriteDraw(texture, drawPos, null, colorA, upLeft, origin, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPos, null, colorA, upRight, origin, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, SpriteEffects.None, 0); + } + + // Draw shields while defender is alive + if (NPC.localAI[3] > 0f && NPC.localAI[3] < TimeForShieldDespawn) + { + float maxOscillation = 60f; + float minScale = 0.9f; + float maxPulseScale = 1f - minScale; + float minOpacity = 0.5f; + float maxOpacityScale = 1f - minOpacity; + float currentOscillation = MathHelper.Lerp(0f, maxOscillation, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi) + 1f) * 0.5f); + float shieldOpacity = minOpacity + maxOpacityScale * Utils.Remap(currentOscillation, 0f, maxOscillation, 1f, 0f); + float oscillationRatio = currentOscillation / maxOscillation; + float invertedOscillationRatio = 1f - (1f - oscillationRatio) * (1f - oscillationRatio); + float oscillationScale = 1f - (1f - invertedOscillationRatio) * (1f - invertedOscillationRatio); + float remappedOscillation = Utils.Remap(currentOscillation, maxOscillation - 15f, maxOscillation, 0f, 1f); + float twoOscillationsMultipliedTogetherForScaleCalculation = remappedOscillation * remappedOscillation; + float invertedOscillationUsedForScale = MathHelper.Lerp(minScale, 1f, 1f - twoOscillationsMultipliedTogetherForScaleCalculation); + float shieldScale = (minScale + maxPulseScale * oscillationScale) * invertedOscillationUsedForScale; + float smallerRemappedOscillation = Utils.Remap(currentOscillation, 20f, maxOscillation, 0f, 1f); + float invertedSmallerOscillationRatio = 1f - (1f - smallerRemappedOscillation) * (1f - smallerRemappedOscillation); + float smallerOscillationScale = 1f - (1f - invertedSmallerOscillationRatio) * (1f - invertedSmallerOscillationRatio); + float shieldScale2 = (minScale + maxPulseScale * smallerOscillationScale) * invertedOscillationUsedForScale; + Texture2D shieldTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value; + Rectangle shieldFrame = shieldTexture.Frame(); + Vector2 origin = shieldFrame.Size() * 0.5f; + Vector2 shieldDrawPos = NPC.Center - screenPos; + shieldDrawPos -= new Vector2(shieldTexture.Width, shieldTexture.Height) * NPC.scale / 2f; + shieldDrawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + float minHue = 0.06f; + float maxHue = 0.18f; + float opacityScaleDuringShieldDespawn = (TimeForShieldDespawn - NPC.localAI[3]) / TimeForShieldDespawn; + float scaleDuringShieldDespawnScale = 1.8f; + float scaleDuringShieldDespawn = (1f - opacityScaleDuringShieldDespawn) * scaleDuringShieldDespawnScale; + float colorScale = MathHelper.Lerp(0f, shieldOpacity, opacityScaleDuringShieldDespawn); + Color color = Main.hslToRgb(MathHelper.Lerp(maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + color2.A = 0; + color *= 0.6f; + color2 *= 0.6f; + float scaleMult = 2.2f + scaleDuringShieldDespawn; + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale2 * scaleMult, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale2 * scaleMult * 0.95f, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color, NPC.rotation, origin, shieldScale * scaleMult, SpriteEffects.None, 0f); + spriteBatch.Draw(shieldTexture, shieldDrawPos, shieldFrame, color2, NPC.rotation, origin, shieldScale * scaleMult * 0.95f, SpriteEffects.None, 0f); + } + return false; } - public override void FindFrame(int frameHeight) //9 total frames + public override void FindFrame(int frameHeight) { if (NPC.IsABestiaryIconDummy) NPC.Opacity = 1f; + int totalFrames = 3; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) { if (!useDefenseFrames) { - NPC.frameCounter += Dying ? 0.25 : 1.0; - if (NPC.frameCounter > 8.0) + NPC.frameCounter += Dying ? 0.25 : 1D; + if (NPC.frameCounter > 10D) { - NPC.frame.Y = NPC.frame.Y + frameHeight; - NPC.frameCounter = 0.0; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; } - if (NPC.frame.Y >= frameHeight * 3) + + if (NPC.frame.Y >= frameHeight * totalFrames) { NPC.frame.Y = 0; useDefenseFrames = true; @@ -1820,12 +2271,13 @@ namespace CalamityMod.NPCs.Providence } else { - NPC.frameCounter += Dying ? 0.25 : 1.0; - if (NPC.frameCounter > 8.0) + NPC.frameCounter += Dying ? 0.25 : 1D; + if (NPC.frameCounter > 10D) { - NPC.frame.Y = NPC.frame.Y + frameHeight; - NPC.frameCounter = 0.0; + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0D; } + if (NPC.frame.Y >= frameHeight * 2) NPC.frame.Y = frameHeight * 2; } @@ -1835,18 +2287,21 @@ namespace CalamityMod.NPCs.Providence if (useDefenseFrames) useDefenseFrames = false; - NPC.frameCounter += Dying ? 0.25 : 1.0; - if (NPC.frameCounter > (NPC.Calamity().newAI[3] < 180f ? 8.0 : 5.0)) + NPC.frameCounter += Dying ? 0.25 : (NPC.Calamity().newAI[3] < 180f) ? 0.625 : 1D; + if (NPC.frameCounter > 5D) { - NPC.frameCounter = 0.0; - NPC.frame.Y = NPC.frame.Y + frameHeight; + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; } - if (NPC.frame.Y >= frameHeight * 3) //6 + + if (NPC.frame.Y >= frameHeight * totalFrames) { NPC.frame.Y = 0; frameUsed++; } - if (frameUsed > 3) + + int totalSheets = 4; + if (frameUsed >= totalSheets) frameUsed = 0; } } @@ -1867,7 +2322,7 @@ namespace CalamityMod.NPCs.Providence { if (!hasTakenDaytimeDamage) { - if (Main.dayTime) + if (currentMode == (int)BossMode.Day) { hasTakenDaytimeDamage = true; @@ -1923,7 +2378,7 @@ namespace CalamityMod.NPCs.Providence { if (!hasTakenDaytimeDamage) { - if (Main.dayTime) + if (currentMode == (int)BossMode.Day) { hasTakenDaytimeDamage = true; @@ -1990,9 +2445,12 @@ namespace CalamityMod.NPCs.Providence SoundEngine.PlaySound(HurtSound, NPC.Center); } - int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(currentMode); for (int k = 0; k < 15; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hitDirection, -1f, 0, default, 1f); + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hitDirection, -1f, 0, default, 1f); + Main.dust[dust].noGravity = true; + } if (NPC.life <= 0) { @@ -2012,6 +2470,7 @@ namespace CalamityMod.NPCs.Providence { int fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 3f; + Main.dust[fire].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[fire].scale = 0.5f; @@ -2025,8 +2484,136 @@ namespace CalamityMod.NPCs.Providence Main.dust[fire].velocity *= 5f; fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; + Main.dust[fire].noGravity = true; } } } } + + //These will be used for almost every single one of her projectiles, so it's useful to have. + public static class ProvUtils + { + public static Color GetProjectileColor(int Mode, int Alpha, bool Outline = false) + { + Color FinalColor = new Color(250, Outline ? 0 : 150, 0, Alpha); //Default to day + switch (Mode) + { + case (int)Providence.BossMode.Red: + FinalColor = new Color(250, 100, Outline ? 200 : 100, Alpha); + break; + case (int)Providence.BossMode.Orange: + FinalColor = new Color(250, 150, Outline ? 150 : 100, Alpha); + break; + case (int)Providence.BossMode.Yellow: //Same as day + break; + case (int)Providence.BossMode.Green: + FinalColor = new Color(Outline ? 200 : 100, 250, 100, Alpha); + break; + case (int)Providence.BossMode.Blue: //Same as night + case (int)Providence.BossMode.Night: + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); + break; + case (int)Providence.BossMode.Violet: + FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, Alpha); + break; + default: + break; + } + + if (Outline) + FinalColor *= 0.1f; + + return FinalColor; + } + + public static int GetDustID(int Mode) + { + int DustType = (int)CalamityDusts.ProfanedFire; //Default to day + switch (Mode) + { + case (int)Providence.BossMode.Red: + DustType = DustID.RedTorch; + break; + case (int)Providence.BossMode.Orange: + DustType = DustID.OrangeTorch; + break; + case (int)Providence.BossMode.Yellow: //Same as day + break; + case (int)Providence.BossMode.Green: + DustType = DustID.GreenTorch; + break; + case (int)Providence.BossMode.Blue: //Same as night + case (int)Providence.BossMode.Night: + DustType = (int)CalamityDusts.Nightwither; + break; + case (int)Providence.BossMode.Violet: + DustType = DustID.PurpleTorch; + break; + default: + break; + } + return DustType; + } + + //Include debuffs inflicted by Providence's projectiles for all her forms + //In the GFB seed, also includes negative healing + public static void ApplyHitEffects(Player Target, int Mode, int BaseDuration, int NegativeHealValue) + { + int BuffType = ModContent.BuffType(); //Default to day + float Multiplier = 1f; //Used to counterbalance Cursed Inferno and Shadowflame + + //Day and Night Providence inflicts 16-80 damage of debuffs depending on attacks + //GFB Providence inflicts 24-120 damage (+50%) for half the colors, 26-130 (+62.5%) for another half + switch (Mode) + { + case (int)Providence.BossMode.Red: + BuffType = ModContent.BuffType(); + break; + case (int)Providence.BossMode.Orange: + BuffType = ModContent.BuffType(); + Multiplier = 0.5f; + break; + case (int)Providence.BossMode.Yellow: //Same as day + break; + case (int)Providence.BossMode.Green: + BuffType = BuffID.CursedInferno; + Multiplier = 0.75f; + break; + case (int)Providence.BossMode.Blue: //Same as night + case (int)Providence.BossMode.Night: + BuffType = ModContent.BuffType(); + break; + case (int)Providence.BossMode.Violet: + BuffType = ModContent.BuffType(); + Multiplier = 0.60f; + break; + default: + break; + } + Target.AddBuff(BuffType, (int)(BaseDuration * Multiplier)); + + //A. Specifically inflicts Vaporfied in quirky RGB Mode because it's a colorful debuff + //B. Apply the negative healing + if (Mode >= (int)Providence.BossMode.Red) + { + //Obligatory offensive guardian boosting negative heals + if (CalamityGlobalNPC.holyBossAttacker != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active) + NegativeHealValue *= 2; + } + + Target.HealEffect(-1 * NegativeHealValue, false); + Target.statLife -= NegativeHealValue; + if (Target.statLife < 0) + { + PlayerDeathReason CustomSource = PlayerDeathReason.ByCustomReason(Target.name + " burst into sinless ash."); + Target.KillMe(CustomSource, NegativeHealValue, 0); + } + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, Target.whoAmI, NegativeHealValue); + + Target.AddBuff(ModContent.BuffType(), (int)(BaseDuration * Multiplier)); + } + } + } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index d1a4866345..50e413c14e 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -13,6 +13,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -105,6 +106,8 @@ namespace CalamityMod.NPCs.Ravager { writer.Write(NPC.dontTakeDamage); writer.Write(velocityY); + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -113,6 +116,8 @@ namespace CalamityMod.NPCs.Ravager { NPC.dontTakeDamage = reader.ReadBoolean(); velocityY = reader.ReadSingle(); + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -229,6 +234,109 @@ namespace CalamityMod.NPCs.Ravager } } + /*if (CalamityWorld.getFixedBoi) + { + bool finalStand = lifeRatio < 0.1f; //At 10% body health, does the funny final attack + NPC.localAI[1]++; + + Vector2 Pos = player.Center; //Spawn projectiles based on player's center. Having it be based on the boss turned out weird. (Except for final) + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + if (finalStand) //Circle + { + Vector2 circleOffset = Pos + (Vector2.UnitY * 640f).RotatedBy(MathHelper.ToRadians(NPC.localAI[1] * 3f)); + if (NPC.localAI[1] % 5 == 0) + Projectile.NewProjectile(NPC.GetSource_FromAI(), circleOffset, Pos, type, damage, 0f, Main.myPlayer, 0f, 0.8f); + } + else if (NPC.localAI[1] >= 8000f) //Random bullshit + { + float randOffsetX = Main.rand.NextFloat(240f, 800f) * (Main.rand.NextBool() ? -1 : 1); + float randOffsetY = Main.rand.NextFloat(240f, 640f) * (Main.rand.NextBool() ? -1 : 1); + if (NPC.localAI[1] > 8300f) //5 seconds + NPC.localAI[1] = 0f; + else if (NPC.localAI[1] % 20 == 0) //15 blasts from random directions + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X - randOffsetX, Pos.Y - randOffsetY, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + else if (NPC.localAI[1] >= 6000f) //Plus + { + float plusOffset = 640f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X - plusOffset, Pos.Y, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 4f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X + plusOffset, Pos.Y, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 4f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X, Pos.Y - plusOffset, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 4f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X, Pos.Y + plusOffset, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 4f); + NPC.localAI[1] = 0f; + } + else if (NPC.localAI[1] >= 4000f) //Cross + { + float crossOffset = 400f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X - crossOffset, Pos.Y - crossOffset, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X - crossOffset, Pos.Y + crossOffset, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X + crossOffset, Pos.Y - crossOffset, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X + crossOffset, Pos.Y + crossOffset, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 2f); + NPC.localAI[1] = 0f; + } + else if (NPC.localAI[1] >= 2000f) //Hash grid + { + float gridOffset1 = 480f; + float gridOffset2 = 560f; + //Top left, aimed right + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X - gridOffset2, Pos.Y - gridOffset1, Pos.X, Pos.Y - gridOffset1, type, damage, 0f, Main.myPlayer, 0f, 1f); + //Top left, aimed down + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X - gridOffset1, Pos.Y - gridOffset2, Pos.X - gridOffset1, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 1f); + //Bottom right, aimed left + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X + gridOffset2, Pos.Y + gridOffset1, Pos.X, Pos.Y + gridOffset1, type, damage, 0f, Main.myPlayer, 0f, 1f); + //Bottom right, aimed up + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X + gridOffset1, Pos.Y + gridOffset2, Pos.X + gridOffset1, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 1f); + NPC.localAI[1] = 0f; + } + else if (NPC.localAI[1] >= 1000f) //Horizontal line + { + float lineOffset = 800f * (Main.rand.NextBool() ? -1 : 1); + if (NPC.localAI[1] > 1180f) //3 seconds + NPC.localAI[1] = 0f; + else if (NPC.localAI[1] % 60 == 0) //3 blasts from the side + Projectile.NewProjectile(NPC.GetSource_FromAI(), Pos.X - lineOffset, Pos.Y, Pos.X, Pos.Y, type, damage, 0f, Main.myPlayer, 0f, 4f); + } + else if (NPC.localAI[1] >= 300f) //Choose an attack after 5 seconds + { + NPC.localAI[1] = 1000f * Main.rand.Next(1, 6 + (immunePhase ? 0 : 4)); //doubled chance for everything except attack 1 + } + else if (NPC.localAI[1] >= 60f && Main.rand.NextBool(2000)) //About 10% chance to reset the timer and instead summon a blue pillar + { + int laser = ModContent.ProjectileType(); + float blueOffset1 = 2400f; + float blueOffset2 = 800f; + + //default = aim up or down, move to the right + Vector2 position = new Vector2(Pos.X - blueOffset2, Pos.Y - (blueOffset1 * (Main.rand.NextBool() ? -1 : 1))); + Vector2 destination = new Vector2(Pos.X - blueOffset2, Pos.Y); + int movement = Main.rand.Next(-4, 0); + switch(movement) + { + case -2: //aim up or down, sweep to the left + position.X = Pos.X + blueOffset2; + destination = new Vector2(Pos.X + blueOffset2, Pos.Y); + break; + case -3: //aim left or right, sweep down + position.X = Pos.X - (blueOffset1 * (Main.rand.NextBool() ? -1 : 1)); + position.Y = Pos.Y - blueOffset2; + destination = new Vector2(Pos.X, Pos.Y - blueOffset2); + break; + case -4: //aim left or right, sweep up + position.X = Pos.X - (blueOffset1 * (Main.rand.NextBool() ? -1 : 1)); + position.Y = Pos.Y + blueOffset2; + destination = new Vector2(Pos.X, Pos.Y + blueOffset2); + break; + default: + break; + } + + Vector2 velocity = (destination - position).SafeNormalize(Vector2.Zero); + Projectile.NewProjectile(NPC.GetSource_FromAI(), position, velocity, laser, damage, 0f, Main.myPlayer, 1f, (float)movement); + NPC.localAI[1] = 0f; + } + }*/ + if (!headActive) { int rightDust = Dust.NewDust(new Vector2(NPC.Center.X, NPC.Center.Y - 30f), 8, 8, DustID.Blood, 0f, 0f, 100, default, 2.5f); @@ -392,7 +500,7 @@ namespace CalamityMod.NPCs.Ravager if (velocityY != 16) { - SoundEngine.PlaySound(JumpSound, NPC.position); + SoundEngine.PlaySound(JumpSound, NPC.Center); } velocityY = -16f; @@ -456,7 +564,7 @@ namespace CalamityMod.NPCs.Ravager { if (NPC.velocity.Y == 0f && (NPC.ai[1] == 31f || NPC.ai[0] == 1f)) { - SoundEngine.PlaySound(StompSound, NPC.position); + SoundEngine.PlaySound(StompSound, NPC.Center); NPC.ai[0] = 0f; NPC.ai[1] = 0f; @@ -482,7 +590,7 @@ namespace CalamityMod.NPCs.Ravager if (!anyrockpillars || !anyflamepillars) { - SoundEngine.PlaySound(PillarSound, NPC.position); + SoundEngine.PlaySound(PillarSound, NPC.Center); } if (!anyrockpillars || Main.getGoodWorld) { @@ -532,7 +640,7 @@ namespace CalamityMod.NPCs.Ravager { if (calamityGlobalNPC.newAI[3] == 0) { - SoundEngine.PlaySound(JumpSound, NPC.position); + SoundEngine.PlaySound(JumpSound, NPC.Center); } NPC.noTileCollide = true; @@ -910,7 +1018,7 @@ namespace CalamityMod.NPCs.Ravager npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedRavager, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedRavager, ModContent.ItemType(), desc: DropHelper.FirstKillText); } } } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index df280a9896..a36c818052 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -58,6 +58,8 @@ namespace CalamityMod.NPCs.Ravager { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -133,7 +135,7 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[0] == 1f) { - SoundEngine.PlaySound(RavagerBody.FistSound, NPC.position); + SoundEngine.PlaySound(RavagerBody.FistSound, NPC.Center); NPC.noTileCollide = true; NPC.collideX = false; NPC.collideY = false; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 134b1038f2..df8541dc6d 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -59,6 +59,8 @@ namespace CalamityMod.NPCs.Ravager //Main.NewText(NPC.ai[0]); if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -134,7 +136,7 @@ namespace CalamityMod.NPCs.Ravager } else if (NPC.ai[0] == 1f) { - SoundEngine.PlaySound(RavagerBody.FistSound, NPC.position); + SoundEngine.PlaySound(RavagerBody.FistSound, NPC.Center); NPC.noTileCollide = true; NPC.collideX = false; NPC.collideY = false; diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index 00f7b1b1a8..785470be21 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -55,6 +55,8 @@ namespace CalamityMod.NPCs.Ravager { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -81,7 +83,7 @@ namespace CalamityMod.NPCs.Ravager NPC.ai[1] += 1f; if (NPC.ai[1] >= (death ? 420f : 480f)) { - SoundEngine.PlaySound(MissileSound, NPC.position); + SoundEngine.PlaySound(MissileSound, NPC.Center); // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -117,7 +119,7 @@ namespace CalamityMod.NPCs.Ravager num285++; } } - else if (Main.netMode != NetmodeID.MultiplayerClient) + else if (Main.netMode != NetmodeID.MultiplayerClient && !CalamityWorld.getFixedBoi) //GFB does something else { NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType(), NPC.whoAmI); } diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index f8ebf25983..3c31161ba6 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -121,7 +121,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(RavagerHead.MissileSound, NPC.position); + SoundEngine.PlaySound(RavagerHead.MissileSound, NPC.Center); type = ModContent.ProjectileType(); damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity * 0.25f, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.scavenger].target, 0f); @@ -133,7 +133,7 @@ namespace CalamityMod.NPCs.Ravager { if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Item33, NPC.position); + SoundEngine.PlaySound(SoundID.Item33, NPC.Center); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, -1f); } } diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index ee3c379be5..74d27b98f4 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -51,6 +51,8 @@ namespace CalamityMod.NPCs.Ravager { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index c87140be3f..1da616f723 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -51,6 +51,8 @@ namespace CalamityMod.NPCs.Ravager { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index e9f2e7b205..475690aff5 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.Ravager { if (NPC.ai[1] == -1f) { - SoundEngine.PlaySound(SoundID.Item62, NPC.position); + SoundEngine.PlaySound(SoundID.Item62, NPC.Center); for (int num621 = 0; num621 < 10; num621++) { @@ -107,7 +107,7 @@ namespace CalamityMod.NPCs.Ravager { if (NPC.velocity.Y == 0f || Vector2.Distance(NPC.Center, Main.npc[CalamityGlobalNPC.scavenger].Center) > 2800f) { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); NPC.ai[0] = 0f; NPC.life = 0; HitEffect(NPC.direction, 9999); @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.Ravager if (damage <= 0) return; player.AddBuff(ModContent.BuffType(), 240, true); - SoundEngine.PlaySound(SoundID.Item14, NPC.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); NPC.ai[0] = 0f; NPC.life = 0; HitEffect(NPC.direction, 9999); diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 6456775fa9..cecaf2158d 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -79,6 +79,8 @@ namespace CalamityMod.NPCs.Signus { if (CalamityGlobalNPC.signus < 0 || !Main.npc[CalamityGlobalNPC.signus].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/Signus/CosmicMine.cs b/NPCs/Signus/CosmicMine.cs index 6c445b334a..e0b491525d 100644 --- a/NPCs/Signus/CosmicMine.cs +++ b/NPCs/Signus/CosmicMine.cs @@ -54,7 +54,8 @@ namespace CalamityMod.NPCs.Signus { if (CalamityGlobalNPC.signus < 0 || !Main.npc[CalamityGlobalNPC.signus].active) { - NPC.active = false; + NPC.life = 0; + NPC.checkDead(); NPC.netUpdate = true; return; } @@ -202,7 +203,7 @@ namespace CalamityMod.NPCs.Signus public override bool CheckDead() { - SoundEngine.PlaySound(SoundID.Item14, NPC.position); + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); NPC.position.X = NPC.position.X + (NPC.width / 2); NPC.position.Y = NPC.position.Y + (NPC.height / 2); NPC.damage = NPC.defDamage; diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 2d50ffd80f..88643ced6d 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -21,6 +21,7 @@ using System.IO; using Terraria; using Terraria.GameContent; using Terraria.GameContent.Bestiary; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; @@ -34,6 +35,7 @@ namespace CalamityMod.NPCs.Signus private int spawnX = 750; private int spawnY = 120; private int lifeToAlpha = 0; + private int stealthTimer = 0; public override void SetStaticDefaults() { @@ -50,7 +52,7 @@ namespace CalamityMod.NPCs.Signus value.Position.X += 6f; value.Position.Y += 10f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -92,6 +94,7 @@ namespace CalamityMod.NPCs.Signus writer.Write(spawnX); writer.Write(spawnY); writer.Write(lifeToAlpha); + writer.Write(stealthTimer); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -101,6 +104,7 @@ namespace CalamityMod.NPCs.Signus spawnX = reader.ReadInt32(); spawnY = reader.ReadInt32(); lifeToAlpha = reader.ReadInt32(); + stealthTimer = reader.ReadInt32(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -195,6 +199,30 @@ namespace CalamityMod.NPCs.Signus } } + // Zenith seed stealth strike stuff + int stealthSoundGate = 300; + int maxStealth = 360; + + if (CalamityWorld.getFixedBoi) + { + if (stealthTimer < maxStealth) + { + stealthTimer++; + } + if (stealthTimer == stealthSoundGate) + { + SoundEngine.PlaySound(CalPlayer.CalamityPlayer.RogueStealthSound, NPC.Center); + } + if (stealthTimer >= stealthSoundGate && stealthTimer < maxStealth) + { + NPC.alpha = 0; + NPC.knockBackResist = 0f; + NPC.rotation = NPC.rotation.AngleLerp(0f, 0.2f); + NPC.velocity *= 0.3f; + return; + } + } + if (NPC.ai[0] <= 2f) { NPC.rotation = NPC.velocity.X * 0.04f; @@ -343,7 +371,7 @@ namespace CalamityMod.NPCs.Signus { if (Main.netMode != NetmodeID.MultiplayerClient && revenge) { - SoundEngine.PlaySound(SoundID.Item122, NPC.position); + SoundEngine.PlaySound(SoundID.Item122, NPC.Center); int num660 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) @@ -353,6 +381,20 @@ namespace CalamityMod.NPCs.Signus if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + if (stealthTimer >= maxStealth) + { + int num662 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 950f), (int)player.position.Y, ModContent.NPCType()); + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num662, 0f, 0f, 0f, 0, 0, 0); + + int num663 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 950f), (int)player.position.Y, ModContent.NPCType()); + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num663, 0f, 0f, 0f, 0, 0, 0); + + SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); + stealthTimer = 0; + } + for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(player.position.X + 750f, player.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); @@ -436,6 +478,17 @@ namespace CalamityMod.NPCs.Signus int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); + if (stealthTimer >= maxStealth) + { + damage *= 2; + SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); + for (int i = 0; i < 4; i++) + { + Vector2 offset = new Vector2(Main.rand.Next(-5, 6), Main.rand.Next(-5, 6)); + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, num1071 + offset.X, num1072 + offset.Y, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); + } + stealthTimer = 0; + } } } } @@ -500,21 +553,47 @@ namespace CalamityMod.NPCs.Signus { if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalLamps = Main.getGoodWorld ? 10 : 5; + int totalLamps = Main.getGoodWorld && !CalamityWorld.getFixedBoi ? 10 : 5; if (NPC.CountNPCS(ModContent.NPCType()) < totalLamps) { + bool buffed = false; + if (stealthTimer >= maxStealth) + { + SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); + buffed = true; + } for (int x = 0; x < totalLamps; x++) { - int num660 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType()); + int type = ModContent.NPCType(); + if (Main.rand.NextBool(10) && CalamityWorld.getFixedBoi) + { + type = ModContent.NPCType(); + } + int num660 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), type); if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - int num661 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType()); + int num661 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), type); if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); + if (buffed) + { + int num662 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX + spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num662, 0f, 0f, 0f, 0, 0, 0); + + int num663 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX - spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num663, 0f, 0f, 0f, 0, 0, 0); + } + spawnY -= 60; } + if (buffed) + { + stealthTimer = 0; + } spawnY = 120; } } @@ -594,13 +673,26 @@ namespace CalamityMod.NPCs.Signus { if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.ai[2] += 1f; - if (phase2 && NPC.ai[2] % 3f == 0f) + bool buffed = false; + if (stealthTimer >= maxStealth && NPC.ai[1] == 0) { - SoundEngine.PlaySound(SoundID.Item73, NPC.position); + SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); + buffed = true; + } + NPC.ai[2] += 1f; + if ((phase2 || buffed) && NPC.ai[2] % 3f == 0f) + { + SoundEngine.PlaySound(SoundID.Item73, NPC.Center); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter, Vector2.Zero, type, damage, 0f, Main.myPlayer); + Vector2 velocity = CalamityWorld.getFixedBoi ? new Vector2(Main.rand.Next(-5, 6), Main.rand.Next(-5, 6)) : Vector2.Zero; + if (Main.getGoodWorld) + { + velocity.Normalize(); + velocity *= 1.05f; + } + int ai = buffed ? 69 : 0; + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter, velocity, type, damage, 0f, Main.myPlayer, ai); } } @@ -611,6 +703,10 @@ namespace CalamityMod.NPCs.Signus calamityGlobalNPC.newAI[0] = 3f; NPC.ai[1] = 30f; NPC.ai[2] = 0f; + if (stealthTimer >= maxStealth) + { + stealthTimer = 0; + } NPC.velocity /= 2f; NPC.netUpdate = true; } @@ -626,6 +722,10 @@ namespace CalamityMod.NPCs.Signus } else if (calamityGlobalNPC.newAI[0] == 3f) // Slow down after charging and reset { + if (stealthTimer >= maxStealth) + { + stealthTimer = 0; + } NPC.ai[1] -= 1f; if (NPC.ai[1] <= 0f) { @@ -717,6 +817,11 @@ namespace CalamityMod.NPCs.Signus float scale = NPC.scale; float rotation = NPC.rotation; float offsetY = NPC.gfxOffY; + float transparency = 1; + if (stealthTimer >= 300) + { + transparency = (100 - (stealthTimer - 300)) * 0.01f; + } if (CalamityConfig.Instance.Afterimages) { @@ -729,16 +834,20 @@ namespace CalamityMod.NPCs.Signus Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; vector41 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector41 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector41, new Rectangle?(frame), color38, rotation, vector11, scale, spriteEffects, 0f); + spriteBatch.Draw(NPCTexture, vector41, new Rectangle?(frame), color38 * transparency, rotation, vector11, scale, spriteEffects, 0f); } } Vector2 vector43 = NPC.Center - screenPos; vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector43, new Rectangle?(frame), NPC.GetAlpha(drawColor), rotation, vector11, scale, spriteEffects, 0f); + spriteBatch.Draw(NPCTexture, vector43, new Rectangle?(frame), NPC.GetAlpha(drawColor) * transparency, rotation, vector11, scale, spriteEffects, 0f); Color color40 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); + if (CalamityWorld.getFixedBoi) + { + color40 = Color.MediumBlue; + } if (CalamityConfig.Instance.Afterimages) { @@ -755,6 +864,24 @@ namespace CalamityMod.NPCs.Signus } } + if (CalamityWorld.getFixedBoi) // make Sig's eyes more visible in the zenith seed due to the color change + { + CalamityUtils.EnterShaderRegion(spriteBatch); + Color outlineColor = Color.Lerp(Color.Blue, Color.White, 0.4f); + Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it + float outlineThickness = MathHelper.Clamp(0.5f, 0f, 1f); + + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + + for (float i = 0; i < 1; i += 0.125f) + { + spriteBatch.Draw(glowMaskTexture, vector43 + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, new Rectangle?(frame), outlineColor, rotation, vector11, scale, spriteEffects, 0f); + } + CalamityUtils.ExitShaderRegion(spriteBatch); + } + spriteBatch.Draw(glowMaskTexture, vector43, new Rectangle?(frame), color40, rotation, vector11, scale, spriteEffects, 0f); return false; @@ -798,10 +925,10 @@ namespace CalamityMod.NPCs.Signus // Vanity normalOnly.Add(ModContent.ItemType(), 7); - var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - normalOnly.Add(godSlayerVanity); + var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(godSlayerVanity); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } @@ -811,7 +938,7 @@ namespace CalamityMod.NPCs.Signus npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSignus, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 7f1fb6e646..21265d0544 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -1,4 +1,6 @@ using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; @@ -18,7 +20,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - NPC.aiStyle = 14; + NPC.aiStyle = NPCAIStyleID.Bat; NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 30; @@ -70,6 +72,15 @@ namespace CalamityMod.NPCs.SlimeGod Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, hitDirection, -1f, NPC.alpha, dustColor, 1f); } } + public override void OnKill() + { + if (CalamityWorld.getFixedBoi && Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + } + } public override void OnHitPlayer(Player player, int damage, bool crit) { diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index d8d0fd12fa..f0bf3bc126 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -1,6 +1,8 @@ using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +20,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 30; @@ -62,7 +64,29 @@ namespace CalamityMod.NPCs.SlimeGod { int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (CalamityWorld.getFixedBoi && Main.rand.NextBool(5)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 valueBoom = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = 30; + for (iBoom = 0; iBoom < 5; iBoom++) + { + int projectileType = ModContent.ProjectileType(); + offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; + float velocityfactor = 0.3f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocityfactor), (float)(Math.Cos(offsetAngleBoom) * velocityfactor), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocityfactor), (float)(-Math.Cos(offsetAngleBoom) * velocityfactor), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + } + } } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Vitamins, 50); diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index 02bf1ead0c..d5d006f683 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -1,6 +1,8 @@ using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -19,7 +21,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 30; @@ -78,6 +80,28 @@ namespace CalamityMod.NPCs.SlimeGod int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (CalamityWorld.getFixedBoi && Main.rand.NextBool(5)) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 valueBoom = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = 30; + for (iBoom = 0; iBoom < 5; iBoom++) + { + int projectileType = ModContent.ProjectileType(); + offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; + float velocityfactor = 0.3f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocityfactor), (float)(Math.Cos(offsetAngleBoom) * velocityfactor), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocityfactor), (float)(-Math.Cos(offsetAngleBoom) * velocityfactor), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + } + } } public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Blindfold, 50); diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 1c01a0b8e1..45eeeab94b 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -1,4 +1,5 @@ using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -24,7 +25,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - NPC.aiStyle = 1; + NPC.aiStyle = NPCAIStyleID.Slime; NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 30; @@ -56,7 +57,7 @@ namespace CalamityMod.NPCs.SlimeGod BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Embedded in these slime’s bodies are shards of crimulan stone, which drip with a toxin meant to impair your vision.") + new FlavorTextBestiaryInfoElement("Embedded in these slime's bodies are shards of crimulan stone, which drip with a toxin meant to impair your vision.") }); } @@ -96,6 +97,10 @@ namespace CalamityMod.NPCs.SlimeGod int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); + if (CalamityWorld.getFixedBoi) + { + type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + } if (!NPC.wet) { Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); @@ -111,7 +116,8 @@ namespace CalamityMod.NPCs.SlimeGod } if (Main.netMode != NetmodeID.MultiplayerClient && spikeTimer == 0f) { - for (int n = 0; n < 5; n++) + int projcount = CalamityWorld.getFixedBoi ? 12 : 5; + for (int n = 0; n < projcount; n++) { Vector2 vector4 = new Vector2((float)(n - 2), -4f); vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; diff --git a/NPCs/SlimeGod/CrimulanSlimeGod.cs b/NPCs/SlimeGod/CrimulanSlimeGod.cs index 94084708be..603f48dc0b 100644 --- a/NPCs/SlimeGod/CrimulanSlimeGod.cs +++ b/NPCs/SlimeGod/CrimulanSlimeGod.cs @@ -124,10 +124,16 @@ namespace CalamityMod.NPCs.SlimeGod if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { - SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); 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 (CalamityWorld.getFixedBoi && 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()); + } + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/SlimeGod/EbonianSlimeGod.cs b/NPCs/SlimeGod/EbonianSlimeGod.cs index f8141d7539..85c881f524 100644 --- a/NPCs/SlimeGod/EbonianSlimeGod.cs +++ b/NPCs/SlimeGod/EbonianSlimeGod.cs @@ -121,10 +121,16 @@ namespace CalamityMod.NPCs.SlimeGod if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { - SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.position); + SoundEngine.PlaySound(SoundID.NPCDeath1, NPC.Center); Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); 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 (CalamityWorld.getFixedBoi && 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()); + } + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 8a0443e821..6c3d1f187d 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.SlimeGod BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("This creature could easily be confused for a giant amoeba. It seems to be developing past the limitations of an usual slime, thanks to all the compacted biomass it contains.") + new FlavorTextBestiaryInfoElement("This God is rather evasive and relies on tricky and strategic retreats due to its relatively minor strength among the Gods. It prefers to be protected rather than be in combat fighting.") }); } @@ -188,11 +188,14 @@ namespace CalamityMod.NPCs.SlimeGod } // Emit dust - for (int k = 0; k < 5; k++) + if (!CalamityWorld.getFixedBoi) // you must see his glory. { - Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; - color.A = 150; - Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 1f); + for (int k = 0; k < 5; k++) + { + Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; + color.A = 150; + Dust.NewDust(NPC.position, NPC.width, NPC.height, 4, 0f, 0f, NPC.alpha, color, 1f); + } } // Slow down @@ -208,7 +211,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.Opacity <= 0f) { NPC.Opacity = 0f; - SoundEngine.PlaySound(PossessionSound, NPC.position); + SoundEngine.PlaySound(PossessionSound, NPC.Center); NPC.position.X = NPC.position.X + (NPC.width / 2); NPC.position.Y = NPC.position.Y + (NPC.height / 2); NPC.width = 40; @@ -316,7 +319,7 @@ namespace CalamityMod.NPCs.SlimeGod if (buffedSlime == 0) { - SoundEngine.PlaySound(PossessionSound, NPC.position); + SoundEngine.PlaySound(PossessionSound, NPC.Center); if (purpleSlimeAlive && redSlimeAlive) buffedSlime = Main.rand.Next(2) + 1; @@ -354,7 +357,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.TargetClosest(); calamityGlobalNPC.newAI[2] = 0f; NPC.velocity = Vector2.UnitY * -12f; - SoundEngine.PlaySound(ExitSound, NPC.position); + SoundEngine.PlaySound(ExitSound, NPC.Center); for (int i = 0; i < 20; i++) { Color color = Main.rand.NextBool() ? Color.Lavender : Color.Crimson; @@ -534,6 +537,7 @@ namespace CalamityMod.NPCs.SlimeGod Color color24 = NPC.GetAlpha(drawColor); Color color25 = 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 = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes").Value; int num156 = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type]; int y3 = num156 * (int)NPC.frameCounter; Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, num156); @@ -544,27 +548,32 @@ namespace CalamityMod.NPCs.SlimeGod float num160 = 0f; int num161 = num159; spriteBatch.Draw(texture2D3, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, color24, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); - while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) + if (CalamityWorld.getFixedBoi) { - Color color26 = NPC.GetAlpha(color25); - { - goto IL_6899; - } - IL_6881: - num161 += num158; - continue; - IL_6899: - float num164 = (float)(num157 - num161); - if (num158 < 0) - { - num164 = (float)(num159 - num161); - } - color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); - Vector2 value4 = NPC.oldPos[num161]; - float num165 = NPC.rotation; - Main.spriteBatch.Draw(texture2D3, value4 + NPC.Size / 2f - screenPos + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + NPC.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, NPC.scale, spriteEffects, 0f); - goto IL_6881; + spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, color24, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); } + if (!CalamityWorld.getFixedBoi) + while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)) && CalamityConfig.Instance.Afterimages) + { + Color color26 = NPC.GetAlpha(color25); + { + goto IL_6899; + } + IL_6881: + num161 += num158; + continue; + IL_6899: + float num164 = (float)(num157 - num161); + if (num158 < 0) + { + num164 = (float)(num159 - num161); + } + color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f); + Vector2 value4 = NPC.oldPos[num161]; + float num165 = NPC.rotation; + Main.spriteBatch.Draw(texture2D3, value4 + NPC.Size / 2f - screenPos + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + NPC.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, NPC.scale, spriteEffects, 0f); + goto IL_6881; + } return false; } @@ -624,7 +633,7 @@ namespace CalamityMod.NPCs.SlimeGod npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSlimeGod, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSlimeGod, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void HitEffect(int hitDirection, double damage) @@ -641,7 +650,8 @@ namespace CalamityMod.NPCs.SlimeGod { if (damage > 0) { - player.AddBuff(BuffID.Slow, 180, true); + int debufftype = CalamityWorld.getFixedBoi ? BuffID.VortexDebuff : BuffID.Slow; + player.AddBuff(debufftype, 180, true); player.AddBuff(BuffID.Weak, 180, true); player.AddBuff(BuffID.Darkness, 180, true); } 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/SplitCrimulanSlimeGod.cs b/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs index 1bdcd41370..e7a310606f 100644 --- a/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs +++ b/NPCs/SlimeGod/SplitCrimulanSlimeGod.cs @@ -66,7 +66,7 @@ namespace CalamityMod.NPCs.SlimeGod BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Flanking their creator and serving as its body, these are concentrated, swirling masses of the world’s evils, each utilizing the rot and corrosion to eat away and assimilate those who oppose it.") + new FlavorTextBestiaryInfoElement("Flanking their creator and serving as its body, these are concentrated, swirling masses of the world's evils, each utilizing the rot and corrosion to eat away and assimilate those who oppose it.") }); } diff --git a/NPCs/SlimeGod/SplitEbonianSlimeGod.cs b/NPCs/SlimeGod/SplitEbonianSlimeGod.cs index 642b429664..9f3352f9c9 100644 --- a/NPCs/SlimeGod/SplitEbonianSlimeGod.cs +++ b/NPCs/SlimeGod/SplitEbonianSlimeGod.cs @@ -66,7 +66,7 @@ namespace CalamityMod.NPCs.SlimeGod BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Flanking their creator and serving as its body, these are concentrated, swirling masses of the world’s evils, each utilizing the rot and corrosion to eat away and assimilate those who oppose it.") + new FlavorTextBestiaryInfoElement("Flanking their creator and serving as its body, these are concentrated, swirling masses of the world's evils, each utilizing the rot and corrosion to eat away and assimilate those who oppose it.") }); } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index e7f095edd5..db114cb346 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -167,7 +167,9 @@ namespace CalamityMod.NPCs.StormWeaver bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - if (!Main.raining && !bossRush) + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); + else if (!Main.raining && !bossRush) CalamityUtils.StartRain(); float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -240,6 +242,19 @@ namespace CalamityMod.NPCs.StormWeaver { int Previous = NPC.whoAmI; int totalLength = death ? 60 : revenge ? 50 : expertMode ? 40 : 30; + int npcCounts = 0; + if (CalamityWorld.getFixedBoi) // use up every remaining npc but 20 for safety in the zenith seed + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (!Main.npc[i].active) + { + npcCounts++; + } + } + totalLength = npcCounts - 20; + } + for (int num36 = 0; num36 < totalLength; num36++) { int lol; @@ -425,7 +440,22 @@ namespace CalamityMod.NPCs.StormWeaver // Dictates whether Storm Weaver will use frost or tornadoes if (phase4) + { + // Lightning strike + if (!Main.DisableIntenseVisualEffects) + { + if (Main.netMode != NetmodeID.Server) + { + if (lightningSpeed == 0f) + { + lightningDecay = Main.rand.NextFloat() * 0.05f + 0.008f; + lightningSpeed = Main.rand.NextFloat() * 0.05f + 0.05f; + } + } + } + calamityGlobalNPC.newAI[3] += 1f; + } // Play a sound on the player getting frost waves rained on them, as a telegraph SoundEngine.PlaySound(SoundID.Item120, Main.player[NPC.target].Center); @@ -760,6 +790,10 @@ namespace CalamityMod.NPCs.StormWeaver lightning -= lightningDecay; } + // Thunder sound + if (lightning == 1f) + SoundEngine.PlaySound(SoundID.Thunder, NPC.Center); + // Start a storm when in third phase. Don't do this during Boss Rush if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu) || calamityGlobalNPC.newAI[1] > 0f || bossRush) return; @@ -978,7 +1012,7 @@ namespace CalamityMod.NPCs.StormWeaver npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(LastSentinelKilled, ModContent.ItemType(), desc: DropHelper.SentinelText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedStormWeaver, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index b7c1909dac..dac0e25e12 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.SulphurousSea bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A relative of its brethren in the far ocean, this one’s spines have been hardened by the sulphuric waters. They drip with the venom they inhabit, so it’s better to not be struck by them.") + new FlavorTextBestiaryInfoElement("A relative of its brethren in the far ocean, this one's spines have been hardened by the sulphuric waters. They drip with the venom they inhabit, so it's better to not be struck by them.") }); } @@ -137,16 +137,17 @@ namespace CalamityMod.NPCs.SulphurousSea { return 0f; } - if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType()) < 12) + if ((spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneAbyssLayer1) && + spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType()) < 12) { - return 1.1f; + return 2.2f; } return 0f; } public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 1, 15, 25); + npcLoot.Add(ModContent.ItemType(), 1, 30, 50); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 0160d6320c..caeeeb8af0 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -32,8 +32,8 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.DR_NERD(0.15f); NPC.lifeMax = 35; NPC.knockBackResist = 0.25f; - NPC.aiStyle = 3; - AIType = 67; + NPC.aiStyle = NPCAIStyleID.Fighter; + AIType = NPCID.Crab; NPC.value = Item.buyPrice(0, 0, 0, 60); NPC.HitSound = SoundID.NPCHit50; NPC.DeathSound = SoundID.NPCDeath54; @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.SulphurousSea { num78 = 2.25f - num79; } - num78 *= (CalamityWorld.death ? 1.2f : 0.8f); + num78 *= (CalamityWorld.death ? 1.2f : CalamityWorld.revenge ? 1f : 0.8f); if (NPC.velocity.X < -num78 || NPC.velocity.X > num78) { if (NPC.velocity.Y == 0f) diff --git a/NPCs/SulphurousSea/Flounder.cs b/NPCs/SulphurousSea/Sulflounder.cs similarity index 86% rename from NPCs/SulphurousSea/Flounder.cs rename to NPCs/SulphurousSea/Sulflounder.cs index 509ae7c61e..c52e82f770 100644 --- a/NPCs/SulphurousSea/Flounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -6,14 +6,15 @@ using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SulphurousSea { - public class Flounder : ModNPC + public class Sulflounder : ModNPC { public override void SetStaticDefaults() { - DisplayName.SetDefault("Flounder"); + DisplayName.SetDefault("Sulflounder"); Main.npcFrameCount[NPC.type] = 4; } @@ -32,13 +33,13 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.DeathSound = SoundID.NPCDeath53; NPC.knockBackResist = 0.35f; Banner = NPC.type; - BannerItem = ModContent.ItemType(); + BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -132,14 +133,14 @@ namespace CalamityMod.NPCs.SulphurousSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe) - { - return 0f; - } if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water) { return 0.2f; } + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) + { + return SpawnCondition.OceanMonster.Chance * 2f; + } return 0f; } @@ -157,6 +158,11 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Sulflounder").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Sulflounder2").Type, 1f); + } } } } diff --git a/NPCs/SulphurousSea/Flounder.png b/NPCs/SulphurousSea/Sulflounder.png similarity index 100% rename from NPCs/SulphurousSea/Flounder.png rename to NPCs/SulphurousSea/Sulflounder.png diff --git a/NPCs/SulphurousSea/Catfish.cs b/NPCs/SulphurousSea/Toxicatfish.cs similarity index 83% rename from NPCs/SulphurousSea/Catfish.cs rename to NPCs/SulphurousSea/Toxicatfish.cs index 0e63e5102f..8dc9e2a378 100644 --- a/NPCs/SulphurousSea/Catfish.cs +++ b/NPCs/SulphurousSea/Toxicatfish.cs @@ -6,14 +6,15 @@ using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SulphurousSea { - public class Catfish : ModNPC + public class Toxicatfish : ModNPC { public override void SetStaticDefaults() { - DisplayName.SetDefault("Catfish"); + DisplayName.SetDefault("Toxicatfish"); Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0); value.Position.X += 10f; @@ -35,13 +36,13 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.DeathSound = SoundID.NPCDeath40; NPC.knockBackResist = 0.8f; Banner = NPC.type; - BannerItem = ModContent.ItemType(); + BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -98,14 +99,14 @@ namespace CalamityMod.NPCs.SulphurousSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe) - { - return 0f; - } if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water) { return 0.2f; } + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) + { + return SpawnCondition.OceanMonster.Chance * 1.65f; + } return 0f; } @@ -123,6 +124,11 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Toxicatfish").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Toxicatfish2").Type, 1f); + } } } } diff --git a/NPCs/SulphurousSea/Catfish.png b/NPCs/SulphurousSea/Toxicatfish.png similarity index 100% rename from NPCs/SulphurousSea/Catfish.png rename to NPCs/SulphurousSea/Toxicatfish.png diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index c709c764f3..7c6ad3ea33 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -131,10 +131,10 @@ namespace CalamityMod.NPCs.SulphurousSea if (flag14) { NPC.TargetClosest(true); - NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.6f : 0.3f); - NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.2f : 0.1f); - float velocityX = CalamityWorld.death ? 20f : 10f; - float velocityY = CalamityWorld.death ? 10f : 5f; + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * (CalamityWorld.death ? 0.6f : CalamityWorld.revenge ? 0.45f : 0.3f); + NPC.velocity.Y = NPC.velocity.Y + (float)NPC.directionY * (CalamityWorld.death ? 0.2f : CalamityWorld.revenge ? 0.15f : 0.1f); + float velocityX = CalamityWorld.death ? 20f : CalamityWorld.revenge ? 15f : 10f; + float velocityY = CalamityWorld.death ? 10f : CalamityWorld.revenge ? 7.5f : 5f; if (NPC.velocity.X > velocityX) { NPC.velocity.X = velocityX; diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 78d168666c..4a60683c11 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -52,7 +52,7 @@ namespace CalamityMod.NPCs.SunkenSea bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Like their adult counterparts, they shimmer gently, and would make great sources of light if the prisms around them didn’t already do so. Maybe if there was a way to bring one with you.") + new FlavorTextBestiaryInfoElement("Like their adult counterparts, they shimmer gently, and would make great sources of light if the prisms around them didn't already do so. Maybe if there was a way to bring one with you.") }); } diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index 3efe94ab52..868ce04307 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -245,6 +245,9 @@ namespace CalamityMod.NPCs.SunkenSea public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 1, 8, 12); + npcLoot.Add(ItemID.WhitePearl, 8); + npcLoot.Add(ItemID.BlackPearl, 16); + npcLoot.Add(ItemID.PinkPearl, 40); npcLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 2); } } diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 65f9c5a2f0..52b6760594 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.SunkenSea bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A stingray that spends much of its time docile on the rocky floors of the sunken sea’s pools. It stores its energy, and when endangered, can release it in short bursts of speed.") + new FlavorTextBestiaryInfoElement("A stingray that spends much of its time docile on the rocky floors of the sunken sea's pools. It stores its energy, and when endangered, can release it in short bursts of speed.") }); } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index d7ff09e973..16e4d9c2f3 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -94,6 +94,8 @@ namespace CalamityMod.NPCs.SunkenSea writer.Write(hasBeenHit); writer.Write(statChange); writer.Write(hide); + for (int i = 0; i < 2; i++) + writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -106,12 +108,15 @@ namespace CalamityMod.NPCs.SunkenSea hasBeenHit = reader.ReadBoolean(); statChange = reader.ReadBoolean(); hide = reader.ReadBoolean(); + for (int i = 0; i < 2; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { NPC.TargetClosest(true); Player player = Main.player[NPC.target]; + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); if (NPC.justHit && hitAmount < 5) { ++hitAmount; @@ -276,6 +281,70 @@ namespace CalamityMod.NPCs.SunkenSea } } + // Gains Calamitas' bullet hells in the zenith seed + if (CalamityWorld.getFixedBoi) + { + calamityGlobalNPC.newAI[0] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + calamityGlobalNPC.newAI[0]++; + if (Main.hardMode) + { + int type = ModContent.ProjectileType(); + int damage = Main.expertMode ? 28 : 35; + float speedPearlFrequency = 180; + float projSpeed = 3f; + if (calamityGlobalNPC.newAI[0] <= 300f) + { + if (calamityGlobalNPC.newAI[0] % speedPearlFrequency == 0f) // Pearls from top + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 1f); + } + else if (calamityGlobalNPC.newAI[0] <= 600f && calamityGlobalNPC.newAI[0] > 300f) + { + if (calamityGlobalNPC.newAI[0] % speedPearlFrequency == 0f) // Pearls from right + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer, 1f); + } + else if (calamityGlobalNPC.newAI[0] > 600f) + { + if (calamityGlobalNPC.newAI[0] % speedPearlFrequency == 0f) // Pearls from top + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 1f); + } + } + + calamityGlobalNPC.newAI[1] += 1f; + float pearlGateValue = 60; + if (calamityGlobalNPC.newAI[1] >= pearlGateValue) + { + calamityGlobalNPC.newAI[1] = 0f; + int type = ModContent.ProjectileType(); + int damage = Main.expertMode ? 28 : 35; + float projSpeed = 4f; + if (calamityGlobalNPC.newAI[0] % (pearlGateValue * 6f) == 0f) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = distance == -1000f ? projSpeed : -projSpeed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 1f); + } + if (calamityGlobalNPC.newAI[0] < 300f) // Pearls from above + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 1f); + } + else if (calamityGlobalNPC.newAI[0] < 600f) // Pearls from left and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 1f); + } + else // Pearls from above, left, and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 1f); + } + } + } + } + if (NPC.ai[3] < 180f && Main.hardMode) { NPC.ai[3] += 1f; @@ -390,6 +459,21 @@ namespace CalamityMod.NPCs.SunkenSea return 0f; } + public override void ModifyTypeName(ref string typeName) + { + if (CalamityWorld.getFixedBoi) + { + if (Main.hardMode) + { + typeName = "Supreme Clamitas"; + } + else + { + typeName = "Clamitas"; + } + } + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) @@ -466,6 +550,11 @@ namespace CalamityMod.NPCs.SunkenSea }; hardmode.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); + // Pearls + npcLoot.Add(ItemID.WhitePearl, 2); + npcLoot.Add(ItemID.BlackPearl, 4); + npcLoot.Add(ItemID.PinkPearl, 10); + // Equipment npcLoot.Add(ModContent.ItemType(), 3); npcLoot.Add(ModContent.ItemType(), 3); @@ -474,7 +563,7 @@ namespace CalamityMod.NPCs.SunkenSea npcLoot.Add(ModContent.ItemType(), 10); // Relic - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType(), 4); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); } } } diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs index 19163a09d5..3c88fc1bf9 100644 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -68,6 +68,20 @@ namespace CalamityMod.NPCs.SunkenSea 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, 204, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + 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) { diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index 59ddc60b73..95ad2acae9 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -63,6 +63,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; diff --git a/NPCs/SupremeCalamitas/SepulcherBody.cs b/NPCs/SupremeCalamitas/SepulcherBody.cs index a9c2f05aca..63e70e5222 100644 --- a/NPCs/SupremeCalamitas/SepulcherBody.cs +++ b/NPCs/SupremeCalamitas/SepulcherBody.cs @@ -113,21 +113,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs index 7ea9afb07a..8b37cb3708 100644 --- a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs +++ b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs @@ -102,7 +102,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.alpha = HeadSegment.alpha; AttackTimer += BossRushEvent.BossRushActive ? 1.5f : 1f; - if (AttackTimer >= 900f) + float attackgate = !HeadSegment.Calamity().unbreakableDR && CalamityWorld.getFixedBoi ? 450f : 900f; + if (AttackTimer >= attackgate) { AttackTimer = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -132,21 +133,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - public override void FindFrame(int frameHeight) { NPC.frameCounter++; diff --git a/NPCs/SupremeCalamitas/SepulcherHead.cs b/NPCs/SupremeCalamitas/SepulcherHead.cs index 445bb73802..8b01431dc1 100644 --- a/NPCs/SupremeCalamitas/SepulcherHead.cs +++ b/NPCs/SupremeCalamitas/SepulcherHead.cs @@ -54,7 +54,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.knockBackResist = 0f; NPC.scale *= Main.expertMode ? 1.35f : 1.2f; NPC.scale *= 1.25f; - NPC.alpha = 255; NPC.chaseable = false; NPC.behindTiles = true; @@ -173,7 +172,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (Main.player[NPC.target].dead || !NPC.AnyNPCs(ModContent.NPCType()) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + if (CalamityWorld.getFixedBoi && !NPC.AnyNPCs(ModContent.NPCType())) + { + CalamityGlobalNPC global = NPC.Calamity(); + global.DR = 0.4f; + global.unbreakableDR = false; + NPC.chaseable = true; + NPC.DeathSound = DeathSound; + } + + if (Main.player[NPC.target].dead || (!NPC.AnyNPCs(ModContent.NPCType()) && !CalamityWorld.getFixedBoi) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { NPC.TargetClosest(false); SoundEngine.PlaySound(DeathSound, Main.player[NPC.target].Center); @@ -337,21 +345,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas return false; } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - public override bool CheckActive() { return false; @@ -359,6 +352,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void HitEffect(int hitDirection, double damage) { + // hit sound in gfb + if (NPC.soundDelay == 0 && NPC.Calamity().unbreakableDR == false) + { + NPC.soundDelay = Main.rand.Next(5, 8); + SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt, NPC.Center); + } if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/SupremeCalamitas/SepulcherTail.cs b/NPCs/SupremeCalamitas/SepulcherTail.cs index f293098ba7..b9d3a2f30c 100644 --- a/NPCs/SupremeCalamitas/SepulcherTail.cs +++ b/NPCs/SupremeCalamitas/SepulcherTail.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.GameContent; using Terraria.ModLoader; @@ -144,6 +145,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.spriteDirection = 1; } } + + if (CalamityWorld.getFixedBoi && !NPC.AnyNPCs(ModContent.NPCType())) + { + CalamityGlobalNPC global = NPC.Calamity(); + global.DR = 0.5f; + global.unbreakableDR = false; + NPC.chaseable = true; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -163,23 +172,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas return false; } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) - { - if (projectile.penetrate == -1 && !projectile.minion) - { - projectile.penetrate = 1; - } - else if (projectile.penetrate >= 1) - { - projectile.penetrate = 1; - } - } - } - public override void HitEffect(int hitDirection, double damage) { + // hit sound in gfb + if (NPC.soundDelay == 0 && NPC.Calamity().unbreakableDR == false) + { + NPC.soundDelay = Main.rand.Next(5, 8); + SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt, NPC.Center); + } if (NPC.life <= 0) { if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 0e9c002a82..3f0071587d 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SCal, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Incomplete, ghoulish skulls, their forms are limited but their devotion boundless. It’s likely each yearns for a soul of their own to be complete, whether it’s given by Calamitas or ripped from the foe they kill.") + new FlavorTextBestiaryInfoElement("Incomplete, ghoulish skulls, their forms are limited but their devotion boundless. It's likely each yearns for a soul of their own to be complete, whether it's given by Calamitas or ripped from the foe they kill.") }); } @@ -102,6 +102,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Die if SCal is no longer present. if (CalamityGlobalNPC.SCal < 0 || !SCal.active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return false; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index d04147c736..f4ec6bef32 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetStaticDefaults() { - DisplayName.SetDefault("Supreme Calamitas"); + DisplayName.SetDefault("Supreme Witch, Calamitas"); Main.npcFrameCount[NPC.type] = 21; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void BossHeadSlot(ref int index) { bool inPhase2 = NPC.ai[0] == 3f; - if (!DownedBossSystem.downedSCal || BossRushEvent.BossRushActive) + if (!DownedBossSystem.downedCalamitas || BossRushEvent.BossRushActive) index = inPhase2 ? hoodedHeadIconP2Index : hoodedHeadIconIndex; else index = inPhase2 ? hoodlessHeadIconP2Index : hoodlessHeadIconIndex; @@ -381,7 +381,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas CalamityNetcode.SyncWorld(); } - CalamityMod.StopRain(); + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; @@ -408,7 +409,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas monsterDamage /= 2; waveDamage /= 2; hellblastDamage /= 2; - } + } + + int bulletHellblast = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int barrage = ModContent.ProjectileType(); + int gigablast = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int fireblast = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int wave = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int hellblast = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int bodyWidth = 44; int bodyHeight = 42; int baseBulletHellProjectileGateValue = revenge ? 8 : expertMode ? 9 : 10; @@ -433,7 +442,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalSummonText"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -547,18 +556,27 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!WorldGen.InWorld(num55, num56, 2)) continue; - if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55, num56].HasTile) + int xoffset = 0; + int yoffset = 0; + int maxoffset = 3; + if (CalamityWorld.getFixedBoi) { - Main.tile[num55, num56].TileType = (ushort)ModContent.TileType(); - Main.tile[num55, num56].Get().HasTile = true; + xoffset += Main.rand.Next(-maxoffset, maxoffset + 1); + yoffset += Main.rand.Next(-maxoffset, maxoffset + 1); + } + + if ((num55 == num52 - num54 || num55 == num52 + num54 || num56 == num53 - num54 || num56 == num53 + num54) && !Main.tile[num55 + xoffset, num56 + yoffset].HasTile) + { + Main.tile[num55 + xoffset, num56 + yoffset].TileType = (ushort)ModContent.TileType(); + Main.tile[num55 + xoffset, num56 + yoffset].Get().HasTile = true; } if (Main.netMode == NetmodeID.Server) { - NetMessage.SendTileSquare(-1, num55, num56, 1, TileChangeType.None); + NetMessage.SendTileSquare(-1, num55 + xoffset, num56 + yoffset, 1, TileChangeType.None); } else { - WorldGen.SquareTileFrame(num55, num56, true); + WorldGen.SquareTileFrame(num55 + xoffset, num56 + yoffset, true); } } } @@ -623,7 +641,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas forcefieldOpacity = Utils.GetLerpValue(0.1f, 0.6f, NPC.Opacity, true); if (NPC.alpha >= 230) { - if (DownedBossSystem.downedSCal && !bossRush) + if (DownedBossSystem.downedCalamitas && !bossRush) { // Create a teleport line effect Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Red); @@ -713,22 +731,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } - if (bulletHellCounter2 < 300) // Blasts from above + if (bulletHellCounter2 < 300 && !CalamityWorld.getFixedBoi) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 < 600) // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else // Blasts from above, left, and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + if (!CalamityWorld.getFixedBoi) + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } } } @@ -779,17 +798,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (bulletHellCounter2 < 1200) { if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) { if (bulletHellCounter2 % 180 == 0) // Blasts from right - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, fireblast, gigablastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 > 1500) { if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); } bulletHellCounter += 1; if (bulletHellCounter >= baseBulletHellProjectileGateValue + 1) @@ -799,20 +818,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } - if (bulletHellCounter2 < 1200) // Blasts from below + if (bulletHellCounter2 < 1200 && !CalamityWorld.getFixedBoi) // Blasts from below { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 < 1500) // Blasts from left { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } } } @@ -824,7 +843,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalBH2Text"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -847,10 +866,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); if (bulletHellCounter2 % 240 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, fireblastDamage, 0f, Main.myPlayer); bulletHellCounter += 1; if (bulletHellCounter >= baseBulletHellProjectileGateValue + 4) @@ -860,20 +879,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } - if (bulletHellCounter2 < 2100) // Blasts from above + if (bulletHellCounter2 < 2100 && !CalamityWorld.getFixedBoi) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 < 2400) // Blasts from right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } } } @@ -885,7 +904,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalBH3Text"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -908,10 +927,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) // More clustered attack { if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); if (bulletHellCounter2 % 240 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, fireblastDamage, 0f, Main.myPlayer); int divisor = revenge ? 225 : expertMode ? 450 : 675; @@ -930,20 +949,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } - if (bulletHellCounter2 < 3000) // Blasts from below + if (bulletHellCounter2 < 3000 && !CalamityWorld.getFixedBoi) // Blasts from below { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 < 3300) // Blasts from left { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } } } @@ -955,7 +974,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalBH4Text"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -978,16 +997,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { if (bulletHellCounter2 % 240 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, gigablastDamage, 0f, Main.myPlayer); if (bulletHellCounter2 % 360 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), fireblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, fireblastDamage, 0f, Main.myPlayer); if (bulletHellCounter2 % 30 == 0) // Projectiles that move in wave pattern { int random = Main.rand.Next(-500, 501); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, ModContent.ProjectileType(), waveDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, ModContent.ProjectileType(), waveDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, wave, waveDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, wave, waveDamage, 0f, Main.myPlayer); } bulletHellCounter += 1; @@ -998,22 +1017,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } - if (bulletHellCounter2 < 3900) // Blasts from above + if (bulletHellCounter2 < 3900 && !CalamityWorld.getFixedBoi) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 < 4200) // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } else // Blasts from above, left, and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + if (!CalamityWorld.getFixedBoi) + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer); } } } @@ -1026,7 +1046,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1055,7 +1075,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) NPC.velocity.X *= 0.96f; - if (DownedBossSystem.downedSCal && !bossRush) + if (DownedBossSystem.downedCalamitas && !bossRush) { if (giveUpCounter == 720) { @@ -1124,7 +1144,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalDesparationText4"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1136,7 +1156,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalDesparationText3"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1148,7 +1168,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalDesparationText2"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1160,7 +1180,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalDesparationText1"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1204,14 +1224,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile projectile = Main.projectile[x]; if (projectile.active) { - if (projectile.type == ModContent.ProjectileType() || - projectile.type == ModContent.ProjectileType() || - projectile.type == ModContent.ProjectileType()) + if (projectile.type == bulletHellblast || + projectile.type == barrage || + projectile.type == wave) { if (projectile.timeLeft > 60) projectile.timeLeft = 60; } - else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + else if (projectile.type == fireblast || projectile.type == gigablast) { projectile.ai[1] = 1f; @@ -1229,7 +1249,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalPhase2Text"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -1243,13 +1263,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.SCalSeekerRingText"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Item74, NPC.position); + SoundEngine.PlaySound(SoundID.Item74, NPC.Center); for (int I = 0; I < 20; I++) { int FireEye = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(vectorCenter.X + (Math.Sin(I * 18) * 300)), (int)(vectorCenter.Y + (Math.Cos(I * 18) * 300)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); @@ -1455,7 +1475,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (randomShot == 0 && canFireSplitingFireball) { canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); + randomShot = gigablast; SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); for (int i = 0; i < 15; i++) @@ -1478,7 +1498,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (randomShot == 1 && canFireSplitingFireball) { canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); + randomShot = fireblast; SoundEngine.PlaySound(BrimstoneShotSound, NPC.Center); for (int i = 0; i < 20; i++) @@ -1501,7 +1521,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { canFireSplitingFireball = true; - randomShot = ModContent.ProjectileType(); + randomShot = barrage; SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); float rotation = MathHelper.ToRadians(20); int numProj = 8; @@ -1666,7 +1686,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas projectileVelocity.Normalize(); Vector2 projectileSpawn = NPC.Center + projectileVelocity * 4f; projectileVelocity *= 10f * uDieLul; - int projectileType = ModContent.ProjectileType(); + int projectileType = hellblast; Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer); } } @@ -1745,7 +1765,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas projectileVelocity.Normalize(); Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; projectileVelocity *= 5f * uDieLul; - int projectileType = ModContent.ProjectileType(); + int projectileType = gigablast; Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, fireblastDamage, 0f, Main.myPlayer); } } @@ -1998,7 +2018,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); + randomShot = gigablast; for (int i = 0; i < 16; i++) { @@ -2021,7 +2041,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { SoundEngine.PlaySound(BrimstoneShotSound, NPC.Center); canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); + randomShot = fireblast; for (int i = 0; i < 24; i++) { @@ -2044,7 +2064,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); canFireSplitingFireball = true; - randomShot = ModContent.ProjectileType(); + randomShot = barrage; float rotation = MathHelper.ToRadians(20); int numProj = 8; for (int j = 0; j < numProj; j++) @@ -2203,7 +2223,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas projectileVelocity.Normalize(); Vector2 projectileSpawn = NPC.Center + projectileVelocity * 4f; projectileVelocity *= 10f * uDieLul; - int projectileType = ModContent.ProjectileType(); + int projectileType = hellblast; Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer); } } @@ -2286,7 +2306,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas projectileVelocity.Normalize(); Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; projectileVelocity *= 5f * uDieLul; - int projectileType = ModContent.ProjectileType(); + int projectileType = gigablast; Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, fireblastDamage, 0f, Main.myPlayer); } } @@ -2349,7 +2369,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -2388,7 +2408,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnX = spawnXReset; spawnX2 = spawnXReset2; spawnY = spawnYReset; - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + if (NPC.CountNPCS(ModContent.NPCType()) <= 0) // Check is here for the zenith seed + { + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + } NPC.netUpdate = true; } @@ -2467,7 +2490,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.SCalBrothersText"; - if (DownedBossSystem.downedSCal) + if (DownedBossSystem.downedCalamitas) key += "Rematch"; CalamityUtils.DisplayLocalizedText(key, textColor); } @@ -2567,14 +2590,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, ModContent.NPCType()); - // Mark Supreme Calamitas as defeated - DownedBossSystem.downedSCal = true; + // Mark Calamitas as defeated + DownedBossSystem.downedCalamitas = true; CalamityNetcode.SyncWorld(); } public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); + npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); @@ -2619,7 +2642,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedSCal, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCalamitas, ModContent.ItemType(), desc: DropHelper.FirstKillText); + + // Cynosure: If the Exo Mechs have been defeated and this is the first kill of SCal, drop the special lore item + npcLoot.Add(ItemDropRule.ByCondition( + DropHelper.If( + () => DownedBossSystem.downedExoMechs && !DownedBossSystem.downedCalamitas, + desc: DropHelper.CynosureText), + ModContent.ItemType() + )); } #endregion @@ -2703,7 +2734,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = DownedBossSystem.downedSCal && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded").Value; + Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[NPC.type].Value : ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded").Value; Vector2 vector11 = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2f); Color color36 = Color.White; @@ -2735,7 +2766,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (inPhase2) { // Make the sprite jitter with rage in phase 2. This does not happen in rematches since it would make little sense logically. - if (!DownedBossSystem.downedSCal) + if (!DownedBossSystem.downedCalamitas) vector43 += Main.rand.NextVector2Circular(0.25f, 0.7f); // And gain a flaming aura. diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index b5efb1b703..9ea1fc3b25 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -134,6 +134,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Disappear if Supreme Calamitas is not present. if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -234,13 +236,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas DartBurstCounter = 0f; SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); - int type = ModContent.ProjectileType(); + int type = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); if (bossRush) damage /= 2; int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 7f; + float velocity = CalamityWorld.getFixedBoi ? 5f : 7f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { @@ -278,7 +280,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas spriteBatch.Draw(texture, mainDrawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); texture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysmGlow").Value; - Color baseGlowmaskColor = NPC.IsABestiaryIconDummy ? Color.White : Color.Lerp(Color.White, Color.Red, 0.5f); + Color primarycolor = CalamityWorld.getFixedBoi ? Color.Blue : Color.Red; // why? because blue fire is awesome!! + Color baseGlowmaskColor = NPC.IsABestiaryIconDummy ? Color.White : Color.Lerp(Color.White, primarycolor, 0.5f); if (CalamityConfig.Instance.Afterimages) { diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index e7b5f96cb8..3acbc12e1f 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SCal, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Calamitas’ necromancy is outmatched by no one, but no one can truly bring the departed back from the dead.") + new FlavorTextBestiaryInfoElement("Calamitas' necromancy is outmatched by no one, but no one can truly bring the departed back from the dead.") }); } @@ -127,6 +127,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Disappear if Supreme Calamitas is not present. if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { + NPC.life = 0; + NPC.HitEffect(); NPC.active = false; NPC.netUpdate = true; return; @@ -229,13 +231,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas DartBurstCounter = 0f; SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); - int type = ModContent.ProjectileType(); + int type = CalamityWorld.getFixedBoi ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); if (bossRush) damage /= 2; int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 7f; + float velocity = CalamityWorld.getFixedBoi ? 5f : 7f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index c223adce87..2b01673fd8 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.TownNPCs NPC.lavaImmune = true; NPC.width = 18; NPC.height = 40; - NPC.aiStyle = 7; + NPC.aiStyle = NPCAIStyleID.Passive; NPC.damage = 10; NPC.defense = 15; NPC.lifeMax = 20000; @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.TownNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("His face shows great age, but also great wisdom. The Archmage once stood against the Jungle Tyrant and paid the price. He sells various frosty wares but of course, keeps the most powerful spells to himself.") + new FlavorTextBestiaryInfoElement("His face shows great age, but also great wisdom. The Archmage once served the Godslayer, but abandoned him later into the war. He sells various frosty wares, but keeps his most powerful spells to himself.") }); } @@ -101,7 +101,7 @@ namespace CalamityMod.NPCs.TownNPCs if (Main.dayTime && !Main.player[Main.myPlayer].ZoneSnow) { dialogue.Add("The sun beats down harshly upon my creations here. If you would allow me to conjure a blizzard every now and then..."); - dialogue.Add("I must admit, I’m not quite used to this weather. It's far too warm for my tastes..."); + dialogue.Add("I must admit, I'm not quite used to this weather. It's far too warm for my tastes..."); } else { @@ -109,10 +109,9 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add("Necromancy was never a field I found interesting. Why utilize the rotting corpses of people, when you could form far more elegant servants of ice?"); } - dialogue.Add("The tundra’s unnatural state is not all my doing. Decades ago, I came across it and amplified the climate with my magic."); dialogue.Add("If you have a request, make it quick. I am in the process of weaving a spell, which requires great focus."); dialogue.Add("You have the makings of a gifted mage. Tell me, what do you think of ice magic?"); - dialogue.Add("Flowers and the like don’t hold a candle to the beauty of intricately formed ice."); + dialogue.Add("Flowers and the like don't hold a candle to the beauty of intricately formed ice."); if (BirthdayParty.PartyIsUp) dialogue.Add("Sometimes... I feel like all I'm good for during these events is making ice cubes and slushies."); @@ -148,11 +147,6 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetupShop(Chest shop, ref int nextSlot) { - shop.item[nextSlot].SetDefaults(ItemID.WarmthPotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); - if (Main.LocalPlayer.discount) - shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); - nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); @@ -185,6 +179,14 @@ namespace CalamityMod.NPCs.TownNPCs } shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; + if (CalamityConfig.Instance.PotionSelling) + { + shop.item[nextSlot].SetDefaults(ItemID.WarmthPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + if (Main.LocalPlayer.discount) + shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); + nextSlot++; + } shop.item[nextSlot].SetDefaults(ItemID.SuperManaPotion); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); @@ -199,6 +201,17 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; } + + bool happy = Main.LocalPlayer.currentShoppingSettings.PriceAdjustment <= 0.8999999761581421; + if (happy) + { + if (Main.LocalPlayer.ZoneSnow) + { + shop.item[nextSlot].SetDefaults(ItemID.IceCream); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; + } + } } // Make this Town NPC teleport to the King statue when triggered. diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 0d81cf057a..028649f00b 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -3,9 +3,11 @@ using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Summon; using CalamityMod.World; using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; @@ -57,7 +59,7 @@ namespace CalamityMod.NPCs.TownNPCs NPC.lavaImmune = true; NPC.width = 18; NPC.height = 40; - NPC.aiStyle = 7; + NPC.aiStyle = NPCAIStyleID.Passive; NPC.damage = 10; NPC.defense = 15; NPC.lifeMax = 20000; @@ -74,16 +76,14 @@ namespace CalamityMod.NPCs.TownNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("No one knows where she came from, but no one minds her either. She’s a good person to share a drink with, given you don’t make her mad.") + new FlavorTextBestiaryInfoElement("No one knows where she came from, but no one minds her either. She's a good person to share a drink with, given you don't make her mad.") }); } public override void AI() { if (!CalamityWorld.spawnedCirrus) - { CalamityWorld.spawnedCirrus = true; - } } public override bool CanTownNPCSpawn(int numTownNPCs, int money) @@ -93,9 +93,7 @@ namespace CalamityMod.NPCs.TownNPCs Player player = Main.player[k]; bool hasVodka = player.InventoryHas(ModContent.ItemType())/* || player.PortableStorageHas(ModContent.ItemType())*/; if (player.active && hasVodka) - { return Main.hardMode || CalamityWorld.spawnedCirrus; - } } return CalamityWorld.spawnedCirrus; } @@ -104,6 +102,12 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { + if (CalamityWorld.getFixedBoi) + { + Main.player[Main.myPlayer].Hurt(PlayerDeathReason.ByCustomReason(Main.player[Main.myPlayer].name + " was slapped too hard."), Main.player[Main.myPlayer].statLife / 2, -Main.player[Main.myPlayer].direction, false, false, false, -1); + SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, Main.player[Main.myPlayer].Center); + } + if (CalamityUtils.AnyBossNPCS()) return "Why are you talking to me right now? Shouldn't you be bumbling around and dying for my amusement?"; @@ -137,6 +141,7 @@ namespace CalamityMod.NPCs.TownNPCs else { Main.player[Main.myPlayer].Hurt(PlayerDeathReason.ByCustomReason(Main.player[Main.myPlayer].name + " was slapped too hard."), Main.player[Main.myPlayer].statLife / 2, -Main.player[Main.myPlayer].direction, false, false, false, -1); + SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, Main.player[Main.myPlayer].Center); return "Sorry, I have no moral compass at the moment."; } } @@ -303,18 +308,25 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original alcohol value { - shop.item[nextSlot].SetDefaults(ItemID.HeartreachPotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); - nextSlot++; + int wife = NPC.FindFirstNPC(NPCID.Stylist); + bool wifeIsAround = wife != -1; + bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; - shop.item[nextSlot].SetDefaults(ItemID.LifeforcePotion); - int goldCost = NPC.downedMoonlord ? 8 : 4; - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, goldCost, 0, 0); - nextSlot++; + if (CalamityConfig.Instance.PotionSelling) + { + shop.item[nextSlot].SetDefaults(ItemID.HeartreachPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.LovePotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.LifeforcePotion); + int goldCost = NPC.downedMoonlord ? 8 : 4; + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, goldCost, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(ItemID.LovePotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + } shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 30, 0); @@ -418,6 +430,25 @@ namespace CalamityMod.NPCs.TownNPCs nextSlot++; } + if (beLessDrunk) + { + shop.item[nextSlot].SetDefaults(ItemID.BloodyMoscato); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(ItemID.BananaDaiquiri); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 75, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(ItemID.PeachSangria); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 50, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(ItemID.PinaColada); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + } + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); nextSlot++; @@ -438,6 +469,30 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(1, 0, 0, 0); nextSlot++; + bool happyAsFuck = Main.LocalPlayer.currentShoppingSettings.PriceAdjustment <= 0.8999999761581421; + if (happyAsFuck) + { + /*if (wifeIsAround) + { + shop.item[nextSlot].SetDefaults(ItemID.MilkCarton); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + }*/ + + if (Main.LocalPlayer.ZoneHallow) + { + shop.item[nextSlot].SetDefaults(ItemID.UnicornHorn); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 50, 0); + nextSlot++; + + if (wifeIsAround) + { + shop.item[nextSlot].SetDefaults(ItemID.Milkshake); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + nextSlot++; + } + } + } } // Make this Town NPC teleport to the Queen statue when triggered. diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 2a1b524e19..8cbb380db5 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -5,7 +5,9 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Pets; using CalamityMod.Projectiles.Rogue; +using IL.Terraria.DataStructures; using System.Collections.Generic; using Terraria; using Terraria.GameContent.Bestiary; @@ -13,6 +15,7 @@ using Terraria.GameContent.Personalities; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] @@ -49,7 +52,7 @@ namespace CalamityMod.NPCs.TownNPCs NPC.friendly = true; NPC.width = 30; NPC.height = 58; - NPC.aiStyle = 7; + NPC.aiStyle = NPCAIStyleID.Passive; NPC.damage = 10; NPC.defense = 25; NPC.lifeMax = 7500; @@ -68,7 +71,7 @@ namespace CalamityMod.NPCs.TownNPCs //Change the info part in his entry when we do the critter barter // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("The Sea King of an ancient civilization long lost to the sands of time— and the desert. He is able to give useful advice on the world around you, having lived for so long. He also used to like clams.") + new FlavorTextBestiaryInfoElement("The Sea King of an ancient civilization long lost to the sands of time— and the desert. He is able to give useful advice on the world around you, having lived for so long.") }); } @@ -91,7 +94,11 @@ namespace CalamityMod.NPCs.TownNPCs if (NPC.homeless) { - return "How much more has the world fallen to ruin? Even the Tyrant’s empire..."; + if (Main.rand.NextBool(2)) + return "How much more has the world fallen to ruin? Even the Tyrant's empire..."; + else + return "I do not expect a kingdom from you, but I would appreciate a safe haven."; + } if (Main.dayTime) { @@ -153,7 +160,7 @@ namespace CalamityMod.NPCs.TownNPCs if (DownedBossSystem.downedDoG) { - dialogue.Add("To see that Tyrant’s serpent free of its shackles. It gave me chills."); + dialogue.Add("To see that Tyrant's serpent free of its shackles. It gave me chills."); } return dialogue[Main.rand.Next(dialogue.Count)]; @@ -170,13 +177,13 @@ namespace CalamityMod.NPCs.TownNPCs switch (NPC.Calamity().newAI[0] % 3f) { case 0f: - displayThisText = "Pockets of ore have appeared once more in the land. This will allow you to create the most powerful weaponry and armor imagined!"; + displayThisText = "Auric is near impossible to work with without being attuned to a Dragon or using the claimed soul of a Dragon to perform a \"mock\" attunement. However, if one can work with it truly powerful things can be created; enough so that using it in anything was deemed heretical by the Gods."; break; case 1f: - displayThisText = "Lord Yharim possesses god-like strength. He may not even fight you at full power which is fortunate for you. His attacks may just kill you in one hit, so be careful."; + displayThisText = "The Golden Heretic, Yharim, possesses strength that may just surpass all of the Gods. When you face him, be well prepared for the battle of your life."; break; case 2f: - displayThisText = "Draedon's style of confrontation is very... alien and hands-off. You may be more likely to fight any one of his mechs before taking him down."; + displayThisText = "Draedon isn't a frontline fighter; he is a scientist and inventor. He is unlikely to face you directly, and will likely have his creations confront you instead. Be prepared for anything that blasphemous machine could throw at you."; break; } } @@ -185,13 +192,13 @@ namespace CalamityMod.NPCs.TownNPCs switch (NPC.Calamity().newAI[0] % 3f) { case 0f: - displayThisText = "The Devourer of God's cosmic armor is unique in that it is capable of not only protecting his body from tearing itself apart when ripping through the fabric of space and time, but also allows him to control his powers."; + displayThisText = "The Devourer's armor was specially made by Draedon. Extremely flexible yet durable and massive, it may be one of his most impressive creations. I shudder to think of what unholy things he may be able to create now, if his research has not stopped."; break; case 1f: displayThisText = "With the cosmic steel you can fashion many of your weapons into much more powerful forms."; break; case 2f: - displayThisText = "The Devourer of Gods is extremely powerful. However, he is young, foolhardy, and very lazy. Perhaps if he had been given time to develop he would have turned into quite the threat."; + displayThisText = "The Devourer of Gods is truly an enigma. Some say it's not even from this world at all. What is known is that he is a being that can devour the essence of Gods entirely, leaving absolutely nothing left. It's no wonder Yharim recruited that monster."; break; } } @@ -209,22 +216,19 @@ namespace CalamityMod.NPCs.TownNPCs } else if (DownedBossSystem.downedProvidence) { - switch (NPC.Calamity().newAI[0] % 3f) + switch (NPC.Calamity().newAI[0] % 2f) { case 0f: displayThisText = "The Rune of Kos holds a significant portion of Providence's brand of magic, easily distinguishable from all others. Activating it in certain places would have some... risky consequences."; break; case 1f: - displayThisText = "Ironic, is it not, that Statis was defeated by the very Sentinel his people fashioned their art of stealth from. Fate so often weaves cruel tales."; - break; - case 2f: - displayThisText = "The Dungeon seems to be more active now. You may hear the faint whisperings of angry spirits who have not left to the Void... I would recommend searching there before taking on the Sentinels."; + displayThisText = "I do wonder what has happened to Braelor and Statis. I have heard or seen very little of either. In my days, both were great heroes to those who worshiped the Gods. Have they been killed, captured, or are they simply in hiding?"; break; } } else if (NPC.downedMoonlord) { - switch (NPC.Calamity().newAI[0] % 6f) + switch (NPC.Calamity().newAI[0] % 5f) { case 0f: displayThisText = "Your adventure focuses to the jungle it seems. The Dragonfolly and its swarming offspring should be eliminated before their numbers spiral out of control."; @@ -233,16 +237,13 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "Profaned creatures now lurk in the Hallow and in Hell. If you destroy enough and gather their essence together you shall be able to capture the attention of the Profaned Guardians."; break; case 2f: - displayThisText = "The Profaned Guardians will do anything to protect their goddess. Makes sense they would die for her since they can be revived just as quickly."; + displayThisText = "The Profaned Guardians serve Providence, one of the few Gods even I despise. The Guardians attempt to eliminate threats to their Goddess preemptively, and it is likely that their next target is you."; break; case 3f: - displayThisText = "Touching Providence's offerings is usually a death wish. Shame that Yharim didn't think to just mess with her things to get her out of hiding."; + displayThisText = "Providence can likely be drawn out for combat by using the relic her Guardians left behind. I wonder... Why has Yharim not challenged her? Is he simply that negligent now?"; break; case 4f: - displayThisText = "Providence is as much the sun goddess as much as the Moon Lord is the moon god. They are two sides of the same coin, choosing to remain neutral amongst our petty squabbles."; - break; - case 5f: - displayThisText = "The stories have it that when Providence faced and defeated Yharim and his forces she lost a lot of energy and reverted to a more skeletal form. She's merely a fraction of the power she was before."; + displayThisText = "Providence was a great threat to Yharim and his army. She would appear out of seemingly thin air, wreck havoc, and vanish before much damage could be done to her. Perhaps she would be overconfident in facing but a single warrior."; break; } } @@ -257,38 +258,35 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "The Abyss has become far more active than before. You might be able to mine some of the volcanic rubble contained within."; break; case 2f: - displayThisText = "The plague was just one of the many experiments authorized by Yharim to raze towns to the ground. This is probably one of the few he shelved for being too terrible."; + displayThisText = "The nature of this plague in the jungle bothers me; it certainly is not the average infection. From afar they seem normal, yet up close it is obvious that the infected creatures are equipped with lights and metallic plating. Whatever it may be, it certainly isn't natural."; break; } } else if (Main.hardMode) { - switch (NPC.Calamity().newAI[0] % 8f) + switch (NPC.Calamity().newAI[0] % (!DownedBossSystem.downedCryogen ? 7f : 6f)) { case 0f: - displayThisText = !DownedBossSystem.downedCryogen ? "Have you heard of the story of Archmage Permafrost? Rumor has it he's been locked away in an icy prison by Lord Yharim. Perhaps you would be able to free him if Cryogen was destroyed." : "You will find more ores have been unlocked due to the magic sealing them away being dispelled. Some of them may require more than just the ore itself to create."; - break; - case 1f: displayThisText = "I would recommend saving some of your old items. You never know if you can engineer them into stronger weapons in the future."; break; - case 2f: - displayThisText = "Once those mechanical creations have been defeated you would do well to seek out the crippled clone of the witch, Calamitas. It might provide some useful weaponry."; - break; - case 3f: + case 1f: displayThisText = "If you take an idol down to the Brimstone Crags you might be able to see just what is lurking in the shadows."; break; - case 4f: - displayThisText = "The Brimstone Crags... Yharim despised that place, and did everything he could to raze it to the ground. It might explain a few things about him."; + case 2f: + displayThisText = "Azafure, the city founded in the Brimstone Crags, was one of the first places to support Yharim in his war. Now, it is nothing more than ruins... Just what happened there?"; break; - case 5f: + case 3f: displayThisText = "If you've gathered the souls used to power those automatons head once more to the jungle. You will find a powerful enemy to fight, which will unleash the full fervor of the jungle once defeated. Do not underestimate it!"; break; - case 6f: + case 4f: displayThisText = "Be careful when defeating Plantera and the Golem. You might accidentally unleash a new threat in the jungle that needs to be quelled."; break; - case 7f: + case 5f: displayThisText = "When exploring the jungle temple be careful. You may not wish to disturb the Lihzahrd's idol, the Golem. It's quite the destructive force."; break; + case 6f: + displayThisText = "Have you ever heard of the Archmage, Permafrost? Once an advisor to Yharim, he one day vanished and Calamitas abandoned Yharim's cause soon after. From what I know, Permafrost was akin to a father to her. Perhaps if she had something to do with his disappearance, he may yet live...?"; + break; } } else @@ -299,7 +297,7 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "There are rumors of ores that lay in latency. When you defeat certain bosses you will undo the ancient magic which conceals those materials."; break; case 1f: - displayThisText = "Have you heard of the Brimstone Crags? It was once a grand kingdom, not too different from my own. However, it also met a similar fate. I would not advise going down there, unless you seek a painful death."; + displayThisText = "Have you heard of the city in the Brimstone Crags? It lies in the Underworld, and was constructed beneath the Abyss. It was once the oldest and largest city in the world, though it seems nothing but danger lies there now. It would be wise to avoid it."; break; case 2f: displayThisText = "Ah yes, the Abyss. That trench is full of powerful creatures that could devour you in a heartbeat. I would explore the dungeon first."; @@ -308,7 +306,7 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "The Sulphurous Seas are dangerous. The toxic waters will burn your skin, but if you can brave them you will be able to reach the Abyss, where there are powerful weapons and dangers aplenty."; break; case 4f: - displayThisText = "The Sulphurous Seas were created long ago, when Yharim's dungeon could no longer hold as many corpses as it needed to. Many of the bodies were dumped into the ocean. This, along with severe pollution from the heydays of Draedon's experiments have turned a paradise into a wasteland."; + displayThisText = "The Sulphurous Sea was created more than a millenia ago, but it has gotten truly unbearable in the past decades. It's the fault of that accursed robot, Draedon, dumping waste and abandoned projects in there constantly. It's viler than it's ever been, thanks to him."; break; case 5f: displayThisText = "Be careful what you attack in the " + worldEvil + ". You might just unveil a greater threat than what was there before."; @@ -317,10 +315,10 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "Scattered across the lands are shrines dedicated to the gods. They contain powerful gear that may help you on your adventures."; break; case 7f: - displayThisText = "I'm assuming you've heard the legends that speak of the ninja, Statis? There are some who say that if you were able to defeat the gods which his clan once worshipped you would be able to harness some of his powers."; + displayThisText = "I assume you have heard of the legendary ninja, Statis? He and his clan worshiped the God of slime, who may be a survivor of the war due to its trickery and knowing when to hide or flee."; break; case 8f: - displayThisText = "The " + worldEvil + " used to be easily manageable and controlled by nature. However, the recent wars and pollution have tipped the balance out of favor."; + displayThisText = "The " + worldEvil + " is a relatively recent development in the world, and its formation marked the start of Yharim's treacherous war. Although the source of its growth would be sealed away, nothing was ever done about the original manifestations."; break; case 9f: displayThisText = "Throughout the world lie various structures left behind by Draedon. Archaic defenses may remain, but the goods inside may be worth your while."; @@ -371,25 +369,28 @@ namespace CalamityMod.NPCs.TownNPCs nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; - shop.item[nextSlot].SetDefaults(ModContent.ItemType()); + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.GillsPotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - if (Main.LocalPlayer.discount) - shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.WaterWalkingPotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - if (Main.LocalPlayer.discount) - shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.FlipperPotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - if (Main.LocalPlayer.discount) - shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); - nextSlot++; + if (CalamityConfig.Instance.PotionSelling) + { + shop.item[nextSlot].SetDefaults(ItemID.GillsPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + if (Main.LocalPlayer.discount) + shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.WaterWalkingPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + if (Main.LocalPlayer.discount) + shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.FlipperPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + if (Main.LocalPlayer.discount) + shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); + nextSlot++; + } if (Main.hardMode) { shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm); @@ -406,6 +407,24 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8); nextSlot++; } + + bool happy = Main.LocalPlayer.currentShoppingSettings.PriceAdjustment <= 0.8999999761581421; + if (happy) + { + if (Main.LocalPlayer.ZoneBeach) + { + shop.item[nextSlot].SetDefaults(ItemID.ShrimpPoBoy); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 50, 0); + nextSlot++; + + if (NPC.downedBoss1) + { + shop.item[nextSlot].SetDefaults(ItemID.Fries); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; + } + } + } } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index d644beab4f..be37eb195e 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -24,9 +24,11 @@ namespace CalamityMod.NPCs.TownNPCs public static List PossibleNames = new List() { // Patron names - "Xplizzy", // <@!98826096237109248> Whitegiraffe#6342 - "Freakish", // <@!750363283520749598> Freakish#0001 - "Calder", // <@!601897959176798228> Paltham#8859 + "Xplizzy", // <@!98826096237109248> (Whitegiraffe#6342) + "Freakish", // <@!750363283520749598> (Freakish#0001) + "Calder", // <@!601897959176798228> (Paltham#8859) + "Hunter Jinx", // <@!757401399783850134> (Jinx_enthusiast#1580) + "Goose", // <@!591421917706321962> (DullElili#8016) // Original names "Laura", "Mie", "Bonnie", @@ -54,10 +56,10 @@ namespace CalamityMod.NPCs.TownNPCs .SetNPCAffection(NPCID.GoblinTinkerer, AffectionLevel.Like) .SetNPCAffection(NPCID.Dryad, AffectionLevel.Dislike) ; - NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { - Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction - }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); + NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { + Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction + }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); } public override void SetDefaults() @@ -67,7 +69,7 @@ namespace CalamityMod.NPCs.TownNPCs NPC.lavaImmune = false; NPC.width = 18; NPC.height = 44; - NPC.aiStyle = 7; + NPC.aiStyle = NPCAIStyleID.Passive; NPC.damage = 10; NPC.defense = 15; NPC.lifeMax = 250; //Im not special :( @@ -84,7 +86,7 @@ namespace CalamityMod.NPCs.TownNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A kleptomaniac who is a bit of a coward when it comes to face-to-face fights. She’s rather good at getting herself both into and out of dicey situations.") + new FlavorTextBestiaryInfoElement("A kleptomaniac who is a bit of a coward when it comes to face-to-face fights. She's rather good at getting herself both into and out of dicey situations.") }); } @@ -169,8 +171,8 @@ namespace CalamityMod.NPCs.TownNPCs } if (NPC.downedMoonlord) { - PossibleDialogs.Add("If you find anything cool, make sure to drop by and show it to me, I promise I’ll keep my hands off it."); - PossibleDialogs.Add("So many new things to steal, I can’t think of where to start!"); + PossibleDialogs.Add("If you find anything cool, make sure to drop by and show it to me, I promise I'll keep my hands off it."); + PossibleDialogs.Add("So many new things to steal, I can't think of where to start!"); PossibleDialogs.Add("If I end up angering some deities or whatever, would you mind taking the blame for me?"); } if (Main.LocalPlayer.InventoryHas(ModContent.ItemType())) @@ -278,7 +280,7 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 9, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 9, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 9, 0, 0); @@ -288,15 +290,18 @@ namespace CalamityMod.NPCs.TownNPCs nextSlot++; shop.item[nextSlot].SetDefaults(ItemID.TigerClimbingGear); nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.InvisibilityPotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.NightOwlPotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.TrapsightPotion); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); - nextSlot++; + if (CalamityConfig.Instance.PotionSelling) + { + shop.item[nextSlot].SetDefaults(ItemID.InvisibilityPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.NightOwlPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.TrapsightPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + } if (Main.hardMode) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); @@ -306,7 +311,6 @@ namespace CalamityMod.NPCs.TownNPCs if (NPC.downedPirates) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(1, 0, 0, 0); nextSlot++; } if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3) @@ -315,7 +319,7 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 60, 0, 0); nextSlot++; } - if (DownedBossSystem.downedCalamitas) + if (DownedBossSystem.downedCalamitasClone) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index 3168a273eb..4dceee1761 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.TownNPCs NPC.lavaImmune = true; NPC.width = 18; NPC.height = 40; - NPC.aiStyle = 7; + NPC.aiStyle = NPCAIStyleID.Passive; NPC.damage = 10; // You should not be able to kill SCal under any typical circumstances. @@ -70,11 +70,11 @@ namespace CalamityMod.NPCs.TownNPCs BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface, // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("A most surprising sight to see this powerful foe live along friendly faces. Will history repeat itself or has she finally managed to free herself from the Tyrant’s grasp?") + new FlavorTextBestiaryInfoElement("A most surprising sight to see this powerful foe live along friendly faces. Will history repeat itself or has she finally managed to free herself from the Tyrant's grasp?") }); } - public override bool CanTownNPCSpawn(int numTownNPCs, int money) => DownedBossSystem.downedSCal && !NPC.AnyNPCs(NPCType()); + public override bool CanTownNPCSpawn(int numTownNPCs, int money) => DownedBossSystem.downedCalamitas && !NPC.AnyNPCs(NPCType()); public override List SetNPCNameList() => new List() { "Calamitas" }; @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.TownNPCs if (NPC.homeless) { textSelector.Add("I'm considering moving back to that old cave of mine."); - textSelector.Add("I certainly can't return to the Tyrant's old dwellings now, have you got any places to stay?"); + textSelector.Add("I certainly can't return to Yharim's old dwellings now, have you got any places to stay?"); } else { @@ -130,11 +130,6 @@ namespace CalamityMod.NPCs.TownNPCs textSelector.Add("I cannot understand the Sea King. He does not seem to want me dead. That amount of compassion" + " I just can't understand.", 1.45); } - if (NPC.AnyNPCs(NPCType())) - { - textSelector.Add("That frosty old man... even if you ignore our brands of magic and our old alliances, I doubt I'd ever" + - " get along with him.", 1.45); - } int fab = NPC.FindFirstNPC(NPCType()); if (fab != -1) diff --git a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs index f934ecfc1e..e056bd6cc1 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs @@ -30,6 +30,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(chantSound, npc.position); } + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -849,7 +850,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses vec4 = new Vector2(npc.direction, 0f); Vector2 vector18 = npc.Center + new Vector2(npc.direction * 30, 12f); - float scaleFactor = 10f; + float scaleFactor = death ? 6f : 4f; float num48 = 0.251327425f; int num49 = 0; @@ -1059,7 +1060,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[0] < duration - 60f) { if (npc.velocity.Length() < 20f) - npc.velocity *= 1.02f; + npc.velocity *= 1.03f; } // Intersect velocity paths with other Ancient Lights for 1 second @@ -1082,7 +1083,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float duration = 420f; float spawnAnimTime = 120f; int rateOfChange = 1; - float splitProjVelocity = 5f; + float splitProjVelocity = death ? 4.8f : 3.2f; // Percent life remaining for Cultist or Eidolon Wyrm float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs index f42aa70cd1..edc11c60ef 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs @@ -144,7 +144,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.realLife = npc.whoAmI; int index = npc.whoAmI; - int totalSegments = death ? 60 : 80; + int totalSegments = 80; if (Main.getGoodWorld) totalSegments *= 2; diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index d73f3cb618..c9fd5c60ee 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.TargetClosest(); if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (npc.height / 2) + npc.velocity.Y), NPCID.VileSpit, 0, 0f, 1f, 0f, 0f, 255); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (npc.height / 2) + npc.velocity.Y), NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f, 0f, 0f, 255); } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs index a687544ce4..f4d9fcf7ee 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index f72d43547e..d8f3de357b 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -135,16 +135,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses SoundEngine.PlaySound(SoundID.Item66, npc.position); - Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - // Fire magic bolt after teleport if (Main.netMode != NetmodeID.MultiplayerClient) { float num151 = 2f + (distance * 0.005f); - if (num151 > 5f) - num151 = 5f; + if (num151 > 6f) + num151 = 6f; - int type = ProjectileID.Shadowflames; + int type = ProjectileID.Skull; int damage = npc.GetProjectileDamage(type); int numProj = death ? 5 : 3; @@ -156,8 +154,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses num743 *= num745; num744 *= num745; Vector2 center = npc.Center; - center.X += num743 * 3f; - center.Y += num744 * 3f; + center.X += num743 * 5f; + center.Y += num744 * 5f; float rotation = MathHelper.ToRadians(60); float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); @@ -168,9 +166,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), center.X, center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[proj].timeLeft = 600; + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), center.X, center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, -2f, 0f); + Main.projectile[proj].timeLeft = 300; } + npc.netUpdate = true; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index 7e2150cc59..7c3d88fe7a 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -162,7 +162,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; diff --git a/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs b/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs index 8eb02a6547..2d519a95f7 100644 --- a/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs +++ b/NPCs/VanillaNPCOverrides/RegularEnemies/DemonEyeAI.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.World; namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies { @@ -173,7 +174,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies else if (fadeThroughWallsFlag == 0f) fadeThroughWallsTimer++; - if (fadeThroughWallsTimer >= FadeThroughWallsDelay) + if (fadeThroughWallsTimer >= (CalamityWorld.death ? FadeThroughWallsDelay / 2 : FadeThroughWallsDelay)) { fadeThroughWallsFlag = 1f; fadeThroughWallsTimer = 0f; @@ -190,6 +191,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies npc.alpha = 200; npc.noTileCollide = true; } + npc.rotation = npc.velocity.Y * 0.1f * npc.direction; npc.TargetClosest(true); @@ -202,7 +204,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies // Emit light for some reason. Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0.3f, 0.2f, 0.1f); - DemonEyeBatMovement(npc, 8f, 3.5f, 0.12f, 0.12f, 0.25f, 0.06f, 0.07f, 0.2f); + DemonEyeBatMovement(npc, CalamityWorld.death ? 10f : 8f, CalamityWorld.death ? 5f : 3.5f, 0.12f, 0.12f, 0.25f, 0.06f, 0.07f, 0.2f); if (Main.rand.NextBool(40)) { Vector2 dustSpawnTopLeft = new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f); @@ -215,14 +217,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies { // Move faster when close to dying. if (npc.life < npc.lifeMax * 0.5) - DemonEyeBatMovement(npc, 8f, 6f, 0.12f, 0.12f, 0.07f, 0.12f, 0.12f, 0.07f); + DemonEyeBatMovement(npc, CalamityWorld.death ? 10f : 8f, CalamityWorld.death ? 8f : 6f, 0.12f, 0.12f, 0.07f, 0.12f, 0.12f, 0.07f); else - DemonEyeBatMovement(npc, 6f, 2.5f, 0.12f, 0.12f, 0.07f, 0.06f, 0.07f, 0.05f); + DemonEyeBatMovement(npc, CalamityWorld.death ? 8f : 6f, CalamityWorld.death ? 4f : 2.5f, 0.12f, 0.12f, 0.07f, 0.06f, 0.07f, 0.05f); } else { - float maxSpeedX = 6f; - float maxSpeedY = 2.5f; + float maxSpeedX = CalamityWorld.death ? 6f : 5f; + float maxSpeedY = CalamityWorld.death ? 2.5f : 2f; maxSpeedX *= 1f + (1f - npc.scale); maxSpeedY *= 1f + (1f - npc.scale); DemonEyeBatMovement(npc, maxSpeedX, maxSpeedY, 0.08f, 0.08f, 0.03f, 0.02f, 0.03f, 0.015f); @@ -249,9 +251,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.95f; - npc.velocity.Y -= 0.7f; - if (npc.velocity.Y < -6f) - npc.velocity.Y = -6f; + npc.velocity.Y -= 0.6f; + if (npc.velocity.Y < -5f) + npc.velocity.Y = -5f; npc.TargetClosest(true); } diff --git a/NPCs/VanillaNPCOverrides/RegularEnemies/SlimeAI.cs b/NPCs/VanillaNPCOverrides/RegularEnemies/SlimeAI.cs index a9e0514637..a94ecc8028 100644 --- a/NPCs/VanillaNPCOverrides/RegularEnemies/SlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/RegularEnemies/SlimeAI.cs @@ -1,6 +1,7 @@ using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.World; using Microsoft.Xna.Framework; using System; using Terraria; @@ -186,14 +187,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies spikeShootVelocity *= Main.rand.NextVector2Square(0.75f, 1.25f); spikeShootVelocity.Normalize(); spikeShootVelocity *= Main.rand.NextFloat(3.5f, 4.5f) * projectileShootSpeedFactor; - Projectile.NewProjectile(source, npc.Center, spikeShootVelocity, projectileShootType, 9, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(source, npc.Center, spikeShootVelocity, projectileShootType, 9, 0f, Main.myPlayer, 0f, 0f); + if (CalamityWorld.death) + Main.projectile[proj].extraUpdates += 1; projectileShootCountdown = 30f; } } else { - Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - Vector2.UnitY * Main.rand.NextFloat(200f)) * projectileShootSpeedFactor * 6f; - Projectile.NewProjectile(source, npc.Center, velocity, projectileShootType, 9, 0f, Main.myPlayer, 0f, 0f); + Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - Vector2.UnitY * Main.rand.NextFloat(200f)) * projectileShootSpeedFactor * (CalamityWorld.death ? 4f : 6f); + int proj = Projectile.NewProjectile(source, npc.Center, velocity, projectileShootType, 9, 0f, Main.myPlayer, 0f, 0f); + if (CalamityWorld.death) + { + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].timeLeft = 1200; + } projectileShootCountdown = 50f; } } @@ -238,9 +246,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.RegularEnemies npc.velocity.X = 0f; // Slimes jump more quickly overall when the slime rain event is ongoing. - jumpDelay += Main.slimeRain ? 4f : 3f; + jumpDelay += (Main.slimeRain ? 4f : 3f) * (CalamityWorld.death ? 2f : 1f); - if (npc.type == NPCID.HoppinJack) + if (npc.type == NPCID.HoppinJack || npc.type == NPCID.GoldenSlime) jumpDelay += 10f; if (isLavaSlime) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index f474daec79..890c1a6002 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.Yharon public override void SetStaticDefaults() { - DisplayName.SetDefault("Jungle Dragon, Yharon"); + DisplayName.SetDefault("Yharon, Dragon of Rebirth"); // phase 1 name Main.npcFrameCount[NPC.type] = 7; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.Yharon value.Position.X += 26f; value.Position.Y -= 14f; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; + NPCID.Sets.MPAllowedEnemies[Type] = true; } public override void SetDefaults() @@ -120,11 +120,17 @@ namespace CalamityMod.NPCs.Yharon bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Perhaps… the last of its kind. It could decimate this Jungle in an instant if it wished, however, it seems to take great care in not doing so.") + // Will move to localization whenever that is cleaned up. + new FlavorTextBestiaryInfoElement("The loyal companion of the God-Hunter, they possess immense power compared to the Dragons of the past. This is likely partly due to fighting and training by their master's side.") }); } + public override void ModifyTypeName(ref string typeName) + { + if (startSecondAI) + typeName = "Yharon, Resplendent Phoenix"; // phase 2 name + } + public override void SendExtraAI(BinaryWriter writer) { BitsByte bb = new BitsByte(); @@ -180,7 +186,8 @@ namespace CalamityMod.NPCs.Yharon float lifeRatio = NPC.life / (float)NPC.lifeMax; // Stop rain - CalamityMod.StopRain(); + if (CalamityConfig.Instance.BossesStopWeather) + CalamityMod.StopRain(); // Variables bool bossRush = BossRushEvent.BossRushActive; @@ -190,8 +197,8 @@ namespace CalamityMod.NPCs.Yharon float pie = (float)Math.PI; - CalamityGlobalNPC.yharon = NPC.whoAmI; - CalamityGlobalNPC.yharonP2 = -1; + CalamityGlobalNPC.yharon = NPC.whoAmI; + CalamityGlobalNPC.yharonP2 = -1; // Start phase 2 or not if (startSecondAI) @@ -285,7 +292,14 @@ namespace CalamityMod.NPCs.Yharon float spinPhaseVelocity = 25f; float spinPhaseRotation = MathHelper.TwoPi * 3 / spinTime; - float increasedIdleTimeAfterBulletHell = -120f; + float increasedIdleTimeAfterBulletHell = 120f; + bool moveSlowerAfterBulletHell = NPC.ai[2] < 0f; + if (moveSlowerAfterBulletHell) + { + float reducedMovementMultiplier = MathHelper.Lerp(0.1f, 1f, (NPC.ai[2] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); + acceleration *= reducedMovementMultiplier; + velocity *= reducedMovementMultiplier; + } float teleportPhaseTimer = 30f; @@ -340,12 +354,12 @@ namespace CalamityMod.NPCs.Yharon enraged = false; if (Main.netMode != NetmodeID.MultiplayerClient) { - safeBox.X = (int)(player.Center.X - (Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f)); + safeBox.X = (int)(player.Center.X - (CalamityWorld.getFixedBoi ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f)); safeBox.Y = (int)(player.Center.Y - 10500f); - safeBox.Width = Main.getGoodWorld ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000; + safeBox.Width = CalamityWorld.getFixedBoi ? 3000 : Main.getGoodWorld ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000; safeBox.Height = 21000; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (CalamityWorld.getFixedBoi ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (CalamityWorld.getFixedBoi ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } // Force Yharon to send a sync packet so that the arena gets sent immediately @@ -497,7 +511,7 @@ namespace CalamityMod.NPCs.Yharon Main.dust[num1470].velocity = Vector2.Normalize(value16) * 3f; } - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); } NPC.ai[2] += 1f; @@ -612,7 +626,7 @@ namespace CalamityMod.NPCs.Yharon else if (aiState == 5) { if (playFastChargeRoarSound) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); if (doFastCharge) { @@ -674,7 +688,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity *= 0.98f; if (NPC.ai[2] == 0f) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); if (NPC.ai[2] % flareBombSpawnDivisor == 0f) { @@ -715,7 +729,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); if (NPC.ai[2] == fireTornadoPhaseTimer - 30) - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == fireTornadoPhaseTimer - 30) { @@ -741,7 +755,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); if (NPC.ai[2] == newPhaseTimer - 60) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.ai[2] += 1f; if (NPC.ai[2] >= newPhaseTimer) @@ -868,15 +882,18 @@ namespace CalamityMod.NPCs.Yharon bool spawnBulletHellVortex = NPC.ai[2] == phaseSwitchTimer + 15f; if (spawnBulletHellVortex) { - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 center = player.Center + new Vector2(0f, -540f); NPC.Center = center; + int type = ModContent.ProjectileType(); + int damage = CalamityWorld.getFixedBoi ? NPC.GetProjectileDamage(type) : 0; float bulletHellVortexDuration = flareDustPhaseTimer + teleportPhaseTimer - 15f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, bulletHellVortexDuration, NPC.whoAmI); + int extraTime = CalamityWorld.getFixedBoi ? 300 : 0; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI); // Yharon takes a small amount of damage in order to summon the bullet hell. This is to compensate for him being invulnerable during it. int damageAmt = (int)(NPC.lifeMax * (bulletHellVortexDuration / calamityGlobalNPC.KillTime)); @@ -921,7 +938,7 @@ namespace CalamityMod.NPCs.Yharon else if (aiState == 5) { if (playFastChargeRoarSound) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); if (doFastCharge) { @@ -992,8 +1009,8 @@ namespace CalamityMod.NPCs.Yharon { if (NPC.ai[2] == 0f) { - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); - SoundEngine.PlaySound(OrbSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + SoundEngine.PlaySound(OrbSound, NPC.Center); } NPC.ai[2] += 1f; @@ -1012,7 +1029,7 @@ namespace CalamityMod.NPCs.Yharon { NPC.ai[0] = 6f; NPC.ai[1] = 0f; - NPC.ai[2] = increasedIdleTimeAfterBulletHell; + NPC.ai[2] = -increasedIdleTimeAfterBulletHell; NPC.TargetClosest(); NPC.netUpdate = true; } @@ -1025,7 +1042,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); if (NPC.ai[2] == fireTornadoPhaseTimer - 30) - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == fireTornadoPhaseTimer - 30) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.target + 1); @@ -1048,7 +1065,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); if (NPC.ai[2] == newPhaseTimer - 60) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.ai[2] += 1f; if (NPC.ai[2] >= newPhaseTimer) @@ -1084,7 +1101,7 @@ namespace CalamityMod.NPCs.Yharon else if (NPC.ai[0] == 12f) { if (NPC.ai[2] == 0f) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.ai[2] += 1f; @@ -1214,15 +1231,18 @@ namespace CalamityMod.NPCs.Yharon bool spawnBulletHellVortex = NPC.ai[2] == phaseSwitchTimer + 15f; if (spawnBulletHellVortex) { - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 center = player.Center + new Vector2(0f, -540f); NPC.Center = center; + int type = ModContent.ProjectileType(); + int damage = CalamityWorld.getFixedBoi ? NPC.GetProjectileDamage(type) : 0; float bulletHellVortexDuration = flareDustPhaseTimer + teleportPhaseTimer - 15f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, bulletHellVortexDuration, NPC.whoAmI); + int extraTime = CalamityWorld.getFixedBoi ? 300 : 0; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI); // Yharon takes a small amount of damage in order to summon the bullet hell. This is to compensate for him being invulnerable during it. int damageAmt = (int)(NPC.lifeMax * (bulletHellVortexDuration / calamityGlobalNPC.KillTime)); @@ -1267,7 +1287,7 @@ namespace CalamityMod.NPCs.Yharon else if (aiState == 5) { if (playFastChargeRoarSound) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); if (doFastCharge) { @@ -1345,8 +1365,8 @@ namespace CalamityMod.NPCs.Yharon { if (NPC.ai[2] == 0f) { - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); - SoundEngine.PlaySound(OrbSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + SoundEngine.PlaySound(OrbSound, NPC.Center); } NPC.ai[2] += 1f; @@ -1364,7 +1384,7 @@ namespace CalamityMod.NPCs.Yharon { NPC.ai[0] = 13f; NPC.ai[1] = 0f; - NPC.ai[2] = increasedIdleTimeAfterBulletHell; + NPC.ai[2] = -increasedIdleTimeAfterBulletHell; NPC.localAI[2] = 0f; NPC.TargetClosest(); NPC.netUpdate = true; @@ -1378,7 +1398,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); if (NPC.ai[2] == fireTornadoPhaseTimer - 30) - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == fireTornadoPhaseTimer - 30) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.target + 1); @@ -1402,7 +1422,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); if (NPC.ai[2] == newPhaseTimer - 60) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.ai[2] += 1f; if (NPC.ai[2] >= newPhaseTimer) @@ -1439,7 +1459,7 @@ namespace CalamityMod.NPCs.Yharon else if (NPC.ai[0] == 19f) { if (NPC.ai[2] == 0f) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.ai[2] += 1f; @@ -1487,7 +1507,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity *= 0.98f; if (NPC.ai[2] == 0f) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); if (NPC.ai[2] % flareBombSpawnDivisor == 0f) { @@ -1526,7 +1546,7 @@ namespace CalamityMod.NPCs.Yharon #region AI2 public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC) { - CalamityGlobalNPC.yharonP2 = NPC.whoAmI; + CalamityGlobalNPC.yharonP2 = NPC.whoAmI; float phase2GateValue = revenge ? 0.44f : expertMode ? 0.385f : 0.275f; bool phase2 = death || lifeRatio <= phase2GateValue; @@ -1556,6 +1576,19 @@ namespace CalamityMod.NPCs.Yharon bool invincible = invincibilityCounter < Phase2InvincibilityTime; if (invincible) { + if (CalamityWorld.getFixedBoi) + { + if (NPC.life < NPC.lifeMax) + { + NPC.life += (int)(NPC.lifeMax * 0.01f); + NPC.HealEffect((int)(NPC.lifeMax * 0.01f), true); + NPC.netUpdate = true; + } + else + { + NPC.life = NPC.lifeMax; + } + } NPC.dontTakeDamage = true; phase2 = phase3 = phase4 = false; invincibilityCounter++; @@ -1671,7 +1704,15 @@ namespace CalamityMod.NPCs.Yharon int spinPhaseTimer = secondPhasePhase == 4 ? (bossRush ? 80 : death ? 100 : 120) : (bossRush ? 120 : death ? 150 : 180); int flareDustSpawnDivisor = spinPhaseTimer / 10; int flareDustSpawnDivisor2 = spinPhaseTimer / 20 + (secondPhasePhase == 4 ? spinPhaseTimer / 60 : 0); - float increasedIdleTimeAfterBulletHell = -120f; + + float increasedIdleTimeAfterBulletHell = 120f; + bool moveSlowerAfterBulletHell = NPC.ai[1] < 0f; + if (moveSlowerAfterBulletHell) + { + float reducedMovementMultiplier = MathHelper.Lerp(0.1f, 1f, (NPC.ai[1] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); + acceleration *= reducedMovementMultiplier; + velocity *= reducedMovementMultiplier; + } float flareSpawnDecelerationTimer = bossRush ? 60f : death ? 75f : 90f; int flareSpawnPhaseTimerReduction = revenge ? (int)(flareSpawnDecelerationTimer * (ai2GateValue - lifeRatio)) : 0; @@ -1890,15 +1931,18 @@ namespace CalamityMod.NPCs.Yharon bool spawnBulletHellVortex = NPC.ai[1] == phaseSwitchTimer + timeBeforeTeleport; if (spawnBulletHellVortex) { - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 center = targetData.Center + new Vector2(0f, -540f); NPC.Center = center; + int type = ModContent.ProjectileType(); + int damage = CalamityWorld.getFixedBoi ? NPC.GetProjectileDamage(type) : 0; float bulletHellVortexDuration = spinPhaseTimer + 15f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, bulletHellVortexDuration, NPC.whoAmI); + int extraTime = CalamityWorld.getFixedBoi ? 300 : 0; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI); // Yharon takes a small amount of damage in order to summon the bullet hell. This is to compensate for him being invulnerable during it. int damageAmt = (int)(NPC.lifeMax * (bulletHellVortexDuration / calamityGlobalNPC.KillTime)); @@ -1932,7 +1976,7 @@ namespace CalamityMod.NPCs.Yharon NPC.rotation = NPC.rotation.AngleTowards(newRotation, amount); if (playFastChargeRoarSound) - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.localAI[1] += 1f; @@ -2045,7 +2089,7 @@ namespace CalamityMod.NPCs.Yharon else if (NPC.ai[0] == 2f) { if (NPC.ai[1] == 1f) - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); ChargeDust(7, pie); @@ -2191,8 +2235,8 @@ namespace CalamityMod.NPCs.Yharon { if (NPC.ai[1] == 1f) { - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); - SoundEngine.PlaySound(OrbSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + SoundEngine.PlaySound(OrbSound, NPC.Center); } NPC.ai[1] += 1f; @@ -2241,7 +2285,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[1] >= spinPhaseTimer) { NPC.ai[0] = 1f; - NPC.ai[1] = increasedIdleTimeAfterBulletHell; + NPC.ai[1] = -increasedIdleTimeAfterBulletHell; NPC.ai[2] = 0f; NPC.localAI[2] = 0f; NPC.TargetClosest(); @@ -2287,7 +2331,7 @@ namespace CalamityMod.NPCs.Yharon { if (NPC.ai[1] == 20f || NPC.ai[1] == 80f || NPC.ai[1] == 140f) { - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); DoFireRing(expertMode ? 300 : 180, NPC.GetProjectileDamage(ModContent.ProjectileType()), NPC.target, 1f); } @@ -2298,7 +2342,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[1] >= flareSpawnPhaseTimer) { - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.target + 1); @@ -2314,7 +2358,7 @@ namespace CalamityMod.NPCs.Yharon else if (NPC.ai[0] == 7f) { if (NPC.ai[1] == 1f) - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); ChargeDust(14, pie); @@ -2342,7 +2386,7 @@ namespace CalamityMod.NPCs.Yharon NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); if (NPC.ai[2] == 15f) - SoundEngine.PlaySound(ShortRoarSound, NPC.position); + SoundEngine.PlaySound(ShortRoarSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == 15f) { @@ -2399,7 +2443,7 @@ namespace CalamityMod.NPCs.Yharon } } - RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.position); + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); } NPC.ai[2] += 1f; @@ -2846,7 +2890,7 @@ namespace CalamityMod.NPCs.Yharon npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedYharon, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedYharon, ModContent.ItemType(), desc: DropHelper.FirstKillText); } public override void BossLoot(ref string name, ref int potionType) @@ -2876,6 +2920,16 @@ namespace CalamityMod.NPCs.Yharon // Mark Yharon as dead DownedBossSystem.downedYharon = true; CalamityNetcode.SyncWorld(); + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + for (int i = 0; i < 4; i++) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, 360, NPC.whoAmI); + } + } } #endregion diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs index 7c3edc9f9b..d1dc8450aa 100644 --- a/Projectiles/Boss/ApolloChargeTelegraph.cs +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss public PrimitiveTrail TelegraphDrawer = null; public const float TelegraphFadeTime = 15f; - public const float TelegraphWidth = 943.39811f; // a squared plus b squared equals c squared, dumbass + public const float TelegraphWidth = 1132.07774f; // a squared plus b squared equals c squared, dumbass public override void SetStaticDefaults() { @@ -42,7 +42,9 @@ namespace CalamityMod.Projectiles.Boss bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - Projectile.timeLeft = bossRush ? 30 : death ? 40 : revenge ? 45 : expertMode ? 50 : 60; + Projectile.timeLeft = bossRush ? 45 : death ? 60 : revenge ? 68 : expertMode ? 75 : 90; + if (Main.getGoodWorld) + Projectile.timeLeft /= 2; } public override void SendExtraAI(BinaryWriter writer) @@ -82,7 +84,10 @@ namespace CalamityMod.Projectiles.Boss bool expertMode = Main.expertMode || bossRush; // Determine opacity - float telegraphTotalTime = bossRush ? 30f : death ? 40f : revenge ? 45f : expertMode ? 50f : 60f; + float telegraphTotalTime = bossRush ? 45f : death ? 60f : revenge ? 68f : expertMode ? 75f : 90f; + if (Main.getGoodWorld) + telegraphTotalTime *= 0.5f; + Projectile.Opacity = Utils.GetLerpValue(0f, 6f, Projectile.timeLeft, true) * Utils.GetLerpValue(telegraphTotalTime, telegraphTotalTime - 6f, Projectile.timeLeft, true); } diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs index 8bf294bc78..f1f4796b43 100644 --- a/Projectiles/Boss/ApolloFireball.cs +++ b/Projectiles/Boss/ApolloFireball.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Boss { @@ -152,7 +153,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.Center = Projectile.position; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaExplosionSound, Projectile.Center); if (Main.myPlayer == Projectile.owner) { diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index 821d89afe3..2c24627ab3 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -1,4 +1,5 @@ -using CalamityMod.Events; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.World; @@ -238,8 +239,7 @@ namespace CalamityMod.Projectiles.Boss if (damage <= 0) return; - target.AddBuff(BuffID.OnFire, 360); - target.AddBuff(BuffID.Frostburn, 360); + target.AddBuff(ModContent.BuffType(), 300); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index 54fd5d092b..e8ecfda8c7 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -11,6 +11,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.NPCs.ExoMechs.Ares; namespace CalamityMod.Projectiles.Boss { @@ -179,8 +180,8 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - // Nuke explosion sound - SoundEngine.PlaySound(TeslaCannon.FireSound, Projectile.Center); + // Nuke explosion sound. + SoundEngine.PlaySound(AresGaussNuke.NukeExplosionSound, Projectile.Center); if (Main.netMode != NetmodeID.Server) { diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index cfc6df15e0..40ccd4180d 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -8,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Boss { @@ -151,7 +152,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.Center = Projectile.position; Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); + SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaExplosionSound, Projectile.Center); if (Main.myPlayer == Projectile.owner && Projectile.ai[1] != -1f) { diff --git a/Projectiles/Boss/ArtemisLaser.cs b/Projectiles/Boss/ArtemisLaser.cs index 07e401693d..bdbf3b5372 100644 --- a/Projectiles/Boss/ArtemisLaser.cs +++ b/Projectiles/Boss/ArtemisLaser.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Boss public Vector2 Destination; public Vector2 Velocity; - public const float TelegraphTotalTime = 30f; - public const float TelegraphFadeTime = 15f; + public const float TelegraphTotalTime = 20f; + public const float TelegraphFadeTime = 10f; public const float TelegraphWidth = 4200f; public override void SetStaticDefaults() @@ -115,7 +115,8 @@ namespace CalamityMod.Projectiles.Boss // Accelerate to max velocity. if (Projectile.velocity.Length() < LaserVelocity) { - Projectile.velocity *= 1.0125f; + float acceleration = 1f + LaserVelocity * 0.0016667f; + Projectile.velocity *= acceleration; if (Projectile.velocity.Length() > LaserVelocity) { Projectile.velocity.Normalize(); @@ -225,9 +226,9 @@ namespace CalamityMod.Projectiles.Boss float yScale = 2f; if (TelegraphDelay < TelegraphFadeTime) - yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 15f); + yScale = MathHelper.Lerp(0f, 2f, TelegraphDelay / 10f); if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) - yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + yScale = MathHelper.Lerp(2f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 10f); Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index c68c8300f7..ce1269c93f 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -6,6 +6,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Events; +using CalamityMod.World; namespace CalamityMod.Projectiles.Boss { @@ -37,6 +39,12 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -86,11 +94,44 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.Normalize(); Projectile.velocity *= scaleFactor2; } - else if (Projectile.velocity.Length() < 16f) + else if (Projectile.velocity.Length() < 12f) Projectile.velocity *= 1.01f; Projectile.ai[1] += 1f; } + else + { + // Move away from other flames + if (Projectile.ai[0] >= 60f) + { + float pushForce = bossRush ? 0.07f : death ? 0.06f : revenge ? 0.055f : expertMode ? 0.05f : 0.04f; + float pushDistance = bossRush ? 180f : death ? 150f : revenge ? 135f : expertMode ? 120f : 90f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + if (sameProjType && taxicabDist < pushDistance) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } + } + } + } } public override bool PreDraw(ref Color lightColor) @@ -114,7 +155,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Zombie103, Projectile.position); + SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 96; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index 2e2a48ce2f..502bf6e1c4 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.alpha = 255; Projectile.penetrate = -1; - Projectile.timeLeft = 480; + Projectile.timeLeft = 720; Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index 3b6d47a9fa..cc62d98805 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.position); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index e180fb8247..b8f1da9eb1 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Boss if (damage <= 0 || Projectile.Opacity != 1f) return; - if (Projectile.ai[0] == 0f || Main.getGoodWorld) + if (Projectile.ai[0] == 0f || CalamityWorld.getFixedBoi) target.AddBuff(ModContent.BuffType(), 120); else target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 6a1d6a2fa1..9514b4d4d0 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -1,11 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -51,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } if (Projectile.velocity.Length() < 18f) @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss if (damage <= 0 || Projectile.timeLeft < 51) return; - if (Projectile.ai[0] == 0f || Main.getGoodWorld) + if (Projectile.ai[0] == 0f || CalamityWorld.getFixedBoi) target.AddBuff(ModContent.BuffType(), 120); else target.AddBuff(ModContent.BuffType(), 180); @@ -91,7 +92,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int dust = 0; dust <= 5; dust++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f); diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index 2f95c3d692..77166b18d6 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Boss if (damage <= 0 || Projectile.Opacity != 1f) return; - if (Projectile.ai[0] == 0f || Main.getGoodWorld) + if (Projectile.ai[0] == 0f || CalamityWorld.getFixedBoi) target.AddBuff(ModContent.BuffType(), 120); else target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index 3bd2bb7d17..326d9e31cb 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 784abd6ed0..3fafbfef13 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -149,7 +149,8 @@ namespace CalamityMod.Projectiles.Boss // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. bool sameProjType = otherProj.type == Projectile.type; float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); - if (sameProjType && taxicabDist < 320f) + float distancegate = CalamityWorld.getFixedBoi ? 360f : 320f; + if (sameProjType && taxicabDist < distancegate) { if (Projectile.position.X < otherProj.position.X) Projectile.velocity.X -= pushForce; diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index d641130912..2da4beab68 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -57,8 +57,11 @@ namespace CalamityMod.Projectiles.Boss if (Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType()) { - Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X + (Main.npc[(int)Projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)Projectile.ai[1]].Center.Y - 74f); - Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; + if (Main.npc[(int)Projectile.ai[1]].ai[0] == 5) + { + Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X + (Main.npc[(int)Projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)Projectile.ai[1]].Center.Y - 74f); + Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; + } } else Projectile.Kill(); @@ -115,11 +118,11 @@ namespace CalamityMod.Projectiles.Boss // Fire brimstone darts along the laser bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; - if (Main.npc[(int)Projectile.ai[1]].ai[1] == 210f && Projectile.owner == Main.myPlayer) + if (Main.npc[(int)Projectile.ai[1]].ai[1] == 210f && Projectile.owner == Main.myPlayer && Main.npc[(int)Projectile.ai[1]].ai[0] == 5) { Vector2 velocity = Projectile.velocity; velocity.Normalize(); - float distanceBetweenProjectiles = bossRush ? 72f : 144f; + float distanceBetweenProjectiles = CalamityWorld.getFixedBoi ? 360 : bossRush ? 72f : 144f; Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X + (Main.npc[(int)Projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)Projectile.ai[1]].Center.Y - 74f) + velocity * distanceBetweenProjectiles; int projectileAmt = (int)(Projectile.localAI[1] / distanceBetweenProjectiles); int type = ModContent.ProjectileType(); diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 6083e367ff..16aaa45ed0 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.NPCs; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -50,6 +51,8 @@ namespace CalamityMod.Projectiles.Boss else Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - 570) / 30f), 0f, 1f); + Lighting.AddLight(Projectile.Center, 0.8f * Projectile.Opacity, 0f, 1.2f * Projectile.Opacity); + Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -72,8 +75,8 @@ namespace CalamityMod.Projectiles.Boss int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow2").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow2").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 35f, targetHitbox); @@ -86,7 +89,12 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.Opacity == 1f) - target.AddBuff(BuffID.VortexDebuff, 60); + { + int debufftype = CalamityWorld.getFixedBoi ? BuffID.Obstructed : BuffID.VortexDebuff; + int duration = CalamityWorld.getFixedBoi ? 30 : 60; + if (damage > 0) + target.AddBuff(debufftype, duration, true); + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 67d765f674..a438272d49 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.NPCs; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -88,7 +89,12 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.Opacity == 1f) - target.AddBuff(BuffID.VortexDebuff, 60); + { + int debufftype = CalamityWorld.getFixedBoi ? BuffID.Obstructed : BuffID.VortexDebuff; + int duration = CalamityWorld.getFixedBoi ? 30 : 60; + if (damage > 0) + target.AddBuff(debufftype, duration, true); + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/DestroyerCursedLaser.cs b/Projectiles/Boss/DestroyerCursedLaser.cs index 4b8f94cd19..98b06555c4 100644 --- a/Projectiles/Boss/DestroyerCursedLaser.cs +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss } if (Projectile.localAI[1] == 0f) { - SoundEngine.PlaySound(SoundID.Item33, Projectile.position); + SoundEngine.PlaySound(SoundID.Item33, Projectile.Center); Projectile.localAI[1] = 1f; } if (Projectile.velocity.Length() < 12f) diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index 44ddb8e286..ce680decf1 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss } if (Projectile.localAI[1] == 0f) { - SoundEngine.PlaySound(SoundID.Item33, Projectile.position); + SoundEngine.PlaySound(SoundID.Item33, Projectile.Center); Projectile.localAI[1] = 1f; } if (Projectile.velocity.Length() < 12f) diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index 0efb77de77..c248608f55 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item33, Projectile.position); + SoundEngine.PlaySound(SoundID.Item33, Projectile.Center); } // Deal no damage if fading out and not set to explode @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Boss // Explode and split into accelerating lasers if (Projectile.ai[0] == 1f) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 96; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index b60268f169..9fe3f9dd95 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss int num103 = Player.FindClosest(Projectile.Center, 1, 1); Projectile.ai[1] += 1f; - if (Projectile.ai[1] < 90f && Projectile.ai[1] > 30f) + if (Projectile.ai[1] < 120f && Projectile.ai[1] > 30f) { float scaleFactor2 = Projectile.velocity.Length(); Vector2 vector11 = Main.player[num103].Center - Projectile.Center; diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index f179c759eb..23105fa7ce 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Boss double deg = Projectile.ai[1]; double rad = deg * (Math.PI / 180); - double dist = bossRush ? 800D : death ? 960D : revenge ? 1000D : expertMode ? 1040D : 1080D; + double dist = bossRush ? 360D : death ? 400D : revenge ? 420D : expertMode ? 440D : 480D; Projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - Projectile.width / 2; Projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - Projectile.height / 2; Projectile.ai[1] += 1f; @@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] = 0f; if (Projectile.owner == Main.myPlayer) { - SoundEngine.PlaySound(SoundID.Item33, Projectile.position); + SoundEngine.PlaySound(SoundID.Item33, Projectile.Center); float speed = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3f; speed *= Main.npc[CalamityGlobalNPC.voidBoss].ai[1]; int totalProjectiles = 3; diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 2eea89e07f..ed5b0fdf87 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -19,9 +19,10 @@ namespace CalamityMod.Projectiles.Boss } public Vector2 OldVelocity; - public const float TelegraphTotalTime = 150f; + public const float TelegraphTotalTime = 210f; public const float TelegraphFadeTime = 30f; public const float TelegraphWidth = 4200f; + public const float FadeTime = 100f; public override void SetStaticDefaults() { @@ -37,10 +38,10 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.alpha = 255; + Projectile.Opacity = 0f; Projectile.penetrate = -1; Projectile.extraUpdates = 3; - Projectile.timeLeft = 780; + Projectile.timeLeft = 940; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -63,17 +64,22 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] = 1f; Projectile.netUpdate = true; } + // Fade in after telegraphs have faded. if (TelegraphDelay > TelegraphTotalTime) { - if (Projectile.alpha > 0) + if (Projectile.timeLeft < FadeTime) { - Projectile.alpha -= 12; + Projectile.Opacity = Projectile.timeLeft / FadeTime; } - if (Projectile.alpha < 0) + else { - Projectile.alpha = 0; + if (Projectile.Opacity < 1f) + Projectile.Opacity += 0.05f; + if (Projectile.Opacity > 1f) + Projectile.Opacity = 1f; } + // If an old velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (OldVelocity != Vector2.Zero) { @@ -81,8 +87,10 @@ namespace CalamityMod.Projectiles.Boss OldVelocity = Vector2.Zero; Projectile.netUpdate = true; } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } + // Otherwise, be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. else if (OldVelocity == Vector2.Zero) { @@ -91,24 +99,22 @@ namespace CalamityMod.Projectiles.Boss Projectile.netUpdate = true; Projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; } + TelegraphDelay++; } - public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime && Projectile.Opacity == 1f; public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage <= 0) return; - if (TelegraphDelay > TelegraphTotalTime) + if (TelegraphDelay > TelegraphTotalTime && Projectile.Opacity == 1f) target.AddBuff(ModContent.BuffType(), 180); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 0) * Projectile.Opacity; public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 70f82a2d52..428480b055 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.alpha = 255; Projectile.extraUpdates = 1; Projectile.penetrate = -1; Projectile.timeLeft = 480; @@ -37,7 +36,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f && Projectile.ai[1] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.frameCounter++; @@ -49,11 +48,6 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 5) Projectile.frame = 0; - if (Projectile.alpha > 0) - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - int dust = Dust.NewDust(new Vector2(Projectile.position.X + Projectile.velocity.X, Projectile.position.Y + Projectile.velocity.Y), Projectile.width, Projectile.height, 173, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 0.8f); Main.dust[dust].noGravity = true; @@ -72,6 +66,8 @@ namespace CalamityMod.Projectiles.Boss return false; } + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 0); + public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage <= 0) @@ -85,8 +81,8 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 64; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + Projectile.position.X = Projectile.position.X - Projectile.width / 2; + Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); @@ -94,7 +90,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 10; num623++) @@ -105,6 +101,54 @@ namespace CalamityMod.Projectiles.Boss num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } + for (int num640 = 0; num640 < 200; num640++) + { + float num641 = 12f; + if (num640 < 150) + num641 = 9f; + if (num640 < 100) + num641 = 6f; + if (num640 < 50) + num641 = 3f; + + int num643 = Dust.NewDust(Projectile.Center, 6, 6, 173, 0f, 0f, 100, default, 1f); + float num644 = Main.dust[num643].velocity.X; + float num645 = Main.dust[num643].velocity.Y; + + if (num644 == 0f && num645 == 0f) + num644 = 1f; + + float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); + num646 = num641 / num646; + num644 *= num646; + num645 *= num646; + + float scale = 1f; + switch ((int)num641) + { + case 4: + scale = 1.2f; + break; + case 8: + scale = 1.1f; + break; + case 12: + scale = 1f; + break; + case 16: + scale = 0.9f; + break; + default: + break; + } + + Dust dust = Main.dust[num643]; + dust.velocity *= 0.5f; + dust.velocity.X += num644; + dust.velocity.Y += num645; + dust.scale = scale; + dust.noGravity = true; + } Projectile.Damage(); } } diff --git a/Projectiles/Boss/DyingSun.cs b/Projectiles/Boss/DyingSun.cs index 4689cbe717..82a33c8ef8 100644 --- a/Projectiles/Boss/DyingSun.cs +++ b/Projectiles/Boss/DyingSun.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; -using System; +using System; using System.Collections.Generic; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -9,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class DyingSun : ModProjectile - { + { public PrimitiveTrail FireDrawer; public ref float Time => ref Projectile.ai[0]; public ref float Radius => ref Projectile.ai[1]; @@ -44,7 +45,7 @@ namespace CalamityMod.Projectiles.Boss public Color SunColorFunction(float completionRatio) { - Color sunColor = Main.dayTime ? Color.Yellow : Color.Cyan; + Color sunColor = CalamityWorld.getFixedBoi ? (new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.8f) : (Main.dayTime ? Color.Yellow : Color.Cyan); return Color.Lerp(sunColor, Color.White, (float)Math.Sin(MathHelper.Pi * completionRatio) * 0.5f + 0.3f) * Projectile.Opacity; } diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index 7ac2b9d552..ea35768509 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -38,9 +38,10 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 96; + int size = Projectile.ai[0] > 60 ? 192 : 96; + Projectile.width = Projectile.height = size; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int num621 = 0; num621 < 10; num621++) diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index 68e0374128..f7305fab6f 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - SoundEngine.PlaySound(FlareSound, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 12a3d563b8..7321aabf1f 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.Yharon; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -107,7 +108,10 @@ namespace CalamityMod.Projectiles.Boss center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } - if (Projectile.ai[0] <= 0f) + int tornadoSpeed = 10; + int breakThreshold = -300; + bool breakapart = CalamityWorld.getFixedBoi && Projectile.ai[0] <= breakThreshold; + if (Projectile.ai[0] <= 0f && !breakapart) { float num622 = 0.104719758f; float num623 = (float)Projectile.width / 5f; @@ -118,6 +122,10 @@ namespace CalamityMod.Projectiles.Boss num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; Projectile.position.X += num624 * -Projectile.direction; } + if (Projectile.ai[0] == breakThreshold && CalamityWorld.getFixedBoi) + { + Projectile.velocity.X = Main.rand.NextBool(2) ? -tornadoSpeed : tornadoSpeed; + } if (Projectile.timeLeft == 480) Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index 45cb75b101..f56fc909c3 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 32; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index eaecada6ab..9a8b3d318b 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } bool flag15 = false; diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 2b2a3e6945..9fb50cde97 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -1,10 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -98,7 +99,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int num621 = 0; num621 < 8; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); @@ -161,14 +162,42 @@ namespace CalamityMod.Projectiles.Boss gore.velocity.Y -= 1f; } } + + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.getFixedBoi) + { + Vector2 valueBoom = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float spreadBoom = 15f * 0.0174f; + double startAngleBoom = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spreadBoom / 2; + double deltaAngleBoom = spreadBoom / 8f; + double offsetAngleBoom; + int iBoom; + int damageBoom = Projectile.damage / 2; + for (iBoom = 0; iBoom < 5; iBoom++) + { + if (Main.rand.NextBool(5) && iBoom > 0) + { + int projectileType = ModContent.ProjectileType(); + offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; + float velocity = 0.5f; + Projectile.NewProjectile(Projectile.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocity), (float)(Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocity), (float)(-Math.Cos(offsetAngleBoom) * velocity), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + } + } + } } public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage <= 0) return; - - target.AddBuff(ModContent.BuffType(), 240); + + if (CalamityWorld.getFixedBoi) // it is the plague, you get very sick. + { + target.AddBuff(ModContent.BuffType(), 240, true); + target.AddBuff(BuffID.Poisoned, 240, true); + target.AddBuff(BuffID.Venom, 240, true); + } + target.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index c47a387637..f7a4d23b32 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -68,19 +69,22 @@ namespace CalamityMod.Projectiles.Boss Color color = Main.hslToRgb(hue[i] % 1f, 1f, 0.5f) * colorChangeAmt * colorChangeAmt2; bool underworld = Projectile.ai[0] == 2f; - if (Main.dayTime) + if (!CalamityWorld.getFixedBoi) { - color.R = 255; - if (underworld) - color.B = 0; - } - else - { - color.B = 255; - if (underworld) - color.G = 0; + if (Main.dayTime) + { + color.R = 255; + if (underworld) + color.B = 0; + } else - color.R = 0; + { + color.B = 255; + if (underworld) + color.G = 0; + else + color.R = 0; + } } color.A /= 4; diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 6f9aebdcd8..b3dc7bb3d2 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,7 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.World; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -9,12 +7,14 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using System.IO; namespace CalamityMod.Projectiles.Boss { public class HolyBlast : ModProjectile { - public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/ProvidenceHolyBlastImpact"); + public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); + public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); public override void SetStaticDefaults() { @@ -28,13 +28,38 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = 180; Projectile.height = 180; Projectile.hostile = true; + Projectile.tileCollide = false; Projectile.penetrate = 1; Projectile.timeLeft = 120; CooldownSlot = ImmunityCooldownID.Bosses; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + } + public override void AI() { + Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f); + + if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) + Projectile.tileCollide = true; + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -42,53 +67,46 @@ namespace CalamityMod.Projectiles.Boss Projectile.frameCounter = 0; } if (Projectile.frame > 3) - { Projectile.frame = 0; - } - if (Projectile.wet || Projectile.lavaWet) + + if (Projectile.localAI[0] == 0f) { - Projectile.Kill(); - } - if (Projectile.ai[1] == 0f) - { - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(ShootSound, Projectile.Center); } + if (Math.Abs(Projectile.velocity.X) > 0.2) - { Projectile.spriteDirection = -Projectile.direction; - } + if (Projectile.velocity.X < 0f) - { Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); - } else - { Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); - } } public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !BossRushEvent.BossRushActive) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + Texture2D texture = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -97,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss { if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = (!Main.dayTime || BossRushEvent.BossRushActive) ? 8 : 6; + int totalProjectiles = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 8 : 6; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); float velocity = 5f; @@ -111,29 +129,34 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(ImpactSound, Projectile.Center); - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int num193 = 0; num193 < 4; num193++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); + Main.dust[dust].noGravity = true; } for (int num194 = 0; num194 < 40; num194++) { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 4f); Main.dust[num195].noGravity = true; Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); Main.dust[num195].velocity *= 2f; Main.dust[num195].noGravity = true; } } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 480); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 480, 20); } } } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 733ae10a1f..b7bfe74f06 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,8 +14,6 @@ namespace CalamityMod.Projectiles.Boss { public class HolyBomb : ModProjectile { - private int flareShootTimer = 120; - public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Bomb"); @@ -35,40 +32,58 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(flareShootTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - flareShootTimer = reader.ReadInt32(); - } - public override void AI() { - flareShootTimer--; - if (flareShootTimer <= 0) + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + + /* + * Day mode by default but syncs with the boss + * Uses maxPenetrate because it's kinda pointless for a boss projectile + * and it's convenient to copypaste without having to do adjustments + * If someone really feels like making a proper int for this purpose they can do it themselves - Iris + */ + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + + Projectile.ai[0] += 1f; + if (Projectile.ai[0] % 120f == 0f) { SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - if (Projectile.owner == Main.myPlayer) + + float velocityY = -2f; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + for (int num193 = 0; num193 < 2; num193++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, -2f, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); + Main.dust[dust].noGravity = true; } - flareShootTimer = 60; + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 0, default, 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 2f; + num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); + Main.dust[num195].velocity *= 1.5f; + Main.dust[num195].noGravity = true; + } + + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, velocityY, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); } + if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } + Projectile.velocity *= 0.975f; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -76,21 +91,20 @@ namespace CalamityMod.Projectiles.Boss Projectile.frameCounter = 0; } if (Projectile.frame > 3) - { Projectile.frame = 0; - } } public override Color? GetAlpha(Color lightColor) { - return ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; + { + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -100,14 +114,15 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 150; - Projectile.height = 150; + Projectile.width = 50; + Projectile.height = 100; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int num193 = 0; num193 < 2; num193++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + Main.dust[dust].noGravity = true; } for (int num194 = 0; num194 < 20; num194++) { @@ -120,13 +135,17 @@ namespace CalamityMod.Projectiles.Boss } } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 240); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 240, 20); } } } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 92d07da91a..c41367e6d3 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; -using CalamityMod.Dusts; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -36,6 +37,17 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + if (Projectile.ai[0] == 0f && BossRushEvent.BossRushActive) Projectile.velocity *= 1.25f; @@ -57,7 +69,7 @@ namespace CalamityMod.Projectiles.Boss Texture2D texture = ModContent.Request(Texture).Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color baseColor = (Main.dayTime && !BossRushEvent.BossRushActive) ? new Color(255, 200, 100, 255) : new Color(100, 200, 255, 255); + Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255); baseColor *= 0.5f; baseColor.A = 0; Color colorA = baseColor; @@ -91,11 +103,12 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.ExpandHitboxBy(50); - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int d = 0; d < 5; d++) { int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[holy].velocity *= 3f; + Main.dust[holy].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[holy].scale = 0.5f; @@ -109,16 +122,21 @@ namespace CalamityMod.Projectiles.Boss Main.dust[fire].velocity *= 5f; fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; + Main.dust[fire].noGravity = true; } } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 180); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 180, 50); Projectile.Kill(); } } diff --git a/Projectiles/Boss/HolyExplosionBoom.cs b/Projectiles/Boss/HolyExplosionBoom.cs index 81951fb456..bdaf96015a 100644 --- a/Projectiles/Boss/HolyExplosionBoom.cs +++ b/Projectiles/Boss/HolyExplosionBoom.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,7 +13,7 @@ namespace CalamityMod.Projectiles.Boss public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 16f; public override Color GetCurrentExplosionColor(float pulseCompletionRatio) { - Color explosionColor = Main.dayTime ? Color.Orange : Color.BlueViolet; + Color explosionColor = CalamityWorld.getFixedBoi ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : (Main.dayTime ? Color.Orange : Color.BlueViolet); return Color.Lerp(explosionColor * 1.6f, Color.White, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f)); } public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 5ea56be1cc..60329864df 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -34,16 +34,27 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - Projectile.alpha -= (!Main.dayTime || BossRushEvent.BossRushActive) ? 10 : 5; + + Projectile.alpha -= (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 10 : 5; if (Projectile.alpha <= 0) - { Projectile.Kill(); - } + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -51,21 +62,20 @@ namespace CalamityMod.Projectiles.Boss Projectile.frameCounter = 0; } if (Projectile.frame > 3) - { Projectile.frame = 0; - } } public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !BossRushEvent.BossRushActive) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -92,14 +102,15 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.position.X = Projectile.position.X + (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 150; - Projectile.height = 150; + Projectile.width = 40; + Projectile.height = 40; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -111,16 +122,21 @@ namespace CalamityMod.Projectiles.Boss int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; } } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 120); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 20); } } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index fba0d50008..049e45b126 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -35,6 +34,17 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -42,18 +52,16 @@ namespace CalamityMod.Projectiles.Boss Projectile.frameCounter = 0; } if (Projectile.frame > 3) - { Projectile.frame = 0; - } + if (Math.Abs(Projectile.velocity.X) < 7f) - { Projectile.velocity.X *= 1.05f; - } + int num103 = Player.FindClosest(Projectile.Center, 1, 1); + if (Projectile.ai[1] == 0f) - { Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); - } + Projectile.ai[1] += 1f; if (Projectile.ai[1] < 180f && Projectile.ai[1] > 60f) { @@ -61,23 +69,26 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector11 = Main.player[num103].Center - Projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - float inertia = (!Main.dayTime || BossRushEvent.BossRushActive) ? 20f : 25f; + float inertia = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 20f : 25f; Projectile.velocity = (Projectile.velocity * (inertia - 1f) + vector11) / inertia; Projectile.velocity.Normalize(); Projectile.velocity *= scaleFactor2; } + + Projectile.rotation = Projectile.velocity.X * 0.025f; } public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !BossRushEvent.BossRushActive) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -87,14 +98,15 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.position.X = Projectile.position.X + (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 150; - Projectile.height = 150; + Projectile.width = 40; + Projectile.height = 40; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -106,16 +118,21 @@ namespace CalamityMod.Projectiles.Boss int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; } } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 120); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 10); } } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 88662a6a85..30493be131 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -35,6 +34,17 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0.35f, 0.275f, 0f); + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Player player = Main.player[Projectile.owner]; Projectile.frameCounter++; @@ -51,7 +61,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Y > velocityYCap) Projectile.velocity.Y = velocityYCap; - float velocityX = (!Main.dayTime || BossRushEvent.BossRushActive) ? 0.025f : 0.02f; + float velocityX = Projectile.maxPenetrate != (int)Providence.BossMode.Day ? 0.025f : 0.02f; if (Projectile.position.X + Projectile.width < player.position.X) { if (Projectile.velocity.X < 0f) @@ -65,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.X -= velocityX; } - float velocityXCap = (!Main.dayTime || BossRushEvent.BossRushActive) ? 10f : 8f; + float velocityXCap = Projectile.maxPenetrate != (int)Providence.BossMode.Day ? 10f : 8f; if (Projectile.velocity.X > velocityXCap || Projectile.velocity.X < -velocityXCap) Projectile.velocity.X *= 0.97f; @@ -74,14 +84,15 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; + Texture2D texture = Projectile.maxPenetrate == (int)Providence.BossMode.Day ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -91,14 +102,15 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.position.X = Projectile.position.X + (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; + Projectile.width = 30; + Projectile.height = 60; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -110,16 +122,21 @@ namespace CalamityMod.Projectiles.Boss int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; } } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = ((Main.dayTime && !BossRushEvent.BossRushActive) || !NPC.AnyNPCs(ModContent.NPCType())) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 180); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 180, 20); } } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 1c38d16473..70c053cbde 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); + if (Projectile.ai[0] < 240f) { Projectile.ai[0] += 1f; @@ -101,14 +103,15 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; + Projectile.width = 40; + Projectile.height = 40; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -122,6 +125,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num624].velocity *= 5f; num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; } } } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index b5d35d1447..a0a754479b 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -51,6 +53,17 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; @@ -59,14 +72,14 @@ namespace CalamityMod.Projectiles.Boss velocity = Projectile.velocity; } - float timeGateValue = (!Main.dayTime || BossRushEvent.BossRushActive) ? 420f : 540f; - if (Projectile.ai[0] == 0f) + float timeGateValue = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 420f : (Projectile.ai[0] == -1f ? 360f : 540f); + if (Projectile.ai[0] <= 0f) { Projectile.ai[1] += 1f; - float slowGateValue = (!Main.dayTime || BossRushEvent.BossRushActive) ? 60f : 90f; + float slowGateValue = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 60f : (Projectile.ai[0] == -1f ? 30f : 90f); float fastGateValue = 30f; - float minVelocity = (!Main.dayTime || BossRushEvent.BossRushActive) ? 4f : 3f; + float minVelocity = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 4f : (Projectile.ai[0] == -1f ? 4.5f : 3f); float maxVelocity = minVelocity * 4f; float extremeVelocity = maxVelocity * 2f; float deceleration = 0.95f; @@ -95,8 +108,8 @@ namespace CalamityMod.Projectiles.Boss } else { - float frequency = (!Main.dayTime || BossRushEvent.BossRushActive) ? 0.2f : 0.1f; - float amplitude = (!Main.dayTime || BossRushEvent.BossRushActive) ? 4f : 2f; + float frequency = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 0.2f : 0.1f; + float amplitude = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 4f : 2f; Projectile.ai[1] += frequency; @@ -121,16 +134,49 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D value = ModContent.Request(Texture).Value; - int green = Projectile.ai[0] != 0f ? 255 : 125; - int blue = Projectile.ai[0] != 0f ? 0 : 125; - Color baseColor = new Color(255, green, blue, 255); + bool aimedSpear = Projectile.ai[0] > 0f; - if (!Main.dayTime || BossRushEvent.BossRushActive) + int red = 255; + int green = 255; + int blue = 0; + switch (Projectile.maxPenetrate) { - int red = Projectile.ai[0] != 0f ? 100 : 175; - green = Projectile.ai[0] != 0f ? 255 : 175; - baseColor = new Color(red, green, 255, 255); + case (int)Providence.BossMode.Red: + red = 255; + green = aimedSpear ? 0 : 125; + blue = aimedSpear ? 0 : 255; + break; + case (int)Providence.BossMode.Orange: + red = 255; + green = 125; + blue = aimedSpear ? 0 : 175; + break; + case (int)Providence.BossMode.Yellow: //Same as day + case (int)Providence.BossMode.Day: + red = 255; + green = aimedSpear ? 255 : 125; + blue = aimedSpear ? 0 : 125; + break; + case (int)Providence.BossMode.Green: + red = 0; + green = 255; + blue = aimedSpear ? 0 : 175; + break; + case (int)Providence.BossMode.Blue: //Same as night + case (int)Providence.BossMode.Night: + red = aimedSpear ? 100 : 175; + green = aimedSpear ? 255 : 175; + blue = 255; + break; + case (int)Providence.BossMode.Violet: + red = aimedSpear ? 125 : 255; + green = aimedSpear ? 0 : 255; + blue = 125; + break; + default: + break; } + Color baseColor = new Color(red, green, blue, 255); Color color33 = baseColor * 0.5f; color33.A = 0; @@ -171,13 +217,17 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 180); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 180, 20); } } } diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index 0aed6497c4..3768b5759b 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.NPCs.Cryogen; namespace CalamityMod.Projectiles.Boss { @@ -57,28 +58,24 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - for (int num322 = 0; num322 < 2; num322++) + for (int i = 0; i < 2; i++) { - int num323 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); - Main.dust[num323].noGravity = true; - Dust dust = Main.dust[num323]; - dust.velocity *= 0.3f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, Projectile.velocity.X, Projectile.velocity.Y, 50, default, 0.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.3f; } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 255, 255, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(1f, 1f, 1f, 1f) * Projectile.Opacity; public override void Kill(int timeLeft) { int num497 = 5; - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); for (int num498 = 0; num498 < num497; num498++) { int num499 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 92, 0f, 0f, 0, default, 1f); - if (Main.rand.Next(3) != 0) + if (!Main.rand.NextBool(3)) { Dust dust = Main.dust[num499]; dust.velocity *= 2f; @@ -105,8 +102,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Projectile.DrawProjectileWithBackglow(Cryogen.BackglowColor, lightColor, 4f); return false; } } diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index b2fa2e62d0..0f3fb7914e 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.NPCs.Cryogen; namespace CalamityMod.Projectiles.Boss { @@ -64,14 +65,17 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => new Color(1f, 1f, 1f, 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) { - return new Color(255, 255, 255, Projectile.alpha); + Projectile.DrawProjectileWithBackglow(Cryogen.BackglowColor, lightColor, 4f); + return false; } public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index d4016bce7a..50a658ad5d 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.NPCs.Cryogen; namespace CalamityMod.Projectiles.Boss { @@ -83,9 +84,12 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => new Color(1f, 1f, 1f, 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) { - return new Color(255, 255, 255, Projectile.alpha); + Projectile.DrawProjectileWithBackglow(Cryogen.BackglowColor, lightColor, 4f); + return false; } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 05c2fc024f..7031177e1d 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.Yharon; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -109,7 +110,10 @@ namespace CalamityMod.Projectiles.Boss center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } - if (Projectile.ai[0] <= 0f) + int tornadoSpeed = 10; + int breakThreshold = -300; + bool breakapart = CalamityWorld.getFixedBoi && Projectile.ai[0] <= breakThreshold; + if (Projectile.ai[0] <= 0f && !breakapart) { float num622 = 0.104719758f; float num623 = (float)Projectile.width / 5f; @@ -120,6 +124,10 @@ namespace CalamityMod.Projectiles.Boss num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; Projectile.position.X += num624 * -Projectile.direction; } + if (Projectile.ai[0] == breakThreshold && CalamityWorld.getFixedBoi) + { + Projectile.velocity.X = Main.rand.NextBool(2) ? -tornadoSpeed : tornadoSpeed; + } if (Projectile.timeLeft == 600) Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index 4e5c2ce0c8..f8bf5e39ca 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.Yharon; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -109,7 +110,10 @@ namespace CalamityMod.Projectiles.Boss center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } - if (Projectile.ai[0] <= 0f) + int tornadoSpeed = 10; + int breakThreshold = -300; + bool breakapart = CalamityWorld.getFixedBoi && Projectile.ai[0] <= breakThreshold; + if (Projectile.ai[0] <= 0f && !breakapart) { float num622 = 0.104719758f; float num623 = (float)Projectile.width / 5f; @@ -120,6 +124,10 @@ namespace CalamityMod.Projectiles.Boss num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623; Projectile.position.X += num624 * -Projectile.direction; } + if (Projectile.ai[0] == breakThreshold && CalamityWorld.getFixedBoi) + { + Projectile.velocity.X = Main.rand.NextBool(2) ? -tornadoSpeed : tornadoSpeed; + } if (Projectile.timeLeft == 720) Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); diff --git a/Projectiles/Boss/JewelProjectile.cs b/Projectiles/Boss/JewelProjectile.cs index dd1ae9dc62..7a3895997c 100644 --- a/Projectiles/Boss/JewelProjectile.cs +++ b/Projectiles/Boss/JewelProjectile.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); for (int index1 = 0; index1 < 15; ++index1) { int ruby = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 50, new Color(), 1.2f); diff --git a/Projectiles/Boss/LeviathanBomb.cs b/Projectiles/Boss/LeviathanBomb.cs index cc8c1d7494..a07015d574 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index cea5938296..3a79420845 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = 42; Projectile.height = 42; Projectile.hostile = true; + Projectile.tileCollide = false; Projectile.penetrate = 1; Projectile.timeLeft = 90; CooldownSlot = ImmunityCooldownID.Bosses; @@ -35,15 +36,31 @@ namespace CalamityMod.Projectiles.Boss public override void SendExtraAI(BinaryWriter writer) { writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + + if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) + Projectile.tileCollide = true; + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -53,24 +70,22 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.wet || Projectile.lavaWet) - Projectile.Kill(); - - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; - if (Projectile.ai[1] == 0f) + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + if (Projectile.localAI[1] == 0f) { for (int d = 0; d < 10; d++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + Projectile.localAI[1] = 1f; + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); } Projectile.localAI[0] += 1f; @@ -96,37 +111,39 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !BossRushEvent.BossRushActive) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } public override void Kill(int timeLeft) { - int blobAmt = (!Main.dayTime || BossRushEvent.BossRushActive) ? 9 : 6; + int blobAmt = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 9 : 6; if (Projectile.owner == Main.myPlayer) { for (int b = 0; b < blobAmt; b++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + Projectile.velocity; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f); } } - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; - for (int num193 = 0; num193 < 2; num193++) + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + for (int num193 = 0; num193 < 4; num193++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); + Main.dust[dust].noGravity = true; } - for (int num194 = 0; num194 < 20; num194++) + for (int num194 = 0; num194 < 40; num194++) { int num195 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; @@ -139,13 +156,17 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18f, targetHitbox); - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 240); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 240, 20); } } } diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 09923d8aee..1483ac264b 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -31,14 +31,30 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Projectile.velocity.X *= 0.95f; if (Projectile.wet || Projectile.lavaWet) { - Projectile.velocity.Y = 0f; + Projectile.velocity.Y -= 0.2f; + if (Projectile.velocity.Y < -10f) + Projectile.velocity.Y = -10f; } else { + if (Projectile.velocity.Y < 0f) + Projectile.velocity.Y = 0f; + Projectile.velocity.Y += 0.1f; if (Projectile.velocity.Y > 5f) Projectile.velocity.Y = 5f; @@ -64,15 +80,16 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return (Main.dayTime && !BossRushEvent.BossRushActive) ? new Color(250, 150, 0, Projectile.alpha) : new Color(100, 200, 250, Projectile.alpha); + return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; + Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? ModContent.Request(Texture).Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -85,10 +102,11 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 10; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); for (int num621 = 0; num621 < 3; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num622].noGravity = true; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; @@ -100,16 +118,21 @@ namespace CalamityMod.Projectiles.Boss int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num624].noGravity = true; } } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + //In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + //If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 120); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 10); } } } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index a9f4540872..c4b105bc9d 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -1,9 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; + namespace CalamityMod.Projectiles.Boss { public class MushBomb : ModProjectile @@ -45,6 +47,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.X *= 0.995f; } + public override Color? GetAlpha(Color drawColor) => CalamityWorld.getFixedBoi ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); + public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; @@ -70,7 +74,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 20; diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 9c00e8435b..1de1854c90 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -57,6 +57,8 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => Projectile.velocity.Y >= 0f; + public override Color? GetAlpha(Color drawColor) => CalamityWorld.getFixedBoi ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); + public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; @@ -82,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); Projectile.width = 20; @@ -106,6 +108,15 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num624].velocity *= 2f; Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); } + + if (CalamityWorld.getFixedBoi && NPC.CountNPCS(NPCID.Crab) < 20 && Main.netMode != NetmodeID.MultiplayerClient) + { + int crab = NPC.NewNPC(Projectile.GetSource_FromAI(), (int)Projectile.Center.X, (int)Projectile.Center.Y, NPCID.Crab); + if (crab.WithinBounds(Main.maxNPCs)) + { + Main.projectile[crab].timeLeft = 1200; + } + } } } } diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index 5d3d053249..5bf56c9a02 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -24,29 +24,27 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 420; Projectile.alpha = 255; CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() { + Lighting.AddLight((int)((Projectile.position.X + (Projectile.width / 2)) / 16f), (int)((Projectile.position.Y + (Projectile.height / 2)) / 16f), 0.5f, 0.4f, 0f); + Projectile.alpha -= 50; if (Projectile.alpha < 0) Projectile.alpha = 0; Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 15f) - { Projectile.velocity.Y += 0.1f; - } - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } + if (Projectile.velocity.Y > 12f) + Projectile.velocity.Y = 12f; - Projectile.tileCollide = Projectile.timeLeft < 240; + Projectile.tileCollide = Projectile.timeLeft < 300; Projectile.rotation += Projectile.velocity.X * 0.1f; @@ -61,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.NPCDeath12, Projectile.position); + SoundEngine.PlaySound(SoundID.NPCDeath12, Projectile.Center); int num226 = 8; for (int num227 = 0; num227 < num226; num227++) diff --git a/Projectiles/Boss/OldDukeToothBallSpike.cs b/Projectiles/Boss/OldDukeToothBallSpike.cs new file mode 100644 index 0000000000..06be773635 --- /dev/null +++ b/Projectiles/Boss/OldDukeToothBallSpike.cs @@ -0,0 +1,66 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class OldDukeToothBallSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spike"); + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.hostile = true; + Projectile.timeLeft = 600; + Projectile.ignoreWater = true; + CooldownSlot = ImmunityCooldownID.Bosses; + } + + public override void AI() + { + Lighting.AddLight((int)((Projectile.position.X + (Projectile.width / 2)) / 16f), (int)((Projectile.position.Y + (Projectile.height / 2)) / 16f), 0.45f, 0.35f, 0f); + + float finalVelocity = new Vector2(Projectile.ai[0], Projectile.ai[1]).Length(); + if (Projectile.velocity.Length() < finalVelocity) + Projectile.velocity *= 1.025f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + for (int i = 0; i < 2; i++) + { + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.3f; + } + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage <= 0) + return; + + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + } + } + } +} diff --git a/Projectiles/Boss/OldDukeToothBallSpike.png b/Projectiles/Boss/OldDukeToothBallSpike.png new file mode 100644 index 0000000000..0e5a123113 Binary files /dev/null and b/Projectiles/Boss/OldDukeToothBallSpike.png differ diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index e893324ded..08f5822473 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -1,11 +1,12 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Boss { @@ -37,29 +38,54 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (Projectile.scale < 1f) + if (CalamityWorld.getFixedBoi) { - if (Projectile.alpha > 0) - Projectile.alpha -= 1; + if (Projectile.scale < 2f) + { + if (Projectile.alpha > 0) + Projectile.alpha -= 1; - Projectile.scale += 0.004f; - if (Projectile.scale > 1f) - Projectile.scale = 1f; + Projectile.scale += 0.004f; + if (Projectile.scale > 2f) + Projectile.scale = 2f; + } + else + { + if (Projectile.timeLeft <= 85) + { + if (Projectile.alpha < 255) + Projectile.alpha += 3; - Projectile.width = Projectile.height = (int)(408f * Projectile.scale); + Projectile.scale += 0.012f; + } + } } else { - if (Projectile.timeLeft <= 85) + if (Projectile.scale < 1f) { - if (Projectile.alpha < 255) - Projectile.alpha += 3; + if (Projectile.alpha > 0) + Projectile.alpha -= 1; + + Projectile.scale += 0.004f; + if (Projectile.scale > 1f) + Projectile.scale = 1f; - Projectile.scale += 0.012f; Projectile.width = Projectile.height = (int)(408f * Projectile.scale); } else - Projectile.width = Projectile.height = 408; + { + if (Projectile.timeLeft <= 85) + { + if (Projectile.alpha < 255) + Projectile.alpha += 3; + + Projectile.scale += 0.012f; + Projectile.width = Projectile.height = (int)(408f * Projectile.scale); + } + else + Projectile.width = Projectile.height = 408; + } } Projectile.velocity = Vector2.Normalize(new Vector2(Projectile.ai[0], Projectile.ai[1]) - Projectile.Center) * 1.5f; @@ -97,7 +123,7 @@ namespace CalamityMod.Projectiles.Boss } float distanceRequired = 800f * Projectile.scale; - float succPower = 0.5f; + float succPower = CalamityWorld.getFixedBoi ? 1f : 0.5f; for (int i = 0; i < Main.maxPlayers; i++) { Player player = Main.player[i]; diff --git a/Projectiles/Boss/PeanutRocket.cs b/Projectiles/Boss/PeanutRocket.cs new file mode 100644 index 0000000000..afdee5f44d --- /dev/null +++ b/Projectiles/Boss/PeanutRocket.cs @@ -0,0 +1,94 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Boss +{ + public class PeanutRocket : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Ranged/HighExplosivePeanutShell"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("High Explosive Peanut Shell"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 9; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + + public override void SetDefaults() + { + Projectile.Calamity().DealsDefenseDamage = true; + Projectile.width = 16; + Projectile.height = 16; + Projectile.hostile = true; + Projectile.extraUpdates = 4; + Projectile.timeLeft = 300; + Projectile.penetrate = -1; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.spriteDirection = 1; + + // Lighting + Lighting.AddLight(Projectile.Center, 0.75f, 0.65f, 0.08f); + + // Dirty dust, done dirt cheap + { + int dustID = 7; // wood flakes + float scale = Main.rand.NextFloat(1f, 1.4f); + Dust d = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustID); + d.noGravity = true; + d.scale = scale; + + // Dust velocity is a complicated flaking function taken from Holy Fire Bullets + d.velocity *= 0.2f; + float angleDeviation = 0.17f; + float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); + Vector2 sprayVelocity = Projectile.velocity.RotatedBy(angle) * 0.6f; + d.velocity += sprayVelocity; + } + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void Kill(int timeLeft) + { + // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion + SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); + + // Massively inflate the projectile's hitbox + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 140; + Projectile.position.X = Projectile.position.X - Projectile.width / 2; + Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; + + // Allow infinite piercing and ignoring iframes for this one extra hit + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + + // Rocket III type explosion is now a utility for convenience + Projectile.LargeFieryExplosion(); + + // Deal damage again. The explosion deals half the damage of the direct hit. + Projectile.damage /= 2; + Projectile.Damage(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + return true; // the projectile does indeed die on collision + } + } +} diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index ba381585c7..f38d08bb0e 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item125, Projectile.position); + SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); Projectile.position.X = Projectile.position.X + (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index 919dae087f..d89ef80da5 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item125, Projectile.position); + SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); Projectile.position.X = Projectile.position.X + (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); Projectile.width = 50; diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index 6668664d6e..b53c12c33f 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index 61dafcf82d..79cafa4037 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index 1f155c2266..2f344c9da0 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.position.X = Projectile.position.X + (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); Projectile.width = 150; diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index d7aa02ddaf..bcb8e8a6e3 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; Projectile.localAI[0] += 1f; diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index efe702b61f..3056fe7f8e 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; Projectile.localAI[0] += 1f; diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 3fc8a0d6cf..20b89924c2 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); if (Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index 078e3e73a8..c190a5a0fd 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -1,10 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class ProfanedSpear : ModProjectile @@ -24,54 +24,33 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.alpha = 255; - Projectile.timeLeft = 300; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.localAI[0] = reader.ReadSingle(); + Projectile.timeLeft = 600; + CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() { - if (Projectile.timeLeft < 210) + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + + if (Projectile.timeLeft < 510) Projectile.tileCollide = true; Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver4; - if (Projectile.alpha > 0) - Projectile.alpha -= 17; - - Projectile.ai[1] += 1f; - if (Projectile.ai[1] <= 20f) + Projectile.ai[0] += 1f; + if (Projectile.ai[0] <= 20f) Projectile.velocity *= 0.95f; - else if (Projectile.ai[1] > 20f && Projectile.ai[1] <= 39f) - Projectile.velocity *= 1.1f; - else if (Projectile.ai[1] == 40f) - Projectile.ai[1] = 0f; + else + Projectile.velocity *= 1.06f; - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 30f) + if (Projectile.ai[0] > 40f) + Projectile.ai[0] = 0f; + + float maxVelocity = 20f; + if (Projectile.velocity.Length() > maxVelocity) { - Projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)-(float)Projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(Projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(Projectile.Center, 0, 0, 244, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = Projectile.Center + vector3; - Main.dust[num9].velocity = Projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } + Projectile.velocity.Normalize(); + Projectile.velocity *= maxVelocity; } } diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 95f13b11e5..f26b1a3e8c 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -1,4 +1,5 @@ using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -9,6 +10,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; + namespace CalamityMod.Projectiles.Boss { public class ProvidenceCrystal : ModProjectile @@ -42,42 +44,41 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Player player = Main.player[Projectile.owner]; - if (player.dead || NPC.CountNPCS(ModContent.NPCType()) < 1) + if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { Projectile.active = false; Projectile.netUpdate = true; return; } - bool dayTime = Main.dayTime && !BossRushEvent.BossRushActive; + Player proviTarget = Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target]; - Projectile.position.X = Main.player[Projectile.owner].Center.X - (Projectile.width / 2); - Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (Projectile.height / 2) + Main.player[Projectile.owner].gfxOffY - 360f; - if (Main.player[Projectile.owner].gravDir == -1f) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + + Projectile.position.X = proviTarget.Center.X - (Projectile.width / 2); + Projectile.position.Y = proviTarget.Center.Y - (Projectile.height / 2) + proviTarget.gfxOffY - 360f; + if (proviTarget.gravDir == -1f) { - Projectile.position.Y = Projectile.position.Y + 400f; - Projectile.rotation = 3.14f; + Projectile.position.Y += 400f; + Projectile.rotation = MathHelper.Pi; } else - { Projectile.rotation = 0f; - } + Projectile.position.X = (int)Projectile.position.X; Projectile.position.Y = (int)Projectile.position.Y; Projectile.velocity = Vector2.Zero; + Projectile.alpha -= 5; if (Projectile.alpha < 0) - { Projectile.alpha = 0; - } - if (Projectile.direction == 0) - { - Projectile.direction = Main.player[Projectile.owner].direction; - } + if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Dust dust34 = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, dayTime ? new Color(255, 200, Main.DiscoB) : new Color(Main.DiscoR, 200, 255), 1f)]; + Color BaseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); + float Brightness = 0.8f; + Color DustColor = Color.Lerp(BaseColor, Color.White, Brightness); + Dust dust34 = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, 267, 0f, 0f, 100, DustColor, 1f)]; dust34.velocity.X = 0f; dust34.noGravity = true; dust34.fadeIn = 1f; @@ -90,25 +91,28 @@ namespace CalamityMod.Projectiles.Boss // Increment timer Projectile.localAI[0] += 1f; - // Spawn daytime shards every 300 frames - // Spawn nighttime shards every 30 frames - if (Projectile.localAI[0] >= (dayTime ? 300f : 30f)) + // At day, fires every 300 frames but lasts 1500-3600 frames. + // At night, fires every 30 framges but lasts 210 frames. + // In GFB, fires at night rate for the first 210 frames, then at day rate for the next 1500. + bool dayAI = Projectile.maxPenetrate == (int)Providence.BossMode.Day || (Projectile.maxPenetrate >= (int)Providence.BossMode.Red && Projectile.timeLeft < 1500); + + if (Projectile.localAI[0] >= (dayAI ? 300f : 30f)) { // Spawn shards every 30 frames at night or at 300 frames during day - if (Projectile.localAI[0] % 30f == 0f || dayTime) + if (Projectile.localAI[0] % 30f == 0f || dayAI) { - SoundEngine.PlaySound(SoundID.Item109, Projectile.position); + SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); Projectile.netUpdate = true; if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = dayTime ? 15 : (Projectile.localAI[0] % 60f == 0f ? 15 : 10); - float speedX = dayTime ? -21f : -15f; + int totalProjectiles = dayAI ? 15 : (Projectile.localAI[0] % 60f == 0f ? 15 : 10); + float speedX = dayAI ? -21f : -15f; float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); float speedY = -3f; for (int i = 0; i < totalProjectiles; i++) { - float x4 = dayTime ? Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X : Main.rgbToHsl(new Color(Main.DiscoR, 200, 255)).X; - float randomSpread = dayTime ? 0f : Main.rand.Next(-150, 151) * 0.01f * (1f - lifeRatio); + float x4 = dayAI ? Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X : Main.rgbToHsl(new Color(Main.DiscoR, 200, 255)).X; + float randomSpread = dayAI ? 0f : Main.rand.Next(-150, 151) * 0.01f * (1f - lifeRatio); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX + speedAdjustment * i + randomSpread, speedY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, Projectile.whoAmI); } } @@ -120,10 +124,9 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); - } + public override bool CanHitPlayer(Player target) => false; + + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 8e20c1d772..fea9f3baea 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -1,4 +1,5 @@ -using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -7,6 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; + namespace CalamityMod.Projectiles.Boss { public class ProvidenceCrystalShard : ModProjectile @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = 34; Projectile.height = 34; Projectile.hostile = true; - Projectile.alpha = 255; + Projectile.Opacity = 0f; Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.ignoreWater = true; @@ -44,26 +46,39 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (!Main.dayTime || BossRushEvent.BossRushActive) + bool healerGuardianAlive = true; + if (CalamityGlobalNPC.doughnutBossHealer < 0 || !Main.npc[CalamityGlobalNPC.doughnutBossHealer].active) + healerGuardianAlive = false; + + Lighting.AddLight(Projectile.Center, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity); + + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + + // Night AI or Guardian Healer + if (Projectile.maxPenetrate != (int)Providence.BossMode.Day || healerGuardianAlive) Projectile.extraUpdates = 1; if (Projectile.timeLeft < 300) - { Projectile.tileCollide = true; - } + Color newColor2 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); - if (Projectile.alpha > 0) - { - Projectile.alpha -= 8; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - if (Projectile.alpha == 0) - { + + if (Projectile.Opacity < 1f) + Projectile.Opacity += 0.03f; + + if (Projectile.Opacity > 1f) + Projectile.Opacity = 1f; + + if (Projectile.Opacity == 1f) Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); - } + Projectile.velocity.X *= 0.995f; if (Projectile.velocity.Y < 0f) { @@ -72,47 +87,47 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.velocity.Y *= 1.06f; - float fallSpeed = (CalamityWorld.revenge || BossRushEvent.BossRushActive || !Main.dayTime) ? 3.5f : 3f; + float fallSpeed = (CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day)) ? 3.5f : 3f; if (Projectile.velocity.Y > fallSpeed) - { Projectile.velocity.Y = fallSpeed; - } } + if (Projectile.velocity.Y > -0.5f && Projectile.localAI[1] == 0f) { Projectile.localAI[1] = 1f; Projectile.velocity.Y = 0.5f; } - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - 1.57f; - int num3; - for (int num979 = 0; num979 < 2; num979 = num3 + 1) + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; + + for (int num979 = 0; num979 < 2; num979++) { if (Main.rand.NextBool(10)) { - Vector2 value55 = Vector2.UnitY.RotatedBy(num979 * 3.14159274f).RotatedBy(Projectile.rotation); + Vector2 value55 = Vector2.UnitY.RotatedBy(num979 * MathHelper.Pi).RotatedBy(Projectile.rotation); Dust dust24 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust24.noGravity = true; dust24.noLight = true; dust24.scale = Projectile.Opacity * Projectile.localAI[0]; dust24.position = Projectile.Center; - dust24.velocity = value55 * 2.5f; + dust24.velocity = value55; } - num3 = num979; } - for (int num980 = 0; num980 < 2; num980 = num3 + 1) + + for (int num980 = 0; num980 < 2; num980++) { if (Main.rand.NextBool(10)) { - Vector2 value56 = Vector2.UnitY.RotatedBy(num980 * 3.14159274f); + Vector2 value56 = Vector2.UnitY.RotatedBy(num980 * MathHelper.Pi); Dust dust25 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust25.noGravity = true; dust25.noLight = true; dust25.scale = Projectile.Opacity * Projectile.localAI[0]; dust25.position = Projectile.Center; - dust25.velocity = value56 * 2.5f; + dust25.velocity = value56; } - num3 = num980; } + if (Main.rand.NextBool(10)) { float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; @@ -123,7 +138,7 @@ namespace CalamityMod.Projectiles.Boss { vector136.Normalize(); } - vector136 *= 20f + Main.rand.NextFloat() * 100f; + vector136 *= 16f + Main.rand.NextFloat() * 16f; Vector2 vector137 = Projectile.Center + vector136; Point point3 = vector137.ToTileCoordinates(); bool flag52 = true; @@ -156,18 +171,17 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); + SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); + Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(MathHelper.Pi); float num69 = Main.rand.Next(7, 13); - Vector2 value5 = new Vector2(2.1f, 2f); + Vector2 value5 = new Vector2(1.6f, 1.5f); Color newColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); newColor.A = 255; - float num72; - for (float num70 = 0f; num70 < num69; num70 = num72 + 1f) + for (float num70 = 0f; num70 < num69; num70++) { int num71 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); Main.dust[num71].position = Projectile.Center; - Main.dust[num71].velocity = spinningpoint.RotatedBy(6.28318548f * num70 / num69) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[num71].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * num70 / num69) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num71].noGravity = true; Main.dust[num71].scale = 2f; Main.dust[num71].fadeIn = Main.rand.NextFloat() * 2f; @@ -177,13 +191,12 @@ namespace CalamityMod.Projectiles.Boss dust = dust11; dust.fadeIn /= 2f; dust11.color = new Color(255, 255, 255, 255); - num72 = num70; } - for (float num73 = 0f; num73 < num69; num73 = num72 + 1f) + for (float num73 = 0f; num73 < num69; num73++) { int num74 = Dust.NewDust(Projectile.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); Main.dust[num74].position = Projectile.Center; - Main.dust[num74].velocity = spinningpoint.RotatedBy(6.28318548f * num73 / num69) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); + Main.dust[num74].velocity = spinningpoint.RotatedBy(MathHelper.TwoPi * num73 / num69) * value5 * (0.8f + Main.rand.NextFloat() * 0.4f); Dust dust = Main.dust[num74]; dust.velocity *= Main.rand.NextFloat() * 0.8f; dust.noGravity = true; @@ -195,13 +208,22 @@ namespace CalamityMod.Projectiles.Boss dust = dust12; dust.fadeIn /= 2f; dust12.color = new Color(255, 255, 255, 255); - num72 = num73; } } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => new Color(255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity, 0); + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); + // In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + // If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) + return; + + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 0, 10); } } } diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 5d809207f4..21572206b7 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -49,28 +49,34 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - bool scissorLasers = CalamityWorld.revenge || !Main.dayTime || BossRushEvent.BossRushActive; + // Day mode by default but syncs with the boss + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].active) + Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + } + else + Projectile.maxPenetrate = (int)Providence.BossMode.Day; + + bool scissorLasers = CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day); Vector2? vector78 = null; if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) - { Projectile.velocity = -Vector2.UnitY; - } - if (Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType()) + if (Main.npc[(int)Projectile.ai[1]].active && (Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType() || Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType())) { - Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X, Main.npc[(int)Projectile.ai[1]].Center.Y + 32f); + Vector2 laserOffset = Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType() ? new Vector2(40f * Main.npc[(int)Projectile.ai[1]].direction, 20f) : Vector2.UnitY * 32f; + Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X, Main.npc[(int)Projectile.ai[1]].Center.Y) + laserOffset; Projectile.position = fireFrom - new Vector2(Projectile.width, Projectile.height) / 2f; } else Projectile.Kill(); if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) - { Projectile.velocity = -Vector2.UnitY; - } - float num801 = 1f; + float num801 = Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType() ? 0.66f : 1f; Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= (scissorLasers ? 100f : 180f)) { @@ -80,23 +86,19 @@ namespace CalamityMod.Projectiles.Boss Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * num801; if (Projectile.scale > num801) - { Projectile.scale = num801; - } float num804 = Projectile.velocity.ToRotation(); num804 += Projectile.ai[0]; Projectile.rotation = num804 - MathHelper.PiOver2; Projectile.velocity = num804.ToRotationVector2(); - float num805 = 3f; //3f + float num805 = 3f; float num806 = Projectile.width; Vector2 samplingPoint = Projectile.Center; if (vector78.HasValue) - { samplingPoint = vector78.Value; - } float[] array3 = new float[(int)num805]; Collision.LaserScan(samplingPoint, Projectile.velocity, num806 * Projectile.scale, 2400f, array3); @@ -109,17 +111,15 @@ namespace CalamityMod.Projectiles.Boss // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) - { num807 = 2400f; - } - int dustType = (Main.dayTime && !BossRushEvent.BossRushActive) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; - float amount = 0.5f; //0.5f - Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); //length of laser, linear interpolation + int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + float amount = 0.5f; + Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); // Length of laser, linear interpolation Vector2 vector79 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); for (int num809 = 0; num809 < 2; num809++) { - float num810 = Projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num810 = Projectile.velocity.ToRotation() + (Main.rand.NextBool() ? -1f : 1f) * MathHelper.PiOver2; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector80 = new Vector2((float)Math.Cos(num810) * num811, (float)Math.Sin(num810) * num811); int num812 = Dust.NewDust(vector79, 0, 0, dustType, vector80.X, vector80.Y, 0, default, 1f); @@ -143,24 +143,25 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { if (Projectile.velocity == Vector2.Zero) - { return false; - } - bool dayTime = Main.dayTime && !BossRushEvent.BossRushActive; + + bool dayTime = Projectile.maxPenetrate == (int)Providence.BossMode.Day; Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight", AssetRequestMode.ImmediateLoad).Value; Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMidNight", AssetRequestMode.ImmediateLoad).Value; Texture2D texture2D21 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; + float num223 = Projectile.localAI[1]; //length of laser - Color color44 = dayTime ? new Color(250, 250, 250, 0) : new Color(175, 175, 250, 0) * 0.9f; + Color color44 = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0) * 0.9f; Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); num223 -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; Vector2 value20 = Projectile.Center; value20 += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; + if (num223 > 0f) { float num224 = 0f; @@ -168,22 +169,23 @@ namespace CalamityMod.Projectiles.Boss while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) - { rectangle7.Height = (int)(num223 - num224); - } + Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, Projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); num224 += rectangle7.Height * Projectile.scale; value20 += Projectile.velocity * rectangle7.Height * Projectile.scale; rectangle7.Y += 36; + if (rectangle7.Y + rectangle7.Height > texture2D20.Height) - { rectangle7.Y = 0; - } } } + Vector2 vector2 = value20 - Main.screenPosition; sourceRectangle2 = null; + Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + return false; } @@ -197,24 +199,26 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { if (projHitbox.Intersects(targetHitbox)) - { return true; - } + float num6 = 0f; if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], 22f * Projectile.scale, ref num6)) - { return true; - } + return false; } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - if (damage <= 0) + // In GFB, "real damage" is replaced with negative healing + if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) + damage = 0; + + // If the player is dodging, don't apply debuffs + if (damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red || target.creativeGodMode) return; - int buffType = (Main.dayTime && !BossRushEvent.BossRushActive) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 600); + ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 600, 20); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index a02985c451..1496807ebe 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[1] == 0f) { Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } } diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index d636e11651..c10a9513e3 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss private void EmitDust() { - SoundEngine.PlaySound(SoundID.Item109, Projectile.position); + SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); for (int num193 = 0; num193 < 6; num193++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1.5f); diff --git a/Projectiles/Boss/SCalBrimstoneFireblast.cs b/Projectiles/Boss/SCalBrimstoneFireblast.cs index 287df1e445..c7dc8f0f19 100644 --- a/Projectiles/Boss/SCalBrimstoneFireblast.cs +++ b/Projectiles/Boss/SCalBrimstoneFireblast.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } float inertia = revenge ? 80f : 100f; diff --git a/Projectiles/Boss/SCalBrimstoneGigablast.cs b/Projectiles/Boss/SCalBrimstoneGigablast.cs index b78ba96b91..88b22d79f6 100644 --- a/Projectiles/Boss/SCalBrimstoneGigablast.cs +++ b/Projectiles/Boss/SCalBrimstoneGigablast.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } int target = Player.FindClosest(Projectile.Center, 1, 1); diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index 34934aaad9..e472821233 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); for (int dust = 0; dust <= 3; dust++) { float num463 = Main.rand.Next(-10, 11); diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index c3a47086fc..a7ec4f6f25 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Projectiles.Boss { @@ -11,7 +12,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Projectile.type] = 10; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } @@ -19,49 +20,48 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; - Projectile.width = 52; - Projectile.height = 48; + Projectile.width = 45; + Projectile.height = 45; Projectile.hostile = true; - Projectile.Opacity = 0f; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 1800; + Projectile.alpha = 125; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.5f, 0.3f, 0f); + Lighting.AddLight(Projectile.Center, 0.5f * Projectile.Opacity, 0.3f * Projectile.Opacity, 0f); + Projectile.ai[0] += 1f; Projectile.frameCounter++; - if (Projectile.frameCounter > 9) + if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - Projectile.frame = 0; + if (Projectile.ai[0] < 1620f) + { + if (Projectile.frame >= 4) + { + Projectile.frame = 0; + } + } + if (Projectile.ai[0] > 1620f) + { + Projectile.damage = 0; + } + else if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.Kill(); + } Projectile.velocity *= 0.995f; - if (Projectile.timeLeft < 180) + if (Math.Abs(Projectile.velocity.X) > 0f) { - Projectile.damage = 0; - if (Projectile.Opacity > 0f) - { - Projectile.Opacity -= 0.02f; - if (Projectile.Opacity <= 0f) - { - Projectile.Opacity = 0f; - Projectile.Kill(); - } - } - } - else if (Projectile.Opacity < 0.9f) - { - Projectile.Opacity += 0.12f; - if (Projectile.Opacity > 0.9f) - Projectile.Opacity = 0.9f; + Projectile.spriteDirection = -Projectile.direction; } } @@ -76,15 +76,14 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => Projectile.Opacity >= 0.9f; + public override bool CanHitPlayer(Player target) => Projectile.ai[0] < 1620f; public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage <= 0) return; - if (Projectile.Opacity >= 0.9f) - target.AddBuff(ModContent.BuffType(), 240, true); + target.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/Projectiles/Boss/SandPoisonCloud.png b/Projectiles/Boss/SandPoisonCloud.png index 412c5607a5..5b47b8afa7 100644 Binary files a/Projectiles/Boss/SandPoisonCloud.png and b/Projectiles/Boss/SandPoisonCloud.png differ diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs index 5b919a9365..f8d032beef 100644 --- a/Projectiles/Boss/SandPoisonCloudOldDuke.cs +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -3,67 +3,65 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Projectiles.Boss { public class SandPoisonCloudOldDuke : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/Boss/SandPoisonCloud"; - public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Projectile.type] = 10; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - Projectile.width = 52; - Projectile.height = 48; + Projectile.width = 45; + Projectile.height = 45; Projectile.hostile = true; - Projectile.Opacity = 0f; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 1800; + Projectile.alpha = 80; CooldownSlot = ImmunityCooldownID.Bosses; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.5f, 0.3f, 0f); + Lighting.AddLight(Projectile.Center, 0.1f, 0.7f, 0f); + Projectile.ai[0] += 1f; Projectile.frameCounter++; - if (Projectile.frameCounter > 9) + if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - Projectile.frame = 0; + if (Projectile.ai[0] < 1620f) + { + if (Projectile.frame >= 4) + { + Projectile.frame = 0; + } + } + if (Projectile.ai[0] > 1620f) + { + Projectile.damage = 0; + } + else if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.Kill(); + } Projectile.velocity *= 0.995f; - if (Projectile.timeLeft < 180) + if (Math.Abs(Projectile.velocity.X) > 0f) { - Projectile.damage = 0; - if (Projectile.Opacity > 0f) - { - Projectile.Opacity -= 0.02f; - if (Projectile.Opacity <= 0f) - { - Projectile.Opacity = 0f; - Projectile.Kill(); - } - } - } - else if (Projectile.Opacity < 0.9f) - { - Projectile.Opacity += 0.12f; - if (Projectile.Opacity > 0.9f) - Projectile.Opacity = 0.9f; + Projectile.spriteDirection = -Projectile.direction; } } @@ -78,15 +76,14 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => Projectile.Opacity >= 0.9f; + public override bool CanHitPlayer(Player target) => Projectile.ai[0] < 1620f; public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage <= 0) return; - if (Projectile.Opacity >= 0.9f) - target.AddBuff(ModContent.BuffType(), 240, true); + target.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.png b/Projectiles/Boss/SandPoisonCloudOldDuke.png new file mode 100644 index 0000000000..059ee53c8b Binary files /dev/null and b/Projectiles/Boss/SandPoisonCloudOldDuke.png differ diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index 667cbb0ff7..217677cc04 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Zombie103, Projectile.position); + SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 64; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 14d3a21cbc..d57a0bde7c 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(ExplosionSound, Projectile.position); + SoundEngine.PlaySound(ExplosionSound, Projectile.Center); Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 160; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); diff --git a/Projectiles/Boss/ShadowflameFireball.cs b/Projectiles/Boss/ShadowflameFireball.cs index e26dedd352..2e11426c6c 100644 --- a/Projectiles/Boss/ShadowflameFireball.cs +++ b/Projectiles/Boss/ShadowflameFireball.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } // Main chunky dark purple dust at the front of the fireball @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); int killDust = 20; for (int i = 0; i < killDust; ++i) { diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 7626b778fa..c5baeb75b7 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Item73, Projectile.position); + SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); } int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 1f); diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index e0cc8614c8..13421830c7 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using System.IO; using Terraria; @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss if (damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(BuffID.Confused, 120); + target.AddBuff(BuffID.Dazed, 120); } } } diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index 3dd79bc2d6..85f4e7f83f 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - SoundEngine.PlaySound(FlareSound, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index e54277cd74..26a23fe4b5 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(FlareSound, Projectile.position); + SoundEngine.PlaySound(FlareSound, Projectile.Center); int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { diff --git a/Projectiles/Boss/SwirlingFire.cs b/Projectiles/Boss/SwirlingFire.cs index 6ee43cd99b..70f7949ba0 100644 --- a/Projectiles/Boss/SwirlingFire.cs +++ b/Projectiles/Boss/SwirlingFire.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,11 +31,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Vector2 fireVelocity = (Time / 6f).ToRotationVector2() * Main.rand.NextFloat(1.7f, 2.2f); - Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3f, 3f), Main.dayTime ? 6 : 267); + Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3f, 3f), CalamityWorld.getFixedBoi || !Main.dayTime ? 267 : 6); fire.velocity = fireVelocity.RotatedBy(MathHelper.PiOver2); fire.scale = Main.rand.NextFloat(1.3f, 1.45f); fire.noGravity = true; - if (!Main.dayTime) + if (CalamityWorld.getFixedBoi) + fire.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + else if (!Main.dayTime) fire.color = Color.Lerp(Color.Cyan, Color.BlueViolet, Main.rand.NextFloat()); Dust.CloneDust(fire).velocity = fireVelocity.RotatedBy(-MathHelper.PiOver2); diff --git a/Projectiles/Boss/ToxicCloud.cs b/Projectiles/Boss/ToxicCloud.cs index 2a1ef6061b..d8b8cb12c7 100644 --- a/Projectiles/Boss/ToxicCloud.cs +++ b/Projectiles/Boss/ToxicCloud.cs @@ -5,17 +5,16 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Projectiles.Boss { public class ToxicCloud : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/Enemy/ToxicMinnowCloud"; - public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Projectile.type] = 10; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } @@ -23,14 +22,14 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; - Projectile.width = 52; - Projectile.height = 48; + Projectile.width = 45; + Projectile.height = 45; Projectile.hostile = true; - Projectile.Opacity = 0f; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 900; + Projectile.alpha = 125; } public override void AI() @@ -41,34 +40,32 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Length() < (bossRush ? 6.25f : 5f)) Projectile.velocity *= 1.01f; + Projectile.ai[0] += 1f; Projectile.frameCounter++; - if (Projectile.frameCounter > 9) + if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - Projectile.frame = 0; - - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 860f) + if (Projectile.ai[0] < 860f) { - Projectile.damage = 0; - if (Projectile.Opacity > 0f) + if (Projectile.frame >= 4) { - Projectile.Opacity -= 0.02f; - if (Projectile.Opacity <= 0f) - { - Projectile.Opacity = 0f; - Projectile.Kill(); - } + Projectile.frame = 0; } } - else if (Projectile.Opacity < 0.9f) + if (Projectile.ai[0] > 860f) { - Projectile.Opacity += 0.12f; - if (Projectile.Opacity > 0.9f) - Projectile.Opacity = 0.9f; + Projectile.damage = 0; + } + else if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.Kill(); + } + + if (Math.Abs(Projectile.velocity.X) > 0f) + { + Projectile.spriteDirection = -Projectile.direction; } } @@ -83,19 +80,16 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => Projectile.Opacity >= 0.9f; + public override bool CanHitPlayer(Player target) => Projectile.ai[0] < 860f; public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage <= 0) return; - if (Projectile.Opacity >= 0.9f) - { - target.AddBuff(BuffID.Poisoned, 240); - target.AddBuff(BuffID.Venom, 240); - target.AddBuff(ModContent.BuffType(), 240); - } + target.AddBuff(BuffID.Poisoned, 240); + target.AddBuff(BuffID.Venom, 240); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Boss/ToxicCloud.png b/Projectiles/Boss/ToxicCloud.png new file mode 100644 index 0000000000..0d0464acbe Binary files /dev/null and b/Projectiles/Boss/ToxicCloud.png differ diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index 15a40dbcf7..ed561ead42 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } if (Projectile.velocity.Length() < 12f) @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); + SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); for (int num584 = 0; num584 < 6; num584++) { int num585 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, -Projectile.velocity.X * 0.2f, -Projectile.velocity.Y * 0.2f, 100, default, 2.5f); diff --git a/Projectiles/Boss/YharonBulletHellVortex.cs b/Projectiles/Boss/YharonBulletHellVortex.cs index c9382948b8..2771501c9e 100644 --- a/Projectiles/Boss/YharonBulletHellVortex.cs +++ b/Projectiles/Boss/YharonBulletHellVortex.cs @@ -1,6 +1,8 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using System.IO; using CalamityMod.NPCs.Yharon; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,7 @@ namespace CalamityMod.Projectiles.Boss public class YharonBulletHellVortex : ModProjectile { public ref float TimeCountdown => ref Projectile.ai[0]; + public int victim = 0; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { @@ -29,9 +32,19 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 60000; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(victim); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + victim = reader.ReadInt32(); + } + public override void AI() { - if (Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType()) + if ((Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType()) || CalamityWorld.getFixedBoi) { if (TimeCountdown > 0f) { @@ -41,6 +54,56 @@ namespace CalamityMod.Projectiles.Boss Projectile.scale = MathHelper.Clamp(Projectile.scale + 0.05f, 0f, 1f); TimeCountdown--; + + // chase players in the zenith seed + if (CalamityWorld.getFixedBoi) + { + Projectile.hostile = true; + Projectile.width = Projectile.height = (int)(408f * Projectile.scale); + float inertia = 5f; + float speed = 5.35f; + float minDist = 160f; + if (victim >= 0 && Main.player[victim].active && !Main.player[victim].dead) + { + if (Projectile.Distance(Main.player[victim].Center) > minDist) + { + Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[victim].Center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; + } + } + else + { + victim = Player.FindClosest(Projectile.Center, 1, 1); + Projectile.netUpdate = true; + } + + // Fly away from other vortices + float pushForce = 0.05f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + float distancegate = 360f; + if (sameProjType && taxicabDist < distancegate) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } + } + } } else Projectile.Kill(); diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index f0f76a3845..041cd236ff 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 0.5f }, Projectile.position); + SoundEngine.PlaySound(SoundID.Item14 with { Volume = SoundID.Item14.Volume * 0.5f }, Projectile.Center); Projectile.ExpandHitboxBy(144); for (int d = 0; d < 2; d++) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 44b89053a2..9e360b7cb5 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -166,6 +166,10 @@ namespace CalamityMod.Projectiles if (pointBlankShotDuration > 0) pointBlankShotDuration--; + // Reduce secondary yoyo damage if the player has Yoyo Glove + if (Main.player[projectile.owner].yoyoGlove && projectile.aiStyle == 99 && projectile.ai[0] == 1f) + projectile.damage = (int)(projectile.originalDamage * 0.5f); + // Chlorophyte Crystal AI rework. if (projectile.type == ProjectileID.CrystalLeaf) return ChlorophyteCrystalAI.DoChlorophyteCrystalAI(projectile); @@ -218,7 +222,7 @@ namespace CalamityMod.Projectiles RequiresManualResurrection = false; } - if (projectile.type == ProjectileID.Skull && projectile.ai[0] == 0f) + if (projectile.type == ProjectileID.Skull && (projectile.ai[0] == 0f || projectile.ai[0] == -2f)) { if (projectile.alpha > 0) projectile.alpha -= 75; @@ -230,6 +234,20 @@ namespace CalamityMod.Projectiles if (projectile.frame > 2) projectile.frame = 0; + // Accelerate if fired in a spread from Skeletron + if (projectile.ai[0] == -2f) + { + if (projectile.velocity.Length() < 15f) + { + projectile.velocity *= 1.02f; + if (projectile.velocity.Length() > 15f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 12f; + } + } + } + for (int num172 = 0; num172 < 2; num172++) { int num173 = Dust.NewDust(new Vector2(projectile.position.X + 4f, projectile.position.Y + 4f), projectile.width - 8, projectile.height - 8, 6, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 2f); @@ -239,81 +257,84 @@ namespace CalamityMod.Projectiles Main.dust[num173].velocity.Y *= 0.3f; } - float num180 = (float)Math.Sqrt(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y); - float num181 = projectile.localAI[0]; - - if (num181 == 0f) + if (projectile.ai[0] == 0f) { - projectile.localAI[0] = num180; - num181 = num180; - } + float num180 = (float)Math.Sqrt(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y); + float num181 = projectile.localAI[0]; - float num182 = projectile.position.X; - float num183 = projectile.position.Y; - float num184 = 300f; - bool flag4 = false; - int num185 = 0; - - if (projectile.ai[1] == 0f) - { - for (int num186 = 0; num186 < Main.maxNPCs; num186++) + if (num181 == 0f) { - if (Main.npc[num186].CanBeChasedBy(this) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num186 + 1))) + projectile.localAI[0] = num180; + num181 = num180; + } + + float num182 = projectile.position.X; + float num183 = projectile.position.Y; + float num184 = 300f; + bool flag4 = false; + int num185 = 0; + + if (projectile.ai[1] == 0f) + { + for (int num186 = 0; num186 < Main.maxNPCs; num186++) { - float num187 = Main.npc[num186].position.X + (float)(Main.npc[num186].width / 2); - float num188 = Main.npc[num186].position.Y + (float)(Main.npc[num186].height / 2); - float num189 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num187) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num188); - if (num189 < num184 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num186].position, Main.npc[num186].width, Main.npc[num186].height)) + if (Main.npc[num186].CanBeChasedBy(this) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num186 + 1))) { - num184 = num189; - num182 = num187; - num183 = num188; - flag4 = true; - num185 = num186; + float num187 = Main.npc[num186].position.X + (float)(Main.npc[num186].width / 2); + float num188 = Main.npc[num186].position.Y + (float)(Main.npc[num186].height / 2); + float num189 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num187) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num188); + if (num189 < num184 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num186].position, Main.npc[num186].width, Main.npc[num186].height)) + { + num184 = num189; + num182 = num187; + num183 = num188; + flag4 = true; + num185 = num186; + } } } + + if (flag4) + projectile.ai[1] = num185 + 1; + + flag4 = false; } + if (projectile.ai[1] > 0f) + { + int num190 = (int)(projectile.ai[1] - 1f); + if (Main.npc[num190].active && Main.npc[num190].CanBeChasedBy(this, ignoreDontTakeDamage: true) && !Main.npc[num190].dontTakeDamage) + { + float num191 = Main.npc[num190].position.X + (float)(Main.npc[num190].width / 2); + float num192 = Main.npc[num190].position.Y + (float)(Main.npc[num190].height / 2); + if (Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num191) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num192) < 1000f) + { + flag4 = true; + num182 = Main.npc[num190].position.X + (float)(Main.npc[num190].width / 2); + num183 = Main.npc[num190].position.Y + (float)(Main.npc[num190].height / 2); + } + } + else + projectile.ai[1] = 0f; + } + + if (!projectile.friendly) + flag4 = false; + if (flag4) - projectile.ai[1] = num185 + 1; - - flag4 = false; - } - - if (projectile.ai[1] > 0f) - { - int num190 = (int)(projectile.ai[1] - 1f); - if (Main.npc[num190].active && Main.npc[num190].CanBeChasedBy(this, ignoreDontTakeDamage: true) && !Main.npc[num190].dontTakeDamage) { - float num191 = Main.npc[num190].position.X + (float)(Main.npc[num190].width / 2); - float num192 = Main.npc[num190].position.Y + (float)(Main.npc[num190].height / 2); - if (Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num191) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num192) < 1000f) - { - flag4 = true; - num182 = Main.npc[num190].position.X + (float)(Main.npc[num190].width / 2); - num183 = Main.npc[num190].position.Y + (float)(Main.npc[num190].height / 2); - } + float num193 = num181; + Vector2 vector9 = new(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num194 = num182 - vector9.X; + float num195 = num183 - vector9.Y; + float num196 = (float)Math.Sqrt(num194 * num194 + num195 * num195); + num196 = num193 / num196; + num194 *= num196; + num195 *= num196; + int num197 = 32; + projectile.velocity.X = (projectile.velocity.X * (float)(num197 - 1) + num194) / (float)num197; + projectile.velocity.Y = (projectile.velocity.Y * (float)(num197 - 1) + num195) / (float)num197; } - else - projectile.ai[1] = 0f; - } - - if (!projectile.friendly) - flag4 = false; - - if (flag4) - { - float num193 = num181; - Vector2 vector9 = new(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num194 = num182 - vector9.X; - float num195 = num183 - vector9.Y; - float num196 = (float)Math.Sqrt(num194 * num194 + num195 * num195); - num196 = num193 / num196; - num194 *= num196; - num195 *= num196; - int num197 = 32; - projectile.velocity.X = (projectile.velocity.X * (float)(num197 - 1) + num194) / (float)num197; - projectile.velocity.Y = (projectile.velocity.Y * (float)(num197 - 1) + num195) / (float)num197; } projectile.spriteDirection = projectile.direction; @@ -419,8 +440,8 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.Starfury) { - if (projectile.timeLeft > 45) - projectile.timeLeft = 45; + if (projectile.timeLeft > 75) + projectile.timeLeft = 75; if (projectile.ai[1] == 0f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { @@ -1450,8 +1471,8 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.AncientDoomProjectile) { - if (projectile.velocity.Length() < 12f) - projectile.velocity *= 1.02f; + if (projectile.velocity.Length() < 8f) + projectile.velocity *= 1.01f; } else if (projectile.type == ProjectileID.CultistBossLightningOrb && BossRushEvent.BossRushActive) @@ -2002,7 +2023,7 @@ namespace CalamityMod.Projectiles if (projectile.CountsAsClass() && stealthStrike) { - int gloveArmorPenAmt = modPlayer.nanotech ? 15 : (modPlayer.electricianGlove ? 10 : 8); + int gloveArmorPenAmt = modPlayer.nanotech ? 15 : 8; if (modPlayer.filthyGlove || modPlayer.bloodyGlove) projectile.ArmorPenetration += gloveArmorPenAmt; } @@ -2029,18 +2050,6 @@ namespace CalamityMod.Projectiles projectile.damage += 15; } - // Setting this in SetDefaults didn't work - switch (projectile.type) - { - case ProjectileID.Bee: - case ProjectileID.Wasp: - case ProjectileID.TinyEater: - case ProjectileID.GiantBee: - case ProjectileID.Bat: - projectile.extraUpdates = 1; - break; - } - if (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee) { if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660 @@ -2055,6 +2064,24 @@ namespace CalamityMod.Projectiles frameOneHacksExecuted = true; } + // Setting this in SetDefaults didn't work + switch (projectile.type) + { + case ProjectileID.RockGolemRock: + case ProjectileID.BloodShot: + case ProjectileID.DandelionSeed: + projectile.extraUpdates = CalamityWorld.revenge ? 1 : 0; + break; + + case ProjectileID.Bee: + case ProjectileID.Wasp: + case ProjectileID.TinyEater: + case ProjectileID.GiantBee: + case ProjectileID.Bat: + projectile.extraUpdates = 1; + break; + } + // Accelerate for 1.5 seconds to full velocity if (projectile.type == ProjectileID.HallowBossLastingRainbow && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) { @@ -2094,7 +2121,7 @@ namespace CalamityMod.Projectiles if (!projectile.npcProj && !projectile.trap && projectile.friendly && projectile.damage > 0) { - if (modPlayer.fungalSymbiote && projectile.IsTrueMelee()) + if (modPlayer.fungalSymbiote && CalamityLists.MushroomProjectileIDs.Contains(projectile.type)) { if (Main.player[projectile.owner].miscCounter % 6 == 0 && projectile.FinalExtraUpdate()) { @@ -2115,11 +2142,11 @@ namespace CalamityMod.Projectiles } vector24 -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f; Vector2 newCenter = player.RotatedRelativePoint(player.position + vector24, true) + projectile.velocity; - Projectile.NewProjectile(projectile.GetSource_FromThis(), newCenter, Vector2.Zero, ProjectileID.Mushroom, (int)(projectile.damage * 0.15), 0f, projectile.owner); + Projectile.NewProjectile(projectile.GetSource_FromThis(), newCenter, Vector2.Zero, ProjectileID.Mushroom, 0, 0f, projectile.owner); } else { - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileID.Mushroom, (int)(projectile.damage * 0.15), 0f, projectile.owner); + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileID.Mushroom, 0, 0f, projectile.owner); } } } @@ -2261,7 +2288,7 @@ namespace CalamityMod.Projectiles } break; case CalamityGlobalBuff.ModdedFlaskEnchant: - int dustType = player.Calamity().aWeapon ? ModContent.DustType() : DustID.Stone; + int dustType = player.Calamity().flaskHoly ? (int)CalamityDusts.ProfanedFire : player.Calamity().flaskBrimstone ? ModContent.DustType() : DustID.Stone; if (Main.rand.NextBool(4)) { int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); @@ -2278,9 +2305,9 @@ namespace CalamityMod.Projectiles if (projectile.CountsAsClass() || projectile.CountsAsClass()) { - if (player.Calamity().aWeapon || player.Calamity().armorCrumbling) + if (player.Calamity().flaskBrimstone || player.Calamity().flaskCrumbling || player.Calamity().flaskHoly) { - int dustType = player.Calamity().aWeapon ? ModContent.DustType() : DustID.Stone; + int dustType = player.Calamity().flaskHoly ? (int)CalamityDusts.ProfanedFire : player.Calamity().flaskBrimstone ? ModContent.DustType() : DustID.Stone; if (Main.rand.NextBool(4)) { int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, new Color(), 1f); @@ -2461,7 +2488,7 @@ namespace CalamityMod.Projectiles } #endregion - #region CanDamage + #region CanDamage + CanHit public override bool? CanDamage(Projectile projectile) { if (projectile.hostile && (projectile.damage - (int)(damageReduction * (Main.expertMode ? 0.25f : 0.5f)) <= 0)) @@ -2491,6 +2518,16 @@ namespace CalamityMod.Projectiles } return null; } + + // Cultist lightning orbs cannot hit players specifically. This could probably be switched to CanDamage? + public override bool CanHitPlayer(Projectile projectile, Player target) + { + if (projectile.type == ProjectileID.CultistBossLightningOrb) + { + return false; + } + return true; + } #endregion #region Drawing @@ -2599,6 +2636,14 @@ namespace CalamityMod.Projectiles } } + if (CalamityWorld.getFixedBoi && NPC.AnyNPCs(NPCType())) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + var midnightShader = Terraria.Graphics.Shaders.GameShaders.Armor.GetShaderFromItemId(ItemID.MidnightRainbowDye); + midnightShader.Apply(); + } + return true; } #endregion @@ -2617,7 +2662,7 @@ namespace CalamityMod.Projectiles for (int i = 0; i < 2; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int damage = (int)player.GetTotalDamage().ApplyTo(25); + int damage = (int)player.GetTotalDamage().ApplyTo(20); int soul = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileType(), damage, 0f, projectile.owner); Main.projectile[soul].tileCollide = false; if (soul.WithinBounds(Main.maxProjectiles)) @@ -2627,7 +2672,7 @@ namespace CalamityMod.Projectiles if (modPlayer.scuttlersJewel && stealthStrike && modPlayer.scuttlerCooldown <= 0) { - int damage = (int)player.GetTotalDamage().ApplyTo(20); + int damage = (int)player.GetTotalDamage().ApplyTo(15); int spike = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), damage, projectile.knockBack, projectile.owner); Main.projectile[spike].frame = 4; if (spike.WithinBounds(Main.maxProjectiles)) @@ -2648,17 +2693,6 @@ namespace CalamityMod.Projectiles } #endregion - #region CanHit - public override bool CanHitPlayer(Projectile projectile, Player target) - { - if (projectile.type == ProjectileID.CultistBossLightningOrb) - { - return false; - } - return true; - } - #endregion - #region LifeSteal public static bool CanSpawnLifeStealProjectile(float healMultiplier, float healAmount) { diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 9753a1dd85..449680f5eb 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -134,7 +134,10 @@ namespace CalamityMod.Projectiles { ProjectileID.LostSoulFriendly, pointBlank }, // TODO -- why does LostSoulFriendly have point blank enabled { ProjectileID.LostSoulHostile, Do(TileCollide) }, { ProjectileID.MeteorShot, standardBulletTweaks }, + + // TODO -- DELETE THIS LINE IN 1.4.4 PORT { ProjectileID.MiniRetinaLaser, Do(LocalIFrames(10)) }, + { ProjectileID.MonkStaffT1, Do(TrueMeleeNoSpeed, ScaleExact(3f)) }, // Sleepy Octopod { ProjectileID.MonkStaffT2, Do(TrueMelee, IDStaticIFrames(18)) }, // Ghastly Glaive { ProjectileID.MonkStaffT3, Do(ScaleRatio(2f)) }, // Sky Dragon's Fury @@ -174,7 +177,10 @@ namespace CalamityMod.Projectiles { ProjectileID.Rally, Do(LocalIFrames(10)) }, { ProjectileID.RedCounterweight, counterweightTweaks }, { ProjectileID.RedsYoyo, Do(LocalIFrames(10)) }, + + // TODO -- DELETE THIS LINE IN 1.4.4 PORT { ProjectileID.Retanimini, Do(LocalIFrames(10)) }, // Optic Staff (Mini Retinazer) + { ProjectileID.RocketSkeleton, defenseDamage }, // Skeleton Commando rockets { ProjectileID.RockGolemRock, defenseDamage }, { ProjectileID.RulerStab, trueMelee }, @@ -194,9 +200,12 @@ namespace CalamityMod.Projectiles { ProjectileID.SnowBallFriendly, pointBlank }, { ProjectileID.SolarFlareChainsaw, trueMeleeNoSpeed }, { ProjectileID.SolarFlareDrill, trueMeleeNoSpeed }, + + // TODO -- DELETE THIS LINE IN 1.4.4 PORT { ProjectileID.Spazmamini, Do(IDStaticIFrames(12)) }, // Optic Staff (Mini Spazmatism) + { ProjectileID.Spear, trueMelee }, - { ProjectileID.Spike, defenseDamage }, // UNKNOWN + { ProjectileID.Spike, defenseDamage }, // Santank spike balls { ProjectileID.Stake, pointBlank }, { ProjectileID.StardustChainsaw, trueMeleeNoSpeed }, { ProjectileID.StardustDrill, trueMeleeNoSpeed }, diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs index 35a8c043b8..1f7594a253 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal get => Projectile.ai[0]; set => Projectile.ai[0] = value; } - public const int Lifetime = 360; + public const int Lifetime = 240; public override void SetStaticDefaults() { DisplayName.SetDefault("Pulse Energy"); diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs index cb6c5b2a01..5bdf28ca94 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs @@ -29,10 +29,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.timeLeft = 180; - Projectile.penetrate = 4; + Projectile.penetrate = 2; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 45; } public override void AI() @@ -88,7 +90,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Main.myPlayer != Projectile.owner) return; // Explode if the projectile is a stealth strike projectile. - int totalEnergyParticlesToSpawn = 4; + int totalEnergyParticlesToSpawn = 3; if (Projectile.Calamity().stealthStrike) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); diff --git a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs index 10c3653ab9..fe4702575e 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs @@ -70,11 +70,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal LaserBurst(1.8f, 3f); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 90); - } - public override void Kill(int timeLeft) { int height = 20; diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index 8157ccfd43..ba15522214 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class HydraulicVoltCrasherProjectile : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; private int chargeCooldown = 0; public override void SetStaticDefaults() @@ -30,7 +31,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.hide = true; Projectile.ownerHitCheck = true; Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Projectile.scale = 1.75f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() @@ -54,13 +56,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal SoundEngine.PlaySound(SoundID.Item22, Projectile.position); Projectile.soundDelay = 30; } - Player player = Main.player[Projectile.owner]; - Vector2 center = player.RotatedRelativePoint(player.MountedCenter); + Vector2 center = Owner.RotatedRelativePoint(Owner.MountedCenter); - if (Main.myPlayer == player.whoAmI) + if (Main.myPlayer == Owner.whoAmI) { // Get the projectile owner's held item. If it's not a modded item, stop now to prevent weird errors. - Item heldItem = player.ActiveItem(); + Item heldItem = Owner.ActiveItem(); if (heldItem.type < ItemID.Count) { Projectile.Kill(); @@ -68,17 +69,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } // Update the damage of the holdout projectile constantly so that it decreases as charge decreases, even while in use. - Projectile.damage = player.GetWeaponDamage(heldItem); + Projectile.damage = Owner.GetWeaponDamage(heldItem); // Check if the player's held item still has sufficient charge. If so, and they're still using it, take a tiny bit of charge from it. CalamityGlobalItem modItem = heldItem.Calamity(); - if (player.channel && modItem.Charge >= HydraulicVoltCrasher.HoldoutChargeUse) + if (Owner.channel && modItem.Charge >= HydraulicVoltCrasher.HoldoutChargeUse) { modItem.Charge -= HydraulicVoltCrasher.HoldoutChargeUse; - float speed = player.inventory[player.selectedItem].shootSpeed * Projectile.scale; + float speed = Owner.inventory[Owner.selectedItem].shootSpeed * Projectile.scale; Vector2 toPointTo = Main.MouseWorld; - if (player.gravDir == -1f) + if (Owner.gravDir == -1f) { toPointTo.Y = Main.screenHeight - toPointTo.Y; } @@ -94,14 +95,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.Kill(); } } - player.ChangeDir((Projectile.velocity.X > 0).ToDirectionInt()); - player.heldProj = Projectile.whoAmI; + Owner.ChangeDir((Projectile.velocity.X > 0).ToDirectionInt()); + Owner.heldProj = Projectile.whoAmI; - player.itemAnimation = 2; - player.itemTime = 2; // Note: player.SetDummyItemTime(frame) exists in 1.4 which accomplishes this task + Owner.itemAnimation = 2; + Owner.itemTime = 2; // Note: Owner.SetDummyItemTime(frame) exists in 1.4 which accomplishes this task - player.itemRotation = (Projectile.velocity * player.direction).ToRotation(); - Projectile.direction = Projectile.spriteDirection = player.direction; + Owner.itemRotation = (Projectile.velocity * Owner.direction).ToRotation(); + Projectile.direction = Projectile.spriteDirection = Owner.direction; Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.direction == -1).ToInt() * MathHelper.Pi; if (Main.rand.NextBool(5)) @@ -112,7 +113,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal spawnPosition += Projectile.Center; Dust dust = Dust.NewDustPerfect(spawnPosition, 226); dust.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(2f, 3.6f); - dust.velocity += player.velocity * 0.4f; + dust.velocity += Owner.velocity * 0.4f; } Projectile.position = center - Projectile.Size * 0.5f; Projectile.position -= Projectile.velocity.ToRotation().ToRotationVector2() * 8f; @@ -126,12 +127,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal return; chargeCooldown = 60; TryToSuperchargeNPC(target); + int extraZaps = 0; for (int i = 0; i < Main.npc.Length; i++) { if (i != target.whoAmI && Main.npc[i].CanBeChasedBy(Projectile, false) && - Main.npc[i].Distance(target.Center) < 240f) + Main.npc[i].Distance(target.Center) < 240f && + extraZaps < 3) { + if (TryToSuperchargeNPC(Main.npc[i])) { for (float increment = 0f; increment <= 1f; increment += 0.05f) @@ -142,6 +146,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust.scale = 1.6f; dust.noGravity = true; } + extraZaps++; } } } @@ -149,11 +154,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public bool TryToSuperchargeNPC(NPC npc) { + int attackType = ModContent.ProjectileType(); + + // No more than 3 enemies with streams + if (Owner.ownedProjectileCounts[attackType] > 3) + return false; + // Prevent supercharging an enemy twice. for (int i = 0; i < Main.projectile.Length; i++) { if (Main.projectile[i].active && - Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].type == attackType && Main.projectile[i].ai[1] == i) { return false; @@ -161,8 +172,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), npc.Center, Vector2.Zero, - ModContent.ProjectileType(), - (int)(Projectile.damage * 0.8), + attackType, + Projectile.damage, 0f, Projectile.owner, 0f, diff --git a/Projectiles/DraedonsArsenal/LaserRifleShot.cs b/Projectiles/DraedonsArsenal/LaserRifleShot.cs index b8188b914d..6ef4dc5af8 100644 --- a/Projectiles/DraedonsArsenal/LaserRifleShot.cs +++ b/Projectiles/DraedonsArsenal/LaserRifleShot.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -52,11 +52,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal LaserBurst(1.8f, 3f); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - } - public override void Kill(int timeLeft) { int height = 60; diff --git a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs index d139e63139..f593e7dd23 100644 --- a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs +++ b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -93,12 +93,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal PlasmaBurst(1f, 1.6f); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.CursedInferno, 90); - } - public override void Kill(int timeLeft) { int height = 90; @@ -115,8 +109,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal PlasmaBurst(1.8f, 3.6f); // 60 dusts - int num3; - for (int num640 = 0; num640 < 400; num640 = num3 + 1) + for (int num640 = 0; num640 < 400; num640++) { float num641 = 16f; if (num640 < 300) @@ -126,7 +119,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (num640 < 100) num641 = 4f; - int num643 = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.Next(2) == 0 ? dust1 : dust2, 0f, 0f, 100, default, 1f); + int num643 = Dust.NewDust(Projectile.Center, 6, 6, Main.rand.NextBool() ? dust1 : dust2, 0f, 0f, 100, default, 1f); float num644 = Main.dust[num643].velocity.X; float num645 = Main.dust[num643].velocity.Y; @@ -163,8 +156,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust.velocity.Y = dust.velocity.Y + num645; dust.scale = scale; dust.noGravity = true; - - num3 = num640; } } diff --git a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs index 653f3d673d..cdd7acb542 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs @@ -2,7 +2,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.DraedonsArsenal { @@ -62,11 +61,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal return true; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127) * Projectile.Opacity, 2); diff --git a/Projectiles/DraedonsArsenal/VoltageStream.cs b/Projectiles/DraedonsArsenal/VoltageStream.cs index b605a37c0b..6c14ce5d2f 100644 --- a/Projectiles/DraedonsArsenal/VoltageStream.cs +++ b/Projectiles/DraedonsArsenal/VoltageStream.cs @@ -33,10 +33,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.height = 8; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 5; + Projectile.penetrate = 3; Projectile.timeLeft = 180; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = 40; } public override void AI() @@ -113,5 +113,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Projectile.damage = (int)(Projectile.damage * 0.75); } + + public override bool? CanHitNPC(NPC target) + { + if (Projectile.ai[1] == target.whoAmI) + return null; + return (bool?)false; + } } } diff --git a/Projectiles/Enemy/CragmawBubble.cs b/Projectiles/Enemy/CragmawBubble.cs deleted file mode 100644 index dd506e31ee..0000000000 --- a/Projectiles/Enemy/CragmawBubble.cs +++ /dev/null @@ -1,127 +0,0 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Enemy -{ - public class CragmawBubble : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidBubble"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Acid Bubble"); - Main.projFrames[Projectile.type] = 7; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.scale = 0.01f; - Projectile.hostile = true; - Projectile.tileCollide = false; - Projectile.alpha = 255; - Projectile.timeLeft = 240; - Projectile.penetrate = 1; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 6) - { - Projectile.frame = 0; - } - if (Projectile.localAI[1] < 1f) - { - Projectile.localAI[1] += 0.01f; - Projectile.scale += 0.01f; - Projectile.width = (int)(30f * Projectile.scale); - Projectile.height = (int)(30f * Projectile.scale); - } - else - { - Projectile.damage = 20; - Projectile.width = 30; - Projectile.height = 30; - Projectile.tileCollide = true; - } - if (Projectile.localAI[0] > 2f) - { - Projectile.alpha -= 20; - if (Projectile.alpha < 100) - { - Projectile.alpha = 100; - } - } - else - { - Projectile.localAI[0] += 1f; - } - if (Projectile.ai[1] > 30f) - { - if (Projectile.velocity.Y > -8f) - { - Projectile.velocity.Y -= 0.125f; - } - } - else - { - Projectile.ai[1] += 1f; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - for (int i = 0; i < 36; i++) - { - float angle = MathHelper.TwoPi * i / 36f; - float y = (float)Math.Sin(angle) * (float)Math.Log(Math.Abs(Math.Cos(angle))); - if (!float.IsNaN(y)) - { - Vector2 velocity = new Vector2((float)Math.Cos(angle), y) * 3f; - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = velocity; - dust.noGravity = true; - dust.scale = 2f; - - velocity = new Vector2(y, (float)Math.Cos(angle)) * 3f; - dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = velocity; - dust.noGravity = true; - dust.scale = 2f; - } - } - for (int i = 0; i < 4; i++) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float angle = MathHelper.TwoPi / 4f * i + MathHelper.PiOver2; - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle.ToRotationVector2().RotatedByRandom(0.1f) * 8f, ModContent.ProjectileType(), - Projectile.damage, 3f).tileCollide = true; - } - } - } - } -} diff --git a/Projectiles/Enemy/CragmawSpike.cs b/Projectiles/Enemy/CragmawSpike.cs index f301e6c4ee..6f48d272ad 100644 --- a/Projectiles/Enemy/CragmawSpike.cs +++ b/Projectiles/Enemy/CragmawSpike.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Enemy } public override void AI() { + Lighting.AddLight(Projectile.Center, 0.1f * Projectile.Opacity, 1f * Projectile.Opacity, 0f); + float maxSpeed = DownedBossSystem.downedPolterghast ? 19.5f : 11.5f; if (Projectile.velocity.Length() < maxSpeed) Projectile.velocity *= 1.024f; diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs index 66790f8e22..c5bf731338 100644 --- a/Projectiles/Enemy/CragmawVibeCheckChain.cs +++ b/Projectiles/Enemy/CragmawVibeCheckChain.cs @@ -1,6 +1,7 @@ -using Microsoft.Xna.Framework; +using System.IO; +using CalamityMod.World; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System.IO; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy @@ -60,6 +61,10 @@ namespace CalamityMod.Projectiles.Enemy } if (Projectile.WithinRange(Main.player[toTarget].Center, 16f)) { + if (CalamityWorld.getFixedBoi) + { + CombatText.NewText(Main.player[toTarget].getRect(), Color.Red, "Vibe check.", true); + } Projectile.localAI[0] = 1f; ReelingPlayer = true; Projectile.netUpdate = true; diff --git a/Projectiles/Enemy/DraedonLaser.cs b/Projectiles/Enemy/DraedonLaser.cs index 9be5899a9b..e3a34531dc 100644 --- a/Projectiles/Enemy/DraedonLaser.cs +++ b/Projectiles/Enemy/DraedonLaser.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Enemy if (Projectile.localAI[0] == 0f) { // play a sound frame 1. changed this from space gun sound because that sound was way too annoying - var sound = SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = CommonCalamitySounds.LaserCannonSound.Volume * 0.35f}, Projectile.Center); + var sound = SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = CommonCalamitySounds.LaserCannonSound.Volume * 0.23f}, Projectile.Center); Projectile.localAI[0] = 1f; } diff --git a/Projectiles/Enemy/GammRayBurst.cs b/Projectiles/Enemy/GammRayBurst.cs new file mode 100644 index 0000000000..b2cc116a09 --- /dev/null +++ b/Projectiles/Enemy/GammRayBurst.cs @@ -0,0 +1,141 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class GammaRayBurst : BaseLaserbeamProjectile + { + public PrimitiveTrail LaserDrawer + { + get; + set; + } = null; + + public int OwnerIndex + { + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; + } + + public override float MaxScale => 10f; + public override float MaxLaserLength => 4800f; + public override float Lifetime => 300; + public override Color LaserOverlayColor => new Color(0, 200, 50, 100); + public override Color LightCastColor => Color.White; + public override Texture2D LaserBeginTexture => ModContent.Request(Texture).Value; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamMiddle", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/AresLaserBeamEnd", AssetRequestMode.ImmediateLoad).Value; + public override string Texture => "CalamityMod/Projectiles/Boss/AresLaserBeamStart"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("G-FUEL BEAM"); + Main.projFrames[Projectile.type] = 5; + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + } + + public override void SetDefaults() + { + Projectile.Calamity().DealsDefenseDamage = true; + Projectile.width = 30; + Projectile.height = 30; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 630; + CooldownSlot = ImmunityCooldownID.Bosses; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AttachToSomething() + { + if (Main.npc[OwnerIndex].active && Main.npc[OwnerIndex].type == ModContent.NPCType()) + { + Projectile.Center = Main.npc[OwnerIndex].Center; + } + + // Die of the owner is invalid in some way. + else + { + Projectile.Kill(); + return; + } + } + + public override void UpdateLaserMotion() + { + Projectile.rotation += Main.npc[OwnerIndex].spriteDirection * 0.005f; + Projectile.velocity = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + } + + public override void PostAI() + { + // Determine frames. + Projectile.frameCounter++; + if (Projectile.frameCounter % 5f == 0f) + Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; + } + + public float LaserWidthFunction(float _) => Projectile.scale * Projectile.width + 180; + + public static Color LaserColorFunction(float completionRatio) + { + float colorInterpolant = (float)Math.Sin(Main.GlobalTimeWrappedHourly * -3.2f + completionRatio * 23f) * 0.5f + 0.5f; + return Color.Lerp(Color.LightGreen, Color.Lime, colorInterpolant * 0.67f); + } + + public override bool PreDraw(ref Color lightColor) + { + // This should never happen, but just in case. + if (Projectile.velocity == Vector2.Zero) + return false; + LaserDrawer ??= new(LaserWidthFunction, LaserColorFunction, null, GameShaders.Misc["CalamityMod:ArtemisLaser"]); + + Vector2 laserEnd = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * LaserLength; + Vector2[] baseDrawPoints = new Vector2[8]; + for (int i = 0; i < baseDrawPoints.Length; i++) + baseDrawPoints[i] = Vector2.Lerp(Projectile.Center, laserEnd, i / (float)(baseDrawPoints.Length - 1f)); + + // Select textures to pass to the shader, along with the electricity color. + GameShaders.Misc["CalamityMod:ArtemisLaser"].UseColor(Color.Cyan); + GameShaders.Misc["CalamityMod:ArtemisLaser"].UseImage1("Images/Extra_189"); + GameShaders.Misc["CalamityMod:ArtemisLaser"].UseImage2("Images/Misc/Perlin"); + + LaserDrawer.Draw(baseDrawPoints, -Main.screenPosition, 64); + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage <= 0) + return; + + target.AddBuff(ModContent.BuffType(), 300); + } + + public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; + } +} diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index 8d18129c61..e3396590b8 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Enemy Projectile.hostile = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 150; } public override void AI() @@ -43,19 +44,29 @@ namespace CalamityMod.Projectiles.Enemy } } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Vector2 drawOrigin = new(tex.Width * 0.5f, Projectile.height * 0.5f); + Vector2 vector = new Vector2(Projectile.Center.X, Projectile.Center.Y) - Main.screenPosition + new Vector2(0, Projectile.gfxOffY); + Rectangle rectangle = new(0, tex.Height / Main.projFrames[Projectile.type] * Projectile.frame, tex.Width, tex.Height / Main.projFrames[Projectile.type]); + Main.EntitySpriteDraw(tex, vector, rectangle, Color.DarkGray, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0); + + return false; + } + public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath28, Projectile.position); - int num251 = Main.rand.Next(5, 8); if (Projectile.owner == Main.myPlayer) { - int num320 = Main.rand.Next(15, 21); + int num320 = Main.rand.Next(5, 9); for (int num321 = 0; num321 < num320; num321++) { - Vector2 vector15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); vector15.Normalize(); - vector15 *= (float)Main.rand.Next(50, 401) * 0.01f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType() + Main.rand.Next(3), (int)Math.Round(Projectile.damage * 0.165), 1f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + vector15 *= Main.rand.Next(50, 401) * 0.01f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector15.X, vector15.Y, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.165), 1f, Projectile.owner, Main.rand.Next(-45, 1)); } } Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); diff --git a/Projectiles/Enemy/InkBombHostile.png b/Projectiles/Enemy/InkBombHostile.png index 867707bfc8..f5eebfc298 100644 Binary files a/Projectiles/Enemy/InkBombHostile.png and b/Projectiles/Enemy/InkBombHostile.png differ diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index cb5e8b0362..201cc97398 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -1,7 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Projectiles.Enemy { @@ -10,15 +12,14 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Ink Cloud"); - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - Projectile.width = 52; - Projectile.height = 48; + Projectile.width = 45; + Projectile.height = 45; Projectile.hostile = true; - Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; @@ -27,48 +28,59 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { + Projectile.ai[0] += 1f; Projectile.frameCounter++; - if (Projectile.frameCounter > 9) + if (Projectile.frameCounter > 6) { Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 3) - Projectile.frame = 0; - - Projectile.velocity *= 0.99f; - - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 120f) + if (Projectile.ai[0] < 180f) { - if (Projectile.alpha < 255) + if (Projectile.frame >= 4) { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - Projectile.alpha = 255; + Projectile.frame = 0; } - else if (Projectile.owner == Main.myPlayer) - Projectile.Kill(); } - else if (Projectile.alpha > 80) + if (Projectile.ai[0] > 180f) { - Projectile.alpha -= 30; - if (Projectile.alpha < 80) - Projectile.alpha = 80; + Projectile.damage = 0; } + else if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.Kill(); + } + + Projectile.velocity *= 0.98f; + + if (Math.Abs(Projectile.velocity.X) > 0f) + { + Projectile.spriteDirection = -Projectile.direction; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + var effects = Projectile.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Vector2 drawOrigin = new(tex.Width * 0.5f, Projectile.height * 0.5f); + Vector2 vector = new Vector2(Projectile.Center.X, Projectile.Center.Y) - Main.screenPosition + new Vector2(0, Projectile.gfxOffY); + Rectangle rectangle = new(0, tex.Height / Main.projFrames[Projectile.type] * Projectile.frame, tex.Width, tex.Height / Main.projFrames[Projectile.type]); + Main.EntitySpriteDraw(tex, vector, rectangle, Color.White * 0.75f, Projectile.rotation, drawOrigin, Projectile.scale * 1.2f, effects, 0); + + return true; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => Projectile.alpha == 80; + public override bool CanHitPlayer(Player target) => Projectile.ai[0] < 180f; public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage <= 0) return; - if (Projectile.alpha == 80) - target.AddBuff(BuffID.Darkness, 300, true); + target.AddBuff(BuffID.Darkness, 300, true); } } } diff --git a/Projectiles/Enemy/InkPoisonCloud.png b/Projectiles/Enemy/InkPoisonCloud.png index 284c8f4ec6..74e69b98f3 100644 Binary files a/Projectiles/Enemy/InkPoisonCloud.png and b/Projectiles/Enemy/InkPoisonCloud.png differ diff --git a/Projectiles/Enemy/InkPoisonCloud2.cs b/Projectiles/Enemy/InkPoisonCloud2.cs deleted file mode 100644 index d1898f425b..0000000000 --- a/Projectiles/Enemy/InkPoisonCloud2.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class InkPoisonCloud2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Cloud"); - Main.projFrames[Projectile.type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 52; - Projectile.height = 48; - Projectile.hostile = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = 3600; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 9) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - Projectile.frame = 0; - - Projectile.velocity *= 0.995f; - - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 120f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - Projectile.alpha = 255; - } - else if (Projectile.owner == Main.myPlayer) - Projectile.Kill(); - } - else if (Projectile.alpha > 80) - { - Projectile.alpha -= 30; - if (Projectile.alpha < 80) - Projectile.alpha = 80; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - - public override bool CanHitPlayer(Player target) => Projectile.alpha == 80; - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - if (damage <= 0) - return; - - if (Projectile.alpha == 80) - target.AddBuff(BuffID.Darkness, 300, true); - } - } -} diff --git a/Projectiles/Enemy/InkPoisonCloud2.png b/Projectiles/Enemy/InkPoisonCloud2.png deleted file mode 100644 index 1aa9239041..0000000000 Binary files a/Projectiles/Enemy/InkPoisonCloud2.png and /dev/null differ diff --git a/Projectiles/Enemy/InkPoisonCloud3.cs b/Projectiles/Enemy/InkPoisonCloud3.cs deleted file mode 100644 index 95b5fa26e5..0000000000 --- a/Projectiles/Enemy/InkPoisonCloud3.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Enemy -{ - public class InkPoisonCloud3 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ink Cloud"); - Main.projFrames[Projectile.type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 52; - Projectile.height = 48; - Projectile.hostile = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = 3600; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 9) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - Projectile.frame = 0; - - Projectile.velocity *= 0.999f; - - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 120f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - Projectile.alpha = 255; - } - else if (Projectile.owner == Main.myPlayer) - Projectile.Kill(); - } - else if (Projectile.alpha > 80) - { - Projectile.alpha -= 30; - if (Projectile.alpha < 80) - Projectile.alpha = 80; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - - public override bool CanHitPlayer(Player target) => Projectile.alpha == 80; - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - if (damage <= 0) - return; - - if (Projectile.alpha == 80) - target.AddBuff(BuffID.Darkness, 300, true); - } - } -} diff --git a/Projectiles/Enemy/InkPoisonCloud3.png b/Projectiles/Enemy/InkPoisonCloud3.png deleted file mode 100644 index 97f095777d..0000000000 Binary files a/Projectiles/Enemy/InkPoisonCloud3.png and /dev/null differ diff --git a/Projectiles/Enemy/PearlBurst.cs b/Projectiles/Enemy/PearlBurst.cs index 8e401aa8f4..ebb677550e 100644 --- a/Projectiles/Enemy/PearlBurst.cs +++ b/Projectiles/Enemy/PearlBurst.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -26,10 +26,13 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); - if (Main.rand.NextBool(5)) + if (Projectile.ai[0] == 0) // saving pcs on the zenith seed { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); + if (Main.rand.NextBool(5)) + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + } } Projectile.frameCounter++; if (Projectile.frameCounter > 3) diff --git a/Projectiles/Enemy/PearlRain.cs b/Projectiles/Enemy/PearlRain.cs index c3cb7cf0be..19f93923c0 100644 --- a/Projectiles/Enemy/PearlRain.cs +++ b/Projectiles/Enemy/PearlRain.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -28,10 +28,13 @@ namespace CalamityMod.Projectiles.Enemy public override void AI() { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); - if (Main.rand.NextBool(5)) + if (Projectile.ai[0] == 0) // saving pcs on the zenith seed { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); + if (Main.rand.NextBool(5)) + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 92, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.7f); + } } Projectile.frameCounter++; if (Projectile.frameCounter > 3) diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index 4c9824076b..2be1df5987 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Projectiles.Enemy { @@ -10,32 +11,25 @@ namespace CalamityMod.Projectiles.Enemy public override void SetStaticDefaults() { DisplayName.SetDefault("Toxic Cloud"); - Main.projFrames[Projectile.type] = 4; + Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - Projectile.width = 52; - Projectile.height = 48; + Projectile.width = 45; + Projectile.height = 45; Projectile.hostile = true; Projectile.friendly = true; - Projectile.alpha = 255; Projectile.penetrate = 7; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 600; + Projectile.alpha = 120; } public override void AI() { - Projectile.frameCounter++; - if (Projectile.frameCounter > 9) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - Projectile.frame = 0; + Lighting.AddLight(Projectile.Center, 0.1f * Projectile.Opacity, 1f * Projectile.Opacity, 0f); if (Main.rand.NextBool(2)) Projectile.velocity *= 0.95f; @@ -47,44 +41,62 @@ namespace CalamityMod.Projectiles.Enemy Projectile.velocity *= 0.8f; Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 560f) + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) { - if (Projectile.alpha < 255) + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.ai[0] < 560f) + { + if (Projectile.frame >= 4) { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - Projectile.alpha = 255; + Projectile.frame = 0; } - else if (Projectile.owner == Main.myPlayer) - Projectile.Kill(); } - else if (Projectile.alpha > 80) + if (Projectile.ai[0] > 560f) { - Projectile.alpha -= 30; - if (Projectile.alpha < 80) - Projectile.alpha = 80; + Projectile.damage = 0; } + else if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.Kill(); + } + + Projectile.velocity *= 0.98f; + + if (Math.Abs(Projectile.velocity.X) > 0f) + { + Projectile.spriteDirection = -Projectile.direction; + } + } + + public override bool PreDraw(ref Color lightColor) + { + 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); + return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f, targetHitbox); - public override bool CanHitPlayer(Player target) => Projectile.alpha == 80; + public override bool CanHitPlayer(Player target) => Projectile.ai[0] < 560f; public override void OnHitPlayer(Player target, int damage, bool crit) { if (damage <= 0) return; - - if (Projectile.alpha == 80) - target.AddBuff(BuffID.Poisoned, 240); + + target.AddBuff(BuffID.Poisoned, 240); } - public override bool? CanHitNPC(NPC target) => Projectile.alpha == 80; + public override bool? CanHitNPC(NPC target) => Projectile.ai[0] < 560f; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Projectile.alpha == 80) - target.AddBuff(BuffID.Poisoned, 240); + target.AddBuff(BuffID.Poisoned, 240); } } } diff --git a/Projectiles/Enemy/ToxicMinnowCloud.png b/Projectiles/Enemy/ToxicMinnowCloud.png index aafab6fe58..0d0464acbe 100644 Binary files a/Projectiles/Enemy/ToxicMinnowCloud.png and b/Projectiles/Enemy/ToxicMinnowCloud.png differ diff --git a/Projectiles/Enemy/TrilobiteSpike.cs b/Projectiles/Enemy/TrilobiteSpike.cs index 377ddb75d4..6acad8257d 100644 --- a/Projectiles/Enemy/TrilobiteSpike.cs +++ b/Projectiles/Enemy/TrilobiteSpike.cs @@ -2,7 +2,6 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy @@ -39,15 +38,6 @@ namespace CalamityMod.Projectiles.Enemy target.AddBuff(ModContent.BuffType(), 120); } - public override bool PreDraw(ref Color lightColor) - { - lightColor.R = (byte)(200 * Projectile.Opacity); - lightColor.G = (byte)(150 * Projectile.Opacity); - lightColor.B = (byte)(100 * Projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - public override void Kill(int timeLeft) { for (int i = 0; i <= 2; i++) diff --git a/Projectiles/Environment/HotSteam.cs b/Projectiles/Environment/HotSteam.cs index 1e4a674748..e0d19485ad 100644 --- a/Projectiles/Environment/HotSteam.cs +++ b/Projectiles/Environment/HotSteam.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Environment { public class HotSteam : ModProjectile, IAdditiveDrawer { - public const int Lifetime = 180; + public const int Lifetime = 90; public override string Texture => "CalamityMod/Projectiles/Summon/SmallAresArms/MinionPlasmaGas"; @@ -37,8 +37,8 @@ namespace CalamityMod.Projectiles.Environment public override void AI() { Projectile.localAI[0] = 0f; - Projectile.scale = Utils.Remap(Projectile.timeLeft, Lifetime, 0.4f, 0.02f, 1.4f); - Projectile.Opacity = Utils.Remap(Projectile.timeLeft, 160f, 50f, 1.15f, 0.01f); + Projectile.scale = Utils.Remap((Projectile.timeLeft+Lifetime), 180, 0.4f, 0.02f, 1.4f); + Projectile.Opacity = Utils.Remap((Projectile.timeLeft+Lifetime), 160f, 50f, 1.15f, 0.01f); Projectile.velocity.Y *= 0.97f; } @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Environment Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - float opacity = Projectile.Opacity * 0.3f; + float opacity = Projectile.Opacity * 0.45f; Color drawColor = new Color(159, 207, 181) * opacity; Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale * 1.35f; spriteBatch.Draw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, 0, 0f); diff --git a/Projectiles/Environment/MurkySteam.cs b/Projectiles/Environment/MurkySteam.cs new file mode 100644 index 0000000000..cf1bd76454 --- /dev/null +++ b/Projectiles/Environment/MurkySteam.cs @@ -0,0 +1,74 @@ +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Environment +{ + public class MurkySteam : ModProjectile, IAdditiveDrawer + { + public const int Lifetime = 90; + + public override string Texture => "CalamityMod/Projectiles/Summon/SmallAresArms/MinionPlasmaGas"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Steam"); + + // This prevents the water from creating a universal distortion wherever it lands, thus making the geysers look weird. + ProjectileID.Sets.NoLiquidDistortion[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 184; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.hide = true; + Projectile.localAI[0] = 1f; + } + + public override void AI() + { + Projectile.localAI[0] = 0f; + Projectile.scale = Utils.Remap((Projectile.timeLeft+Lifetime), 180, 0.4f, 0.02f, 1.4f); + Projectile.Opacity = Utils.Remap((Projectile.timeLeft+Lifetime), 160f, 50f, 1.15f, 0.01f); + Projectile.velocity.Y *= 0.97f; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage <= 0) + return; + + target.AddBuff(BuffID.Burning, 180); + } + + public override bool? CanDamage() => Projectile.Opacity > 0.6f ? null : false; + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 92f, targetHitbox); + } + + public void AdditiveDraw(SpriteBatch spriteBatch) + { + if (Projectile.localAI[0] == 1f) + return; + + Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + Vector2 origin = texture.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float opacity = Projectile.Opacity * 0.45f; + Color drawColor = new Color(14, 138, 92) * opacity; + Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale * 1.35f; + spriteBatch.Draw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, 0, 0f); + } + } +} diff --git a/Projectiles/Environment/ThermalSteam.cs b/Projectiles/Environment/ThermalSteam.cs new file mode 100644 index 0000000000..97673d09ad --- /dev/null +++ b/Projectiles/Environment/ThermalSteam.cs @@ -0,0 +1,74 @@ +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Environment +{ + public class ThermalSteam : ModProjectile, IAdditiveDrawer + { + public const int Lifetime = 90; + + public override string Texture => "CalamityMod/Projectiles/Summon/SmallAresArms/MinionPlasmaGas"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Steam"); + + // This prevents the water from creating a universal distortion wherever it lands, thus making the geysers look weird. + ProjectileID.Sets.NoLiquidDistortion[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 184; + Projectile.penetrate = -1; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.hide = true; + Projectile.localAI[0] = 1f; + } + + public override void AI() + { + Projectile.localAI[0] = 0f; + Projectile.scale = Utils.Remap((Projectile.timeLeft+Lifetime), 180, 0.4f, 0.02f, 1.4f); + Projectile.Opacity = Utils.Remap((Projectile.timeLeft+Lifetime), 160f, 50f, 1.15f, 0.01f); + Projectile.velocity.Y *= 0.97f; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (damage <= 0) + return; + + target.AddBuff(BuffID.Burning, 180); + } + + public override bool? CanDamage() => Projectile.Opacity > 0.6f ? null : false; + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 92f, targetHitbox); + } + + public void AdditiveDraw(SpriteBatch spriteBatch) + { + if (Projectile.localAI[0] == 1f) + return; + + Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + Vector2 origin = texture.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float opacity = Projectile.Opacity * 0.45f; + Color drawColor = new Color(154, 69, 38) * opacity; + Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale * 1.35f; + spriteBatch.Draw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, 0, 0f); + } + } +} diff --git a/Projectiles/Healing/GladiatorHealOrb.cs b/Projectiles/Healing/GladiatorHealOrb.cs new file mode 100644 index 0000000000..bf166da514 --- /dev/null +++ b/Projectiles/Healing/GladiatorHealOrb.cs @@ -0,0 +1,115 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class GladiatorHealOrb : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int target = -1; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Heal"); + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + } + + public override void SetDefaults() + { + Projectile.width = 8; + Projectile.height = 8; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.alpha = 255; + Projectile.penetrate = 1; + Projectile.timeLeft = 4800; + Projectile.tileCollide = false; + Projectile.extraUpdates = 3; + } + + public override void AI() + { + float maxDistance = 150f; + if (target < 0) + { + PassiveBehavior(); + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + if (player.lifeMagnet) { maxDistance = 225f; } + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + if (targetDist < maxDistance) + { + maxDistance = targetDist; + target = playerIndex; + } + } + } + else HealHome(); + } + public void PassiveBehavior() + { + float maxYVelocity = 2f; + CalamityUtils.StickToTiles(Projectile, false, false); + Projectile.velocity.X *= 0.99f; + if (Projectile.velocity.Y < maxYVelocity) + Projectile.velocity.Y += 0.02f; + if (Projectile.velocity.Y > maxYVelocity) { Projectile.velocity.Y = maxYVelocity; } + } + public void HealHome() + { + Player player = Main.player[target]; + //Code snippet taken from the HealingProjectile utility, to do what I want with it easier. + Vector2 playerVector = player.Center - Projectile.Center; + float playerDist = playerVector.Length(); + if (playerDist < 50f && Projectile.position.X < player.position.X + player.width && Projectile.position.X + Projectile.width > player.position.X && Projectile.position.Y < player.position.Y + player.height && Projectile.position.Y + Projectile.height > player.position.Y) + { + int healAmt = 10; + player.HealEffect(healAmt, false); + player.statLife += healAmt; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/OrbHeal", 5) { Volume = 0.15f }, Projectile.Center); + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); + Projectile.Kill(); + } + + Projectile.velocity = (playerVector.SafeNormalize(Vector2.UnitY) * 3.5f) + (player.velocity / 4); + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + //Photoviscerator drawcode, edited slightly + float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 32f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + Color color = Color.Lerp(Color.LightSeaGreen, Color.LimeGreen, colorInterpolation) * 0.4f; + color.A = 0; + Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. + Color outerColor = color; + Color innerColor = color * 0.5f; + float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length); + if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death + { + intensity *= Projectile.timeLeft / 60f; + } + // Become smaller the futher along the old positions we are. + Vector2 outerScale = new Vector2(1f) * intensity; + Vector2 innerScale = new Vector2(1f) * intensity * 0.7f; + outerColor *= intensity; + innerColor *= intensity; + Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.25f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.25f, SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Projectiles/Healing/PhantomicHeart.cs b/Projectiles/Healing/PhantomicHeart.cs index 1b64469de1..cb31f20f26 100644 --- a/Projectiles/Healing/PhantomicHeart.cs +++ b/Projectiles/Healing/PhantomicHeart.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Healing { - class PhantomicHeart : ModProjectile + public class PhantomicHeart : ModProjectile { private int floatTimer = 0; diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index b02276a89e..eaf087d39e 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Projectiles.Healing Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 300; + Projectile.MaxUpdates = 5; + Projectile.timeLeft = 600; } public override void AI() diff --git a/Projectiles/Magic/AetherfluxCannonHoldout.cs b/Projectiles/Magic/AetherfluxCannonHoldout.cs index c4966e8f81..aaedd06de6 100644 --- a/Projectiles/Magic/AetherfluxCannonHoldout.cs +++ b/Projectiles/Magic/AetherfluxCannonHoldout.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic // Update damage based on curent magic damage stat (so Mana Sickness affects it) Item weaponItem = Owner.ActiveItem(); - Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(weaponItem?.damage ?? 0); + Projectile.damage = weaponItem is null ? 0 : Owner.GetWeaponDamage(weaponItem); // Get the original weapon's use time. int itemUseTime = weaponItem?.useAnimation ?? AetherfluxCannon.UseTime; diff --git a/Projectiles/Magic/Ancient.cs b/Projectiles/Magic/Ancient.cs index a25bc86101..a754055479 100644 --- a/Projectiles/Magic/Ancient.cs +++ b/Projectiles/Magic/Ancient.cs @@ -1,4 +1,6 @@ -using CalamityMod.DataStructures; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using System; using Terraria; @@ -96,6 +98,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation += 0.3f * (float)Projectile.direction; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index f2e6971180..3399da0620 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -1,4 +1,5 @@ -using CalamityMod.DataStructures; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -82,6 +83,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation += 0.3f * (float)Projectile.direction; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index 1c1bd59de5..6cc30bdfe4 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -253,9 +253,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300, true); - target.AddBuff(ModContent.BuffType(), 300, true); - target.AddBuff(ModContent.BuffType(), 300, true); - target.AddBuff(ModContent.BuffType(), 30, true); + target.AddBuff(ModContent.BuffType(), 300, true); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/ArcticBearPawProj.cs b/Projectiles/Magic/ArcticBearPawProj.cs index 7a539e3532..bcaa70dc10 100644 --- a/Projectiles/Magic/ArcticBearPawProj.cs +++ b/Projectiles/Magic/ArcticBearPawProj.cs @@ -48,11 +48,8 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); - - if (Main.rand.NextBool(3)) - target.AddBuff(BuffID.Confused, Main.rand.Next(60, 240)); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/ArtAttackHoldout.cs b/Projectiles/Magic/ArtAttackHoldout.cs index 3f827286dd..7717b48e36 100644 --- a/Projectiles/Magic/ArtAttackHoldout.cs +++ b/Projectiles/Magic/ArtAttackHoldout.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -37,11 +39,18 @@ namespace CalamityMod.Projectiles.Magic UpdateAim(); // Create the star. - if (Projectile.localAI[0] == 0f) + int attackType = ModContent.ProjectileType(); + if (Owner.ownedProjectileCounts[attackType] == 0) { - Vector2 initialStarVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, initialStarVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.localAI[0] = 1f; + if (Projectile.ai[0] >= 0f && Owner.CheckMana(Owner.ActiveItem(), -1, true, false)) + { + SoundEngine.PlaySound(ArtAttack.UseSound, Owner.Center); + Vector2 initialStarVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, initialStarVelocity, attackType, Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.ai[0] = -24f; + } + else + Projectile.ai[0]++; } if (!Owner.channel) diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index cd4cc3f369..cd28245b9e 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -115,11 +115,9 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[Projectile.owner]; - player.AddBuff(ModContent.BuffType(), 360); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.OnFire3, 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.OnFire3, 180); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index d21cf3468d..d0daba8ced 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -99,6 +100,41 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { + Texture2D tex = ModContent.Request(Texture).Value; + Vector2 offsets = new Vector2(0f, Projectile.gfxOffY) - Main.screenPosition; + Color alpha = Projectile.GetAlpha(lightColor); + Rectangle spriteRec = new Microsoft.Xna.Framework.Rectangle(0, 0, tex.Width, tex.Height); + Vector2 spriteOrigin = spriteRec.Size() / 2f; + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D aura = ModContent.Request("CalamityMod/Projectiles/StarTrail").Value; + Vector2 drawStart = Projectile.Center + Projectile.velocity; + Vector2 drawStart2 = Projectile.Center - Projectile.velocity * 0.5f; + Vector2 spinPoint = new Vector2(0f, -10f); + float time = Main.player[Projectile.owner].miscCounter % 216000f / 60f; + Rectangle auraRec = aura.Frame(); + Color pink = Color.Coral * 0.2f; + Color white = Color.White * 0.5f; + white.A = 0; + pink.A = 0; + Vector2 auraOrigin = new Vector2(auraRec.Width / 2f, 10f); + + //Draw the aura + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time), auraRec, pink, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.5f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.TwoPi / 3f), auraRec, pink, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.1f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.Pi * 4f / 3f), auraRec, pink, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.3f, SpriteEffects.None, 0); + for (float d = 0f; d < 1f; d += 0.5f) + { + float scaleMult = time % 0.5f / 0.5f; + scaleMult = (scaleMult + d) % 1f; + float colorMult = scaleMult * 2f; + if (colorMult > 1f) + { + colorMult = 2f - colorMult; + } + Main.EntitySpriteDraw(aura, drawStart2 + offsets, auraRec, white * colorMult, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); + } + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index ec40bd85c2..fb95eb8c09 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; AIType = ProjectileID.CrystalVileShardHead; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; } public override void AI() @@ -45,13 +47,13 @@ namespace CalamityMod.Projectiles.Magic if (Main.myPlayer == Projectile.owner) { int projType = Projectile.type; - if (Projectile.ai[1] >= (float)(12 + Main.rand.Next(2))) + if (Projectile.ai[1] >= 20f) { projType = ModContent.ProjectileType(); } int dmg = Projectile.damage; float kBack = Projectile.knockBack; - int number = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, projType, dmg, kBack, Projectile.owner, 0f, Projectile.ai[1] + 1f); + int number = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, projType, dmg, kBack, Projectile.owner, 0f, Projectile.ai[1] + 1f); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); } } @@ -81,11 +83,6 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 6; - } - public override void Kill(int timeLeft) { int numProj = 2; diff --git a/Projectiles/Magic/AtlantisSpear2.cs b/Projectiles/Magic/AtlantisSpear2.cs index 89c990a897..a1b6b55a49 100644 --- a/Projectiles/Magic/AtlantisSpear2.cs +++ b/Projectiles/Magic/AtlantisSpear2.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; AIType = ProjectileID.CrystalVileShardShaft; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; } public override void AI() diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 49387a3924..bf4b131808 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = Projectile.height = 30; Projectile.friendly = true; Projectile.timeLeft = 120; - Projectile.penetrate = -1; + Projectile.penetrate = 1; Projectile.DamageType = DamageClass.Magic; } @@ -76,10 +76,5 @@ namespace CalamityMod.Projectiles.Magic } SoundEngine.PlaySound(SoundID.Item105, Projectile.position); } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 7; - } } } diff --git a/Projectiles/Magic/BeastScythe.cs b/Projectiles/Magic/BeastScythe.cs index 8a3eb09441..d8218755b6 100644 --- a/Projectiles/Magic/BeastScythe.cs +++ b/Projectiles/Magic/BeastScythe.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -134,23 +134,6 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - if (Main.rand.NextBool(3)) - { - target.AddBuff(BuffID.ShadowFlame, 90); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(ModContent.BuffType(), 120); - } - else - { - target.AddBuff(BuffID.Frostburn, 150); - } - } - public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); diff --git a/Projectiles/Magic/BigBeamofDeath.cs b/Projectiles/Magic/BigBeamofDeath.cs index 255f0c5ae0..80badd34b3 100644 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ b/Projectiles/Magic/BigBeamofDeath.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 100; + Projectile.idStaticNPCHitCooldown = 6; Projectile.penetrate = -1; Projectile.extraUpdates = 100; Projectile.timeLeft = 80; diff --git a/Projectiles/Magic/BigBeamofDeath2.cs b/Projectiles/Magic/BigBeamofDeath2.cs index 5eacbbdc9d..f0ebf8ae11 100644 --- a/Projectiles/Magic/BigBeamofDeath2.cs +++ b/Projectiles/Magic/BigBeamofDeath2.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 100; + Projectile.idStaticNPCHitCooldown = 6; Projectile.penetrate = -1; Projectile.extraUpdates = 100; Projectile.timeLeft = 80; diff --git a/Projectiles/Magic/BloodBeam.cs b/Projectiles/Magic/BloodBeam.cs index 5df9378cc5..2813d8cab1 100644 --- a/Projectiles/Magic/BloodBeam.cs +++ b/Projectiles/Magic/BloodBeam.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -63,5 +64,9 @@ namespace CalamityMod.Projectiles.Magic } Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - MathHelper.PiOver2; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Magic/BlushieStaffProj.cs b/Projectiles/Magic/BlushieStaffProj.cs index 7b3f4d46e6..2ef56e5949 100644 --- a/Projectiles/Magic/BlushieStaffProj.cs +++ b/Projectiles/Magic/BlushieStaffProj.cs @@ -96,8 +96,6 @@ namespace CalamityMod.Projectiles.Magic { Projectile.penetrate++; target.AddBuff(BuffID.Daybreak, 300); - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Frostburn, 300); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/BrimroseBeam.cs b/Projectiles/Magic/BrimroseBeam.cs new file mode 100644 index 0000000000..39466f5c9c --- /dev/null +++ b/Projectiles/Magic/BrimroseBeam.cs @@ -0,0 +1,66 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class BrimroseBeam : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimrose Beam"); + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 4; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.extraUpdates = 100; + Projectile.timeLeft = 30; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + } + + public override void Kill(int timeLeft) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(Projectile.ai[0] >= 3f ? 20 : 10); + // Splits up to 4 times + if (Projectile.owner == Main.myPlayer && Projectile.ai[0] < 4f) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] + 1f); + } + } + } + + public override void AI() + { + // Small buffer before dust spawns on the first projectile + Projectile.ai[1]++; + if (Projectile.ai[1] > 9f || Projectile.ai[0] > 0f) + { + int fire = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); + Main.dust[fire].velocity *= 0.1f; + Main.dust[fire].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + + // Pierce damage decay time + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8); + } + } +} diff --git a/Projectiles/Magic/BrimstoneBeam.cs b/Projectiles/Magic/BrimstoneBeam.cs deleted file mode 100644 index 49b22584c9..0000000000 --- a/Projectiles/Magic/BrimstoneBeam.cs +++ /dev/null @@ -1,62 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - Projectile.width = 2; - Projectile.height = 2; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 30; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity; - Projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Magic/BrimstoneBeam2.cs b/Projectiles/Magic/BrimstoneBeam2.cs deleted file mode 100644 index 2dc1abf343..0000000000 --- a/Projectiles/Magic/BrimstoneBeam2.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam2 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - Projectile.width = 2; - Projectile.height = 2; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 30; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity; - Projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Magic/BrimstoneBeam3.cs b/Projectiles/Magic/BrimstoneBeam3.cs deleted file mode 100644 index 41275ff8e4..0000000000 --- a/Projectiles/Magic/BrimstoneBeam3.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam3 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - Projectile.width = 2; - Projectile.height = 2; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 30; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity; - Projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Magic/BrimstoneBeam4.cs b/Projectiles/Magic/BrimstoneBeam4.cs deleted file mode 100644 index 14623c464f..0000000000 --- a/Projectiles/Magic/BrimstoneBeam4.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam4 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - Projectile.width = 2; - Projectile.height = 2; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 30; - } - - public override void Kill(int timeLeft) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = new Vector2(Projectile.velocity.X, Projectile.velocity.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } - } - - public override void AI() - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity; - Projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Magic/BrimstoneBeam5.cs b/Projectiles/Magic/BrimstoneBeam5.cs deleted file mode 100644 index cd05d3e0e0..0000000000 --- a/Projectiles/Magic/BrimstoneBeam5.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneBeam5 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - Projectile.width = 2; - Projectile.height = 2; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 30; - } - - public override void AI() - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity; - Projectile.alpha = 255; - int num249 = 235; - int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index 04badd11be..2c2fb93db2 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = 4; Projectile.timeLeft = 300; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -35,8 +37,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.Kill(); if (Projectile.owner == Main.myPlayer) { - int fireballAmt = Main.rand.Next(2, 4); - for (int j = 0; j < fireballAmt; j++) + for (int j = 0; j < 2; j++) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-100f, -50f)); while (velocity.X == 0f) @@ -44,8 +45,8 @@ namespace CalamityMod.Projectiles.Magic velocity.X = (float)Main.rand.Next(-100, 101); } velocity.Normalize(); - velocity *= Main.rand.NextFloat(70f, 100f) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.85), 0f, Projectile.owner, 0f, 0f); + velocity *= Main.rand.NextFloat(7f, 10f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocity.X, velocity.Y, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } @@ -112,10 +113,6 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item20, Projectile.position); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 8; - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index 305c1112c5..e68fe70f6f 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -26,11 +26,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.timeLeft = 300; - Projectile.penetrate = 2; - Projectile.extraUpdates = 1; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 1; Projectile.DamageType = DamageClass.Magic; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -57,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic 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; - int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); + int num458 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 170, default, 1.1f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += Projectile.velocity * 0.1f; @@ -65,7 +63,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.localAI[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); Projectile.localAI[0] += 1f; } @@ -77,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.owner == Main.myPlayer) { - int fire = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int fire = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index dd2496866b..f307490ee7 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using System; @@ -97,7 +97,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[Projectile.owner] = 5; - target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index 43a9ed4734..2f9aa4b0ba 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Magic // Spin chaotically given a pre-defined spin direction. Choose one initially at random. float spinTheta = 0.11f; - if (Projectile.localAI[1] == 0f) - Projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta; - Projectile.rotation += Projectile.localAI[1]; + if (Projectile.localAI[0] == 0f) + Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta; + Projectile.rotation += Projectile.localAI[0]; // Animate the lightning orb. Projectile.frameCounter++; diff --git a/Projectiles/Magic/CoralSpoutHoldout.cs b/Projectiles/Magic/CoralSpoutHoldout.cs index a4839a3e66..25e6d8bcde 100644 --- a/Projectiles/Magic/CoralSpoutHoldout.cs +++ b/Projectiles/Magic/CoralSpoutHoldout.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Magic blinkage = (float)Math.Sin(MathHelper.Clamp((Charge - MaxCharge * 1.5f) / 15f, 0, 1) * MathHelper.PiOver2 + MathHelper.PiOver2); } - Effect effect = Filters.Scene["SpreadTelegraph"].GetShader().Shader; + Effect effect = Filters.Scene["CalamityMod:SpreadTelegraph"].GetShader().Shader; effect.Parameters["centerOpacity"].SetValue(0.7f); effect.Parameters["mainOpacity"].SetValue((float)Math.Sqrt(ChargeProgress)); effect.Parameters["halfSpreadAngle"].SetValue(Spread / 2f); diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs index 256012aa33..79829113c4 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.coldDamage = true; Projectile.ignoreWater = true; Projectile.alpha = 255; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -40,11 +42,14 @@ namespace CalamityMod.Projectiles.Magic { Projectile.ai[0] += 1f; - // Fire extra waves to the left and right - for (int i = 0; i < 2; i++) + if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(-Spread * (i + 1)), Projectile.type, Projectile.damage / 2, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(+Spread * (i + 1)), Projectile.type, Projectile.damage / 2, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + // Fire extra waves to the left and right + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(-Spread * (i + 1)), Projectile.type, Projectile.damage / 2, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(+Spread * (i + 1)), Projectile.type, Projectile.damage / 2, Projectile.knockBack, Projectile.owner, Projectile.ai[0], 0f); + } } Projectile.Kill(); @@ -124,7 +129,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 30); - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); } } } diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index a32a7d9a67..2e75cee025 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.ai[0] > 480f) num26 = 5f; - Projectile.damage = (int)player.GetTotalDamage().ApplyTo(player.ActiveItem().damage); + Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); Projectile.ai[0] += 1f; Projectile.ai[1] += 1f; diff --git a/Projectiles/Magic/DeathhailBeam.cs b/Projectiles/Magic/DeathhailBeam.cs index b5a9256593..7c45785fda 100644 --- a/Projectiles/Magic/DeathhailBeam.cs +++ b/Projectiles/Magic/DeathhailBeam.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -55,10 +56,8 @@ namespace CalamityMod.Projectiles.Magic public override bool ShouldUpdatePosition() => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 90); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index cd11096f1f..d4506f052e 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -74,11 +74,9 @@ namespace CalamityMod.Projectiles.Magic return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); public override void Kill(int timeLeft) { diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs index 86092f0b53..146b8a6876 100644 --- a/Projectiles/Magic/DustProjectile.cs +++ b/Projectiles/Magic/DustProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.DataStructures; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using System; using Terraria; @@ -24,9 +25,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 90; + Projectile.penetrate = 4; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 30 * Projectile.MaxUpdates; // 30 effectively, 120 total + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 40 total } public override void AI() @@ -60,11 +63,15 @@ namespace CalamityMod.Projectiles.Magic } Projectile.ai[0] += 1f; Projectile.rotation += 0.3f * (float)Projectile.direction; - if (Projectile.timeLeft < 30) - Projectile.Opacity = MathHelper.Lerp(0f, 1f, (float)Projectile.timeLeft / 30f); + if (Projectile.timeLeft < 5) + Projectile.Opacity = MathHelper.Lerp(0f, 1f, (float)Projectile.timeLeft / 5f); } - public override bool? CanDamage() => Projectile.timeLeft > 30; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override bool? CanDamage() => Projectile.timeLeft > 5; public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Magic/ElementBolt.cs b/Projectiles/Magic/ElementBolt.cs deleted file mode 100644 index d8daf92aec..0000000000 --- a/Projectiles/Magic/ElementBolt.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ElementBolt : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.extraUpdates = 100; - Projectile.friendly = true; - Projectile.timeLeft = 30; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 29f && Projectile.owner == Main.myPlayer) - { - Projectile.localAI[1] = 0f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack, Projectile.owner, 0f, 0f); - } - - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } - } - } -} diff --git a/Projectiles/Magic/ElementBolt2.cs b/Projectiles/Magic/ElementBolt2.cs deleted file mode 100644 index a5f63e81a7..0000000000 --- a/Projectiles/Magic/ElementBolt2.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ElementBolt2 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.extraUpdates = 100; - Projectile.friendly = true; - Projectile.timeLeft = 15; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].noGravity = true; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } - } -} diff --git a/Projectiles/Magic/ElementOrb.cs b/Projectiles/Magic/ElementOrb.cs deleted file mode 100644 index d2567c8a91..0000000000 --- a/Projectiles/Magic/ElementOrb.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ElementOrb : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.timeLeft = 30; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - } - - public override void AI() - { - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); - } - } -} diff --git a/Projectiles/Magic/ElementOrb2.cs b/Projectiles/Magic/ElementOrb2.cs deleted file mode 100644 index 2531bcea98..0000000000 --- a/Projectiles/Magic/ElementOrb2.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ElementOrb2 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.timeLeft = 30; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - } - - public override void AI() - { - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); - } - } -} diff --git a/Projectiles/Magic/ElementTentacle.cs b/Projectiles/Magic/ElementTentacle.cs index ac856f340a..e6507f7eed 100644 --- a/Projectiles/Magic/ElementTentacle.cs +++ b/Projectiles/Magic/ElementTentacle.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -92,12 +92,5 @@ namespace CalamityMod.Projectiles.Magic } } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } } } diff --git a/Projectiles/Magic/ElementalRayBeam.cs b/Projectiles/Magic/ElementalRayBeam.cs deleted file mode 100644 index 6b12a14c77..0000000000 --- a/Projectiles/Magic/ElementalRayBeam.cs +++ /dev/null @@ -1,61 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ElementalRayBeam : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ray"); - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 10; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 180; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 22f && Projectile.owner == Main.myPlayer) - { - Projectile.localAI[1] = 0f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 3; num447++) - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num448].noGravity = true; - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - } -} diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index 11bb11a0a6..19c3e679f2 100644 --- a/Projectiles/Magic/EnormousConsumingVortex.cs +++ b/Projectiles/Magic/EnormousConsumingVortex.cs @@ -63,6 +63,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + // Emit light. + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.3f); + // If the player is no longer able to channel the vortex and it hasn't been released yet, release it. if ((!Owner.Calamity().mouseRight || Owner.noItems || Owner.CCed) && !HasBeenReleased) { diff --git a/Projectiles/Magic/EventHorizonBlackhole.cs b/Projectiles/Magic/EventHorizonBlackhole.cs index 9e320e1bf3..8f24d05e9d 100644 --- a/Projectiles/Magic/EventHorizonBlackhole.cs +++ b/Projectiles/Magic/EventHorizonBlackhole.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -62,11 +62,6 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 180); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Magic/EventHorizonStar.cs b/Projectiles/Magic/EventHorizonStar.cs index e8da323d36..79224bfa04 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -122,7 +122,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Daybreak, 120); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index 3de4602e7b..441991e8a6 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - Projectile.width = 32; - Projectile.height = 32; + Projectile.width = 4; + Projectile.height = 4; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 6; @@ -44,8 +44,7 @@ namespace CalamityMod.Projectiles.Magic { float num152 = Projectile.velocity.X / 3f * (float)num151; float num153 = Projectile.velocity.Y / 3f * (float)num151; - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num154, Projectile.position.Y + (float)num154), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 157, 0f, 0f, 100, default, 1f); + int num155 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 157, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num155]; dust.noGravity = true; dust.velocity *= 0.1f; @@ -55,8 +54,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.rand.NextBool(8)) { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num156, Projectile.position.Y + (float)num156), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 157, 0f, 0f, 100, default, 0.5f); + int num157 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 157, 0f, 0f, 100, default, 0.5f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].velocity += Projectile.velocity * 0.5f; } diff --git a/Projectiles/Magic/ExoVortex.cs b/Projectiles/Magic/ExoVortex.cs index e8037df2da..f70cad2a50 100644 --- a/Projectiles/Magic/ExoVortex.cs +++ b/Projectiles/Magic/ExoVortex.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -61,6 +62,9 @@ namespace CalamityMod.Projectiles.Magic // Rotate. Projectile.rotation += Projectile.velocity.X * 0.04f; + // Emit light. + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.9f); + // Re-determine the hitbox size. Projectile.Opacity = Utils.GetLerpValue(0f, 20f, Time, true); Projectile.scale = Utils.Remap(Time, 0f, Projectile.MaxUpdates * 15f, 0.01f, 1.5f) * Utils.GetLerpValue(0f, Projectile.MaxUpdates * 16f, Projectile.timeLeft, true); @@ -69,12 +73,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } // Draw these vortices behind other projectiles to ensure that they do not obstruct SCal's projectiles. diff --git a/Projectiles/Magic/ExoVortex2.cs b/Projectiles/Magic/ExoVortex2.cs index 31d05ce2c7..6e03fb4272 100644 --- a/Projectiles/Magic/ExoVortex2.cs +++ b/Projectiles/Magic/ExoVortex2.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -65,6 +66,9 @@ namespace CalamityMod.Projectiles.Magic // Rotate. Projectile.rotation += Projectile.velocity.X * 0.04f; + // Emit light. + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.25f); + // Re-determine the hitbox size. Projectile.Opacity = Utils.GetLerpValue(0f, 20f, Time, true); Projectile.scale = Utils.Remap(Time, 0f, Projectile.MaxUpdates * 15f, 0.01f, 1.1f) * Utils.GetLerpValue(0f, Projectile.MaxUpdates * 16f, Projectile.timeLeft, true); @@ -73,12 +77,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } // Draw these vortices behind other projectiles to ensure that they do not obstruct SCal's projectiles. diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index ee2dbe0755..8fad8df544 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 4; Projectile.timeLeft = 480; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/ForbiddenSunProjectile.cs b/Projectiles/Magic/ForbiddenSunProjectile.cs index fa1369b78f..fb0980cd0d 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } } } diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index ef810dd9f9..43936540c2 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[Projectile.owner] = 8; - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 78a224db21..ca2c8e6bd0 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 5; Projectile.timeLeft = 480; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -118,8 +120,8 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 90); + target.AddBuff(BuffID.OnFire3, 180); + target.AddBuff(BuffID.Frostburn, 180); } } } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 8aaf8e57a3..1cac15e013 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 480; Projectile.DamageType = DamageClass.Magic; Projectile.coldDamage = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index 4afdb9b4ac..3f549c7587 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -65,7 +65,6 @@ namespace CalamityMod.Projectiles.Magic { Projectile.ai[1] = (float)(num40 - num41 * num39); flag15 = true; - int arg_1EF4_0 = (int)Projectile.ai[0] / (num40 - num41 * num39); } bool flag16 = player.channel && !player.noItems && !player.CCed; if (Projectile.localAI[0] > 0f) @@ -104,9 +103,10 @@ namespace CalamityMod.Projectiles.Magic } } Projectile.localAI[1] += 1f; + Projectile.soundDelay = num40 - num41 * num39; SoundEngine.PlaySound(SoundID.Item117, Projectile.position); } - if (Projectile.soundDelay <= 0 && flag16) + else if (Projectile.soundDelay <= 0 && flag16) { if (player.statMana < manaCost) { diff --git a/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.cs b/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.cs new file mode 100644 index 0000000000..f281f0301f --- /dev/null +++ b/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.cs @@ -0,0 +1,166 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Magic +{ + public class GrandStaffoftheNebulaMage_Held : ModProjectile + { + private const int TotalXFrames = 2; + private const int TotalYFrames = 8; + private const int FrameTimer = 6; + private const int ShootFrame = 3; + + public int frameX = 0; + public int frameY = 0; + + public int CurrentFrame + { + get => frameX * TotalYFrames + frameY; + set + { + frameX = value / TotalYFrames; + frameY = value % TotalYFrames; + } + } + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Grand Staff of the Nebula Mage"); + + public override void SetDefaults() + { + Projectile.width = 120; + Projectile.height = 124; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter % FrameTimer == 0) + { + CurrentFrame++; + if (frameX >= TotalXFrames) + CurrentFrame = 0; + } + + Lighting.AddLight(Projectile.Center, 1.25f, 0f, 0.2f); + + if (CurrentFrame != ShootFrame) + Projectile.ai[0] = 0f; + + bool shoot = CurrentFrame == ShootFrame && Projectile.ai[0] == 0f; + bool weaponInUse = Owner.channel && !Owner.noItems && !Owner.CCed; + int manaCost = (int)(30f * Owner.manaCost); + Vector2 halvedSize = Projectile.Size / 2f; + Vector2 staffOffset = halvedSize + new Vector2(24f, 24f); + + if (shoot) + { + Projectile.ai[0] = 1f; + + if (weaponInUse) + { + if (Owner.statMana < manaCost) + { + if (Owner.manaFlower) + { + Owner.QuickMana(); + if (Owner.statMana >= (int)(float)manaCost) + { + Owner.manaRegenDelay = (int)Owner.maxRegenDelay; + Owner.statMana -= manaCost; + } + else + Projectile.Kill(); + } + else + Projectile.Kill(); + } + else + { + if (Owner.statMana >= (int)(float)manaCost) + { + Owner.statMana -= manaCost; + Owner.manaRegenDelay = (int)Owner.maxRegenDelay; + } + } + + SoundEngine.PlaySound(SoundID.Item117, Projectile.position); + } + + if (Main.myPlayer == Projectile.owner) + { + int projectileType = ModContent.ProjectileType(); + float coreVelocity = 8f; + int weaponDamage = Owner.GetWeaponDamage(Owner.ActiveItem()); + float weaponKnockback = Owner.ActiveItem().knockBack; + if (weaponInUse) + { + weaponKnockback = Owner.GetWeaponKnockback(Owner.ActiveItem(), weaponKnockback); + float scaleFactor = Owner.ActiveItem().shootSpeed * Projectile.scale; + Vector2 projectileSpawnPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + Vector2 projectileDestination = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - projectileSpawnPosition; + + if (Owner.gravDir == -1f) + projectileDestination.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - projectileSpawnPosition.Y; + + Vector2 velocity = Vector2.Normalize(projectileDestination); + if (float.IsNaN(velocity.X) || float.IsNaN(velocity.Y)) + velocity = -Vector2.UnitY; + + velocity *= scaleFactor; + if (velocity.X != Projectile.velocity.X || velocity.Y != Projectile.velocity.Y) + Projectile.netUpdate = true; + + Projectile.velocity = velocity * 0.5f; + + Vector2 projectileVelocity = Vector2.Normalize(Projectile.velocity) * coreVelocity; + if (float.IsNaN(projectileVelocity.X) || float.IsNaN(projectileVelocity.Y)) + projectileVelocity = -Vector2.UnitY; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), projectileSpawnPosition + Vector2.Normalize(projectileVelocity) * staffOffset.Length(), projectileVelocity, projectileType, weaponDamage, weaponKnockback, Projectile.owner); + } + else + Projectile.Kill(); + } + } + + Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - halvedSize + Vector2.Normalize(Projectile.velocity) * staffOffset; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.PiOver4 * 3f : MathHelper.PiOver4); + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * Projectile.direction), (double)(Projectile.velocity.X * Projectile.direction)); + } + + public override bool PreDraw(ref Color lightColor) => false; + + public override void PostDraw(Color lightColor) + { + if (Projectile.frameCounter < 5) + return; + + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 position = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() / new Vector2(TotalXFrames, TotalYFrames) * 0.5f; + Rectangle frame = texture.Frame(TotalXFrames, TotalYFrames, frameX, frameY); + SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.png b/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.png new file mode 100644 index 0000000000..bc588a609d Binary files /dev/null and b/Projectiles/Magic/GrandStaffoftheNebulaMage_Held.png differ diff --git a/Projectiles/Magic/HadalUrnHoldout.cs b/Projectiles/Magic/HadalUrnHoldout.cs index 1ec1bd6086..fcc275b5ee 100644 --- a/Projectiles/Magic/HadalUrnHoldout.cs +++ b/Projectiles/Magic/HadalUrnHoldout.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic float rotoffset = MathHelper.PiOver2; Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true); bool shouldBeHeld = player.channel && !player.noItems && !player.CCed; - Projectile.damage = (int)player.GetTotalDamage().ApplyTo(player.ActiveItem()?.damage ?? 0); + Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); if (Projectile.ai[0] > 0f) { Projectile.ai[0] -= 1f; diff --git a/Projectiles/Magic/IceBarrageMain.cs b/Projectiles/Magic/IceBarrageMain.cs index 331033a269..dbba3e0229 100644 --- a/Projectiles/Magic/IceBarrageMain.cs +++ b/Projectiles/Magic/IceBarrageMain.cs @@ -174,7 +174,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Magic/IceSpike.cs b/Projectiles/Magic/IceSpike.cs deleted file mode 100644 index 71d1249c7c..0000000000 --- a/Projectiles/Magic/IceSpike.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Magic -{ - public class IceSpike : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/Boss/IceRain"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spike"); - } - - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.DamageType = DamageClass.Magic; - Projectile.timeLeft = 240; - Projectile.coldDamage = 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.Pi * 0.5f * Projectile.direction); - - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 1f); - Main.dust[num469].noGravity = true; - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); - } - - public override void Kill(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, 67, 0f, 0f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 180); - } - } -} diff --git a/Projectiles/Magic/Icicle.cs b/Projectiles/Magic/Icicle.cs index d6b31956ca..1e67843f86 100644 --- a/Projectiles/Magic/Icicle.cs +++ b/Projectiles/Magic/Icicle.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index 8d42b53aa3..bc3a02d0aa 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -24,8 +26,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.timeLeft = 500; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; Projectile.DamageType = DamageClass.Magic; } @@ -123,6 +125,11 @@ namespace CalamityMod.Projectiles.Magic } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + public override Color? GetAlpha(Color lightColor) { if (!intersectingSomething) diff --git a/Projectiles/Magic/InfernalBlade.cs b/Projectiles/Magic/InfernalBlade.cs index 7e383cfa29..6fc9235c35 100644 --- a/Projectiles/Magic/InfernalBlade.cs +++ b/Projectiles/Magic/InfernalBlade.cs @@ -117,13 +117,13 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { OnHitEffects(target.Center); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.OnFire3, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { OnHitEffects(target.Center); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.OnFire3, 180); } private void OnHitEffects(Vector2 targetPos) diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 240b9cc97a..3d6b1e454e 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.OnFire3, 120); } } } diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 57fdaa5eaf..a66f4b16e1 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -32,8 +32,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + MathHelper.PiOver2; - Projectile.velocity.X *= 1.015f; - Projectile.velocity.Y *= 1.015f; + Projectile.velocity *= 1.015f; if (Projectile.alpha > 0) { Projectile.alpha -= 3; @@ -84,11 +83,6 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Magic/SolarBeam2.cs b/Projectiles/Magic/LazharSolarBeam.cs similarity index 71% rename from Projectiles/Magic/SolarBeam2.cs rename to Projectiles/Magic/LazharSolarBeam.cs index c726917077..8d3f30d792 100644 --- a/Projectiles/Magic/SolarBeam2.cs +++ b/Projectiles/Magic/LazharSolarBeam.cs @@ -1,16 +1,17 @@ using CalamityMod.Projectiles.Typeless; +using Terraria.ID; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class SolarBeam2 : ModProjectile + public class LazharSolarBeam : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Beam"); + DisplayName.SetDefault("Concentrated Solar Beam"); } public override void SetDefaults() @@ -19,32 +20,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 4; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 6; + Projectile.penetrate = 1; Projectile.extraUpdates = 100; Projectile.timeLeft = 300; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); - } - else - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - public override void AI() { Projectile.localAI[0] += 1f; @@ -65,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[Projectile.owner] = 4; + target.AddBuff(BuffID.Daybreak, 180); if (Projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); @@ -73,5 +53,7 @@ namespace CalamityMod.Projectiles.Magic Main.projectile[proj].DamageType = DamageClass.Magic; } } + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.Daybreak, 180); } } diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index 11a0831af7..6b542eb866 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Magic AdjustMagnitude(ref Projectile.velocity); Projectile.localAI[0] = 1f; } + Vector2 move = Vector2.Zero; float distance = 160f; bool target = false; @@ -65,10 +66,13 @@ namespace CalamityMod.Projectiles.Magic } } } + //if not found, look through npcs that have been shocked before - if (!target) { - foreach (NPC pastnpc in shockedbefore) { - Vector2 newMove = pastnpc.Center -(Projectile.velocity + Projectile.Center); + if (!target) + { + foreach (NPC pastnpc in shockedbefore) + { + Vector2 newMove = pastnpc.Center - (Projectile.velocity + Projectile.Center); float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y); if (distanceTo < distance) { @@ -81,7 +85,6 @@ namespace CalamityMod.Projectiles.Magic } } - // Main.dust[dust].velocity /= 2f; Vector2 current = Projectile.Center; if (target) @@ -92,24 +95,27 @@ namespace CalamityMod.Projectiles.Magic //AdjustMagnitude(ref projectile.velocity); //projectile.velocity = (10 * projectile.velocity + move) / 11f; - move+= new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10))*distance/30; - if (pastNPC) { + move += new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)) * distance / 30; + if (pastNPC) + { prevX++; - move += new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)) * prevX; + move += new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)) * prevX; } - - } - else { - move = (Projectile.velocity+ new Vector2(Main.rand.Next(-10, 10), Main.rand.Next(-10, 10)))*5; + else + { + move = (Projectile.velocity + new Vector2(Main.rand.Next(-5, 6), Main.rand.Next(-5, 6))) * 5; } + for (int i = 0; i < 20; i++) { int dust = Dust.NewDust(current, Projectile.width, Projectile.height, 20, 0, 0); Main.dust[dust].velocity = new Vector2(0); current += move / 20f; } + Projectile.position = current; + /*int tx = (int)(projectile.position.X / 16f); int ty = (int)(projectile.position.Y / 16f); diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index db919b7f6e..27a18a3a31 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -124,17 +124,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { OnHitEffects(target.Center); - target.AddBuff(BuffID.Ichor, 90); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.CursedInferno, 90); } public override void OnHitPvp(Player target, int damage, bool crit) { OnHitEffects(target.Center); - target.AddBuff(BuffID.Ichor, 90); - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.CursedInferno, 90); } private void OnHitEffects(Vector2 targetPos) diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index 42685b4c17..d6b1197781 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -120,12 +120,5 @@ namespace CalamityMod.Projectiles.Magic Main.spriteBatch.Draw(texture2D3, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, Projectile.rotation, origin2, Projectile.scale, SpriteEffects.None, 0); return false; } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 60); - } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index b03e73cd99..bc2d37ebbc 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -41,16 +41,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int duration = 120; + int duration = 240; target.AddBuff(ModContent.BuffType(), duration); target.AddBuff(ModContent.BuffType(), duration); target.AddBuff(ModContent.BuffType(), duration); - target.AddBuff(BuffID.Poisoned, duration); - target.AddBuff(BuffID.OnFire, duration); - target.AddBuff(BuffID.CursedInferno, duration / 2); - target.AddBuff(BuffID.Frostburn, duration); + target.AddBuff(BuffID.Electrified, duration); target.AddBuff(BuffID.Venom, duration); - target.AddBuff(BuffID.ShadowFlame, duration); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index f0e244a5e3..30b51fdaf5 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic // On frame 1, pick a random offset to use for the firing pattern. if (Projectile.timeLeft == Lifetime) - Projectile.localAI[0] = Main.rand.NextFloat(0f, FramesPerBeam); + Projectile.localAI[1] = Main.rand.NextFloat(0f, FramesPerBeam); // What in the hell does this code do if (Projectile.velocity.X > 0f) diff --git a/Projectiles/Magic/ManaMonster.cs b/Projectiles/Magic/ManaMonster.cs index fbf34a4a0f..ba146bb2c1 100644 --- a/Projectiles/Magic/ManaMonster.cs +++ b/Projectiles/Magic/ManaMonster.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { @@ -15,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic public const int PlayerAttackRedirectTime = 45; public override void SetStaticDefaults() { - DisplayName.SetDefault("Monster"); + DisplayName.SetDefault("Mana Monster"); ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } @@ -94,8 +95,15 @@ namespace CalamityMod.Projectiles.Magic } } - // Ensure damage is not absolutely obscene when hitting players. - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 102; + // TODO -- this damage should be after Terraria vanilla multipliers, so it won't one shot people + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + if (Main.masterMode) damage = 540; + else if (Main.expertMode) damage = 450; + else damage = 360; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); public override bool? CanDamage() => Projectile.Opacity >= 1f ? null : false; diff --git a/Projectiles/Magic/NanoPurgeHoldout.cs b/Projectiles/Magic/NanoPurgeHoldout.cs index 9a1f7e1532..3551169822 100644 --- a/Projectiles/Magic/NanoPurgeHoldout.cs +++ b/Projectiles/Magic/NanoPurgeHoldout.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Magic // Update damage based on curent magic damage stat (so Mana Sickness affects it) Item weaponItem = Owner.ActiveItem(); - Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(weaponItem?.damage ?? 0); + Projectile.damage = weaponItem is null ? 0 : Owner.GetWeaponDamage(weaponItem); // Get the original weapon's use time. int itemUseTime = weaponItem?.useAnimation ?? NanoPurge.UseTime; diff --git a/Projectiles/Magic/NebulaCloud.cs b/Projectiles/Magic/NebulaCloud.cs new file mode 100644 index 0000000000..7d9e8979d3 --- /dev/null +++ b/Projectiles/Magic/NebulaCloud.cs @@ -0,0 +1,124 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class NebulaCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebula Cloud"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 116; + Projectile.height = 116; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 720; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + int num925 = ModContent.ProjectileType(); + float num926 = 720f; + float x5 = 0.15f; + float y4 = 0.15f; + bool flag50 = false; + bool flag51 = false; + + if (flag51) + { + int num927 = (int)Projectile.ai[1]; + if (!Main.projectile[num927].active || Main.projectile[num927].type != num925) + { + Projectile.Kill(); + return; + } + + Projectile.timeLeft = 2; + } + + Projectile.ai[0]++; + if (!(Projectile.ai[0] < num926)) + return; + + bool flag52 = true; + int num928 = (int)Projectile.ai[1]; + if (Main.projectile[num928].active && Main.projectile[num928].type == num925) + { + if (!flag50 && Main.projectile[num928].oldPos[1] != Vector2.Zero) + Projectile.position += Main.projectile[num928].position - Main.projectile[num928].oldPos[1]; + + if (Projectile.Center.HasNaNs()) + { + Projectile.Kill(); + return; + } + } + else + { + Projectile.ai[0] = num926; + flag52 = false; + Projectile.Kill(); + } + + if (flag52 && !flag50) + { + Projectile.velocity += new Vector2(Math.Sign(Main.projectile[num928].Center.X - Projectile.Center.X), Math.Sign(Main.projectile[num928].Center.Y - Projectile.Center.Y)) * new Vector2(x5, y4); + if (Projectile.velocity.Length() > 6f) + Projectile.velocity *= 6f / Projectile.velocity.Length(); + } + + if (Main.rand.NextBool()) + { + int num929 = Dust.NewDust(Projectile.Center, 8, 8, 86); + Main.dust[num929].position = Projectile.Center; + Main.dust[num929].velocity = Projectile.velocity; + Main.dust[num929].noGravity = true; + Main.dust[num929].scale = 1.75f; + + if (flag52) + Main.dust[num929].customData = Main.projectile[(int)Projectile.ai[1]]; + } + } + + public override void Kill(int timeLeft) + { + Projectile.ai[0] = 86f; + + for (int num164 = 0; num164 < 15; num164++) + { + int num165 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, (int)Projectile.ai[0], Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default(Color), 0.75f); + Dust dust; + if (Main.rand.NextBool(3)) + { + Main.dust[num165].fadeIn = 0.75f + Main.rand.Next(-10, 11) * 0.015f; + Main.dust[num165].scale = 0.325f + Main.rand.Next(-10, 11) * 0.0075f; + dust = Main.dust[num165]; + dust.type++; + } + else + Main.dust[num165].scale = 1.5f + Main.rand.Next(-10, 11) * 0.015f; + + Main.dust[num165].noGravity = true; + dust = Main.dust[num165]; + dust.velocity *= 1.375f; + dust = Main.dust[num165]; + dust.velocity -= Projectile.oldVelocity / 20f; + } + } + } +} diff --git a/Projectiles/Magic/NebulaCloud.png b/Projectiles/Magic/NebulaCloud.png new file mode 100644 index 0000000000..41d49b6e6c Binary files /dev/null and b/Projectiles/Magic/NebulaCloud.png differ diff --git a/Projectiles/Magic/NebulaCloudCore.cs b/Projectiles/Magic/NebulaCloudCore.cs new file mode 100644 index 0000000000..98eb540f57 --- /dev/null +++ b/Projectiles/Magic/NebulaCloudCore.cs @@ -0,0 +1,362 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; + +namespace CalamityMod.Projectiles.Magic +{ + public class NebulaCloudCore : ModProjectile + { + private const float IntendedVelocity = 4f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebula Cloud Core"); + Main.projFrames[Projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.alpha = 255; + Projectile.penetrate = 4; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + // Timer. + Projectile.ai[0]++; + + // Animation. + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + // Decide what state the projectile is in. + int projectileState = 0; + if (Projectile.velocity.Length() <= IntendedVelocity) + projectileState = 1; + + // Become visible. + Projectile.alpha -= 15; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + + switch (projectileState) + { + // Do this if moving faster than 4 units per frame. + case 0: + + // Rotate. + Projectile.rotation -= (float)Math.PI / 30f; + + // Emit pretty as fuck dust. + if (Main.rand.NextBool(3)) + { + if (Main.rand.NextBool(2)) + { + Vector2 vector93 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust dust45 = Main.dust[Dust.NewDust(Projectile.Center - vector93 * 45f, 0, 0, Utils.SelectRandom(Main.rand, 86, 90))]; + dust45.noGravity = true; + dust45.position = Projectile.Center - vector93 * Main.rand.Next(20, 31); + dust45.velocity = vector93.RotatedBy(MathHelper.PiOver2) * 9f; + dust45.scale = 0.7f + Main.rand.NextFloat(); + dust45.fadeIn = 0.5f; + dust45.customData = this; + } + else + { + Vector2 vector94 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust dust46 = Main.dust[Dust.NewDust(Projectile.Center - vector94 * 45f, 0, 0, 240)]; + dust46.noGravity = true; + dust46.position = Projectile.Center - vector94 * 45f; + dust46.velocity = vector94.RotatedBy(-MathHelper.PiOver2) * 4f; + dust46.scale = 0.7f + Main.rand.NextFloat(); + dust46.fadeIn = 0.5f; + dust46.customData = this; + } + } + + // Scale up, decelerate and rotate. + if (Projectile.ai[0] >= 30f) + { + Projectile.velocity *= 0.98f; + Projectile.scale += 0.0074468083f; + if (Projectile.scale > 1.3f) + Projectile.scale = 1.3f; + + Projectile.rotation -= (float)Math.PI / 180f; + } + + // Set velocity to intended velocity if moving slower than intended velocity. + if (Projectile.velocity.Length() < IntendedVelocity + 0.1f) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= IntendedVelocity; + Projectile.ai[0] = 0f; + } + + break; + + // Do this if moving slower or equal to 4 units per frame. + case 1: + { + // Rotate. + Projectile.rotation -= (float)Math.PI / 30f; + + // Emit pretty as fuck dust. + if (Main.rand.NextBool()) + { + Vector2 vector88 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust dust43 = Main.dust[Dust.NewDust(Projectile.Center - vector88 * 45f, 0, 0, 86)]; + dust43.noGravity = true; + dust43.position = Projectile.Center - vector88 * Main.rand.Next(20, 31); + dust43.velocity = vector88.RotatedBy(MathHelper.PiOver2) * 9f; + dust43.scale = 1.2f + Main.rand.NextFloat(); + dust43.fadeIn = 0.5f; + dust43.customData = this; + vector88 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + dust43 = Main.dust[Dust.NewDust(Projectile.Center - vector88 * 45f, 0, 0, 90)]; + dust43.noGravity = true; + dust43.position = Projectile.Center - vector88 * Main.rand.Next(20, 31); + dust43.velocity = vector88.RotatedBy(MathHelper.PiOver2) * 9f; + dust43.scale = 1.2f + Main.rand.NextFloat(); + dust43.fadeIn = 0.5f; + dust43.customData = this; + dust43.color = Color.Purple; + } + else + { + Vector2 vector89 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); + Dust dust44 = Main.dust[Dust.NewDust(Projectile.Center - vector89 * 45f, 0, 0, 240)]; + dust44.noGravity = true; + dust44.position = Projectile.Center - vector89 * Main.rand.Next(30, 41); + dust44.velocity = vector89.RotatedBy(-MathHelper.PiOver2) * 6f; + dust44.scale = 1.2f + Main.rand.NextFloat(); + dust44.fadeIn = 0.5f; + dust44.customData = this; + } + + // Create the vortexes. + if (Projectile.ai[0] % 30f == 0f && Projectile.ai[0] < 241f && Main.myPlayer == Projectile.owner) + { + Vector2 vector90 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector90, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner, 0f, Projectile.whoAmI); + } + + // Homing. + Vector2 vector91 = Projectile.Center; + float num915 = 1200f; + bool flag49 = false; + int num916 = 0; + if (Projectile.ai[1] == 0f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(this)) + { + Vector2 center12 = Main.npc[i].Center; + if (Projectile.Distance(center12) < num915 && Collision.CanHit(new Vector2(Projectile.position.X + Projectile.width / 2, Projectile.position.Y + Projectile.height / 2), 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) + { + num915 = Projectile.Distance(center12); + vector91 = center12; + flag49 = true; + num916 = i; + } + } + } + + if (flag49) + { + if (Projectile.ai[1] != num916 + 1) + Projectile.netUpdate = true; + + Projectile.ai[1] = num916 + 1; + } + + flag49 = false; + } + + if (Projectile.ai[1] != 0f) + { + int num918 = (int)(Projectile.ai[1] - 1f); + if (Main.npc[num918].active && Main.npc[num918].CanBeChasedBy(this, ignoreDontTakeDamage: true) && Projectile.Distance(Main.npc[num918].Center) < 1000f) + { + flag49 = true; + vector91 = Main.npc[num918].Center; + } + } + + if (flag49) + { + float num919 = IntendedVelocity; + int inertia = 12; + Vector2 vector92 = Projectile.Center; + float num921 = vector91.X - vector92.X; + float num922 = vector91.Y - vector92.Y; + float num923 = (float)Math.Sqrt(num921 * num921 + num922 * num922); + num923 = num919 / num923; + num921 *= num923; + num922 *= num923; + Projectile.velocity.X = (Projectile.velocity.X * (inertia - 1) + num921) / inertia; + Projectile.velocity.Y = (Projectile.velocity.Y * (inertia - 1) + num922) / inertia; + } + + break; + } + } + + // Emit light if visible enough. + if (Projectile.alpha < 150) + Lighting.AddLight(Projectile.Center, 1.4f, 0.4f, 1.2f); + + // Kill after 15 seconds. + if (Projectile.ai[0] >= 900f) + Projectile.Kill(); + } + + // Bounce off tiles. + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = (0f - oldVelocity.X) * 0.25f; + + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = (0f - oldVelocity.Y) * 0.25f; + + return false; + } + + // Draw all the clouds and other crap. + public override bool PreDraw(ref Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (Projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Color fuckYou = Projectile.GetAlpha(lightColor); + Color coreColor = fuckYou * 0.8f; + coreColor.A /= 2; + Color cloudColor = Color.Lerp(fuckYou, Color.Black, 0.5f); + cloudColor.A = fuckYou.A; + float rotationScale = 0.95f + (Projectile.rotation * 0.75f).ToRotationVector2().Y * 0.1f; + cloudColor *= rotationScale; + float cloudScale = 0.6f + Projectile.scale * 0.6f * rotationScale; + Texture2D coreTexture = ModContent.Request(Texture).Value; + Texture2D nebulaCloudTexture = ModContent.Request("CalamityMod/Projectiles/Magic/NebulaCloud", AssetRequestMode.ImmediateLoad).Value; + Vector2 position = Projectile.Center - Main.screenPosition; + Vector2 coreOrigin = coreTexture.Size() / new Vector2(0, Main.projFrames[Projectile.type]) * 0.5f; + Vector2 cloudOrigin = nebulaCloudTexture.Size() * 0.5f; + Main.EntitySpriteDraw(nebulaCloudTexture, position, null, cloudColor, 0f - Projectile.rotation + 0.35f, cloudOrigin, cloudScale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(nebulaCloudTexture, position, null, fuckYou, 0f - Projectile.rotation, cloudOrigin, Projectile.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(coreTexture, position, new Rectangle?(new Rectangle(0, Main.projFrames[Projectile.type] * Projectile.frame, coreTexture.Width, Main.projFrames[Projectile.type])), coreColor, (0f - Projectile.rotation) * 0.7f, coreOrigin, Projectile.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(nebulaCloudTexture, position, null, fuckYou * 0.8f, Projectile.rotation * 0.5f, cloudOrigin, Projectile.scale * 0.9f, spriteEffects, 0); + fuckYou.A = 0; + + return false; + } + + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha); + + // Explode. + public override void Kill(int timeLeft) + { + Projectile.position = Projectile.Center; + Projectile.width = Projectile.height = 264; + Projectile.Center = Projectile.position; + + Projectile.maxPenetrate = -1; + Projectile.penetrate = -1; + Projectile.Damage(); + + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + + for (int num145 = 0; num145 < 6; num145++) + { + int num146 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 240, 0f, 0f, 100, default(Color), 1.75f); + Main.dust[num146].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + } + + for (int num147 = 0; num147 < 45; num147++) + { + int num148 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 200, default(Color), 5.05f); + Main.dust[num148].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Main.dust[num148].noGravity = true; + Dust dust = Main.dust[num148]; + dust.velocity *= 4f; + num148 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 90, 0f, 0f, 100, default(Color), 1.75f); + Main.dust[num148].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + dust = Main.dust[num148]; + dust.velocity *= 2.5f; + Main.dust[num148].noGravity = true; + Main.dust[num148].fadeIn = 1f; + Main.dust[num148].color = Color.Purple * 0.5f; + } + + for (int num149 = 0; num149 < 15; num149++) + { + int num150 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 62, 0f, 0f, 0, default(Color), 3.55f); + Main.dust[num150].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; + Main.dust[num150].noGravity = true; + Dust dust = Main.dust[num150]; + dust.velocity *= 4f; + } + + for (int num151 = 0; num151 < 15; num151++) + { + int num152 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 240, 0f, 0f, 0, default(Color), 1.75f); + Main.dust[num152].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(Math.PI).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 2f; + Main.dust[num152].noGravity = true; + Dust dust = Main.dust[num152]; + dust.velocity *= 4f; + } + + for (int num153 = 0; num153 < 3; num153++) + { + int num154 = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position + new Vector2(Projectile.width * Main.rand.Next(100) / 100f, Projectile.height * Main.rand.Next(100) / 100f) - Vector2.One * 10f, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[num154].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(Math.PI) * (float)Main.rand.NextDouble() * Projectile.width / 2f; + Gore gore = Main.gore[num154]; + gore.velocity *= 0.5f; + Main.gore[num154].velocity.X += Main.rand.Next(-10, 11) * 0.075f; + Main.gore[num154].velocity.Y += Main.rand.Next(-10, 11) * 0.075f; + } + + if (Main.myPlayer == Projectile.owner) + { + for (int num155 = 0; num155 < Main.maxProjectiles; num155++) + { + if (Main.projectile[num155].active && Main.projectile[num155].type == ModContent.ProjectileType() && Main.projectile[num155].ai[1] == Projectile.whoAmI) + Main.projectile[num155].Kill(); + } + + int totalProjectiles = Main.rand.Next(6, 9); + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = Main.rand.Next(70, 101) * 0.1f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f), velocity2, type, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.8f, Projectile.owner); + } + } + } + } +} diff --git a/Projectiles/Magic/NebulaCloudCore.png b/Projectiles/Magic/NebulaCloudCore.png new file mode 100644 index 0000000000..0807aa5819 Binary files /dev/null and b/Projectiles/Magic/NebulaCloudCore.png differ diff --git a/Projectiles/Magic/NebulaNova.cs b/Projectiles/Magic/NebulaNova.cs new file mode 100644 index 0000000000..ea1005d94e --- /dev/null +++ b/Projectiles/Magic/NebulaNova.cs @@ -0,0 +1,73 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class NebulaNova : ModProjectile + { + private const int TotalXFrames = 2; + private const int TotalYFrames = 7; + private const int FrameTimer = 4; + + public int frameX = 0; + public int frameY = 0; + + public int CurrentFrame + { + get => frameX * TotalYFrames + frameY; + set + { + frameX = value / TotalYFrames; + frameY = value % TotalYFrames; + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nebula Nova"); + } + + public override void SetDefaults() + { + Projectile.width = 190; + Projectile.height = 168; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = TotalXFrames * TotalYFrames * FrameTimer; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter % FrameTimer == 0) + { + CurrentFrame++; + if (frameX >= TotalXFrames) + CurrentFrame = 0; + } + + Projectile.velocity *= 0.95f; + } + + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 position = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() / new Vector2(TotalXFrames, TotalYFrames) * 0.5f; + Rectangle frame = texture.Frame(TotalXFrames, TotalYFrames, frameX, frameY); + SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + + return false; + } + } +} diff --git a/Projectiles/Magic/NebulaNova.png b/Projectiles/Magic/NebulaNova.png new file mode 100644 index 0000000000..f89397e9a8 Binary files /dev/null and b/Projectiles/Magic/NebulaNova.png differ diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 7895e4c047..0d24e9b399 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -142,19 +142,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.buffImmune[BuffID.Wet] = false; //I'm not sorry - target.AddBuff(BuffID.Wet, 600); if (Projectile.ai[1] != 1f) //Nuclear Fury { target.immune[Projectile.owner] = 5; } } - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 600); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Magic/PhasedGodRay.cs b/Projectiles/Magic/PhasedGodRay.cs index 5310767cd4..e020d7fa7a 100644 --- a/Projectiles/Magic/PhasedGodRay.cs +++ b/Projectiles/Magic/PhasedGodRay.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -100,9 +101,9 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); public override Color? GetAlpha(Color lightColor) => new Color(222, 166, 44, 0); diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index b24e9db233..a71154e1b7 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.ShadowFlame, 600); + target.AddBuff(BuffID.ShadowFlame, 360); } } } diff --git a/Projectiles/Magic/PoseidonTyphoon.cs b/Projectiles/Magic/PoseidonTyphoon.cs index 08d83f8d0a..002829229a 100644 --- a/Projectiles/Magic/PoseidonTyphoon.cs +++ b/Projectiles/Magic/PoseidonTyphoon.cs @@ -4,6 +4,8 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Magic { @@ -36,6 +38,10 @@ namespace CalamityMod.Projectiles.Magic CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 6f, 30f); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); diff --git a/Projectiles/Magic/RainbowComet.cs b/Projectiles/Magic/RainbowComet.cs index 60b78407cd..e77b1c5fb4 100644 --- a/Projectiles/Magic/RainbowComet.cs +++ b/Projectiles/Magic/RainbowComet.cs @@ -30,9 +30,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 1; Projectile.DamageType = DamageClass.Magic; Projectile.timeLeft = 300; - Projectile.usesLocalNPCImmunity = true; Projectile.alpha = 255; - Projectile.localNPCHitCooldown = 16; } public override void AI() diff --git a/Projectiles/Magic/RainbowPartyCannonProjectile.cs b/Projectiles/Magic/RainbowPartyCannonProjectile.cs index d212c3e82a..27d5c1cc35 100644 --- a/Projectiles/Magic/RainbowPartyCannonProjectile.cs +++ b/Projectiles/Magic/RainbowPartyCannonProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Item heldItem = Owner.ActiveItem(); - Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(heldItem?.damage ?? 0); + Projectile.damage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); UpdatePlayerVisuals(Owner.Center); diff --git a/Projectiles/Magic/RancorArm.cs b/Projectiles/Magic/RancorArm.cs index 9b839e2798..ce46dc481a 100644 --- a/Projectiles/Magic/RancorArm.cs +++ b/Projectiles/Magic/RancorArm.cs @@ -58,8 +58,9 @@ namespace CalamityMod.Projectiles.Magic // Decide a frame to use and adjust the hitbox based on it. if (Projectile.localAI[0] == 0f) { - // Play a wraith death sound. - SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); + // Play a wraith death sound by default, play a generic flame sound when spawned by gfb Orthoceras + SoundStyle sound = Time == 0 ? SoundID.NPCDeath52 : SoundID.Item20; + SoundEngine.PlaySound(sound, Projectile.Center); Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); @@ -134,9 +135,15 @@ namespace CalamityMod.Projectiles.Magic behindNPCsAndTiles.Add(index); } + // TODO -- this damage should be after Terraria vanilla multipliers, so it won't one shot people public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - damage = Main.rand.Next(80, 90); + if (Projectile.friendly) + { + if (Main.masterMode) damage = 450; + else if (Main.expertMode) damage = 375; + else damage = 300; + } } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 8abbd7cc03..eb9811b264 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using System; @@ -88,8 +88,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index 0e1656f80a..4f8ae9445f 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -50,6 +51,10 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override Color? GetAlpha(Color lightColor) { return new Color(250, 50, 50, Projectile.alpha); diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index 599cb3803d..634c678b66 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { @@ -77,6 +78,10 @@ namespace CalamityMod.Projectiles.Magic } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override Color? GetAlpha(Color lightColor) { return new Color(250, 50, 50, Projectile.alpha); diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs index e265bb2a77..e75799581a 100644 --- a/Projectiles/Magic/ShadeNimbus.cs +++ b/Projectiles/Magic/ShadeNimbus.cs @@ -88,15 +88,5 @@ namespace CalamityMod.Projectiles.Magic } } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - } } } diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index ad6e0d2689..c569c56686 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.Frostburn2, 120); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index 5472869bdb..6719fdc750 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -42,15 +42,5 @@ namespace CalamityMod.Projectiles.Magic dust.velocity += -Projectile.oldVelocity * 0.25f; dust.scale = 0.95f; } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.ShadowFlame, 60); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - } } } diff --git a/Projectiles/Magic/Snowball.cs b/Projectiles/Magic/Snowball.cs index bfd7df20ad..04741e9055 100644 --- a/Projectiles/Magic/Snowball.cs +++ b/Projectiles/Magic/Snowball.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); } diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 60c08a4997..561b971e26 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[Projectile.owner] = 7; - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); } } } diff --git a/Projectiles/Magic/SoulPiercerBeam.cs b/Projectiles/Magic/SoulPiercerBeam.cs index d3b501f39e..5623a51c93 100644 --- a/Projectiles/Magic/SoulPiercerBeam.cs +++ b/Projectiles/Magic/SoulPiercerBeam.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -43,14 +44,16 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); + var source = Projectile.GetSource_FromThis(); for (int x = 0; x < 3; x++) { if (Projectile.owner == Main.myPlayer) - { CalamityUtils.ProjectileBarrage(source, Projectile.Center, target.Center, true, -500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, false, 0f); - } } } + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/SoulPiercerBolt.cs b/Projectiles/Magic/SoulPiercerBolt.cs index 7e700c78d7..24a6156e62 100644 --- a/Projectiles/Magic/SoulPiercerBolt.cs +++ b/Projectiles/Magic/SoulPiercerBolt.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -35,5 +36,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.014f; Main.dust[num448].velocity *= 0.2f; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/SparkInfernal.cs b/Projectiles/Magic/SparkInfernal.cs index 0041199ea6..f9be8980a9 100644 --- a/Projectiles/Magic/SparkInfernal.cs +++ b/Projectiles/Magic/SparkInfernal.cs @@ -3,6 +3,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Magic { @@ -40,8 +41,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Daybreak, 120); - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Magic/SparklingBeam.cs b/Projectiles/Magic/SparklingBeam.cs deleted file mode 100644 index 17623e04f7..0000000000 --- a/Projectiles/Magic/SparklingBeam.cs +++ /dev/null @@ -1,296 +0,0 @@ -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Linq; -using Terraria; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Magic -{ - // The following laser shows a channeled ability, after charging up the laser will be fired - // Using custom drawing, dust effects, and custom collision checks for tiles - public class SparklingBeam : ModProjectile - { - // Use a different style for constant so it is very clear in code when a constant is used - - // The maximum charge value - private const float MAX_CHARGE = 50f; - //The distance charge particle from the player center - private const float MOVE_DISTANCE = 60f; - - // The actual distance is stored in the ai0 field - // By making a property to handle this it makes our life easier, and the accessibility more readable - public float Distance - { - get => Projectile.ai[0]; - set => Projectile.ai[0] = value; - } - - // The actual charge value is stored in the localAI0 field - public float Charge - { - get => Projectile.localAI[0]; - set => Projectile.localAI[0] = value; - } - - // Are we at max charge? With c#6 you can simply use => which indicates this is a get only property - public bool IsAtMaxCharge => Charge == MAX_CHARGE; - - private bool playedSound = false; - //private int manaDrain = 0; - - public Player Owner => Main.player[Projectile.owner]; - private const float AimResponsiveness = 0.8f; // Last Prism is 0.92f. Lower makes the laser turn faster. - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.hide = true; - Projectile.timeLeft = 300; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 20; - } - - public override bool PreDraw(ref Color lightColor) - { - // We start drawing the laser if we have charged up - if (IsAtMaxCharge) - { - DrawLaser(ModContent.Request(Texture).Value, Main.player[Projectile.owner].Center, - Projectile.velocity, 10, Projectile.damage, -1.57f, 1f, 1000f, Color.White, (int)MOVE_DISTANCE); - } - return false; - } - - // The core function of drawing a laser - public void DrawLaser(Texture2D texture, Vector2 start, Vector2 unit, float step, int damage, float rotation = 0f, float scale = 1f, float maxDist = 2000f, Color color = default(Color), int transDist = 50) - { - float r = unit.ToRotation() + rotation; - - // Draws the laser 'body' - for (float i = transDist; i <= Distance; i += step) - { - Color c = Color.White; - var origin = start + i * unit; - Main.EntitySpriteDraw(texture, origin - Main.screenPosition, - new Rectangle(0, 26, 28, 26), i < transDist ? Color.Transparent : c, r, - new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); - } - - // Draws the laser 'tail' - Main.EntitySpriteDraw(texture, start + unit * (transDist - step) - Main.screenPosition, - new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); - - // Draws the laser 'head' - Main.EntitySpriteDraw(texture, start + (Distance + step) * unit - Main.screenPosition, - new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(28 * .5f, 26 * .5f), scale, 0, 0); - } - - // Change the way of collision check of the projectile - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - // We can only collide if we are at max charge, which is when the laser is actually fired - if (!IsAtMaxCharge) - return false; - - Player player = Main.player[Projectile.owner]; - Vector2 unit = Projectile.velocity; - float point = 0f; - // Run an AABB versus Line check to look for collisions, look up AABB collision first to see how it works - // It will look for collisions on the given line using AABB - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.Center, - player.Center + unit * Distance, 22, ref point); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0 && target.lifeMax > 5) - { - Player player = Main.player[Projectile.owner]; - int shardDamage = Projectile.damage / 5; - int shardAmt = Main.rand.Next(2, 4); - if (Projectile.owner == Main.myPlayer) - { - 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; - } - } - } - } - - // The AI of the projectile - public override void AI() - { - Player player = Main.player[Projectile.owner]; - Projectile.position = player.Center + Projectile.velocity * MOVE_DISTANCE; - Projectile.timeLeft = 2; - - // By separating large AI into methods it becomes very easy to see the flow of the AI in a broader sense - // First we update player variables that are needed to channel the laser - // Then we run our charging laser logic - // If we are fully charged, we proceed to update the laser's position - // Finally we spawn some effects like dusts and light - - UpdatePlayer(player); - ChargeLaser(player); - - // If laser is not charged yet, stop the AI here. - if (Charge < MAX_CHARGE) - return; - - //Play cool sound when fully charged - if (!playedSound) - { - SoundEngine.PlaySound(SoundID.Item68, Projectile.position); - playedSound = true; - } - - SetLaserPosition(player); - SpawnDusts(player); - CastLights(); - } - - private void SpawnDusts(Player player) - { - Vector2 unit = Projectile.velocity * -1; - Vector2 dustPos = player.Center + Projectile.velocity * Distance; - - for (int i = 0; i < 2; ++i) - { - float num1 = Projectile.velocity.ToRotation() + (Main.rand.Next(2) == 1 ? -1.0f : 1.0f) * 1.57f; - float num2 = (float)(Main.rand.NextDouble() * 0.8f + 1.0f); - Vector2 dustVel = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2); - Dust dust = Main.dust[Dust.NewDust(dustPos, 0, 0, 226, dustVel.X, dustVel.Y)]; - dust.noGravity = true; - dust.scale = 1.2f; - dust = Dust.NewDustDirect(Main.player[Projectile.owner].Center, 0, 0, 31, - -unit.X * Distance, -unit.Y * Distance); - dust.fadeIn = 0f; - dust.noGravity = true; - dust.scale = 0.88f; - dust.color = Color.Cyan; - } - - if (Main.rand.NextBool(5)) - { - Vector2 offset = Projectile.velocity.RotatedBy(1.57f) * ((float)Main.rand.NextDouble() - 0.5f) * Projectile.width; - Dust dust = Main.dust[Dust.NewDust(dustPos + offset - Vector2.One * 4f, 8, 8, 31, 0.0f, 0.0f, 100, new Color(), 1.5f)]; - dust.velocity *= 0.5f; - dust.velocity.Y = -Math.Abs(dust.velocity.Y); - unit = dustPos - Main.player[Projectile.owner].Center; - unit.Normalize(); - dust = Main.dust[Dust.NewDust(Main.player[Projectile.owner].Center + 55 * unit, 8, 8, 31, 0.0f, 0.0f, 100, new Color(), 1.5f)]; - dust.velocity = dust.velocity * 0.5f; - dust.velocity.Y = -Math.Abs(dust.velocity.Y); - } - } - - /* - * Sets the end of the laser position based on where it collides with something - */ - private void SetLaserPosition(Player player) - { - float[] samplingPoints = new float[12]; - Collision.LaserScan(player.Center + Projectile.velocity * MOVE_DISTANCE, Projectile.velocity, Projectile.width * 0.5f, 2200f, samplingPoints); - Distance = MathHelper.Max(samplingPoints.Average() + Projectile.height * 2f, 40f); - } - - private void ChargeLaser(Player player) - { - // Kill the projectile if the player stops channeling - if (!player.channel) - { - Projectile.Kill(); - } - else { - // Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore - if (Main.player[Projectile.owner].miscCounter % 10 == 0 && !player.CheckMana(player.ActiveItem(), -1, true)) - { - Projectile.Kill(); - } - Vector2 offset = Projectile.velocity; - offset *= MOVE_DISTANCE - 20; - Vector2 pos = player.Center + offset - new Vector2(10, 10); - if (Charge < MAX_CHARGE) - { - Charge++; - } - int chargeFact = (int)(Charge / 20f); - Vector2 dustVelocity = Vector2.UnitX * 18f; - dustVelocity = dustVelocity.RotatedBy(Projectile.rotation - 1.57f); - Vector2 spawnPos = Projectile.Center + dustVelocity; - for (int k = 0; k < chargeFact + 1; k++) - { - Vector2 spawn = spawnPos + ((float)Main.rand.NextDouble() * 6.28f).ToRotationVector2() * (12f - chargeFact * 2); - Dust dust = Main.dust[Dust.NewDust(pos, 20, 20, 226, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f)]; - dust.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f; - dust.noGravity = true; - dust.scale = Main.rand.Next(10, 20) * 0.05f; - } - } - } - - private void UpdatePlayer(Player player) - { - // 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; - Owner.ChangeDir(dir); - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; - Owner.itemRotation = ((Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * -Owner.direction).ToRotation(); - } - - 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; - } - - private void CastLights() - { - // Cast a light along the line of the laser - DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f); - Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26, DelegateMethods.CastLight); - } - - public override bool ShouldUpdatePosition() => false; - - /* - * 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 * Distance, (Projectile.width + 16) * Projectile.scale, DelegateMethods.CutTiles); - } - } -} diff --git a/Projectiles/Magic/SparklingBeam.png b/Projectiles/Magic/SparklingBeam.png deleted file mode 100644 index 7508432a14..0000000000 Binary files a/Projectiles/Magic/SparklingBeam.png and /dev/null differ diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs new file mode 100644 index 0000000000..6a3fbb6f42 --- /dev/null +++ b/Projectiles/Magic/SparklingLaser.cs @@ -0,0 +1,237 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SparklingLaser : BaseLaserbeamProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + 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() + { + DisplayName.SetDefault("Sparkling Laser"); + Main.projFrames[Projectile.type] = 5; + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.hide = true; + Projectile.timeLeft = 18000; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 20; + } + + public override void DetermineScale() + { + Projectile.scale = Time < ChargeupTime ? 0f : MaxScale; + } + + public override float DetermineLaserLength() + { + return DetermineLaserLength_CollideWithTiles(5); + } + + 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.ActiveItem(), -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, 226, 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.position); + 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, int damage, float knockback, bool crit) + { + 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; + } + } + } + + 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/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index aaf27ee79e..dc9d940084 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -135,13 +135,17 @@ namespace CalamityMod.Projectiles.Magic // Set the hover offset to a zero vector after enough time has passed and the projectile is powerful/tame enough. bool tame = CurrentPower > 0.97f; - Projectile.hostile = !tame && Time > 75f; if (tame) { if (HoverOffset != Vector2.Zero) HoverOffset = Vector2.Zero; } + // Previously, Gruesome Eminence stopped being able to hurt you when fully charged. + // This has been changed so that its threat is everpresent. + Projectile.hostile = Time > 75f; + // Projectile.hostile = !tame && Time > 75f; + // Explode into a burst of spirit dust and gas clouds when a bigger face appears. if (!WasStrongBefore && CurrentPower > LargeMouthPowerLowerBound) { @@ -286,10 +290,17 @@ namespace CalamityMod.Projectiles.Magic return false; } - // Prevent obsence damage when hitting players. + // TODO -- this damage should be after Terraria vanilla multipliers, so it won't one shot people + // Damage scales up over time as it grows public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - damage = 92; + float damageFactor = 0.25f + 0.75f * CurrentPower; + int fullPowerDamage; + if (Main.masterMode) fullPowerDamage = 540; + else if (Main.expertMode) fullPowerDamage = 450; + else fullPowerDamage = 360; + + damage = (int)(damageFactor * fullPowerDamage); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Magic/StardustElementalBeam.cs b/Projectiles/Magic/StardustElementalBeam.cs index f32a28fc17..6af923489c 100644 --- a/Projectiles/Magic/StardustElementalBeam.cs +++ b/Projectiles/Magic/StardustElementalBeam.cs @@ -64,9 +64,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - // Inflict the celled debuff for 3 seconds. - target.AddBuff(BuffID.StardustMinionBleed, 180); - if (!Main.rand.NextBool(7)) return; diff --git a/Projectiles/Magic/SupremeDustFlakProjectile.cs b/Projectiles/Magic/SupremeDustFlakProjectile.cs index 7527dc7c58..c805af6239 100644 --- a/Projectiles/Magic/SupremeDustFlakProjectile.cs +++ b/Projectiles/Magic/SupremeDustFlakProjectile.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -18,9 +19,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 2; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 100; + Projectile.penetrate = 1; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 25 * Projectile.MaxUpdates; // 25 effective, 100 total } public override void AI() @@ -89,9 +90,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation += 0.3f * (float)Projectile.direction; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 6; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/SupremeDustProjectile.cs b/Projectiles/Magic/SupremeDustProjectile.cs index 517026e38d..2df3b7c803 100644 --- a/Projectiles/Magic/SupremeDustProjectile.cs +++ b/Projectiles/Magic/SupremeDustProjectile.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -19,8 +20,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = 4; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 200; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 50 * Projectile.MaxUpdates; // 50 effective, 200 total + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 40 total } public override void AI() @@ -85,11 +88,13 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[Projectile.owner] = 6; + target.AddBuff(ModContent.BuffType(), 180); 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, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index aa2436772d..221a0bfafe 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -20,11 +20,13 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.alpha = 255; Projectile.timeLeft = 240; Projectile.light = 0.5f; Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() @@ -60,7 +62,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[Projectile.owner] = 6; target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/TridentIcicle.cs b/Projectiles/Magic/TridentIcicle.cs index 15f04916fa..b9f9419723 100644 --- a/Projectiles/Magic/TridentIcicle.cs +++ b/Projectiles/Magic/TridentIcicle.cs @@ -37,8 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(BuffID.Frostburn2, 180); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index d87b4a25a8..9c550c86eb 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -114,11 +114,6 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); diff --git a/Projectiles/Magic/VehemenceHoldout.cs b/Projectiles/Magic/VehemenceHoldout.cs index 56ba667d66..f87820d3e7 100644 --- a/Projectiles/Magic/VehemenceHoldout.cs +++ b/Projectiles/Magic/VehemenceHoldout.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Magic Item heldItem = Owner.ActiveItem(); Vector2 shootVelocity = Projectile.velocity * heldItem.shootSpeed; - int damage = (int)Owner.GetTotalDamage().ApplyTo(heldItem.damage); + int damage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), damage, heldItem.knockBack, Projectile.owner); } diff --git a/Projectiles/Magic/VehemenceSkull.cs b/Projectiles/Magic/VehemenceSkull.cs index 499e0f72b3..7b4fc97281 100644 --- a/Projectiles/Magic/VehemenceSkull.cs +++ b/Projectiles/Magic/VehemenceSkull.cs @@ -62,7 +62,5 @@ namespace CalamityMod.Projectiles.Magic } public override Color? GetAlpha(Color lightColor) => new Color(191, 63, 54, 100); - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index e9209dcb09..5750855021 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Daybreak, 300); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index ec2d8bcefc..c5f86c6378 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Daybreak, 300); } } } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index 3de2b8f6ab..730f4e0b1b 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 150); + target.AddBuff(BuffID.Daybreak, 150); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index eedd6e635f..02b71375d5 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -20,8 +20,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = 1; Projectile.timeLeft = 300; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; } public override void AI() diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index 5e72c6ab6e..9a296dcb63 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -97,7 +98,7 @@ namespace CalamityMod.Projectiles.Magic { SummonLasers(); } - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Magic { SummonLasers(); } - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } private void SummonLasers() diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index c0c02cfa3d..010a55e67e 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -65,12 +66,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Magic/VividClarityBeam.cs b/Projectiles/Magic/VividClarityBeam.cs index b195bc22d6..07e778be45 100644 --- a/Projectiles/Magic/VividClarityBeam.cs +++ b/Projectiles/Magic/VividClarityBeam.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -74,7 +75,6 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.damage = (int)((double)Projectile.damage * 1.2); Projectile.penetrate--; if (Projectile.penetrate <= 0) { @@ -96,14 +96,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); - Projectile.damage = (int)(Projectile.damage * 1.1); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); - Projectile.damage = (int)(Projectile.damage * 1.1); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Magic/VividExplosion.cs b/Projectiles/Magic/VividExplosion.cs index 19f25c1fca..248fc41d27 100644 --- a/Projectiles/Magic/VividExplosion.cs +++ b/Projectiles/Magic/VividExplosion.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -52,12 +53,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index be9b105443..6c8a4e6d3e 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -62,12 +63,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } // Cannot deal damage for the first several frames of existence. diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index 5e98f5ec2d..7e2aac7324 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Projectiles.Magic { // Spin chaotically given a pre-defined spin direction. Choose one initially at random. float spinTheta = 0.11f; - if (Projectile.localAI[1] == 0f) - Projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta; - Projectile.rotation += Projectile.localAI[1]; + if (Projectile.localAI[0] == 0f) + Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta; + Projectile.rotation += Projectile.localAI[0]; // Animate the lightning orb. Projectile.frameCounter++; diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index 30aa502eab..1cdcc24b17 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -96,13 +96,11 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Daybreak, 180); - target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Daybreak, 180); - target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/VortexElementalBeam.cs b/Projectiles/Magic/VortexElementalBeam.cs index 092f324155..7edd0082aa 100644 --- a/Projectiles/Magic/VortexElementalBeam.cs +++ b/Projectiles/Magic/VortexElementalBeam.cs @@ -157,8 +157,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Electrified, 180); - for (int i = 0; i < Projectile.oldPos.Length - 1; i++) { // Skip zeroed old positions. They are almost certainly a diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 361dd54540..6c1bf1fcd0 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; @@ -202,6 +203,11 @@ namespace CalamityMod.Projectiles.Magic return MathHelper.Lerp(1f, MaxDamageMultiplier, f); } + // Inflict Dragonfire. + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + // Determines whether the specified target hitbox is intersecting with the beam. public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index 338cddb893..464606e1ef 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); // Update damage based on curent magic damage stat (so Mana Sickness affects it) - Projectile.damage = (int)player.GetTotalDamage().ApplyTo(player.ActiveItem()?.damage ?? 0); + Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); // ai[0] is the overall frame counter. Projectile.ai[0] += 1f; diff --git a/Projectiles/Melee/AquaStream.cs b/Projectiles/Melee/AquaStream.cs index 9a057eb259..cb23f42f27 100644 --- a/Projectiles/Melee/AquaStream.cs +++ b/Projectiles/Melee/AquaStream.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = 1f; Projectile.friendly = true; Projectile.alpha = 150; - Projectile.penetrate = 1; - Projectile.timeLeft = 14; + Projectile.penetrate = 2; + Projectile.timeLeft = 90; Projectile.DamageType = DamageClass.MeleeNoSpeed; } @@ -29,14 +29,12 @@ namespace CalamityMod.Projectiles.Melee //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]; - if (Main.rand.NextFloat() < 1f) - { - 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), 2.368421f); - dust.noGravity = true; - } + + 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/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index f9aea376e0..34edf25cd6 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire3, 240); if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < 2; k++) diff --git a/Projectiles/Melee/BallOFuguProj.cs b/Projectiles/Melee/BallOFuguProj.cs index 2af1c4aff8..f7e3c9236f 100644 --- a/Projectiles/Melee/BallOFuguProj.cs +++ b/Projectiles/Melee/BallOFuguProj.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 180); + target.AddBuff(BuffID.Poisoned, 180); Projectile.ai[0] = 1f; Projectile.netUpdate = true; } diff --git a/Projectiles/Melee/BloodyBlade.cs b/Projectiles/Melee/BloodyBlade.cs deleted file mode 100644 index 84b31ec938..0000000000 --- a/Projectiles/Melee/BloodyBlade.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BloodyBlade : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloody Blade"); - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 48; - Projectile.height = 48; - Projectile.aiStyle = ProjAIStyleID.Sickle; - AIType = ProjectileID.DeathSickle; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0.3f / 255f, (255 - Projectile.alpha) * 0f / 255f); - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 9; - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Ichor, 60); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Ichor, 60); - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Melee/BloodyBlade.png b/Projectiles/Melee/BloodyBlade.png deleted file mode 100644 index b8d1439078..0000000000 Binary files a/Projectiles/Melee/BloodyBlade.png and /dev/null differ diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 92362756e4..a201e5f13a 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.owner == Main.myPlayer) { - for (int s = 0; s < Main.rand.Next(2,5); s++) + for (int s = 0; s < 2; s++) { Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); while (velocity.X == 0f && velocity.Y == 0f) diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index f1c893f270..89864b2b0e 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -20,8 +20,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.timeLeft = 240; + Projectile.penetrate = 5; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() @@ -84,11 +86,6 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - // TODO -- Change this to use proper i-frame variables. - target.immune[Projectile.owner] = 7; - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Melee/BrimstoneSwordExplosion.cs b/Projectiles/Melee/BrimstoneSwordExplosion.cs index 0aa90ddcb8..a414156406 100644 --- a/Projectiles/Melee/BrimstoneSwordExplosion.cs +++ b/Projectiles/Melee/BrimstoneSwordExplosion.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.penetrate = 3; + Projectile.penetrate = 2; Projectile.timeLeft = 60; Projectile.DamageType = DamageClass.Melee; Projectile.usesLocalNPCImmunity = true; @@ -97,9 +97,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/BrimstoneSwordProj.cs similarity index 78% rename from Projectiles/Melee/ProfanedSwordProj.cs rename to Projectiles/Melee/BrimstoneSwordProj.cs index a9c333e5cd..3c31fbf7a4 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/BrimstoneSwordProj.cs @@ -8,14 +8,13 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class ProfanedSwordProj : ModProjectile + public class BrimstoneSwordProj : ModProjectile { public override string Texture => "CalamityMod/Items/Weapons/Melee/BrimstoneSword"; - private int explosionCount = 0; public override void SetStaticDefaults() { - DisplayName.SetDefault("Profaned Sword"); + DisplayName.SetDefault("Brimstone Sword"); } public override void SetDefaults() @@ -23,11 +22,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 10; Projectile.height = 10; Projectile.friendly = true; - Projectile.penetrate = -1; + Projectile.penetrate = 5; Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -63,20 +64,15 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[Projectile.owner] = 6; target.AddBuff(ModContent.BuffType(), 180); - if (Main.myPlayer == Projectile.owner) + if (Main.myPlayer == Projectile.owner && Projectile.numHits == 0) { - if (explosionCount < 3) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), knockback, Projectile.owner); - explosionCount++; - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), knockback, Projectile.owner); } if (Projectile.damage > 1) Projectile.damage = (int)(Projectile.damage * 0.6); - if (Projectile.damage <= 0) - Projectile.damage = 1; + else + Projectile.Kill(); } } } diff --git a/Projectiles/Melee/CalamityAura.cs b/Projectiles/Melee/CalamityAura.cs deleted file mode 100644 index e45120d189..0000000000 --- a/Projectiles/Melee/CalamityAura.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class CalamityAura : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 80; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 73, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 73, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 120); - } - - public override void Kill(int timeLeft) - { - int height = 40; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = height; - Projectile.Center = Projectile.position; - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 200, default, num50); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, num51); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 0, default, num52); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } -} diff --git a/Projectiles/Melee/CalamityAuraType2.cs b/Projectiles/Melee/CalamityAuraType2.cs deleted file mode 100644 index 623b975bf1..0000000000 --- a/Projectiles/Melee/CalamityAuraType2.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class CalamityAuraType2 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 80; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 56, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 56, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 90); - } - - public override void Kill(int timeLeft) - { - int height = 40; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = height; - Projectile.Center = Projectile.position; - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 200, default, num50); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, num51); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 0, default, num52); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } -} diff --git a/Projectiles/Melee/CalamityAuraType3.cs b/Projectiles/Melee/CalamityAuraType3.cs deleted file mode 100644 index 03615463a4..0000000000 --- a/Projectiles/Melee/CalamityAuraType3.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class CalamityAuraType3 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aura"); - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 80; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - for (int num151 = 0; num151 < 3; num151++) - { - int num154 = 14; - int num155 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num154 * 2, Projectile.height - num154 * 2, 57, 0f, 0f, 100, default, 1.35f); - Main.dust[num155].noGravity = true; - Main.dust[num155].velocity *= 0.1f; - Main.dust[num155].velocity += Projectile.velocity * 0.5f; - } - if (Main.rand.NextBool(8)) - { - int num156 = 16; - int num157 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width - num156 * 2, Projectile.height - num156 * 2, 57, 0f, 0f, 100, default, 1f); - Main.dust[num157].velocity *= 0.25f; - Main.dust[num157].noGravity = true; - Main.dust[num157].velocity += Projectile.velocity * 0.5f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 60); - } - - public override void Kill(int timeLeft) - { - int height = 40; - float num50 = 1.7f; - float num51 = 0.8f; - float num52 = 2f; - Vector2 value3 = (Projectile.rotation - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = height; - Projectile.Center = Projectile.position; - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - int num3; - for (int num53 = 0; num53 < 40; num53 = num3 + 1) - { - int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 200, default, num50); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - Main.dust[num54].noGravity = true; - Dust dust = Main.dust[num54]; - dust.velocity *= 3f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 100, default, num51); - Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f; - dust = Main.dust[num54]; - dust.velocity *= 2f; - Main.dust[num54].noGravity = true; - Main.dust[num54].fadeIn = 1f; - Main.dust[num54].color = Color.Crimson * 0.5f; - dust = Main.dust[num54]; - dust.velocity += value4 * Main.rand.NextFloat(); - num3 = num53; - } - for (int num55 = 0; num55 < 20; num55 = num3 + 1) - { - int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 57, 0f, 0f, 0, default, num52); - Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f; - Main.dust[num56].noGravity = true; - Dust dust = Main.dust[num56]; - dust.velocity *= 0.5f; - dust = Main.dust[num56]; - dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); - num3 = num55; - } - } - } -} diff --git a/Projectiles/Melee/CatastropheClaymoreSparkle.cs b/Projectiles/Melee/CatastropheClaymoreSparkle.cs new file mode 100644 index 0000000000..53e6240ee2 --- /dev/null +++ b/Projectiles/Melee/CatastropheClaymoreSparkle.cs @@ -0,0 +1,71 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Melee +{ + public class CatastropheClaymoreSparkle : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float ProjectileType => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aura"); + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 80; + Projectile.DamageType = DamageClass.Melee; + } + + public override void AI() + { + int dustType = (ProjectileType == 2f ? 57 : ProjectileType == 1f ? 56 : 73); // Frostbite, Ichor, Hellfire respectively + for (int i = 0; i < 3; i++) + { + Dust trail = Dust.NewDustPerfect(Projectile.Center, dustType); + trail.noGravity = true; + trail.scale = 1.35f; + trail.velocity = Projectile.velocity * 0.5f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + switch (ProjectileType) + { + case 1f: + target.AddBuff(BuffID.Frostburn2, 90); + break; + case 2f: + target.AddBuff(BuffID.Ichor, 60); + break; + default: + target.AddBuff(BuffID.OnFire3, 120); + break; + } + } + + public override void Kill(int timeLeft) + { + int dustType = (ProjectileType == 2f ? 57 : ProjectileType == 1f ? 56 : 73); // Frostbite, Ichor, Hellfire respectively + float effectiveVelocity = Projectile.velocity.Length() * Projectile.MaxUpdates; + for (int i = 0; i < 60; i++) + { + Dust boom = Dust.NewDustPerfect(Projectile.Center, dustType); + boom.noGravity = true; + boom.scale = Main.rand.NextFloat(0.8f, 1.7f); + boom.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 6f) * Main.rand.NextFloat(-2.4f, -1.2f) * effectiveVelocity; + } + } + } +} diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index f7202aacf8..4c3b92b744 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -121,14 +121,14 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 420); Projectile.direction = Main.player[Projectile.owner].direction; } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 420); Projectile.direction = Main.player[Projectile.owner].direction; } } diff --git a/Projectiles/Melee/CosmicShivBall.cs b/Projectiles/Melee/CosmicShivBall.cs index 4e037ef6e6..27e4437808 100644 --- a/Projectiles/Melee/CosmicShivBall.cs +++ b/Projectiles/Melee/CosmicShivBall.cs @@ -32,8 +32,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.timeLeft = 220; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; } public override void AI() { @@ -90,9 +88,6 @@ namespace CalamityMod.Projectiles.Melee Vector2 toTarget = Vector2.Normalize(target.Center - toSpawn) * 35f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), toSpawn, toTarget, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn, 60); - target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(ModContent.BuffType(), 60); } // pretty much entirely from the Oracle circular damage code diff --git a/Projectiles/Melee/CosmicShivBlade.cs b/Projectiles/Melee/CosmicShivBlade.cs index 57c9a6124f..662b0f2054 100644 --- a/Projectiles/Melee/CosmicShivBlade.cs +++ b/Projectiles/Melee/CosmicShivBlade.cs @@ -72,10 +72,7 @@ namespace CalamityMod.Projectiles.Melee } Projectile.ai[1] = 5 + Main.rand.Next(-2, 3); target.immune[Projectile.owner] = 0; //so that all blades can hit the enemy - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn, 60); - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/CosmicSpiritBomb1.cs b/Projectiles/Melee/CosmicSpiritBomb1.cs index fdec285bfd..ea4b0050ed 100644 --- a/Projectiles/Melee/CosmicSpiritBomb1.cs +++ b/Projectiles/Melee/CosmicSpiritBomb1.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 24; + Projectile.height = 24; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/CosmicSpiritBomb1.png b/Projectiles/Melee/CosmicSpiritBomb1.png index 80b55e105c..5221f3486f 100644 Binary files a/Projectiles/Melee/CosmicSpiritBomb1.png and b/Projectiles/Melee/CosmicSpiritBomb1.png differ diff --git a/Projectiles/Melee/CosmicSpiritBomb2.cs b/Projectiles/Melee/CosmicSpiritBomb2.cs index 3a66a4f59e..48b6f0327e 100644 --- a/Projectiles/Melee/CosmicSpiritBomb2.cs +++ b/Projectiles/Melee/CosmicSpiritBomb2.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 24; + Projectile.height = 24; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/CosmicSpiritBomb2.png b/Projectiles/Melee/CosmicSpiritBomb2.png index d8ef69b775..8e7225e7d7 100644 Binary files a/Projectiles/Melee/CosmicSpiritBomb2.png and b/Projectiles/Melee/CosmicSpiritBomb2.png differ diff --git a/Projectiles/Melee/CosmicSpiritBomb3.cs b/Projectiles/Melee/CosmicSpiritBomb3.cs index 7ede951858..2229970827 100644 --- a/Projectiles/Melee/CosmicSpiritBomb3.cs +++ b/Projectiles/Melee/CosmicSpiritBomb3.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 24; + Projectile.height = 24; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/CosmicSpiritBomb3.png b/Projectiles/Melee/CosmicSpiritBomb3.png index 08eba7c027..d8fea3a59e 100644 Binary files a/Projectiles/Melee/CosmicSpiritBomb3.png and b/Projectiles/Melee/CosmicSpiritBomb3.png differ diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 3a6f7f011f..ec35d680e2 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -10,8 +10,6 @@ namespace CalamityMod.Projectiles.Melee { public class Cyclone : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/TornadoProj"; - public int dustvortex = 0; public override void SetStaticDefaults() { @@ -22,8 +20,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 40; - Projectile.height = 40; + Projectile.width = 56; + Projectile.height = 56; Projectile.alpha = 255; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/Cyclone.png b/Projectiles/Melee/Cyclone.png new file mode 100644 index 0000000000..944eeccee0 Binary files /dev/null and b/Projectiles/Melee/Cyclone.png differ diff --git a/Projectiles/Melee/DarkIceZero.cs b/Projectiles/Melee/DarkIceZero.cs index 805b47e645..3bb1160280 100644 --- a/Projectiles/Melee/DarkIceZero.cs +++ b/Projectiles/Melee/DarkIceZero.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); } diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index 2c7210588a..c5803636bf 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -26,8 +26,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.extraUpdates = 1; Projectile.timeLeft = 600; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/ElementBall.cs b/Projectiles/Melee/ElementBall.cs index fe7203ef60..b898177b14 100644 --- a/Projectiles/Melee/ElementBall.cs +++ b/Projectiles/Melee/ElementBall.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -34,12 +33,5 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } } } diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index 2013beb409..ce97d59134 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -54,17 +53,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { OnHitEffects(target.Center); - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); } public override void OnHitPvp(Player target, int damage, bool crit) { OnHitEffects(target.Center); - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); } private void OnHitEffects(Vector2 targetPos) diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index 1b8227c599..f1139b8cb6 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -5,6 +5,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; + namespace CalamityMod.Projectiles.Melee { public class ElementalExcaliburBeam : ModProjectile @@ -240,7 +242,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(2f); + target.AddBuff(ModContent.BuffType(), 600); if (Projectile.ai[0] == 7f) { @@ -254,7 +256,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(2f); + target.AddBuff(ModContent.BuffType(), 600); if (Projectile.ai[0] == 7f) { diff --git a/Projectiles/Melee/EssenceBeam.cs b/Projectiles/Melee/EssenceBeam.cs deleted file mode 100644 index f76abd2061..0000000000 --- a/Projectiles/Melee/EssenceBeam.cs +++ /dev/null @@ -1,77 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class EssenceBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Essence Beam"); - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 26; - Projectile.height = 26; - Projectile.aiStyle = ProjAIStyleID.Beam; - AIType = ProjectileID.LightBeam; - Projectile.ignoreWater = true; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 10; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.6f, 0f, 0.2f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, Projectile.alpha); - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 595) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - target.immune[Projectile.owner] = 2; - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 173, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 173, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} diff --git a/Projectiles/Melee/EssenceBeam.png b/Projectiles/Melee/EssenceBeam.png deleted file mode 100644 index 8fa56cb0df..0000000000 Binary files a/Projectiles/Melee/EssenceBeam.png and /dev/null differ diff --git a/Projectiles/Melee/EssenceFireball.cs b/Projectiles/Melee/EssenceFireball.cs deleted file mode 100644 index 9c6a185fb0..0000000000 --- a/Projectiles/Melee/EssenceFireball.cs +++ /dev/null @@ -1,110 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Melee -{ - public class EssenceFireball : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fireball"); - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; - } - - public override void AI() - { - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - } - - Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 5) - { - Projectile.frame = 0; - } - - if (Projectile.alpha > 0) - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - Projectile.alpha = 0; - - int dust = Dust.NewDust(new Vector2(Projectile.position.X + Projectile.velocity.X, Projectile.position.Y + Projectile.velocity.Y), Projectile.width, Projectile.height, 173, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.2f); - Main.dust[dust].noGravity = true; - - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 115) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.damage /= 10; - Projectile.Damage(); - } - } -} diff --git a/Projectiles/Melee/EssenceFireball.png b/Projectiles/Melee/EssenceFireball.png deleted file mode 100644 index a97abf9659..0000000000 Binary files a/Projectiles/Melee/EssenceFireball.png and /dev/null differ diff --git a/Projectiles/Melee/ExcelsusBlue.cs b/Projectiles/Melee/ExcelsusBlue.cs index 493e49eee8..7b56217840 100644 --- a/Projectiles/Melee/ExcelsusBlue.cs +++ b/Projectiles/Melee/ExcelsusBlue.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -96,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.timeLeft = 85; } - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/ExcelsusMain.cs b/Projectiles/Melee/ExcelsusMain.cs index 31dfab5928..8b1facc51c 100644 --- a/Projectiles/Melee/ExcelsusMain.cs +++ b/Projectiles/Melee/ExcelsusMain.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -96,8 +97,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.timeLeft = 85; } - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 90); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/ExcelsusPink.cs b/Projectiles/Melee/ExcelsusPink.cs index 5c6f0903f5..ba94fe9e88 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -96,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.timeLeft = 85; } - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 62aafa3434..00c2417cbf 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -1,17 +1,15 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; -using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Items.Weapons.Melee; using Terraria.Graphics.Shaders; -using Terraria.Graphics.Effects; using static CalamityMod.CalamityUtils; using static Terraria.ModLoader.ModContent; using System; using Microsoft.Xna.Framework.Graphics; -using System.Linq; using ReLogic.Content; namespace CalamityMod.Projectiles.Melee @@ -109,12 +107,12 @@ namespace CalamityMod.Projectiles.Melee Main.projectile[slash].timeLeft = 20; } - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override Color? GetAlpha(Color lightColor) => Color.White with { A = 0 } * Projectile.Opacity; diff --git a/Projectiles/Melee/ExobeamSlash.cs b/Projectiles/Melee/ExobeamSlash.cs index d1fc4bc876..221a8226cf 100644 --- a/Projectiles/Melee/ExobeamSlash.cs +++ b/Projectiles/Melee/ExobeamSlash.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using System; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -40,12 +41,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override bool ShouldUpdatePosition() => true; diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index c0f43de1d1..b4999caab7 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -4,11 +4,8 @@ using System.IO; using System.Linq; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Particles; -using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -424,6 +421,7 @@ namespace CalamityMod.Projectiles.Melee public float SlashWidthFunction(float completionRatio) => SquishAtProgress(RealProgressionAtTrailCompletion(completionRatio)) * Projectile.scale * 36.5f; + public Color SlashColorFunction(float completionRatio) => Color.Lime * Utils.GetLerpValue(0.9f, 0.4f, completionRatio, true) * Projectile.Opacity; public float PierceWidthFunction(float completionRatio) @@ -518,7 +516,7 @@ namespace CalamityMod.Projectiles.Melee if (State == SwingState.Swinging) { - Effect swingFX = Filters.Scene["SwingSprite"].GetShader().Shader; + Effect swingFX = Filters.Scene["CalamityMod:SwingSprite"].GetShader().Shader; swingFX.Parameters["rotation"].SetValue(SwingAngleShift + MathHelper.PiOver4 + (Direction == -1 ? MathHelper.Pi : 0f)); swingFX.Parameters["pommelToOriginPercent"].SetValue(0.05f); swingFX.Parameters["color"].SetValue(Color.White.ToVector4()); diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index 2083b52dae..cbba00d044 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using CalamityMod.Particles; @@ -56,12 +57,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index c4be7fec65..b98ff6fffb 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Healing; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); float healAmt = damage * 0.01f; if ((int)healAmt == 0) @@ -100,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); float healAmt = damage * 0.01f; if ((int)healAmt == 0) diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index 9755a86da5..a38ee649f5 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -146,7 +146,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.DamageType != DamageClass.Ranged) + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/GalaxyStar.cs b/Projectiles/Melee/GalaxyStar.cs index faa3cdd7b3..e738304317 100644 --- a/Projectiles/Melee/GalaxyStar.cs +++ b/Projectiles/Melee/GalaxyStar.cs @@ -25,8 +25,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.timeLeft = 160; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; } public override void AI() { diff --git a/Projectiles/Melee/GemTechYellowShard.cs b/Projectiles/Melee/GemTechYellowShard.cs index 2cff19f4a7..eb201823d4 100644 --- a/Projectiles/Melee/GemTechYellowShard.cs +++ b/Projectiles/Melee/GemTechYellowShard.cs @@ -26,8 +26,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.MaxUpdates = 2; Projectile.timeLeft = 45; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; Projectile.ignoreWater = true; } diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index 65bcd81a91..1918e9acfb 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -74,7 +74,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } } } diff --git a/Projectiles/Melee/MirrorBlast.png b/Projectiles/Melee/MirrorBlast.png index b2dba2923c..ae7a902f9a 100644 Binary files a/Projectiles/Melee/MirrorBlast.png and b/Projectiles/Melee/MirrorBlast.png differ diff --git a/Projectiles/Melee/MourningSkull.cs b/Projectiles/Melee/MourningSkull.cs index 3f99d710ee..a1970de43c 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Daybreak, 300); if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < 2; k++) diff --git a/Projectiles/Melee/NebulaShot.cs b/Projectiles/Melee/NebulaShot.cs index f5e7cbf656..e19aabdeb3 100644 --- a/Projectiles/Melee/NebulaShot.cs +++ b/Projectiles/Melee/NebulaShot.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -58,8 +59,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 90); + target.AddBuff(ModContent.BuffType(), 90); } } } diff --git a/Projectiles/Melee/OldLordOathswordProj.cs b/Projectiles/Melee/OldLordClaymoreProj.cs similarity index 97% rename from Projectiles/Melee/OldLordOathswordProj.cs rename to Projectiles/Melee/OldLordClaymoreProj.cs index e421d27324..0fd6ba2880 100644 --- a/Projectiles/Melee/OldLordOathswordProj.cs +++ b/Projectiles/Melee/OldLordClaymoreProj.cs @@ -12,7 +12,7 @@ using Terraria.Audio; namespace CalamityMod.Projectiles.Melee { - public class OldLordOathswordProj : BaseIdleHoldoutProjectile + public class OldLordClaymoreProj : BaseIdleHoldoutProjectile { public enum SwingState { @@ -27,19 +27,19 @@ namespace CalamityMod.Projectiles.Melee public ref float ChargeTime => ref Projectile.ai[0]; public ref float GeneralTime => ref Projectile.ai[1]; public ref float PostSwingRepositionDelay => ref Projectile.localAI[0]; - public ref bool RMBChannel => ref (Owner.HeldItem.ModItem as OldLordOathsword).RMBchannel; + public ref bool RMBChannel => ref (Owner.HeldItem.ModItem as OldLordClaymore).RMBchannel; public bool LMBUse => Owner.altFunctionUse != 2 && !RMBChannel && Owner.itemAnimation > 0; public ref float ChargePower => ref Projectile.localAI[1]; public const int MaxChargeTime = 60; - public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordOathsword"; - public override int AssociatedItemID => ModContent.ItemType(); - public override int IntendedProjectileType => ModContent.ProjectileType(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordClaymore"; + public override int AssociatedItemID => ModContent.ItemType(); + public override int IntendedProjectileType => ModContent.ProjectileType(); public override bool? CanDamage() => CurrentState != 0; //Could also disable the damage during the channel state, public override void SetStaticDefaults() { - DisplayName.SetDefault("Old Lord Oathsword"); + DisplayName.SetDefault("Old Lord Claymore"); ProjectileID.Sets.TrailingMode[Projectile.type] = 2; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; } @@ -304,7 +304,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(0.7f - ((Main.GlobalTimeWrappedHourly * 30) % 30f / 60f)); GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - var texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordOathsword").Value; + var texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordClaymore").Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, Projectile.Size / 2f, Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); Main.spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index cd41daf2bb..be1cccbf64 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -58,8 +58,7 @@ namespace CalamityMod.Projectiles.Melee { // Recalculate damage every frame for balance reasons, as this is a long-lasting holdout. // This is important because you could start using it while benefitting from Auric Tesla standstill bonus, for example. - float baseDamage = Owner.ActiveItem()?.damage ?? 0f; - Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(baseDamage); + Projectile.damage = Owner.ActiveItem() is null ? 0 : Owner.GetWeaponDamage(Owner.ActiveItem()); DetermineDamage(); PlayChainsawSounds(); @@ -221,8 +220,14 @@ namespace CalamityMod.Projectiles.Melee // If the distance to the mouse is less than the base reach, reach only to mouse. // This way the player can more directly control the crystals if they want. // This comes with a small constant offset to cancel out other factors. - if (distanceFromMouse < shootReach && distanceFromMouse > 40f) - shootReach = distanceFromMouse + 32f; + // If the mouse is very close to the player, set the shoot reach to its minimum. + if (distanceFromMouse < shootReach) + { + if (distanceFromMouse > 40f) + shootReach = distanceFromMouse + 32f; + else + shootReach = 72f; + } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI); } diff --git a/Projectiles/Melee/PrismRay.cs b/Projectiles/Melee/PrismRay.cs index 15fcee14a3..f871a41c9d 100644 --- a/Projectiles/Melee/PrismRay.cs +++ b/Projectiles/Melee/PrismRay.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -205,5 +206,9 @@ namespace CalamityMod.Projectiles.Melee } public override Color? GetAlpha(Color lightColor) => new Color(Projectile.Opacity, Projectile.Opacity, Projectile.Opacity, 0); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Melee/PrismTooth.cs b/Projectiles/Melee/PrismTooth.cs index 684dc4f35e..5cb6143138 100644 --- a/Projectiles/Melee/PrismTooth.cs +++ b/Projectiles/Melee/PrismTooth.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -141,5 +142,9 @@ namespace CalamityMod.Projectiles.Melee // Prevent the crystals from utilizing velocity. Their movement is entirely dependant on Center setting. public override bool ShouldUpdatePosition() => false; + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index b94f80419a..816fd4c4b0 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -43,13 +42,6 @@ namespace CalamityMod.Projectiles.Melee Main.dust[rainbow].noGravity = true; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override bool PreDraw(ref Color lightColor) { if (Projectile.timeLeft > 85) diff --git a/Projectiles/Melee/Shortswords/CosmicShivProj.cs b/Projectiles/Melee/Shortswords/CosmicShivProj.cs index 4c8068b43b..d49be5cae6 100644 --- a/Projectiles/Melee/Shortswords/CosmicShivProj.cs +++ b/Projectiles/Melee/Shortswords/CosmicShivProj.cs @@ -63,27 +63,19 @@ namespace CalamityMod.Projectiles.Melee.Shortswords int dustID = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height -16, 173, 0f, 0f, 0, default, 1f); Main.dust[dustID].velocity *= 3f; Main.dust[dustID].scale *= 2f; - } - - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); + } target.AddBuff(ModContent.BuffType(), 120); } - public override void OnHitPvp(Player target, int damage, bool crit) - { - for (int k = 0; k < 36; k++) + public override void OnHitPvp(Player target, int damage, bool crit) { - int dustID = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height - 16, 173, 0f, 0f, 0, default, 1f); - Main.dust[dustID].velocity *= 3f; - Main.dust[dustID].scale *= 2f; + for (int k = 0; k < 36; k++) + { + int dustID = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height - 16, 173, 0f, 0f, 0, default, 1f); + Main.dust[dustID].velocity *= 3f; + Main.dust[dustID].scale *= 2f; + } + target.AddBuff(ModContent.BuffType(), 120); } - - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); } } -} diff --git a/Projectiles/Melee/Shortswords/ElementalShivProj.cs b/Projectiles/Melee/Shortswords/ElementalShivProj.cs index a073e02efb..d8d39ba297 100644 --- a/Projectiles/Melee/Shortswords/ElementalShivProj.cs +++ b/Projectiles/Melee/Shortswords/ElementalShivProj.cs @@ -2,7 +2,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; using System; using CalamityMod.Projectiles.BaseProjectiles; @@ -60,19 +59,5 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Main.dust[num250].noGravity = true; } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - } } } diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index f3cff20eda..9a9e019a63 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -25,10 +25,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; - Projectile.timeLeft = 420; + Projectile.timeLeft = 240; Projectile.ignoreWater = true; Projectile.tileCollide = false; AIType = ProjectileID.DeathSickle; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() @@ -38,7 +40,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[Projectile.owner] = 6; target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.CursedInferno, 90); if (target.life <= (target.lifeMax * 0.15f)) @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item14, Projectile.position); if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center.X, target.Center.Y, Projectile.velocity.X * 0f, Projectile.velocity.Y * 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Melee/SoulScytheExplosion.cs b/Projectiles/Melee/SoulScytheExplosion.cs index 60db2f39e9..ff73838022 100644 --- a/Projectiles/Melee/SoulScytheExplosion.cs +++ b/Projectiles/Melee/SoulScytheExplosion.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = 5; } diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index 5a7db3df4d..90edf207a1 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -94,13 +93,6 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item10, Projectile.position); diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index b44b661617..7e47d15876 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -82,13 +81,6 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override void Kill(int timeLeft) { for (int num795 = 4; num795 < 12; num795++) diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index 4270d82452..863236bc3f 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -80,13 +79,6 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override void Kill(int timeLeft) { for (int num795 = 4; num795 < 12; num795++) diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index 95e86995e1..6a29da7837 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -65,13 +64,6 @@ namespace CalamityMod.Projectiles.Melee return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override void Kill(int timeLeft) { for (int num795 = 4; num795 < 12; num795++) diff --git a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs b/Projectiles/Melee/Spears/ElementalLanceProjectile.cs index de802144b1..fa5968debe 100644 --- a/Projectiles/Melee/Spears/ElementalLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ElementalLanceProjectile.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using System; using Terraria; @@ -46,12 +45,5 @@ namespace CalamityMod.Projectiles.Melee.Spears Main.dust[idx].noGravity = true; } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - } } } diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 06c90abc92..35bc91965e 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[Projectile.owner] = 8; - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.Frostburn2, 120); } } } diff --git a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs index 0afe7617dc..e117b568dd 100644 --- a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs +++ b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Melee.Spears { target.immune[Projectile.owner] = 6; OnHitEffects(target.Center, crit); - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire3, 240); } public override void OnHitPvp(Player target, int damage, bool crit) { OnHitEffects(target.Center, crit); - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire3, 240); } private void OnHitEffects(Vector2 targetPos, bool crit) diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 2ffd079226..7cc0089869 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 180); - target.AddBuff(BuffID.Venom, 90); } } } diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 093a1fda17..00f08d9e3a 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.Frostburn2, 120); } } } diff --git a/Projectiles/Melee/SwordsplosionBlue.cs b/Projectiles/Melee/SwordsplosionBlue.cs index 5e1415c195..e6ef4cc033 100644 --- a/Projectiles/Melee/SwordsplosionBlue.cs +++ b/Projectiles/Melee/SwordsplosionBlue.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -64,12 +63,5 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num308].noGravity = true; } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } } } diff --git a/Projectiles/Melee/SwordsplosionGreen.cs b/Projectiles/Melee/SwordsplosionGreen.cs index c698b3ee4a..d2e6c58c26 100644 --- a/Projectiles/Melee/SwordsplosionGreen.cs +++ b/Projectiles/Melee/SwordsplosionGreen.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -63,12 +62,5 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num308].noGravity = true; } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } } } diff --git a/Projectiles/Melee/SwordsplosionPurple.cs b/Projectiles/Melee/SwordsplosionPurple.cs index c5772b17d5..d9b7323488 100644 --- a/Projectiles/Melee/SwordsplosionPurple.cs +++ b/Projectiles/Melee/SwordsplosionPurple.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -64,12 +63,5 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num308].noGravity = true; } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } } } diff --git a/Projectiles/Melee/SwordsplosionRed.cs b/Projectiles/Melee/SwordsplosionRed.cs index c24535fff2..25889213ed 100644 --- a/Projectiles/Melee/SwordsplosionRed.cs +++ b/Projectiles/Melee/SwordsplosionRed.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -64,12 +63,5 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num308].noGravity = true; } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } } } diff --git a/Projectiles/Melee/TerraEdgeBeam.cs b/Projectiles/Melee/TerraEdgeBeam.cs deleted file mode 100644 index 18768908bf..0000000000 --- a/Projectiles/Melee/TerraEdgeBeam.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class TerraEdgeBeam : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Beam; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.timeLeft = 600; - AIType = ProjectileID.TerraBeam; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 1.3f / 255f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 200, 0, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 45); - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} diff --git a/Projectiles/Melee/TerraEdgeBeam.png b/Projectiles/Melee/TerraEdgeBeam.png deleted file mode 100644 index 810b0c09d8..0000000000 Binary files a/Projectiles/Melee/TerraEdgeBeam.png and /dev/null differ diff --git a/Projectiles/Melee/TerratomereBeam.cs b/Projectiles/Melee/TerratomereBeam.cs new file mode 100644 index 0000000000..057806d1d3 --- /dev/null +++ b/Projectiles/Melee/TerratomereBeam.cs @@ -0,0 +1,74 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerratomereBeam : ModProjectile + { + public Vector2[] ControlPoints; + + public PrimitiveTrail SlashDrawer = null; + + public bool Flipped => Projectile.ai[0] == 1f; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Slash Beam"); + } + + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 144; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = -1; + Projectile.timeLeft = 30; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Projectile.Opacity = Utils.GetLerpValue(0f, 26f, Projectile.timeLeft, true); + Projectile.velocity *= 0.91f; + Projectile.scale *= 1.01f; + } + + public float SlashWidthFunction(float completionRatio) => Projectile.scale * 22f; + + public Color SlashColorFunction(float completionRatio) => Color.Lime * Utils.GetLerpValue(0.04f, 0.27f, completionRatio, true) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + // Initialize the primitive drawer. + SlashDrawer ??= new(SlashWidthFunction, SlashColorFunction, null, GameShaders.Misc["CalamityMod:ExobladeSlash"]); + + // Draw the slash effect. + Main.spriteBatch.EnterShaderRegion(); + + TerratomereHoldoutProj.PrepareSlashShader(Flipped); + + List points = new List(); + for (int i = 0; i < ControlPoints.Length; i++) + points.Add(ControlPoints[i] + ControlPoints[i].SafeNormalize(Vector2.Zero) * (Projectile.scale - 1f) * 40f); + + for (int i = 0; i < 3; i++) + SlashDrawer.Draw(points, Projectile.Center - Main.screenPosition, 65); + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + } +} diff --git a/Projectiles/Melee/TerratomereBeam.png b/Projectiles/Melee/TerratomereBeam.png new file mode 100644 index 0000000000..f9789cf159 Binary files /dev/null and b/Projectiles/Melee/TerratomereBeam.png differ diff --git a/Projectiles/Melee/TerratomereBigSlash.cs b/Projectiles/Melee/TerratomereBigSlash.cs new file mode 100644 index 0000000000..deb928c8d4 --- /dev/null +++ b/Projectiles/Melee/TerratomereBigSlash.cs @@ -0,0 +1,87 @@ +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerratomereBigSlash : ModProjectile + { + public int TargetIndex = -1; + + public PrimitiveTrail SlashDrawer = null; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terratomere Slash"); + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = Terratomere.SlashLifetime + 1; + } + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = Terratomere.SlashLifetime; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() => Projectile.scale = Utils.GetLerpValue(0f, 8f, Projectile.timeLeft, true); + + public float SlashWidthFunction(float _) => Projectile.width * Projectile.scale * Utils.GetLerpValue(0f, 0.1f, _, true); + + public Color SlashColorFunction(float _) => Color.Lime * Projectile.Opacity; + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + TargetIndex = target.whoAmI; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + + if (Projectile.timeLeft > 12) + Projectile.timeLeft = 12; + Projectile.velocity *= 0.2f; + Projectile.damage = 0; + Projectile.netUpdate = true; + } + + public override void Kill(int timeLeft) + { + if (Main.myPlayer == Projectile.owner && TargetIndex >= 0) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Main.npc[TargetIndex].Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, TargetIndex, Main.rand.NextFloat(MathHelper.TwoPi)); + } + + public override bool PreDraw(ref Color lightColor) + { + // Initialize the slash drawer. + SlashDrawer ??= new PrimitiveTrail(SlashWidthFunction, SlashColorFunction, null, GameShaders.Misc["CalamityMod:ExobladePierce"]); + + GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/BlobbyNoise")); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189"); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(Terratomere.TerraColor1); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(Terratomere.TerraColor2); + + for (int i = 0; i < 4; i++) + SlashDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 30); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (Projectile.oldPos[0] == Vector2.Zero) + return false; + + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.oldPos[0] + Projectile.Size * 0.5f, Projectile.Center); + } + } +} diff --git a/Projectiles/Melee/TerratomereExplosion.cs b/Projectiles/Melee/TerratomereExplosion.cs new file mode 100644 index 0000000000..5dce9d29c9 --- /dev/null +++ b/Projectiles/Melee/TerratomereExplosion.cs @@ -0,0 +1,74 @@ +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerratomereExplosion : ModProjectile, IAdditiveDrawer + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Explosion"); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 520; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 150; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 14; + Projectile.scale = 0.2f; + Projectile.hide = true; + } + + public override void AI() + { + // Play an explosion sound on the first frame of this projectile's existence. + if (Projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(SubsumingVortex.ExplosionSound, Projectile.Center); + Projectile.localAI[0] = 1f; + } + + // Emit a strong white light. + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 1.5f); + + // Determine frames. Once the maximum frame is reached the projectile dies. + Projectile.frameCounter++; + if (Projectile.frameCounter % 8 == 7) + Projectile.frame++; + if (Projectile.frame >= 18) + Projectile.Kill(); + + // Exponentially accelerate. + Projectile.scale *= Terratomere.ExplosionExpandFactor; + Projectile.Opacity = Utils.GetLerpValue(5f, 36f, Projectile.timeLeft, true); + } + + public void AdditiveDraw(SpriteBatch spriteBatch) + { + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D lightTexture = ModContent.Request("CalamityMod/Skies/XerocLight").Value; + Rectangle frame = texture.Frame(3, 6, Projectile.frame / 6, Projectile.frame % 6); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = frame.Size() * 0.5f; + + for (int i = 0; i < 36; i++) + { + Vector2 lightDrawPosition = drawPosition + (MathHelper.TwoPi * i / 36f + Main.GlobalTimeWrappedHourly * 5f).ToRotationVector2() * Projectile.scale * 12f; + Color lightBurstColor = CalamityUtils.MulticolorLerp(Projectile.timeLeft / 144f, Terratomere.TerraColor1, Terratomere.TerraColor2); + lightBurstColor = Color.Lerp(lightBurstColor, Color.White, 0.4f) * Projectile.Opacity * 0.184f; + Main.spriteBatch.Draw(lightTexture, lightDrawPosition, null, lightBurstColor, 0f, lightTexture.Size() * 0.5f, Projectile.scale * 1.32f, SpriteEffects.None, 0); + } + Main.spriteBatch.Draw(texture, drawPosition, frame, Color.White, 0f, origin, 1.6f, SpriteEffects.None, 0); + } + } +} diff --git a/Projectiles/Melee/TerratomereExplosion.png b/Projectiles/Melee/TerratomereExplosion.png new file mode 100644 index 0000000000..771a012374 Binary files /dev/null and b/Projectiles/Melee/TerratomereExplosion.png differ diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs new file mode 100644 index 0000000000..bf00eab0e4 --- /dev/null +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -0,0 +1,311 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria.Graphics.Shaders; +using Terraria.Audio; +using static CalamityMod.CalamityUtils; +using System.Linq; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerratomereHoldoutProj : ModProjectile + { + public PrimitiveTrail SlashDrawer = null; + + public Player Owner => Main.player[Projectile.owner]; + + public int Direction => Projectile.velocity.X.DirectionalSign(); + + public float SwingCompletion => MathHelper.Clamp(Time / Terratomere.SwingTime, 0f, 1f); + + public float SwingCompletionAtStartOfTrail + { + get + { + float swingCompletion = SwingCompletion - Terratomere.TrailOffsetCompletionRatio; + + // Ensure that the trail does not attempt to "start" in the anticipation state, as the trail only exists after the charge begins. + return MathHelper.Clamp(swingCompletion, SwingCompletionRatio, 1f); + } + } + + public float SwordRotation + { + get + { + float swordRotation = InitialRotation + GetSwingOffsetAngle(SwingCompletion) * Projectile.spriteDirection + MathHelper.PiOver4; + if (Projectile.spriteDirection == -1) + swordRotation += MathHelper.PiOver2; + return swordRotation; + } + } + + public Vector2 SwordDirection => SwordRotation.ToRotationVector2() * Direction; + + public ref float Time => ref Projectile.ai[0]; + + public ref float InitialRotation => ref Projectile.ai[1]; + + // Easings for things such as rotation. + public static float SwingCompletionRatio => 0.37f; + + public static float RecoveryCompletionRatio => 0.84f; + + // Brief delay before the animations begin, with the blade simply being held upright for a time. + public static CurveSegment AnticipationWait => new(EasingType.PolyOut, 0f, -1.67f, 0f); + + // Period of time where the blade reels back in anticipation of a swing. + public static CurveSegment Anticipation => new(EasingType.PolyOut, 0.14f, AnticipationWait.EndingHeight, -1.05f, 2); + + // A short, powerful swing that rapidly approaches it destination. + public static CurveSegment Swing => new(EasingType.PolyIn, SwingCompletionRatio, Anticipation.EndingHeight, 4.43f, 5); + + // Period of time after the swing where the blade reels back further before it disappears. + public static CurveSegment Recovery => new(EasingType.PolyOut, RecoveryCompletionRatio, Swing.EndingHeight, 0.97f, 3); + + public static float GetSwingOffsetAngle(float completion) => PiecewiseAnimation(completion, AnticipationWait, Anticipation, Swing, Recovery); + + public override string Texture => "CalamityMod/Items/Weapons/Melee/Terratomere"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terratomere"); + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 100; + } + + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 66; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.timeLeft = Terratomere.SwingTime; + Projectile.usesLocalNPCImmunity = true; + Projectile.MaxUpdates = 2; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 7; + Projectile.noEnchantments = true; + } + + #region AI and Behaviors + + public override void AI() + { + // Initialize the initial rotation if necessary. + if (InitialRotation == 0f) + { + InitialRotation = Projectile.velocity.ToRotation(); + Projectile.netUpdate = true; + } + + // Perform squish effects. + Projectile.scale = Utils.GetLerpValue(0f, 0.13f, SwingCompletion, true) * Utils.GetLerpValue(1f, 0.87f, SwingCompletion, true) * 0.7f + 0.3f; + + AdjustPlayerValues(); + StickToOwner(); + CreateProjectiles(); + if (SwingCompletion > SwingCompletionRatio + 0.2f && SwingCompletion < RecoveryCompletionRatio) + CreateSlashSparkleDust(); + + // Determine rotation. + Projectile.rotation = SwordRotation; + Time++; + } + + public void AdjustPlayerValues() + { + Projectile.spriteDirection = Projectile.direction = Direction; + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.direction * Projectile.velocity).ToRotation(); + + // Decide the arm rotation for the owner. + float armRotation = SwordRotation - Direction * 1.67f; + Owner.SetCompositeArmFront(Math.Abs(armRotation) > 0.01f, Player.CompositeArmStretchAmount.Full, armRotation); + } + + public void StickToOwner() + { + // Glue the sword to its owner. This applies a handful of offsets to make the blade look like it's roughly inside of the owner's hand. + Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true) + SwordDirection * new Vector2(7f, 16f) * Projectile.scale; + Projectile.Center -= Projectile.velocity.SafeNormalize(Vector2.UnitY) * new Vector2(66f, 54f + Projectile.scale * 8f); + + // Set the owner's held projectile to this and register a false item time calculation. + Owner.heldProj = Projectile.whoAmI; + Owner.SetDummyItemTime(2); + + // Make the owner turn in the direction of the blade. + Owner.direction = Direction; + } + + public void CreateProjectiles() + { + // Create the slash. + if (Time == (int)(Terratomere.SwingTime * (SwingCompletionRatio + 0.15f))) + SoundEngine.PlaySound(Terratomere.SwingSound, Projectile.Center); + + if (Main.myPlayer == Projectile.owner && Time == (int)(Terratomere.SwingTime * (SwingCompletionRatio + 0.34f))) + { + Vector2 bigSlashVelocity = Projectile.SafeDirectionTo(Main.MouseWorld) * Owner.ActiveItem().shootSpeed; + if (bigSlashVelocity.AngleBetween(InitialRotation.ToRotationVector2()) > 1.456f) + bigSlashVelocity = InitialRotation.ToRotationVector2() * bigSlashVelocity.Length(); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - bigSlashVelocity * 0.4f, bigSlashVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + + // Create a terra blade-like beam when the slash terminates. + if (Main.myPlayer == Projectile.owner && Time == (int)(Terratomere.SwingTime * RecoveryCompletionRatio) + 5f) + { + Vector2 bigSlashVelocity = InitialRotation.ToRotationVector2() * Owner.ActiveItem().shootSpeed / 6f; + Vector2 bigSlashSpawnPosition = Projectile.Center + bigSlashVelocity.SafeNormalize(Vector2.UnitY) * 64f; + + int slash = Projectile.NewProjectile(Projectile.GetSource_FromThis(), bigSlashSpawnPosition, bigSlashVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(slash)) + { + Main.projectile[slash].ai[0] = (Direction == 1f).ToInt(); + Main.projectile[slash].ModProjectile().ControlPoints = GenerateSlashPoints().ToArray(); + } + } + } + + public void CreateSlashSparkleDust() + { + Vector2 initialDirection = InitialRotation.ToRotationVector2(); + Vector2 bladeEnd = Projectile.Center + (GetSwingOffsetAngle(SwingCompletion) * Direction + InitialRotation).ToRotationVector2() * Main.rand.NextFloat(8f, 66f) + initialDirection * 76f; + + int dustID = Main.rand.NextBool() ? 267 : 264; + Dust magic = Dust.NewDustPerfect(bladeEnd, dustID, Vector2.Zero); + magic.color = Color.Lerp(Terratomere.TerraColor1, Terratomere.TerraColor2, Main.rand.NextFloat()); + magic.color = Color.Lerp(magic.color, Color.Yellow, (float)Math.Pow(Main.rand.NextFloat(), 1.63)); + magic.fadeIn = Main.rand.NextFloat(1f, 2f); + magic.scale = 0.4f; + magic.velocity = initialDirection * Main.rand.NextFloat(0.5f, 15f); + magic.noLight = true; + magic.noGravity = true; + } + #endregion AI and Behaviors + + #region Drawing + + public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + // Draw the slash effect. + DrawSlash(); + + // Draw the blade. + DrawBlade(lightColor); + + return false; + } + + public float SlashWidthFunction(float completionRatio) => Projectile.scale * 22f; + + public Color SlashColorFunction(float completionRatio) => Color.Lime * Utils.GetLerpValue(0.9f, 0.4f, completionRatio, true) * Projectile.Opacity; + + public IEnumerable GenerateSlashPoints() + { + for (int i = 0; i < 20; i++) + { + float progress = MathHelper.Lerp(SwingCompletion, SwingCompletionAtStartOfTrail, i / 20f); + float reelBackAngle = Math.Abs(Projectile.oldRot[0] - Projectile.oldRot[1]) * 0.8f; + if (SwingCompletion > RecoveryCompletionRatio) + reelBackAngle = 0.21f; + + float offsetAngle = (GetSwingOffsetAngle(progress) - reelBackAngle) * Direction + InitialRotation; + yield return offsetAngle.ToRotationVector2() * Projectile.scale * 54f; + } + } + + public void DrawSlash() + { + // Initialize the primitive drawer. + SlashDrawer ??= new(SlashWidthFunction, SlashColorFunction, null, GameShaders.Misc["CalamityMod:ExobladeSlash"]); + + // Draw the slash effect. + Main.spriteBatch.EnterShaderRegion(); + + // Prepare shader parameters. This relies on the same shader as the Exoblade, albeit with a less contrasted palette. + PrepareSlashShader(Direction == 1); + + if (SwingCompletionAtStartOfTrail > SwingCompletionRatio) + SlashDrawer.Draw(GenerateSlashPoints(), Projectile.Center - Main.screenPosition, 95); + + Main.spriteBatch.ExitShaderRegion(); + } + + public void DrawBlade(Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * Vector2.UnitY; + if (Projectile.spriteDirection == -1) + origin.X += texture.Width; + + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0f); + } + + public static void PrepareSlashShader(bool flipped) + { + GameShaders.Misc["CalamityMod:ExobladeSlash"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/VoronoiShapes")); + GameShaders.Misc["CalamityMod:ExobladeSlash"].UseColor(Terratomere.TerraColor1); + GameShaders.Misc["CalamityMod:ExobladeSlash"].UseSecondaryColor(Terratomere.TerraColor2); + GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["fireColor"].SetValue(Terratomere.TerraColor1.ToVector3()); + GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue(flipped); + GameShaders.Misc["CalamityMod:ExobladeSlash"].Apply(); + } + #endregion Drawing + + #region Hit Effects and Collision + + public void OnHitHealEffect() + { + if (Owner.moonLeech) + return; + + Owner.statLife += Terratomere.TrueMeleeHitHeal; + Owner.HealEffect(Terratomere.TrueMeleeHitHeal); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + Vector2 direction = (InitialRotation + GetSwingOffsetAngle(SwingCompletion)).ToRotationVector2() * new Vector2(Projectile.spriteDirection, 1f); + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + direction * Projectile.height * Projectile.scale, Projectile.width * 0.25f, ref _); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); + if (target.canGhostHeal) + OnHitHealEffect(); + + // Create a slash creator on top of the hit target. + int slashCreatorID = ModContent.ProjectileType(); + if (Owner.ownedProjectileCounts[slashCreatorID] < 4) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, slashCreatorID, Projectile.damage, Projectile.knockBack, Projectile.owner, target.whoAmI, Main.rand.NextFloat(MathHelper.TwoPi)); + Owner.ownedProjectileCounts[slashCreatorID]++; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); + OnHitHealEffect(); + } + #endregion Hit Effects and Collision + } +} diff --git a/Projectiles/Melee/TerratomereProjectile.cs b/Projectiles/Melee/TerratomereProjectile.cs deleted file mode 100644 index e577e47ec7..0000000000 --- a/Projectiles/Melee/TerratomereProjectile.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Melee -{ - public class TerratomereProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.aiStyle = ProjAIStyleID.Beam; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.timeLeft = 180; - Projectile.tileCollide = false; - AIType = ProjectileID.TerraBeam; - } - - public override void AI() - { - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); - - Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.75f / 255f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 200, 0, 0); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 30); - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - int num3; - for (int num795 = 4; num795 < 31; num795 = num3 + 1) - { - float num796 = Projectile.oldVelocity.X * (30f / (float)num795); - float num797 = Projectile.oldVelocity.Y * (30f / (float)num795); - int num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f); - Main.dust[num798].noGravity = true; - Dust dust = Main.dust[num798]; - dust.velocity *= 0.5f; - num798 = Dust.NewDust(new Vector2(Projectile.oldPosition.X - num796, Projectile.oldPosition.Y - num797), 8, 8, 107, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f); - dust = Main.dust[num798]; - dust.velocity *= 0.05f; - num3 = num795; - } - } - } -} diff --git a/Projectiles/Melee/TerratomereProjectile.png b/Projectiles/Melee/TerratomereProjectile.png deleted file mode 100644 index 5403f92ba1..0000000000 Binary files a/Projectiles/Melee/TerratomereProjectile.png and /dev/null differ diff --git a/Projectiles/Melee/TerratomereSlash.cs b/Projectiles/Melee/TerratomereSlash.cs new file mode 100644 index 0000000000..02c50c15d3 --- /dev/null +++ b/Projectiles/Melee/TerratomereSlash.cs @@ -0,0 +1,74 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerratomereSlash : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Melee/ExobeamSlash"; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Terratomere Slash"); + + public override void SetDefaults() + { + Projectile.width = 512; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.Opacity = 1f; + Projectile.timeLeft = 35; + Projectile.MaxUpdates = 2; + Projectile.scale = 0.75f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Opacity = Projectile.timeLeft / 35f; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + } + + public override bool ShouldUpdatePosition() => true; + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.Cyan, Color.Lime, Projectile.identity / 7f % 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft >= 34f) + return false; + + Main.spriteBatch.SetBlendState(BlendState.Additive); + + float progress = (33f - Projectile.timeLeft) / 33f; + + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + Vector2 scale = new Vector2(MathHelper.Lerp(0.8f, 1.25f, (float)Math.Pow(progress, 0.45)), MathHelper.Lerp(0.6f, 0.24f, (float)Math.Pow(progress, 0.4))) * Projectile.scale; + + // Draw an inner bloom circle to signify power at the center of the strike along with two thinner lines. + Vector2 bloomScale = Projectile.Size / bloomTexture.Size() * new Vector2(1f, 2f); + Vector2 bloomOrigin = bloomTexture.Size() * 0.5f; + Main.spriteBatch.Draw(bloomTexture, drawPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, bloomOrigin, bloomScale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, scale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, origin, scale * new Vector2(1f, 0.6f), 0, 0f); + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + } +} diff --git a/Projectiles/Melee/TerratomereSlashCreator.cs b/Projectiles/Melee/TerratomereSlashCreator.cs new file mode 100644 index 0000000000..54c0ddf1a5 --- /dev/null +++ b/Projectiles/Melee/TerratomereSlashCreator.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TerratomereSlashCreator : ModProjectile + { + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + + public float SlashDirection + { + get + { + if (Projectile.ai[1] > MathHelper.Pi) + return Main.rand.NextFloatDirection(); + return Projectile.ai[1] + Main.rand.NextFloatDirection() * 0.2f; + } + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anime Sword Effect"); + } + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 45; + Projectile.MaxUpdates = 2; + } + + public override void AI() + { + if (Projectile.timeLeft % Terratomere.SmallSlashCreationRate == 0) + { + SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + float maxOffset = Target.width * 0.4f; + if (maxOffset > 300f) + maxOffset = 300f; + + Vector2 spawnOffset = SlashDirection.ToRotationVector2() * Main.rand.NextFloatDirection() * maxOffset; + Vector2 sliceVelocity = spawnOffset.SafeNormalize(Vector2.UnitY) * 0.1f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Target.Center + spawnOffset, sliceVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * Terratomere.SmallSlashDamageFactor), 0f, Projectile.owner); + } + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 1670f6c403..82a54e6265 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 7; + Projectile.penetrate = 4; Projectile.alpha = 255; Projectile.timeLeft = 600; Projectile.light = 1f; diff --git a/Projectiles/Melee/ThanatosBoom.cs b/Projectiles/Melee/ThanatosBoom.cs index 382ae0ce1d..5338dfd906 100644 --- a/Projectiles/Melee/ThanatosBoom.cs +++ b/Projectiles/Melee/ThanatosBoom.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -50,5 +51,9 @@ namespace CalamityMod.Projectiles.Melee } } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index 425d6df1e5..ba97059368 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 90); + target.AddBuff(BuffID.OnFire3, 90); } } } diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index 4dfc232938..384626ab93 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -1,3 +1,5 @@ +using CalamityMod.Buffs.DamageOverTime; +using Terraria.ID; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -94,5 +96,17 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.HomeInOnNPC(Projectile, true, 150f, 12f, 20f); } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Projectile.DamageType == RogueDamageClass.Instance) + target.AddBuff(BuffID.Electrified, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Projectile.DamageType == RogueDamageClass.Instance) + target.AddBuff(BuffID.Electrified, 120); + } } } diff --git a/Projectiles/Melee/UrchinBall.cs b/Projectiles/Melee/UrchinBall.cs index 11f9c40ed3..35976f0bf7 100644 --- a/Projectiles/Melee/UrchinBall.cs +++ b/Projectiles/Melee/UrchinBall.cs @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Melee spike = true; Projectile.ai[0] = 1f; Projectile.netUpdate = true; - target.AddBuff(BuffID.Venom, 180); + target.AddBuff(BuffID.Poisoned, 180); } } } diff --git a/Projectiles/Melee/UrchinBallSpike.cs b/Projectiles/Melee/UrchinBallSpike.cs index 96648e7426..8eaf75143b 100644 --- a/Projectiles/Melee/UrchinBallSpike.cs +++ b/Projectiles/Melee/UrchinBallSpike.cs @@ -70,12 +70,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.KingSlime || target.type == NPCID.WallofFlesh || target.type == NPCID.WallofFleshEye || - target.type == NPCID.SkeletronHead || target.type == NPCID.SkeletronHand) - { - target.buffImmune[BuffID.Venom] = false; - } - target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.Poisoned, 120); } } } diff --git a/Projectiles/Melee/UrchinMaceProjectile.cs b/Projectiles/Melee/UrchinMaceProjectile.cs index abc4d1c88d..9318d5b68f 100644 --- a/Projectiles/Melee/UrchinMaceProjectile.cs +++ b/Projectiles/Melee/UrchinMaceProjectile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee public static float MaxWindup = 110; public ref float Windup => ref Projectile.ai[0]; public float WindupProgress => MathHelper.Clamp(Windup, 0, MaxWindup) / MaxWindup; - public static float whirlpoolDamageMultiplier = 1.6f; + public static float whirlpoolDamageMultiplier = 2f; public override void SetStaticDefaults() { diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 92544b84bc..625e8b245a 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 120); + target.AddBuff(BuffID.Poisoned, 120); } } } diff --git a/Projectiles/Melee/VolcanicFireball.cs b/Projectiles/Melee/VolcanicFireball.cs index 0958c509d4..a576061b52 100644 --- a/Projectiles/Melee/VolcanicFireball.cs +++ b/Projectiles/Melee/VolcanicFireball.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.OnFire3, 120); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/VolcanicFireballLarge.cs b/Projectiles/Melee/VolcanicFireballLarge.cs index 2d97bb056f..af55b14036 100644 --- a/Projectiles/Melee/VolcanicFireballLarge.cs +++ b/Projectiles/Melee/VolcanicFireballLarge.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index 6e2bb1acbd..2bf2806edd 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -164,7 +164,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D empty = Request("CalamityMod/Projectiles/InvisibleProj").Value; //Setup the laser sights effect. - Effect laserScopeEffect = Filters.Scene["PixelatedSightLine"].GetShader().Shader; + Effect laserScopeEffect = Filters.Scene["CalamityMod:PixelatedSightLine"].GetShader().Shader; laserScopeEffect.Parameters["sampleTexture2"].SetValue(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/CertifiedCrustyNoise").Value); laserScopeEffect.Parameters["noiseOffset"].SetValue(Main.GameUpdateCount * -0.003f); diff --git a/Projectiles/Melee/YateveoBloomProj.cs b/Projectiles/Melee/YateveoBloomProj.cs index d08deaa688..ddb0c9eeff 100644 --- a/Projectiles/Melee/YateveoBloomProj.cs +++ b/Projectiles/Melee/YateveoBloomProj.cs @@ -224,7 +224,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 180); - target.AddBuff(BuffID.Venom, 90); } } } diff --git a/Projectiles/Melee/Yoyos/FaultLineYoyo.cs b/Projectiles/Melee/Yoyos/FaultLineYoyo.cs index f465c73a82..6d26fa6a44 100644 --- a/Projectiles/Melee/Yoyos/FaultLineYoyo.cs +++ b/Projectiles/Melee/Yoyos/FaultLineYoyo.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire3, 240); if (Projectile.owner == Main.myPlayer) { int boom = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); diff --git a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index 10836945b1..f9034249de 100644 --- a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { - CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 30f, 5, ProjectileID.SlimeGun, 0.75); + CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 30f, 5, ModContent.ProjectileType(), 0.75); if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); } diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index 2c70926bef..4320c534ac 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using Terraria; @@ -124,8 +125,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 90); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/Yoyos/RiptideYoyo.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs index df624198fd..dd76feff51 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -1,4 +1,7 @@ -using Terraria; +using System.IO; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -6,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class RiptideYoyo : ModProjectile { + private const int MaxUpdates = 2; + public override void SetStaticDefaults() { DisplayName.SetDefault("Riptide"); @@ -24,44 +29,91 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.alpha = 150; Projectile.penetrate = -1; - Projectile.MaxUpdates = 2; + Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.localNPCHitCooldown = 10 * MaxUpdates; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[1] = reader.ReadSingle(); } public override void AI() { - if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) // 200 blocks Projectile.Kill(); - if (Main.rand.NextBool(90)) + + Projectile.localAI[1]++; + if (Projectile.localAI[1] % (15f * MaxUpdates) == 0f) { - switch (Main.rand.Next(1, 9)) + float xVelocity = 0f; + float yVelocity = -10f; + float xIncrement = 1.2f; + float yIncrement = 0.2f; + switch (Projectile.localAI[1] / (15f * MaxUpdates)) { case 1: - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0, -10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); break; + case 2: - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 5, -5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); + xVelocity = 5f; + yVelocity = -5f; + xIncrement = 0.7f; + yIncrement = 0.7f; break; + case 3: - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 10, 0, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); + xVelocity = 10f; + yVelocity = 0f; + xIncrement = 0.2f; + yIncrement = 1.2f; break; + case 4: - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 5, 5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); + xVelocity = 5f; + yVelocity = 5f; + xIncrement = -0.7f; + yIncrement = 0.7f; break; + case 5: - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, -0, 10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); + xVelocity = 0f; + yVelocity = 10f; + xIncrement = -1.2f; + yIncrement = -0.2f; break; + case 6: - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, -5, 5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); + xVelocity = -5f; + yVelocity = 5f; + xIncrement = -0.7f; + yIncrement = -0.7f; break; + case 7: - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, -10, -0, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); + xVelocity = -10f; + yVelocity = 0f; + xIncrement = -0.2f; + yIncrement = -1.2f; break; + case 8: - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, -10, -10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); + 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); } } } diff --git a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs index eb368c760e..3fd3f00d41 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.Frostburn2, 120); } } } diff --git a/Projectiles/Melee/Yoyos/SmokingCometChain.png b/Projectiles/Melee/Yoyos/SmokingCometChain.png new file mode 100644 index 0000000000..87573adcce Binary files /dev/null and b/Projectiles/Melee/Yoyos/SmokingCometChain.png differ diff --git a/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs b/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs new file mode 100644 index 0000000000..7bb4f31e00 --- /dev/null +++ b/Projectiles/Melee/Yoyos/SmokingCometYoyo.cs @@ -0,0 +1,189 @@ +using System; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee.Yoyos +{ + public class SmokingCometYoyo : ModProjectile + { + // Declare max updates as a contant up here since it will be used in many places + private const int MaxUpdates = 2; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Smoking Comet"); + ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 8f; + ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 200f; + ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 12f; + + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + + public override void SetDefaults() + { + Projectile.aiStyle = ProjAIStyleID.Yoyo; + Projectile.width = 16; + Projectile.height = 16; + Projectile.scale = 1f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.penetrate = -1; + Projectile.MaxUpdates = MaxUpdates; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * MaxUpdates; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + // Normal yoyo rotation is +0.5f, so reduce it by 0.25 to compensate for the extra updates + Projectile.rotation -= 0.25f; + + // Kill if the yoyo is greater than 200 blocks away from the player + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) + Projectile.Kill(); + + // Rain Starfury stars every 30 frames + // Multiply the gate value by the amount of extra updates the projectile has because it's updating faster than normal per frame + Projectile.localAI[1]++; + float starRainGateValue = 30f * MaxUpdates; + if (Projectile.localAI[1] % starRainGateValue == 0f) + { + Vector2 starSpawnLocation = Projectile.Center + new Vector2(Main.rand.Next(-200, 201), -600f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), starSpawnLocation, Vector2.Normalize(Projectile.Center - starSpawnLocation) * 12f, ProjectileID.Starfury, Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[proj].extraUpdates = 1; + } + + if (Main.rand.NextBool(5 * MaxUpdates)) + Dust.NewDust(Projectile.Center + new Vector2(-25f, -25f), 50, 50, 58, 0f, 0f, 150, default(Color), 1.2f); + + if (Main.rand.NextBool(10 * MaxUpdates)) + Gore.NewGore(Projectile.GetSource_FromAI(), new Vector2(Projectile.position.X, Projectile.position.Y), default(Vector2), Main.rand.Next(16, 18)); + } + + // Hitbox is larger than normal while trying to hit NPCs + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 25f, targetHitbox); + + // Draw the new string + public override bool PreDraw(ref Color lightColor) + { + Vector2 vector = Main.player[Projectile.owner].MountedCenter; + vector.Y += Main.player[Projectile.owner].gfxOffY; + float num2 = Projectile.Center.X - vector.X; + float num3 = Projectile.Center.Y - vector.Y; + Math.Sqrt(num2 * num2 + num3 * num3); + if (!Projectile.counterweight) + { + int num5 = -1; + if (Projectile.position.X + (float)(Projectile.width / 2) < Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2)) + num5 = 1; + + num5 *= -1; + Main.player[Projectile.owner].itemRotation = (float)Math.Atan2(num3 * (float)num5, num2 * (float)num5); + } + + bool flag = true; + if (num2 == 0f && num3 == 0f) + { + flag = false; + } + else + { + float num6 = (float)Math.Sqrt(num2 * num2 + num3 * num3); + num6 = 12f / num6; + num2 *= num6; + num3 *= num6; + vector.X -= num2 * 0.1f; + vector.Y -= num3 * 0.1f; + num2 = Projectile.position.X + (float)Projectile.width * 0.5f - vector.X; + num3 = Projectile.position.Y + (float)Projectile.height * 0.5f - vector.Y; + } + + while (flag) + { + float num7 = 12f; + float num8 = (float)Math.Sqrt(num2 * num2 + num3 * num3); + float num9 = num8; + if (float.IsNaN(num8) || float.IsNaN(num9)) + { + flag = false; + continue; + } + + if (num8 < 20f) + { + num7 = num8 - 8f; + flag = false; + } + + num8 = 12f / num8; + num2 *= num8; + num3 *= num8; + vector.X += num2; + vector.Y += num3; + num2 = Projectile.position.X + (float)Projectile.width * 0.5f - vector.X; + num3 = Projectile.position.Y + (float)Projectile.height * 0.1f - vector.Y; + if (num9 > 12f) + { + float num10 = 0.3f; + float num11 = Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y); + if (num11 > 16f) + num11 = 16f; + + num11 = 1f - num11 / 16f; + num10 *= num11; + num11 = num9 / 80f; + if (num11 > 1f) + num11 = 1f; + + num10 *= num11; + if (num10 < 0f) + num10 = 0f; + + num10 *= num11; + num10 *= 0.5f; + if (num3 > 0f) + { + num3 *= 1f + num10; + num2 *= 1f - num10; + } + else + { + num11 = Math.Abs(Projectile.velocity.X) / 3f; + if (num11 > 1f) + num11 = 1f; + + num11 -= 0.5f; + num10 *= num11; + if (num10 > 0f) + num10 *= 2f; + + num3 *= 1f + num10; + num2 *= 1f - num10; + } + } + + float num4 = (float)Math.Atan2(num3, num2) - MathHelper.PiOver2; + Texture2D stringTexture = ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Value; + Main.spriteBatch.Draw(stringTexture, new Vector2(vector.X - Main.screenPosition.X + (float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width() * 0.5f, vector.Y - Main.screenPosition.Y + (float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Height() * 0.5f) - new Vector2(6f, 0f), new Rectangle(0, 0, ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width(), (int)num7), Color.White, num4, new Vector2((float)ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SmokingCometChain").Width() * 0.5f, 0f), 1f, SpriteEffects.None, 0f); + } + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Melee/Yoyos/SmokingCometYoyo.png b/Projectiles/Melee/Yoyos/SmokingCometYoyo.png new file mode 100644 index 0000000000..c13104b487 Binary files /dev/null and b/Projectiles/Melee/Yoyos/SmokingCometYoyo.png differ diff --git a/Projectiles/Pets/EidolonSnail.cs b/Projectiles/Pets/EidolonSnail.cs new file mode 100644 index 0000000000..9421f95604 --- /dev/null +++ b/Projectiles/Pets/EidolonSnail.cs @@ -0,0 +1,333 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Projectiles.Pets +{ + public class EidolonSnail : ModProjectile + { + private int playerStill = 0; + private bool fly = false; + private int idleTimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Escargidolon Snail"); + Main.projFrames[Projectile.type] = 8; + Main.projPet[Projectile.type] = true; + } + + public override void SetDefaults() + { + Projectile.netImportant = true; + Projectile.width = 54; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft *= 5; + Projectile.tileCollide = true; + Projectile.ignoreWater = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Pets/EidolonSnail").Value; + + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY + 2), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), lightColor, + Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0); + + return false; + } + + public override void PostDraw(Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Pets/EidolonSnailGlow").Value; + + int height = texture.Height / Main.projFrames[Projectile.type]; + int frameHeight = height * Projectile.frame; + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY + 2), + new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Color.White, + Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0); + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + Player player = Main.player[Projectile.owner]; + Vector2 center2 = Projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + fallThrough = playerDistance > 200f; + return true; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + if (!player.active) + { + Projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.Calamity(); + if (player.dead) + { + modPlayer.eidolonSnailPet = false; + } + if (modPlayer.eidolonSnailPet) + { + Projectile.timeLeft = 2; + } + + Vector2 vector46 = Projectile.position; + if (!fly) + { + Projectile.rotation = 0; + Vector2 center2 = Projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (Projectile.velocity.Y == 0 && ((HoleBelow() && playerDistance > 150f) || (playerDistance > 150f && Projectile.position.X == Projectile.oldPosition.X))) + { + Projectile.velocity.Y = -8f; + } + Projectile.velocity.Y += 0.35f; + if (Projectile.velocity.Y > 15f) + { + Projectile.velocity.Y = 15f; + } + if (playerDistance > 520f) + { + fly = true; + Projectile.velocity.X = 0f; + Projectile.velocity.Y = 0f; + } + if (playerDistance > 100f) + { + if (player.position.X - Projectile.position.X > 0f) + { + Projectile.velocity.X += 0.12f; + if (Projectile.velocity.X > 6f) + { + Projectile.velocity.X = 6f; + } + } + else + { + Projectile.velocity.X -= 0.12f; + if (Projectile.velocity.X < -6f) + { + Projectile.velocity.X = -6f; + } + } + } + if (playerDistance < 100f) + { + if (Projectile.velocity.X != 0f) + { + if (Projectile.velocity.X > 0.8f) + { + Projectile.velocity.X -= 0.25f; + } + else if (Projectile.velocity.X < -0.8f) + { + Projectile.velocity.X += 0.25f; + } + else if (Projectile.velocity.X < 0.8f && Projectile.velocity.X > -0.8f) + { + Projectile.velocity.X = 0f; + } + } + } + if (playerDistance < 70f) + { + Projectile.velocity.X *= 0.5f; + } + + //set frames when idle + if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) + { + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + //falling frame + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) + { + Projectile.frame = 4; + Projectile.frameCounter = 0; + } + else if (Projectile.velocity.X != 0) + { + //moving animation + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 4) + { + Projectile.frame = 1; + } + } + + if (Projectile.velocity.X > 0.8f) + { + Projectile.spriteDirection = 1; + } + else if (Projectile.velocity.X < -0.8f) + { + Projectile.spriteDirection = -1; + } + } + else if (fly) + { + float num16 = 0.5f; + Projectile.tileCollide = false; + Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f); + float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y; + vertiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)(60 * -(float)player.direction); + vertiPos -= 60f; + float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + float num21 = 18f; + float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + if (playerDistance > 1200f) + { + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; + } + if (playerDistance < 100f) + { + num16 = 0.5f; + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 10 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + { + fly = false; + Projectile.velocity *= 0.2f; + Projectile.tileCollide = true; + } + } + if (playerDistance < 50f) + { + if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f) + { + Projectile.velocity *= 0.90f; + } + num16 = 0.02f; + } + else + { + if (playerDistance < 100f) + { + num16 = 0.35f; + } + if (playerDistance > 300f) + { + num16 = 1f; + } + playerDistance = num21 / playerDistance; + horiPos *= playerDistance; + vertiPos *= playerDistance; + } + if (Projectile.velocity.X <= horiPos) + { + Projectile.velocity.X = Projectile.velocity.X + num16; + if (num16 > 0.05f && Projectile.velocity.X < 0f) + { + Projectile.velocity.X = Projectile.velocity.X + num16; + } + } + if (Projectile.velocity.X > horiPos) + { + Projectile.velocity.X = Projectile.velocity.X - num16; + if (num16 > 0.05f && Projectile.velocity.X > 0f) + { + Projectile.velocity.X = Projectile.velocity.X - num16; + } + } + if (Projectile.velocity.Y <= vertiPos) + { + Projectile.velocity.Y = Projectile.velocity.Y + num16; + if (num16 > 0.05f && Projectile.velocity.Y < 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f; + } + } + if (Projectile.velocity.Y > vertiPos) + { + Projectile.velocity.Y = Projectile.velocity.Y - num16; + if (num16 > 0.05f && Projectile.velocity.Y > 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; + } + } + + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; + + if (Projectile.Center.X < Main.player[Projectile.owner].Center.X) + { + Projectile.spriteDirection = 1; + } + else if (Projectile.Center.X > Main.player[Projectile.owner].Center.X) + { + Projectile.spriteDirection = -1; + } + + //funny flying animation + Projectile.frameCounter++; + if (Projectile.frameCounter > 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 7) + { + Projectile.frame = 5; + } + + idleTimer = 0; + } + } + + private bool HoleBelow() + { + int tileWidth = 4; + int tileX = (int)(Projectile.Center.X / 16f) - tileWidth; + if (Projectile.velocity.X > 0) + { + tileX += tileWidth; + } + int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + tileWidth; x++) + { + if (Main.tile[x, y].HasTile && (Main.tile[x - 1, y].HasTile || Main.tile[x + 1, y].HasTile)) + { + return false; + } + } + } + return true; + } + } +} \ No newline at end of file diff --git a/Projectiles/Pets/EidolonSnail.png b/Projectiles/Pets/EidolonSnail.png new file mode 100644 index 0000000000..6618499211 Binary files /dev/null and b/Projectiles/Pets/EidolonSnail.png differ diff --git a/Projectiles/Pets/EidolonSnailGlow.png b/Projectiles/Pets/EidolonSnailGlow.png new file mode 100644 index 0000000000..2097448bf6 Binary files /dev/null and b/Projectiles/Pets/EidolonSnailGlow.png differ diff --git a/Projectiles/Pets/GoldiePet.cs b/Projectiles/Pets/GoldiePet.cs new file mode 100644 index 0000000000..d1fa811b01 --- /dev/null +++ b/Projectiles/Pets/GoldiePet.cs @@ -0,0 +1,164 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class GoldiePet : ModProjectile + { + public Player Owner => Main.player[Projectile.owner]; + + public ref float RotationTimer => ref Projectile.ai[0]; + public ref float SparkleTimer => ref Projectile.ai[1]; + public float MaxBloomTime = 30f; + public float MaxSparkleTime = 150f; + public static Color GoldColor = Color.Goldenrod; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Goldie"); + Main.projFrames[Projectile.type] = 5; + Main.projPet[Projectile.type] = true; + ProjectileID.Sets.LightPet[Projectile.type] = true; + } + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 16; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.netImportant = true; + } + + public override void AI() + { + if (OwnerCheck()) + return; + + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + Lighting.AddLight(Projectile.Center, GoldColor.ToVector3() * 0.9f); + + if (SparkleTimer < MaxBloomTime) + SparkleTimer++; + else if (SparkleTimer > MaxBloomTime) + SparkleTimer--; + + if (Main.rand.NextBool(6)) + Dust.QuickDust(Projectile.Center, GoldColor); + + //Find coins + Vector2 targetLocation = Projectile.position; + bool foundCoin = false; + float range = 800f; //50 block range + + for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++) + { + Item item = Main.item[itemIndex]; + if (item.active && ItemID.Sets.CommonCoin[item.type] && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Projectile.owner && + ItemLoader.CanPickup(item, Main.player[item.playerIndexTheItemIsReservedFor]) && Main.player[item.playerIndexTheItemIsReservedFor].ItemSpace(item).CanTakeItemToPersonalInventory) + { + float itemDist = Vector2.Distance(item.Center, Projectile.Center); + float distanceToPotential = Vector2.Distance(Projectile.Center, targetLocation); + //Pick it up + if (Projectile.owner == Main.myPlayer && Projectile.getRect().Intersects(new Rectangle((int)item.position.X, (int)item.position.Y, item.width, item.height))) + { + Main.item[itemIndex] = Owner.GetItem(Projectile.owner, item, new GetItemSettings()); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, itemIndex, 0f, 0f, 0f, 0, 0, 0); + } + + //Max sparkle on collect + SparkleTimer = MaxSparkleTime; + } + //Otherwise, start chasing + if (distanceToPotential < itemDist && itemDist < range) + { + range = itemDist; + targetLocation = item.Center; + foundCoin = true; + } + } + } + + //Chase after coins + if (foundCoin) + { + Vector2 destination = Projectile.SafeDirectionTo(targetLocation); + destination *= 12f; + Projectile.velocity = (Projectile.velocity * 40f + destination) / 41f; + Projectile.rotation = Projectile.velocity.X * 0.05f; + RotationTimer = -1f; + } + //Return to resting position + else if (RotationTimer == -1f) + { + Vector2 restingSpot = Owner.Center + Vector2.UnitY * -80f; + Projectile.velocity = (restingSpot - Projectile.Center) / 15f; + Projectile.rotation = Projectile.velocity.X * 0.05f; + + //Start spinning again when rested + if (Vector2.Distance(restingSpot, Projectile.Center) <= 2f) + RotationTimer++; + } + //Rotate + else + { + Vector2 playerDist = Owner.Center - Projectile.Center; + Projectile.rotation = playerDist.ToRotation() - MathHelper.PiOver2; + Projectile.Center = Owner.Center + Vector2.UnitY.RotatedBy(RotationTimer) * -80f; + RotationTimer += MathHelper.ToRadians(4f); + + if (Main.rand.NextBool(150) && SparkleTimer <= MaxBloomTime) + SparkleTimer = MaxSparkleTime * 0.6f; //Slight sparkle randomly + } + } + + public bool OwnerCheck() + { + // No logic should be run if the player is no longer active in the game. + if (!Owner.active) + { + Projectile.Kill(); + return true; + } + + if (Owner.dead) + Owner.Calamity().thiefsDime = false; + if (Owner.Calamity().thiefsDime) + Projectile.timeLeft = 2; + + return false; + } + + public override bool PreDraw(ref Color lightColor) + { + //Similar coin shining to Midas Prime coins. Thought it'd look pretty neat for a light pet. + Texture2D shineTex = ModContent.Request("CalamityMod/Particles/Sparkle").Value; + float shinePercent = Utils.SmoothStep(MaxBloomTime, MaxSparkleTime, SparkleTimer); + float shineScale = (float)Math.Log10(shinePercent + 0.01) + 2f; + + Texture2D bloomTex = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + float bloomPercent = Math.Clamp(SparkleTimer / MaxBloomTime, 0f, 5f); //Max of 500% when collecting coins + float bloomScale = Math.Clamp(bloomPercent, 0f, 2.5f); + + if (bloomPercent > 0f) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + + Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, GoldColor * bloomPercent * 0.2f, Projectile.rotation, bloomTex.Size() / 2f, bloomPercent * Projectile.scale * 0.3f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, GoldColor * shinePercent, Projectile.rotation, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + + Main.spriteBatch.ExitShaderRegion(); + } + + return true; + } + } +} diff --git a/Projectiles/Rogue/ThiefsDimeProj.png b/Projectiles/Pets/GoldiePet.png similarity index 100% rename from Projectiles/Rogue/ThiefsDimeProj.png rename to Projectiles/Pets/GoldiePet.png diff --git a/Projectiles/Pets/RotomPet.cs b/Projectiles/Pets/RotomPet.cs index 976d45391b..a011deb884 100644 --- a/Projectiles/Pets/RotomPet.cs +++ b/Projectiles/Pets/RotomPet.cs @@ -8,14 +8,18 @@ namespace CalamityMod.Projectiles.Pets public class RotomPet : ModProjectile { private bool initialized = false; - private int form = 0; - private const int Normal = 0; - private const int Dex = 1; - private const int Wash = 2; - private const int Heat = 3; - private const int Frost = 4; - private const int Mow = 5; - private const int Fan = 6; + + private Form RotomType = Form.Normal; + private enum Form + { + Normal, + Dex, + Wash, + Heat, + Frost, + Mow, + Fan + } public override void SetStaticDefaults() { @@ -67,19 +71,19 @@ namespace CalamityMod.Projectiles.Pets private void UpdateForm(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - form = Dex; + RotomType = Form.Dex; else if (player.ZoneBeach || player.InSunkenSea() || player.InSulphur() || player.InAbyss()) - form = Wash; + RotomType = Form.Wash; else if (player.ZoneTowerSolar || player.ZoneDesert || player.ZoneUndergroundDesert || player.ZoneUnderworldHeight || player.InCalamity()) - form = Heat; + RotomType = Form.Heat; else if (player.ZoneSnow || Main.snowMoon) - form = Frost; + RotomType = Form.Frost; else if (player.ZoneJungle) - form = Mow; + RotomType = Form.Mow; else if (player.ZoneSkyHeight || player.ZoneMeteor || player.InAstral()) - form = Fan; + RotomType = Form.Fan; else - form = Normal; + RotomType = Form.Normal; } private void DustEffects() @@ -135,24 +139,24 @@ namespace CalamityMod.Projectiles.Pets private void Drawing(Color color, Texture2D normal, Texture2D dex, Texture2D wash, Texture2D heat, Texture2D frost, Texture2D mow, Texture2D fan) { Texture2D texture = normal; - switch (form) + switch (RotomType) { - case Dex: + case Form.Dex: texture = dex; break; - case Wash: + case Form.Wash: texture = wash; break; - case Heat: + case Form.Heat: texture = heat; break; - case Frost: + case Form.Frost: texture = frost; break; - case Mow: + case Form.Mow: texture = mow; break; - case Fan: + case Form.Fan: texture = fan; break; default: diff --git a/Projectiles/Ranged/AquaBlastToxic.cs b/Projectiles/Ranged/AquaBlastToxic.cs index ed34d8a0c9..9c297c1ea0 100644 --- a/Projectiles/Ranged/AquaBlastToxic.cs +++ b/Projectiles/Ranged/AquaBlastToxic.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -64,8 +64,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); + target.AddBuff(BuffID.Venom, 120); } } } diff --git a/Projectiles/Ranged/ArcherfishShot.cs b/Projectiles/Ranged/ArcherfishShot.cs index b80507570b..50ac4f5406 100644 --- a/Projectiles/Ranged/ArcherfishShot.cs +++ b/Projectiles/Ranged/ArcherfishShot.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; Projectile.penetrate = 2; Projectile.alpha = 255; Projectile.timeLeft = 600; - Projectile.extraUpdates = 2; + Projectile.MaxUpdates = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } diff --git a/Projectiles/Ranged/AuralisBullet.cs b/Projectiles/Ranged/AuralisBullet.cs index df415401ae..566136b592 100644 --- a/Projectiles/Ranged/AuralisBullet.cs +++ b/Projectiles/Ranged/AuralisBullet.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -50,18 +50,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int duration = 420; - target.AddBuff(ModContent.BuffType(), duration); - target.AddBuff(BuffID.Ichor, duration); - target.AddBuff(BuffID.CursedInferno, duration); + target.AddBuff(ModContent.BuffType(), 420); } public override void OnHitPvp(Player target, int damage, bool crit) { - int duration = 420; - target.AddBuff(ModContent.BuffType(), duration); - target.AddBuff(BuffID.Ichor, duration); - target.AddBuff(BuffID.CursedInferno, duration); + target.AddBuff(ModContent.BuffType(), 420); } } } diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index 66336919a7..67496bfb00 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 2; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.WoodenArrowFriendly; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } @@ -38,24 +40,18 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[Projectile.owner] = 12; target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 3; i++) + for (int i = -1; i < 2; i++) // Burst into 3 shards upwards { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), Projectile.knockBack / 5, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), Projectile.knockBack / 5, Projectile.owner, 0f, 0f); + Vector2 baseVelocity = Vector2.UnitY * -12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top, baseVelocity.RotatedBy(MathHelper.ToRadians(10 * i)), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack * 0.25f, Projectile.owner); } } } diff --git a/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs b/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs new file mode 100644 index 0000000000..f62d9e79d7 --- /dev/null +++ b/Projectiles/Ranged/BlissfulBombardierDustProjectile.cs @@ -0,0 +1,99 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Typeless +{ + public class BlissfulBombardierDustProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + } + + public override void SetDefaults() + { + Projectile.width = 46; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f); + bool flag15 = false; + bool flag16 = false; + if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) + { + flag15 = true; + } + if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) + { + flag15 = true; + } + if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) + { + flag16 = true; + } + if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + Projectile.Kill(); + } + float num461 = 25f; + if (Projectile.ai[0] > 60f) + { + num461 -= (Projectile.ai[0] - 60f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + Projectile.Kill(); + } + num461 *= 0.7f; + Projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-8, 9); + float num464 = (float)Main.rand.Next(-8, 9); + float num465 = (float)Main.rand.Next(2, 7); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = Projectile.Center.X; + dust.position.Y = Projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; + num462++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[Projectile.owner] = 0; + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 9eb0130502..4aaffe3255 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -165,7 +165,6 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(ModContent.BuffType(), 240); if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index 527b17edf5..b379749416 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -3,6 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -42,6 +43,10 @@ namespace CalamityMod.Projectiles.Ranged } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 6bc1166a0c..5459bca922 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -86,8 +86,6 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; diff --git a/Projectiles/Ranged/AcidRoundProj.cs b/Projectiles/Ranged/BubonicRoundProj.cs similarity index 96% rename from Projectiles/Ranged/AcidRoundProj.cs rename to Projectiles/Ranged/BubonicRoundProj.cs index a5914e7741..c16460ff52 100644 --- a/Projectiles/Ranged/AcidRoundProj.cs +++ b/Projectiles/Ranged/BubonicRoundProj.cs @@ -7,11 +7,11 @@ using Terraria.Audio; namespace CalamityMod.Projectiles.Ranged { - public class AcidRoundProj : ModProjectile + public class BubonicRoundProj : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Acid Round"); + DisplayName.SetDefault("Bubonic Round"); ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } diff --git a/Projectiles/Ranged/AcidRoundProj.png b/Projectiles/Ranged/BubonicRoundProj.png similarity index 100% rename from Projectiles/Ranged/AcidRoundProj.png rename to Projectiles/Ranged/BubonicRoundProj.png diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index 01dbeae395..f9db62ab9a 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -59,11 +59,6 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item110, Projectile.Center); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Ranged/CardClubSplit.cs b/Projectiles/Ranged/CardClubSplit.cs index e18aff78ef..18efad82dc 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -62,11 +62,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index 6ee24fb27f..8332044e72 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -123,11 +123,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index da3722348f..836b603795 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -59,8 +59,6 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - Player player = Main.player[Projectile.owner]; if (player.moonLeech) return; diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index 2da46b868d..33b7fda622 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -59,11 +59,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Ranged/ChargedBlast3.cs b/Projectiles/Ranged/ChargedBlast3.cs deleted file mode 100644 index 56ba50b3f0..0000000000 --- a/Projectiles/Ranged/ChargedBlast3.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Ranged -{ - public class ChargedBlast3 : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/LaserProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - public override void SetDefaults() - { - Projectile.width = 5; - Projectile.height = 5; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 4; - Projectile.extraUpdates = 3; - Projectile.alpha = 255; - Projectile.timeLeft = 300; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0f, 0.3f, 0.7f); - float num55 = 50f; - float num56 = 1.5f; - if (Projectile.ai[1] == 0f) - { - Projectile.localAI[0] += num56; - if (Projectile.localAI[0] > num55) - { - Projectile.localAI[0] = num55; - } - } - else - { - Projectile.localAI[0] -= num56; - if (Projectile.localAI[0] <= 0f) - { - Projectile.Kill(); - } - } - } - - public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); - - public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0f); - SoundEngine.PlaySound(SoundID.Item62, Projectile.position); - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); - } - else - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void Kill(int timeLeft) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 1f, 0f); - SoundEngine.PlaySound(SoundID.Item62, Projectile.position); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 2; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - } -} diff --git a/Projectiles/Ranged/ChargedDartExplosion.cs b/Projectiles/Ranged/ChargedDartExplosion.cs deleted file mode 100644 index 2929a5d51a..0000000000 --- a/Projectiles/Ranged/ChargedDartExplosion.cs +++ /dev/null @@ -1,86 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ChargedDartExplosion : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - Projectile.width = 50; - Projectile.height = 50; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.timeLeft = 5; - } - - public override void AI() - { - if (Projectile.timeLeft == 5) - { - if (Projectile.ai[1] == 0f) //small, on hit npc and tile collide - { - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - else //big, on kill - { - Projectile.height = Projectile.width = 100; - for (int num621 = 0; num621 < 10; num621++) - { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 20; num623++) - { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 160, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } - } -} diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index f897e2623d..8b493f34a0 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -42,6 +43,16 @@ namespace CalamityMod.Projectiles.Ranged EmitDust(); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + public void EmitDust() { if (Main.dedServ) diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index 95b1a466e1..7e2cb0511b 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -3,6 +3,9 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.Projectiles.Ranged { public class ClamorRifleProj : ModProjectile @@ -42,6 +45,10 @@ namespace CalamityMod.Projectiles.Ranged CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 25f); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void Kill(int timeLeft) { int bulletAmt = 2; @@ -50,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged for (int b = 0; b < bulletAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.45), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); } } SoundEngine.PlaySound(SoundID.Item118, Projectile.Center); diff --git a/Projectiles/Ranged/ClaretCannonProj.cs b/Projectiles/Ranged/ClaretCannonProj.cs index ff01c19cdb..a3dc6b5d03 100644 --- a/Projectiles/Ranged/ClaretCannonProj.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -54,8 +54,6 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - if (!target.canGhostHeal || Main.player[Projectile.owner].moonLeech) return; diff --git a/Projectiles/Ranged/ClockworkBowHoldout.cs b/Projectiles/Ranged/ClockworkBowHoldout.cs index d5b5aaa72d..dac0f374f4 100644 --- a/Projectiles/Ranged/ClockworkBowHoldout.cs +++ b/Projectiles/Ranged/ClockworkBowHoldout.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Ranged return; Item heldItem = Owner.ActiveItem(); - float individualBoltDamage = Owner.GetTotalDamage().ApplyTo(heldItem.damage); + float individualBoltDamage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); int BoltDamage = (int)(individualBoltDamage * (LoadedBolts + 1) / (float)(ClockworkBow.MaxBolts + 1)); float shootSpeed = heldItem.shootSpeed * 1f; float knockback = heldItem.knockBack; diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index 70c7f32eb4..5a712961e1 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -91,6 +91,28 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.dedServ) return; + + //Special visuals for the final loaded arrow + if (ArrowsLoaded >= Condemnation.MaxLoadedArrows - 1f) + { + //Star + for (int i = 0; i < 5; i++) + { + float angle = MathHelper.Pi * 1.5f - i * MathHelper.TwoPi / 5f; + float nextAngle = MathHelper.Pi * 1.5f - (i + 2) * MathHelper.TwoPi / 5f; + Vector2 start = angle.ToRotationVector2(); + Vector2 end = nextAngle.ToRotationVector2(); + for (int j = 0; j < 40; j++) + { + Dust starDust = Dust.NewDustPerfect(tipPosition, 267); + starDust.scale = 2.5f; + starDust.velocity = Vector2.Lerp(start, end, j / 40f) * 16f; + starDust.color = Color.Crimson; + starDust.noGravity = true; + } + } + return; + } for (int i = 0; i < 36; i++) { diff --git a/Projectiles/Ranged/ContagionArrow.cs b/Projectiles/Ranged/ContagionArrow.cs index ecb028a5df..3ef8c3703c 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -59,11 +59,6 @@ namespace CalamityMod.Projectiles.Ranged return true; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Ranged/ContagionBall.cs b/Projectiles/Ranged/ContagionBall.cs index 525a6b51f7..03a150f420 100644 --- a/Projectiles/Ranged/ContagionBall.cs +++ b/Projectiles/Ranged/ContagionBall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -42,10 +42,5 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } } } diff --git a/Projectiles/Ranged/CorinthPrimeAirburst.cs b/Projectiles/Ranged/CorinthPrimeAirburst.cs new file mode 100644 index 0000000000..215ee7da98 --- /dev/null +++ b/Projectiles/Ranged/CorinthPrimeAirburst.cs @@ -0,0 +1,31 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CorinthPrimeAirburst : BaseMassiveExplosionProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override int Lifetime => 60; + public override bool UsesScreenshake => Projectile.damage > 1; + public override float GetScreenshakePower(float pulseCompletionRatio) => CalamityUtils.Convert01To010(pulseCompletionRatio) * 16f; + public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.Blue * 1.6f, Color.Cyan, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f)); + public override void SetStaticDefaults() => DisplayName.SetDefault("Airburst"); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = Lifetime; + Projectile.DamageType = DamageClass.Ranged; + } + + public override void PostAI() => Lighting.AddLight(Projectile.Center, 0f, 0f, 0.3f); + } +} diff --git a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs new file mode 100644 index 0000000000..33434b7de0 --- /dev/null +++ b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.cs @@ -0,0 +1,200 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.NPCs.ExoMechs.Ares; +using System; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CorinthPrimeAirburstGrenade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corinth Prime Airburst Shot"); + Main.projFrames[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 44; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.timeLeft = 130; + Projectile.DamageType = DamageClass.Ranged; + } + + public override void AI() + { + //Animation + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 3) + Projectile.frame = 0; + + // Gravity + if (Projectile.velocity.Y < 12f && Projectile.timeLeft < 115) + Projectile.velocity.Y += 0.1f; + + // Rotate the projectile + Projectile.rotation = Projectile.velocity.ToRotation(); + + Vector2 pos = Projectile.Center; + + // Belch out dust when the grenade is fired. + Projectile.localAI[0] += 1f; + if (Projectile.localAI[0] > 7f) // Projectile has had more than 8 updates, draw fire trail. + { + for (int i = 0; i < 5; i++) + { + pos -= Projectile.velocity * (i * 0.25f); + int idx = Dust.NewDust(pos, Projectile.width, Projectile.height, Main.rand.NextBool() ? 206 : 187, 0f, 0f, 0, default, 1f); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = pos; + Main.dust[idx].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[idx].velocity *= 0.3f; + } + } + else // Projectile has had less than 8 updates, draw smoke. + { + for (int i = 0; i < 30; i++) + { + // Pick a random type of smoke (there's a little fire mixed in). + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + dustID = 186; + break; + case 1: + case 2: + dustID = 20; + break; + default: + dustID = 56; + break; + } + + // Choose a random speed and angle to belch out the smoke. + float dustSpeed = Main.rand.NextFloat(3.0f, 13.0f); + float angleRandom = 0.06f; + 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 smoke particle. + float scale = Main.rand.NextFloat(0.5f, 1.6f); + + // Actually spawn the smoke. + int idx = Dust.NewDust(pos, Projectile.width, Projectile.height, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = pos; + } + } + } + + public override void Kill(int timeLeft) + { + bool weakExplosion = Projectile.localAI[0] < 90f; + + // Play weaker sound if not fully charged and strong sound if fully charged. + if (weakExplosion) + SoundEngine.PlaySound(TeslaCannon.FireSound, Projectile.Center); + else + SoundEngine.PlaySound(AresGaussNuke.NukeExplosionSound, Projectile.Center); + + if (Main.myPlayer == Projectile.owner) + { + // Make big boom that does big damage if it's been active for 1.5 seconds. + // Make small boom that does 1 damage if it hasn't been active for 1.5 seconds. + if (weakExplosion) + { + for (int i = 0; i < 2; i++) + { + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 1, 0f, Projectile.owner); + explosion.ai[1] = Main.rand.NextFloat(64f, 174f) + i * 20f; // Randomize the maximum radius. + explosion.localAI[1] = Main.rand.NextFloat(0.18f, 0.3f); // And the interpolation step. + explosion.netUpdate = true; + } + } + else + { + for (int i = 0; i < 7; i++) + { + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), Projectile.knockBack, Projectile.owner); + if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) + { + explosion.ai[1] = Main.rand.NextFloat(256f, 696f) + i * 45f; // Randomize the maximum radius. + explosion.localAI[1] = Main.rand.NextFloat(0.08f, 0.25f); // And the interpolation step. + explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, i / 7f) + Main.rand.NextFloat(-0.08f, 0.08f); + explosion.netUpdate = true; + } + } + } + } + + // Dust circles + int totalDust = weakExplosion ? 100 : 400; + for (int num640 = 0; num640 < totalDust; num640++) + { + int dustType = 206; + float num641 = 32f; + if (num640 < 300) + { + dustType = 187; + num641 = 16f; + } + if (num640 < 200) + num641 = 8f; + if (num640 < 100) + num641 = 4f; + + int num643 = Dust.NewDust(Projectile.Center, 6, 6, dustType, 0f, 0f, 100, default, 1f); + float num644 = Main.dust[num643].velocity.X; + float num645 = Main.dust[num643].velocity.Y; + + if (num644 == 0f && num645 == 0f) + num644 = 1f; + + float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); + num646 = num641 / num646; + num644 *= num646; + num645 *= num646; + + float scale = 1f; + switch ((int)num641) + { + case 4: + scale = 1.1f; + break; + case 8: + scale = 1.2f; + break; + case 16: + scale = 1.4f; + break; + case 32: + scale = 1.8f; + break; + default: + break; + } + + Dust dust = Main.dust[num643]; + dust.velocity *= 0.5f; + dust.velocity.X += num644; + dust.velocity.Y += num645; + dust.scale = scale; + dust.noGravity = true; + } + } + } +} + diff --git a/Projectiles/Ranged/CorinthPrimeAirburstGrenade.png b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.png new file mode 100644 index 0000000000..833170cfb2 Binary files /dev/null and b/Projectiles/Ranged/CorinthPrimeAirburstGrenade.png differ diff --git a/Projectiles/Ranged/CorrodedShell.cs b/Projectiles/Ranged/CorrodedShell.cs index fed8705746..1894b565a6 100644 --- a/Projectiles/Ranged/CorrodedShell.cs +++ b/Projectiles/Ranged/CorrodedShell.cs @@ -34,8 +34,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Projectile.velocity.X *= 0.9995f; - Projectile.velocity.Y *= 0.9995f; + Projectile.velocity *= 0.9995f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft % 3 == 0) @@ -72,8 +71,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 480); } } } diff --git a/Projectiles/Ranged/CrackshotBlast.cs b/Projectiles/Ranged/CrackshotBlast.cs index abb9c21869..811767179f 100644 --- a/Projectiles/Ranged/CrackshotBlast.cs +++ b/Projectiles/Ranged/CrackshotBlast.cs @@ -1,6 +1,5 @@ using System; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Systems; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -21,7 +20,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - DisplayName.SetDefault("Blast"); + DisplayName.SetDefault("Crack Shot"); ProjectileID.Sets.TrailCacheLength[Projectile.type] = TrailLenght; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 4000; diff --git a/Projectiles/Ranged/DWArrow.cs b/Projectiles/Ranged/DWArrow.cs index 8c6348f297..c0cfb9a47a 100644 --- a/Projectiles/Ranged/DWArrow.cs +++ b/Projectiles/Ranged/DWArrow.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -24,8 +25,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.extraUpdates = 5; Projectile.timeLeft = 600; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.arrow = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } @@ -54,11 +53,10 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 90); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override bool PreDraw(ref Color lightColor) { Texture2D texture; diff --git a/Projectiles/Ranged/DesertMark.cs b/Projectiles/Ranged/DesertMark.cs deleted file mode 100644 index 68d9d61beb..0000000000 --- a/Projectiles/Ranged/DesertMark.cs +++ /dev/null @@ -1,158 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class DesertMark : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.timeLeft = 900; - Projectile.ignoreWater = true; - Projectile.alpha = 255; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); - } - if (Projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 269, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = Projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 0.8f; - Projectile.direction = 1; - Point point9 = Projectile.Center.ToTileCoordinates(); - Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; - if (Projectile.localAI[1] < 33f) - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 8; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - } - if (Projectile.localAI[1] > 103f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 16; - } - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - if (Projectile.alpha == 0) - { - Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = Projectile.Opacity * Projectile.localAI[0]; - dust35.position = Projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 269, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = Projectile.Opacity * Projectile.localAI[0]; - dust36.position = Projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) - { - Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; - } - Projectile.velocity = Vector2.Zero; - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 0f, 0f); - } - if (Projectile.localAI[1] >= 120f) - { - Projectile.Kill(); - return; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = ModContent.Request(Texture).Value; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, SpriteEffects.None, 0); - Main.spriteBatch.Draw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Ranged/DesertTornado.cs b/Projectiles/Ranged/DesertTornado.cs deleted file mode 100644 index 7a4af6787a..0000000000 --- a/Projectiles/Ranged/DesertTornado.cs +++ /dev/null @@ -1,185 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Ranged -{ - public class DesertTornado : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/TornadoProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Tornado"); - } - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = -1; - Projectile.timeLeft = 1200; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - //only 1 tornado can exist at a time - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 10f) - { - Projectile.localAI[1] = 0f; - int projCount = 0; - int oldestTornado = 0; - float tornadoAge = 0f; - int projType = Projectile.type; - for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) - { - Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[0] < 900f) - { - projCount++; - if (proj.ai[0] > tornadoAge) - { - oldestTornado = projIndex; - tornadoAge = proj.ai[0]; - } - } - } - if (projCount > 1) - { - Main.projectile[oldestTornado].netUpdate = true; - Main.projectile[oldestTornado].ai[0] = 36000f; - return; - } - } - - float lifeSpan = 900f; - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= lifeSpan) - { - Projectile.Kill(); - } - if (Projectile.localAI[0] >= 30f) - { - Projectile.damage = 0; - if (Projectile.ai[0] < lifeSpan - 120f) - { - float num1126 = Projectile.ai[0] % 60f; - Projectile.ai[0] = lifeSpan - 120f + num1126; - Projectile.netUpdate = true; - } - } - float num1127 = 15f; - float num1128 = 15f; - Point point8 = Projectile.Center.ToTileCoordinates(); - int num1129; - int num1130; - Collision.ExpandVertically(point8.X, point8.Y, out num1129, out num1130, (int)num1127, (int)num1128); - num1129++; - num1130--; - Vector2 value72 = new Vector2((float)point8.X, (float)num1129) * 16f + new Vector2(8f); - Vector2 value73 = new Vector2((float)point8.X, (float)num1130) * 16f + new Vector2(8f); - Vector2 vector146 = Vector2.Lerp(value72, value73, 0.5f); - Vector2 value74 = new Vector2(0f, value73.Y - value72.Y); - value74.X = value74.Y * 0.2f; - Projectile.width = (int)(value74.X * 0.65f); - Projectile.height = (int)value74.Y; - Projectile.Center = vector146; - if (Projectile.owner == Main.myPlayer) - { - bool flag74 = false; - Vector2 center16 = Main.player[Projectile.owner].Center; - Vector2 top = Main.player[Projectile.owner].Top; - for (float num1131 = 0f; num1131 < 1f; num1131 += 0.05f) - { - Vector2 position2 = Vector2.Lerp(value72, value73, num1131); - if (Collision.CanHitLine(position2, 0, 0, center16, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) - { - flag74 = true; - break; - } - } - if (!flag74 && Projectile.ai[0] < lifeSpan - 120f) - { - float num1132 = Projectile.ai[0] % 60f; - Projectile.ai[0] = lifeSpan - 120f + num1132; - Projectile.netUpdate = true; - } - } - if (Projectile.ai[0] < lifeSpan - 120f) - { - return; - } - } - - public override bool PreDraw(ref Color lightColor) - { - float num226 = 600f; - float num227 = 15f; - float num228 = 15f; - float num229 = Projectile.ai[0]; - float scale5 = MathHelper.Clamp(num229 / 30f, 0f, 1f); - if (num229 > num226 - 60f) - { - scale5 = MathHelper.Lerp(1f, 0f, (num229 - (num226 - 60f)) / 60f); - } - Point point5 = Projectile.Center.ToTileCoordinates(); - int num230; - int num231; - Collision.ExpandVertically(point5.X, point5.Y, out num230, out num231, (int)num227, (int)num228); - num230++; - num231--; - float num232 = 0.2f; - Vector2 value32 = new Vector2((float)point5.X, (float)num230) * 16f + new Vector2(8f); - Vector2 value33 = new Vector2((float)point5.X, (float)num231) * 16f + new Vector2(8f); - Vector2.Lerp(value32, value33, 0.5f); - Vector2 vector33 = new Vector2(0f, value33.Y - value32.Y); - vector33.X = vector33.Y * num232; - new Vector2(value32.X - vector33.X / 2f, value32.Y); - Texture2D texture2D23 = ModContent.Request(Texture).Value; - Rectangle rectangle9 = texture2D23.Frame(1, 1, 0, 0); - Vector2 origin3 = rectangle9.Size() / 2f; - float num233 = -0.06283186f * num229; - Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num229 * 0.1f), default); - float num234 = 0f; - float num235 = 5.1f; - Color value34 = new Color(225, 225, 100); - for (float num236 = (float)(int)value33.Y; num236 > (float)(int)value32.Y; num236 -= num235) - { - num234 += num235; - float num237 = num234 / vector33.Y; - float num238 = num234 * 6.28318548f / -20f; - float num239 = num237 - 0.15f; - Vector2 vector34 = spinningpoint2.RotatedBy((double)num238, default); - Vector2 value35 = new Vector2(0f, num237 + 1f); - value35.X = value35.Y * num232; - Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, num237 * 2f); - if (num237 > 0.5f) - { - color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value34, 2f - num237 * 2f); - } - color39.A = (byte)((float)color39.A * 0.5f); - color39 *= scale5; - vector34 *= value35 * 100f; - vector34.Y = 0f; - vector34.X = 0f; - vector34 += new Vector2(value33.X, num236) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, vector34, new Microsoft.Xna.Framework.Rectangle?(rectangle9), color39, num233 + num238, origin3, 1f + num239, SpriteEffects.None, 0); - } - return false; - } - } -} diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index 65d209d296..cd2be3c201 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -62,17 +62,14 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[Projectile.owner] = 0; - target.AddBuff(BuffID.Daybreak, 180); - target.AddBuff(ModContent.BuffType(), 180); - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override Color? GetAlpha(Color lightColor) => new Color(250, 25, 0, Projectile.alpha); diff --git a/Projectiles/Ranged/DrataliornusFlame.cs b/Projectiles/Ranged/DrataliornusFlame.cs index 7110190672..7f3dec6770 100644 --- a/Projectiles/Ranged/DrataliornusFlame.cs +++ b/Projectiles/Ranged/DrataliornusFlame.cs @@ -214,7 +214,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); if (Projectile.ai[0] != 0f && Projectile.owner == Main.myPlayer) //if empowered { @@ -240,8 +240,7 @@ namespace CalamityMod.Projectiles.Ranged { target.immune[Projectile.owner] = 0; - target.AddBuff(BuffID.Daybreak, 240); - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); if (Projectile.ai[0] != 0f && Projectile.owner == Main.myPlayer) //if empowered { diff --git a/Projectiles/Ranged/DrizzlefishFire.cs b/Projectiles/Ranged/DrizzlefishFire.cs index bb90190e0c..d143f52bb4 100644 --- a/Projectiles/Ranged/DrizzlefishFire.cs +++ b/Projectiles/Ranged/DrizzlefishFire.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Ranged } else { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Ranged/DrizzlefishFireSplit.cs b/Projectiles/Ranged/DrizzlefishFireSplit.cs index eebcadbe28..efda874bee 100644 --- a/Projectiles/Ranged/DrizzlefishFireSplit.cs +++ b/Projectiles/Ranged/DrizzlefishFireSplit.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Ranged } else { - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 30); } } } diff --git a/Projectiles/Ranged/DrizzlefishFireball.cs b/Projectiles/Ranged/DrizzlefishFireball.cs index 37d703feff..dc88cd2c36 100644 --- a/Projectiles/Ranged/DrizzlefishFireball.cs +++ b/Projectiles/Ranged/DrizzlefishFireball.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Ranged } else { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Ranged/ExoCrystalArrow.cs b/Projectiles/Ranged/ExoCrystalArrow.cs index db3cbfbb72..dafce171fe 100644 --- a/Projectiles/Ranged/ExoCrystalArrow.cs +++ b/Projectiles/Ranged/ExoCrystalArrow.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; @@ -8,7 +9,6 @@ using CalamityMod.Particles; using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Items.Weapons.Ranged; -using Terraria.DataStructures; namespace CalamityMod.Projectiles.Ranged { @@ -57,6 +57,10 @@ namespace CalamityMod.Projectiles.Ranged // Determine rotation. Projectile.rotation = Projectile.velocity.ToRotation(); + // Emit light. + DelegateMethods.v3_1 = Color.Lerp(Color.Lime, Color.White, 0.55f).ToVector3() * 0.65f; + Utils.PlotTileLine(Projectile.Center - Projectile.velocity * 0.5f, Projectile.Center + Projectile.velocity * 0.5f, 16f, DelegateMethods.CastLightOpen); + Time++; } @@ -125,10 +129,13 @@ namespace CalamityMod.Projectiles.Ranged int lightning = Projectile.NewProjectile(Projectile.GetSource_FromThis(), lightningSpawnPosition, lightningShootVelocity, ModContent.ProjectileType(), lightningDamage, 0f, Projectile.owner); if (Main.projectile.IndexInRange(lightning)) { - Main.projectile[lightning].CritChance = Projectile.CritChance; Main.projectile[lightning].ai[0] = lightningShootVelocity.ToRotation(); Main.projectile[lightning].ai[1] = Main.rand.Next(100); } + + target.AddBuff(ModContent.BuffType(), 300); } + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index dfb0d31225..72c0b30578 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; @@ -76,8 +77,8 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); - public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Ranged/ExoFlare.cs b/Projectiles/Ranged/ExoFlare.cs index 1d4475778c..31f6308df3 100644 --- a/Projectiles/Ranged/ExoFlare.cs +++ b/Projectiles/Ranged/ExoFlare.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -68,6 +69,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = (Projectile.position - Projectile.oldPos[1]).ToRotation(); OffsetRotation += OffsetSpeed; } + public override bool PreDraw(ref Color lightColor) { Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; @@ -76,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 16f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; Color color = Color.Lerp(Color.LightGreen, Color.LightPink, colorInterpolation) * 0.4f; color.A = 0; - Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-25f, -25f); Color outerColor = color; Color innerColor = color * 0.5f; float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); @@ -93,7 +95,9 @@ namespace CalamityMod.Projectiles.Ranged } return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(2f); - public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(2f); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 600); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 600); } } diff --git a/Projectiles/Ranged/ExoFlareCluster.cs b/Projectiles/Ranged/ExoFlareCluster.cs index 6a6ba13e61..3dd817798d 100644 --- a/Projectiles/Ranged/ExoFlareCluster.cs +++ b/Projectiles/Ranged/ExoFlareCluster.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; @@ -78,12 +79,12 @@ namespace CalamityMod.Projectiles.Ranged int height = (int)MathHelper.Min(target.Hitbox.Height, 60); Projectile.ExpandHitboxBy(width, height); } - target.ExoDebuffs(2f); + target.AddBuff(ModContent.BuffType(), 600); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(2f); + target.AddBuff(ModContent.BuffType(), 600); } } } diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index eb4fe298d0..b96e4a4aa5 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Ranged { @@ -145,7 +146,7 @@ namespace CalamityMod.Projectiles.Ranged Color.SlateGray }) * Projectile.Opacity; color.A = 0; - Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-15f, -15f); Color outerColor = color; Color innerColor = color * 0.5f; float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); @@ -177,8 +178,8 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(1.5f); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 360); - public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(1.5f); + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 360); } } diff --git a/Projectiles/Ranged/ExoLightningBolt.cs b/Projectiles/Ranged/ExoLightningBolt.cs index bcfc256a16..12d1840213 100644 --- a/Projectiles/Ranged/ExoLightningBolt.cs +++ b/Projectiles/Ranged/ExoLightningBolt.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; @@ -170,5 +171,9 @@ namespace CalamityMod.Projectiles.Ranged LightningDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 18); return false; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Ranged/ExoSpark.cs b/Projectiles/Ranged/ExoSpark.cs index ad3d7b81ba..16e90a57d5 100644 --- a/Projectiles/Ranged/ExoSpark.cs +++ b/Projectiles/Ranged/ExoSpark.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -64,8 +65,8 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); - public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Ranged/FallenStarProj.cs b/Projectiles/Ranged/FallenStarProj.cs index 9e752ff1d9..82e12a7942 100644 --- a/Projectiles/Ranged/FallenStarProj.cs +++ b/Projectiles/Ranged/FallenStarProj.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 spriteOrigin = spriteRec.Size() / 2f; SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D aura = ModContent.Request("CalamityMod/Projectiles/Ranged/FallenStarAura").Value; + Texture2D aura = ModContent.Request("CalamityMod/Projectiles/StarTrail").Value; Vector2 drawStart = Projectile.Center + Projectile.velocity; Vector2 drawStart2 = Projectile.Center - Projectile.velocity * 0.5f; Vector2 spinPoint = new Vector2(0f, -10f); diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index 3cab7d3c7f..f2bc78f057 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -25,8 +25,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; } public override void AI() @@ -47,7 +45,7 @@ namespace CalamityMod.Projectiles.Ranged { num26 = 5f; } - Projectile.damage = (int)player.GetTotalDamage().ApplyTo(player.ActiveItem().damage); + Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); Projectile.ai[0] += 1f; Projectile.ai[1] += 1f; int num27 = 10; diff --git a/Projectiles/Ranged/FlakKrakenProj.cs b/Projectiles/Ranged/FlakKrakenProj.cs index bd56efa15b..2f93f46122 100644 --- a/Projectiles/Ranged/FlakKrakenProj.cs +++ b/Projectiles/Ranged/FlakKrakenProj.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -40,12 +41,14 @@ namespace CalamityMod.Projectiles.Ranged return; } - // This code uses player-specific fields (such as the mouse), and does not need to be run for anyone // other than its owner. if (Main.myPlayer != Projectile.owner) return; + // This needs to happen retroactively due to Deadshot Brooch and other potential items boosting updates + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; + Projectile.rotation += 0.2f; if (Projectile.localAI[0] < 1f) { @@ -129,6 +132,10 @@ namespace CalamityMod.Projectiles.Ranged } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { damage = (int)(damage * Projectile.localAI[0]); diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index 336f458502..6dc7e5b51e 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -1,5 +1,7 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -87,9 +89,16 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(BuffID.OnFire3, 480); + Projectile.Kill(); } + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire3, 180); + } + public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) diff --git a/Projectiles/Ranged/FreedomStarBeam.cs b/Projectiles/Ranged/FreedomStarBeam.cs new file mode 100644 index 0000000000..e609271eb0 --- /dev/null +++ b/Projectiles/Ranged/FreedomStarBeam.cs @@ -0,0 +1,287 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.Enums; +using Terraria.GameContent.Shaders; +using Terraria.Graphics.Effects; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FreedomStarBeam : ModProjectile + { + private const int Lifetime = 840; + private const int TimeToReachMaxSize = 480; + private const int TimeToShrink = 60; + private const float MaxBeamScale = 3f; + private const int DustType = 226; + + private const float MaxBeamLength = 1200f; + private const float BeamTileCollisionWidth = 1f; + private const float BeamHitboxCollisionWidth = 15f; + private const int NumSamplePoints = 3; + private const float BeamLengthChangeFactor = 0.5f; + + private const float OuterBeamOpacityMultiplier = 0.82f; + private const float InnerBeamOpacityMultiplier = 0.2f; + private const float MaxBeamBrightness = 0.75f; + + private const float MainDustBeamEndOffset = 14.5f; + private const float SidewaysDustBeamEndOffset = 4f; + private const float BeamRenderTileOffset = 10.5f; + private const float BeamLengthReductionFactor = 14.5f; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Freedom Star Beam"); + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + // The beam itself still stops on tiles, but its invisible "source" projectile ignores them. + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = Lifetime; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[0]); + writer.Write(Projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + Projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; + + if (Main.projectile[(int)Projectile.ai[1]].active && Main.projectile[(int)Projectile.ai[1]].type == ModContent.ProjectileType()) + { + Vector2 value27 = Vector2.Normalize(Main.projectile[(int)Projectile.ai[1]].velocity); + Projectile.position = Main.projectile[(int)Projectile.ai[1]].Center + value27 * 16f - new Vector2(Projectile.width, Projectile.height) / 2f + new Vector2(0f, 0f - Main.projectile[(int)Projectile.ai[1]].gfxOffY); + Projectile.velocity = Vector2.Normalize(Main.projectile[(int)Projectile.ai[1]].velocity); + } + else + { + Projectile.Kill(); + return; + } + + if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) + Projectile.velocity = -Vector2.UnitY; + + float rotation = Projectile.velocity.ToRotation(); + Projectile.rotation = rotation - (float)Math.PI / 2f; + Projectile.velocity = rotation.ToRotationVector2(); + + // Figure out the scale. + if (Projectile.timeLeft > Lifetime - TimeToReachMaxSize) + Projectile.localAI[0]++; + else if (Projectile.timeLeft < TimeToShrink) + Projectile.localAI[0] -= TimeToReachMaxSize / TimeToShrink; + + // Set initial damage. + if (Projectile.localAI[1] == 0f) + Projectile.localAI[1] = Projectile.damage; + + // Reduce the "power" and thus scale of the projectile over its lifetime. + float power = MathHelper.Clamp(Projectile.localAI[0] / TimeToReachMaxSize, 0.1f, 1f); + Projectile.scale = MaxBeamScale * power; + Projectile.damage = (int)MathHelper.Lerp(Projectile.localAI[1], Projectile.localAI[1] * 3f, power); + + // Perform a laser scan to calculate the correct length of the beam. + float[] laserScanResults = new float[NumSamplePoints]; + + // A minimum width is forced for the beam scan to prevent massive lag when fired into open areas. + float scanWidth = Projectile.scale < 1f ? 1f : Projectile.scale; + Collision.LaserScan(Projectile.Center, Projectile.velocity, BeamTileCollisionWidth * scanWidth, MaxBeamLength, laserScanResults); + float avg = 0f; + for (int i = 0; i < laserScanResults.Length; i++) + avg += laserScanResults[i]; + avg /= NumSamplePoints; + Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], avg, BeamLengthChangeFactor); + + // X = beam length. + // Y = beam width. + Vector2 beamDims = new Vector2(Projectile.velocity.Length() * Projectile.ai[0], Projectile.width * Projectile.scale); + Color beamColor = Color.Cyan; + ProduceBeamDust(beamColor); + + // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. + if (Main.netMode != NetmodeID.Server) + { + WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); + + // A universal time-based sinusoid which updates extremely rapidly. + // GlobalTimeWrappedHourly is 0 to 3600, measured in seconds. + float waveSine = 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f); + Vector2 ripplePos = Projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(Projectile.rotation); + + // WaveData is encoded as a Color. + // Not sure why, considering Vector3 exists. + Color waveData = new Color(0.5f, 0.1f * Math.Sign(waveSine) + 0.5f, 0f, 1f) * Math.Abs(waveSine); + wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, Projectile.rotation); + } + + // Make the beam cast light along its length. + // v3_1 is an unnamed decompiled variable which is the color of the light cast by DelegateMethods.CastLight. + DelegateMethods.v3_1 = beamColor.ToVector3() * power * MaxBeamBrightness; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.ai[0], beamDims.Y, DelegateMethods.CastLight); + + // Also add some fast moving dust. + if (Projectile.timeLeft == Lifetime) + { + int dustCount = Main.rand.Next(10, 30); + for (int i = 0; i < dustCount; i++) + { + float dustProgressAlongBeam = Projectile.ai[0] * Main.rand.NextFloat(0f, 0.7f); + Vector2 dustPosition = Projectile.Center + dustProgressAlongBeam * Projectile.velocity + Projectile.velocity.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-6f, 6f) * Projectile.scale; + + Dust dust = Dust.NewDustPerfect(dustPosition, DustType, Projectile.velocity * Main.rand.NextFloat(2f, 16f), 0, beamColor); + dust.color = beamColor; + dust.noGravity = true; + dust.scale = 0.7f; + } + } + } + + // Determines whether the specified target hitbox is intersecting with the beam. + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + // If the target is touching the beam's hitbox, that's good enough. + if (projHitbox.Intersects(targetHitbox)) + return true; + + // Otherwise, perform an AABB line collision check to check the whole beam. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.ai[0], BeamHitboxCollisionWidth * Projectile.scale, ref _); + } + + // Spawn lunar flare explosions on hit. + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 explosionOffset = new Vector2(Projectile.width, Projectile.height).RotatedByRandom(MathHelper.TwoPi); + SoundEngine.PlaySound(SoundID.Item14, target.Center + explosionOffset); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center + explosionOffset, Vector2.Zero, ProjectileID.LunarFlare, Projectile.damage / 5, Projectile.knockBack, Projectile.owner, 0f, -1f); + Main.projectile[proj].DamageType = DamageClass.Ranged; + Main.projectile[proj].scale = Projectile.scale * 0.7f; + Main.projectile[proj].netUpdate = true; + } + } + + public override bool PreDraw(ref Color lightColor) + { + // If the beam has its velocity set to zero, don't draw anything. + if (Projectile.velocity == Vector2.Zero) + return false; + + Texture2D tex = ModContent.Request(Texture).Value; + float beamLength = Projectile.ai[0]; + Vector2 centerFloored = Projectile.Center.Floor() + Projectile.velocity * Projectile.scale * BeamRenderTileOffset; + Vector2 scaleVec = new Vector2(Projectile.scale); + + // Reduce the beam length proportional to its square area to reduce block penetration. + beamLength -= BeamLengthReductionFactor * Projectile.scale; + + // f_1 is an unnamed decompiled variable whose function is unknown. Leave it at 1. + DelegateMethods.f_1 = 1f; + + Vector2 beamStartPos = centerFloored - Main.screenPosition; + Vector2 beamEndPos = beamStartPos + Projectile.velocity * beamLength; + Utils.LaserLineFraming llf = new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw); + + // Draw the outer beam. + // c_1 is an unnamed decompiled variable which is the render color of the beam drawn by DelegateMethods.RainbowLaserDraw. + Color beamColor = Color.Cyan; + DelegateMethods.c_1 = beamColor * OuterBeamOpacityMultiplier * Projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); + + // Draw the inner beams, each with reduced size and whiter color. + for (int i = 0; i < 5; i++) + { + beamColor = Color.Lerp(beamColor, Color.White, 0.4f); + scaleVec *= 0.85f - i * 0.15f; + DelegateMethods.c_1 = beamColor * InnerBeamOpacityMultiplier * Projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); + } + + return false; + } + + private void ProduceBeamDust(Color beamColor) + { + // Create a few dust per frame a small distance from where the beam ends. + Vector2 laserEndPos = Projectile.Center + Projectile.velocity * (Projectile.ai[0] - MainDustBeamEndOffset * Projectile.scale); + + for (int i = 0; i < 2; i++) + { + // 50% chance for the dust to come off on either side of the beam. + float dustAngle = Projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2; + float dustStartDist = Main.rand.NextFloat(1f, 1.8f); + Vector2 dustVel = dustAngle.ToRotationVector2() * dustStartDist; + int d = Dust.NewDust(laserEndPos, 0, 0, DustType, dustVel.X, dustVel.Y, 0, beamColor); + Main.dust[d].color = beamColor; + Main.dust[d].noGravity = true; + Main.dust[d].scale = 0.7f; + + // Scale up dust with the projectile if it's large. + if (Projectile.scale > 1f) + { + Main.dust[d].velocity *= Projectile.scale; + Main.dust[d].scale *= Projectile.scale; + } + + // If the beam isn't at max scale, then make additional smaller dust. + if (Projectile.scale != MaxBeamScale) + { + Dust smallDust = Dust.CloneDust(d); + smallDust.scale /= 2f; + } + } + + // Low chance every frame to spawn a large "directly sideways" dust which doesn't move. + if (Main.rand.NextBool(5)) + { + // Velocity, flipped sideways, times -50% to 50% of beam width. + Vector2 dustOffset = Projectile.velocity.RotatedBy(MathHelper.PiOver2) * (Main.rand.NextFloat() - 0.5f) * Projectile.width; + Vector2 dustPos = laserEndPos + dustOffset - Vector2.One * SidewaysDustBeamEndOffset; + int d = Dust.NewDust(dustPos, 8, 8, DustType, 0f, 0f, 100, beamColor, 1.2f); + Main.dust[d].velocity *= 0.5f; + + // Force the dust to always move downwards, never upwards. + Main.dust[d].velocity.Y = -Math.Abs(Main.dust[d].velocity.Y); + } + } + + // Automatically iterates through every tile the laser is overlapping to cut grass at all those locations. + public override void CutTiles() + { + // tilecut_0 is an unnamed decompiled variable which tells CutTiles how the tiles are being cut (in this case, via a projectile). + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Utils.TileActionAttempt cut = DelegateMethods.CutTiles; + Vector2 beamStartPos = Projectile.Center; + Vector2 beamEndPos = beamStartPos + Projectile.velocity * Projectile.ai[0]; + Utils.PlotTileLine(beamStartPos, beamEndPos, Projectile.width * Projectile.scale, cut); + } + } +} diff --git a/Projectiles/Ranged/FreedomStarBeam.png b/Projectiles/Ranged/FreedomStarBeam.png new file mode 100644 index 0000000000..4bcb09bbf2 Binary files /dev/null and b/Projectiles/Ranged/FreedomStarBeam.png differ diff --git a/Projectiles/Ranged/FreedomStarHoldout.cs b/Projectiles/Ranged/FreedomStarHoldout.cs new file mode 100644 index 0000000000..ceb73d73b8 --- /dev/null +++ b/Projectiles/Ranged/FreedomStarHoldout.cs @@ -0,0 +1,247 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FreedomStarHoldout : ModProjectile + { + private const float OrbLargeGateValue = 80f; + private const float LaserGateValue = 180f; + private const float LaserLargeGateValue = 660f; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Freedom Star"); + + public override void SetDefaults() + { + Projectile.width = 54; + Projectile.height = 28; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + + Projectile.ai[0] += 1f; + int chargeAmt = 0; + if (Projectile.ai[0] >= OrbLargeGateValue) + chargeAmt++; + + if (Projectile.ai[0] >= LaserGateValue) + chargeAmt++; + + float lerpAmtForCharge = (Projectile.ai[0] - LaserGateValue) / (LaserLargeGateValue - LaserGateValue); + if (lerpAmtForCharge > 1f) + lerpAmtForCharge = 1f; + + bool shootLaser = Projectile.ai[0] >= LaserGateValue; + int shootGateValue = 5; + if (!shootLaser) + Projectile.ai[1] += 1f; + + bool shootThisFrame = false; + if (Projectile.ai[0] == 1f) + shootThisFrame = true; + + if (shootLaser && Projectile.ai[0] % 20f == 0f) + shootThisFrame = true; + + // Update position. + if ((!shootLaser && Projectile.ai[1] >= shootGateValue) || shootLaser) + { + if (!shootLaser) + Projectile.ai[1] = 0f; + + shootThisFrame = true; + float num21 = player.inventory[player.selectedItem].shootSpeed * Projectile.scale; + Vector2 value11 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - Projectile.Center; + if (player.gravDir == -1f) + value11.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; + + Vector2 velocity2 = Vector2.Normalize(value11); + if (float.IsNaN(velocity2.X) || float.IsNaN(velocity2.Y)) + velocity2 = -Vector2.UnitY; + + velocity2 *= num21; + if (velocity2.X != Projectile.velocity.X || velocity2.Y != Projectile.velocity.Y) + Projectile.netUpdate = true; + + Projectile.velocity = velocity2; + } + + // Emit sounds. + if (Projectile.soundDelay <= 0 && !shootLaser) + { + Projectile.soundDelay = shootGateValue - chargeAmt; + Projectile.soundDelay *= 2; + if (Projectile.ai[0] != 1f) + SoundEngine.PlaySound(SoundID.Item15, Projectile.position); + } + + // Dust spawning for orbs. + if (Projectile.ai[0] > 5f && !shootLaser) + { + Vector2 spinningpoint3 = Vector2.UnitX * 32f; + spinningpoint3 = spinningpoint3.RotatedBy(Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f)); + Vector2 value12 = Projectile.Center + spinningpoint3; + + for (int k = 0; k < chargeAmt + 1; k++) + { + int num22 = 226; + float num23 = 0.4f; + if (k % 2 == 1) + { + num22 = 226; + num23 = 0.65f; + } + + Vector2 vector3 = value12 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (12f - chargeAmt * 2); + int num24 = Dust.NewDust(vector3 - Vector2.One * 8f, 16, 16, num22, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + Main.dust[num24].velocity = Vector2.Normalize(value12 - vector3) * 1.5f * (10f - chargeAmt * 2f) / 10f; + Main.dust[num24].noGravity = true; + Main.dust[num24].scale = num23; + Main.dust[num24].customData = player; + } + } + + // Dust spawning for laser. + if (shootLaser) + { + Vector2 spinningpoint4 = Vector2.UnitX * 32f; + spinningpoint4 = spinningpoint4.RotatedBy(Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f)); + Vector2 vector4 = Projectile.Center + spinningpoint4; + + for (int l = 0; l < 2; l++) + { + int num25 = 226; + float num26 = 0.35f; + if (l % 2 == 1) + { + num25 = 226; + num26 = 0.45f; + } + num26 *= MathHelper.Lerp(1f, 3f, lerpAmtForCharge); + + float num27 = Main.rand.NextFloatDirection(); + Vector2 value13 = vector4 + (Projectile.rotation + (Projectile.spriteDirection == -1 ? -MathHelper.PiOver2 : MathHelper.PiOver2) + num27 * ((float)Math.PI / 4f) * 0.8f - (float)Math.PI / 2f).ToRotationVector2() * 6f; + int num28 = 24; + int num29 = Dust.NewDust(value13 - Vector2.One * (num28 / 2), num28, num28, num25, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); + Main.dust[num29].velocity = (value13 - vector4).SafeNormalize(Vector2.Zero) * MathHelper.Lerp(1.5f, 9f, Utils.GetLerpValue(1f, 0f, Math.Abs(num27), clamped: true)); + Main.dust[num29].noGravity = true; + Main.dust[num29].scale = num26; + Main.dust[num29].customData = player; + Main.dust[num29].fadeIn = 0.5f; + } + } + + // Projectile shooting. + if (shootThisFrame && Main.myPlayer == Projectile.owner) + { + Item freedomStar = player.ActiveItem(); + + // This grabs the weapon's current damage, taking current charge level into account. + int currentDamage = player.GetWeaponDamage(freedomStar); + + bool stillInUse = player.channel && !player.noItems && !player.CCed; + + // Checks if the Freedom Star has sufficient charge to fire. If this is false, it stops functioning. + CalamityGlobalItem modItem = freedomStar.Calamity(); + float chargeConsumed = FreedomStar.HoldoutChargeUse_Orb; + switch (chargeAmt) + { + case 1: + chargeConsumed = FreedomStar.HoldoutChargeUse_OrbLarge; + break; + + case 2: + chargeConsumed = MathHelper.Lerp(FreedomStar.HoldoutChargeUse_Laser, FreedomStar.HoldoutChargeUse_LaserLarge, lerpAmtForCharge); + break; + + default: + break; + } + bool hasCharge = modItem.Charge >= chargeConsumed; + + if (stillInUse && hasCharge) + { + // Use charge when firing anything. + modItem.Charge -= chargeConsumed; + + if (Projectile.ai[0] == LaserGateValue) + { + SoundEngine.PlaySound(SoundID.Item124, Projectile.position); + + Vector2 actualVelocity = Vector2.Normalize(Projectile.velocity); + if (float.IsNaN(actualVelocity.X) || float.IsNaN(actualVelocity.Y)) + actualVelocity = -Vector2.UnitY; + + int projectileDamage = (int)(currentDamage * 1.5f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, actualVelocity, ModContent.ProjectileType(), projectileDamage, Projectile.knockBack, Projectile.owner, 0f, Projectile.whoAmI); + Projectile.ai[1] = proj; + Projectile.netUpdate = true; + } + else if (shootLaser) + { + Projectile projectile = Main.projectile[(int)Projectile.ai[1]]; + if (!projectile.active || projectile.type != ModContent.ProjectileType()) + { + Projectile.Kill(); + return; + } + } + else + { + bool shootOrb = false; + if (Projectile.ai[0] == 1f) + shootOrb = true; + if (Projectile.ai[0] <= 50f && Projectile.ai[0] % 5f == 0f) + shootOrb = true; + if (Projectile.ai[0] >= OrbLargeGateValue && Projectile.ai[0] < LaserGateValue && Projectile.ai[0] % 10f == 0f) + shootOrb = true; + + if (shootOrb) + { + SoundEngine.PlaySound(SoundID.Item75, Projectile.position); + + int projectileType = ProjectileID.ChargedBlasterOrb; + float projectileVelocity = 10f; + Vector2 actualVelocity = Vector2.Normalize(Projectile.velocity) * projectileVelocity; + if (float.IsNaN(actualVelocity.X) || float.IsNaN(actualVelocity.Y)) + actualVelocity = -Vector2.UnitY; + + float orbPower = 0.7f + chargeAmt * 0.3f; + int projectileDamage = (orbPower < 1f) ? currentDamage : ((int)(currentDamage * 1.5f)); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, actualVelocity, projectileType, projectileDamage, Projectile.knockBack, Projectile.owner, 0f, orbPower); + Main.projectile[proj].DamageType = DamageClass.Ranged; + Main.projectile[proj].extraUpdates += 2; + } + } + } + else + Projectile.Kill(); + } + + Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + player.ChangeDir(Projectile.direction); + player.heldProj = Projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Ranged/FreedomStarHoldout.png b/Projectiles/Ranged/FreedomStarHoldout.png new file mode 100644 index 0000000000..16f764e3bf Binary files /dev/null and b/Projectiles/Ranged/FreedomStarHoldout.png differ diff --git a/Projectiles/Ranged/HeavenlyGaleProj.cs b/Projectiles/Ranged/HeavenlyGaleProj.cs index ed63bb7c71..d4f5a32ab4 100644 --- a/Projectiles/Ranged/HeavenlyGaleProj.cs +++ b/Projectiles/Ranged/HeavenlyGaleProj.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SafeAI() { Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; + Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.45f; // Activate shot behavior if the owner stops channeling or otherwise cannot use the weapon. bool activatingShoot = ShootDelay <= 0 && Main.mouseLeft && !Main.mapFullscreen && !Main.blockMouse; @@ -72,6 +72,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.netUpdate = true; } + // Update damage based on current ranged damage stat, since this projectile exists regardless of if it's being fired. + Projectile.damage = Owner.ActiveItem() is null ? 0 : Owner.GetWeaponDamage(Owner.ActiveItem()); + UpdateProjectileHeldVariables(armPosition); ManipulatePlayerVariables(); @@ -86,15 +89,15 @@ namespace CalamityMod.Projectiles.Ranged if (ShootDelay % HeavenlyGale.ArrowShootRate == 0) { Vector2 arrowDirection = Projectile.velocity.RotatedBy(bowAngularOffset); - + // Release a streak of energy. Color energyBoltColor = CalamityUtils.MulticolorLerp(shootCompletionRatio, CalamityUtils.ExoPalette); energyBoltColor = Color.Lerp(energyBoltColor, Color.White, 0.35f); SquishyLightParticle exoEnergyBolt = new(tipPosition + arrowDirection * 16f, arrowDirection * 4.5f, 0.85f, energyBoltColor, 40, 1f, 5.4f, 4f, 0.08f); GeneralParticleHandler.SpawnParticle(exoEnergyBolt); - + // Update the tip position for one frame. - tipPosition = armPosition + arrowDirection * Projectile.width * 0.5f; + tipPosition = armPosition + arrowDirection * Projectile.width * 0.45f; if (Main.myPlayer == Projectile.owner) { @@ -110,18 +113,23 @@ namespace CalamityMod.Projectiles.Ranged ChargeTimer = 0f; } - // Create exo energy at the tip of the bow. + // Create orange exo energy at the tip of the bow. + Color energyColor = Color.Orange; + Vector2 verticalOffset = Vector2.UnitY.RotatedBy(Projectile.rotation) * 8f; + if (Math.Cos(Projectile.rotation) < 0f) + verticalOffset *= -1f; + if (Main.rand.NextBool(4)) { - Color energyColor = Color.Orange; - Vector2 verticalOffset = Vector2.UnitY.RotatedBy(Projectile.rotation) * 8f; - if (Math.Cos(Projectile.rotation) < 0f) - verticalOffset *= -1f; - SquishyLightParticle exoEnergy = new(tipPosition + verticalOffset, -Vector2.UnitY.RotatedByRandom(0.39f) * Main.rand.NextFloat(0.4f, 1.6f), 0.28f, energyColor, 25); GeneralParticleHandler.SpawnParticle(exoEnergy); } + // Create light at the tip of the bow. + DelegateMethods.v3_1 = energyColor.ToVector3(); + Utils.PlotTileLine(tipPosition - verticalOffset, tipPosition + verticalOffset, 10f, DelegateMethods.CastLightOpen); + Lighting.AddLight(tipPosition, energyColor.ToVector3()); + // Create a puff of energy in a star shape and play a sound to indicate that the bow is at max charge. if (ShootDelay <= 0) ChargeTimer++; @@ -135,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged // Parametric equations for an asteroid. float unitOffsetX = (float)Math.Pow(Math.Cos(offsetAngle), 3D); float unitOffsetY = (float)Math.Pow(Math.Sin(offsetAngle), 3D); - + Vector2 puffDustVelocity = new Vector2(unitOffsetX, unitOffsetY) * 5f; Dust magic = Dust.NewDustPerfect(tipPosition, 267, puffDustVelocity); magic.scale = 1.8f; @@ -146,7 +154,7 @@ namespace CalamityMod.Projectiles.Ranged ChargeTimer++; } } - + public void UpdateProjectileHeldVariables(Vector2 armPosition) { if (Main.myPlayer == Projectile.owner) diff --git a/Projectiles/Ranged/HydraHead.cs b/Projectiles/Ranged/HydraHead.cs new file mode 100644 index 0000000000..fbf084a037 --- /dev/null +++ b/Projectiles/Ranged/HydraHead.cs @@ -0,0 +1,250 @@ +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HydraHead : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Hydra"; + + public Vector2 CurrentPositionOffset; + public Vector2 IdealPositionOffset; + public Vector2[] OldVelocities = new Vector2[20]; + public Player Owner => Main.player[Projectile.owner]; + + public ref float Time => ref Projectile.ai[0]; + public ref float AttackType => ref Projectile.ai[1]; + + public Vector2 DrawStartPosition + { + get + { + if (Projectile.owner < 0 || Projectile.owner >= Main.player.Length) + return Vector2.Zero; + return Main.player[Projectile.owner].Top + Vector2.UnitY * 8f; + } + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydra Head"); + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 30; //66x30 sprite + Projectile.friendly = true; + Projectile.netImportant = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Ranged; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WritePackedVector2(CurrentPositionOffset); + writer.WritePackedVector2(IdealPositionOffset); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + CurrentPositionOffset = reader.ReadPackedVector2(); + IdealPositionOffset = reader.ReadPackedVector2(); + } + + public override void AI() + { + if (Owner.dead || !Owner.active || Owner.ActiveItem().type != ModContent.ItemType()) + Projectile.Kill(); + else + Projectile.timeLeft = 2; //Infinite lifespan + + Vector2 returnPosition = DrawStartPosition + CurrentPositionOffset; + + if (Projectile.localAI[0] == 0f) + { + PerformInitializationEffects(); + Projectile.localAI[0] = 1f; + } + + Vector2 aimDestination = Owner.Calamity().mouseWorld; + float idealRotation = Projectile.AngleTo(aimDestination); + if (Time < 0f) + Projectile.rotation = MathHelper.Lerp(Projectile.rotation, idealRotation, (Time + 15f) / 15f); + else + Projectile.rotation = idealRotation; + + Projectile.Center = new Vector2(Projectile.Center.X, MathHelper.Clamp(Projectile.Center.Y, 1f, returnPosition.Y - 8f)); + MoveTowardsDestination(returnPosition); + AdjustOldVelocityArray(); + + PerformAttacks(aimDestination); + } + + public void PerformInitializationEffects() + { + int totalHeads = Owner.ownedProjectileCounts[Projectile.type]; + CurrentPositionOffset = IdealPositionOffset = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); + Projectile.netUpdate = true; + } + + public void MoveTowardsDestination(Vector2 returnPosition) + { + float distanceFromTarget = Projectile.Distance(returnPosition); + if (distanceFromTarget > 7f) + { + float flySpeed = MathHelper.Lerp(2f, 17f, Utils.GetLerpValue(10f, 70f, distanceFromTarget, true)); + Projectile.velocity = (Projectile.velocity * 9f + Projectile.SafeDirectionTo(returnPosition) * flySpeed) / 10f; + } + + int totalHeads = Owner.ownedProjectileCounts[Projectile.type]; + int moveRate = 40 + totalHeads * 4; + + // Reset the ideal offset from time to time. + Time++; + if (Time % moveRate == moveRate - 1f) + IdealPositionOffset = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); + + if (Vector2.Distance(IdealPositionOffset, CurrentPositionOffset) > 0.2f) + CurrentPositionOffset = Vector2.Lerp(CurrentPositionOffset, IdealPositionOffset, 0.125f); + + // Clamp the Y position. + if (Projectile.Center.Y > Owner.Top.Y - 46f) + Projectile.Center = new Vector2(Projectile.Center.X, Owner.Top.Y - 46f); + + // Clamp the center so that it does not go too far from the return position. + if (Projectile.Distance(returnPosition) > 120f) + Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; + + // Disallow heads from getting too close to each other. + Projectile.MinionAntiClump(0.15f); + } + + public void AdjustOldVelocityArray() + { + for (int i = OldVelocities.Length - 1; i > 0; i--) + OldVelocities[i] = OldVelocities[i - 1]; + + OldVelocities[0] = Projectile.velocity; + } + + public void PerformAttacks(Vector2 aimDestination) + { + Item heldItem = Owner.ActiveItem(); + + Vector2 shootDirection = Projectile.SafeDirectionTo(aimDestination); + + //Normal shot + if (AttackType > 0f) + { + //Calculation for damage and co + Owner.PickAmmo(heldItem, out _, out float itemVelocity, out int itemDamage, out float itemKB, out _); + int type = ModContent.ProjectileType(); + for (int i = 0; i < 4; i++) + { + Vector2 spreadDirection = shootDirection.RotatedByRandom(MathHelper.ToRadians(Hydra.ShotSpread / 2f)); + float spreadVelocity = itemVelocity * Main.rand.NextFloat(1f, 1.4f); + Vector2 shootPos = Projectile.Center + shootDirection * 24f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), shootPos, spreadVelocity * spreadDirection, type, itemDamage, itemKB, Projectile.owner); + } + + //Minor recoil + Projectile.rotation -= MathHelper.ToRadians(25f) * Math.Sign(Projectile.rotation); + Time = -15f; //Reset the movement shift and let it recoil normally + Projectile.velocity += shootDirection * -10f; + + //Reset the attack + AttackType = 0f; + } + //Yeet + else if (AttackType < 0f) + { + //Calculation for damage and co + Owner.PickAmmo(heldItem, out _, out float itemVelocity, out int itemDamage, out float itemKB, out _); + int gunType = ModContent.ProjectileType(); + int gunDamage = itemDamage * 3; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, itemVelocity * shootDirection, gunType, gunDamage, itemKB, Projectile.owner); + + Projectile.Kill(); + } + } + + public override void Kill(int timeLeft) + { + if (Main.dedServ) + return; + + for (int i = 0; i < 10; i++) + Dust.NewDustPerfect(Projectile.Center, 171, Main.rand.NextVector2CircularEdge(4f, 4f)).noGravity = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D chain = ModContent.Request("CalamityMod/Projectiles/Ranged/HydraHeadChain").Value; + Vector2 end = Projectile.Center + (Projectile.spriteDirection == 1).ToInt() * 10 * Vector2.UnitX; + + List controlPoints = new List + { + DrawStartPosition + }; + for (int i = 0; i < OldVelocities.Length; i++) + { + // Incorporate the past movement into neck turns, giving it rubber band-like movment. + // Become less responsive at the neck ends. Having the ends have typical movement can look strange sometimes. + float swayResponsiveness = Utils.GetLerpValue(0f, 6f, i, true) * Utils.GetLerpValue(OldVelocities.Length, OldVelocities.Length - 6f, i, true); + Vector2 swayTotalOffset = OldVelocities[i] * swayResponsiveness; + controlPoints.Add(Vector2.Lerp(DrawStartPosition, end, i / (float)OldVelocities.Length) + swayTotalOffset); + } + controlPoints.Add(end); + + int chainPointCount = (int)(Vector2.Distance(controlPoints.First(), controlPoints.Last()) / 5f); + if (chainPointCount < 12) + chainPointCount = 12; + BezierCurve bezierCurve = new BezierCurve(controlPoints.ToArray()); + List chainPoints = bezierCurve.GetPoints(chainPointCount); + + for (int i = 0; i < chainPoints.Count; i++) + { + Vector2 positionAtPoint = chainPoints[i]; + if (Vector2.Distance(positionAtPoint, Projectile.Center) < 10f) + continue; + float angleAtPoint = i == chainPoints.Count - 1 ? (end - chainPoints[i]).ToRotation() : (chainPoints[i + 1] - chainPoints[i]).ToRotation(); + angleAtPoint += MathHelper.PiOver2; + Main.EntitySpriteDraw(chain, + positionAtPoint - Main.screenPosition, + null, + Color.Lerp(Color.White, Color.Transparent, 0.6f), + angleAtPoint, + chain.Size() / 2f, + 1f, + SpriteEffects.None, + 0); + } + + Texture2D headTexture = ModContent.Request(Texture).Value; + Main.EntitySpriteDraw(headTexture, + Projectile.Center - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY, + null, + lightColor, + Projectile.rotation, + Projectile.Size * 0.5f, + Projectile.scale, + Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + 0); + + return false; + } + + public override bool? CanDamage() => false; + } +} \ No newline at end of file diff --git a/Projectiles/Ranged/HydraHeadChain.png b/Projectiles/Ranged/HydraHeadChain.png new file mode 100644 index 0000000000..688841e42b Binary files /dev/null and b/Projectiles/Ranged/HydraHeadChain.png differ diff --git a/Projectiles/Ranged/HydraHeadLaunch.cs b/Projectiles/Ranged/HydraHeadLaunch.cs new file mode 100644 index 0000000000..f430361159 --- /dev/null +++ b/Projectiles/Ranged/HydraHeadLaunch.cs @@ -0,0 +1,71 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HydraHeadLaunch : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Hydra"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydra Head"); + } + + public override void SetDefaults() + { + Projectile.width = 66; + Projectile.height = 30; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 360; + Projectile.MaxUpdates = 3; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + //Normal hitbox size for explosion, rotated otherwise + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.ai[1] < 1f ? Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()) : null); + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(Projectile.ai[0]); + Projectile.ai[0] += 12f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 60); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 60); + + public override void Kill(int timeLeft) + { + Projectile.ai[1] = 1f; + Projectile.ExpandHitboxBy(180); + Projectile.Damage(); + + float randAngle = Main.rand.NextFloat(1f, 2f); + //8-pointed star + for (int i = 0; i < 8; i++) + { + float angle = MathHelper.Pi * randAngle - i * MathHelper.TwoPi / 8f; + float nextAngle = MathHelper.Pi * randAngle - (i + 2) * MathHelper.TwoPi / 8f; + Vector2 start = angle.ToRotationVector2(); + Vector2 end = nextAngle.ToRotationVector2(); + for (int j = 0; j < 30; j++) + { + Dust starDust = Dust.NewDustPerfect(Projectile.Center, 267); + starDust.scale = 1.5f; + starDust.velocity = Vector2.Lerp(start, end, j / 30f) * 12f; + starDust.color = Color.Orchid; + starDust.noGravity = true; + } + } + SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound, Projectile.Center); + } + } +} \ No newline at end of file diff --git a/Projectiles/Ranged/HydrasBlood.cs b/Projectiles/Ranged/HydrasBlood.cs new file mode 100644 index 0000000000..39e6f8b577 --- /dev/null +++ b/Projectiles/Ranged/HydrasBlood.cs @@ -0,0 +1,65 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HydrasBlood : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Magic/VitriolicViperSpit"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hydra's Blood"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.timeLeft = 90; + Projectile.MaxUpdates = 5; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.timeLeft < 85 && Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, 171); + dust.velocity = Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(5f)) * -0.5f; + dust.scale = Main.rand.NextFloat(0.3f, 1.6f); + dust.noGravity = true; + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 14; i++) + { + Dust dust = Dust.NewDustDirect(Projectile.position, 14, 14, 171); + dust.scale = Main.rand.NextFloat(0.3f, 1.6f); + dust.noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Venom, 300); + } + } +} diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index 1ee1b2669f..572eb892b8 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/IcyBulletProj.cs b/Projectiles/Ranged/IcyBulletProj.cs index 8c8adc811a..a0766b2f94 100644 --- a/Projectiles/Ranged/IcyBulletProj.cs +++ b/Projectiles/Ranged/IcyBulletProj.cs @@ -49,8 +49,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(BuffID.Frostburn2, 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/KarasawaShot.cs b/Projectiles/Ranged/KarasawaShot.cs index af20d2673e..1f2fda5de3 100644 --- a/Projectiles/Ranged/KarasawaShot.cs +++ b/Projectiles/Ranged/KarasawaShot.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; @@ -127,13 +127,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Confused, 300); - target.AddBuff(ModContent.BuffType(), 180); - } - public override void Kill(int timeLeft) { int height = 150; diff --git a/Projectiles/Ranged/MaelstromHoldout.cs b/Projectiles/Ranged/MaelstromHoldout.cs index 421e98cfbb..ff12683256 100644 --- a/Projectiles/Ranged/MaelstromHoldout.cs +++ b/Projectiles/Ranged/MaelstromHoldout.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Ranged Item heldItem = Owner.ActiveItem(); // Calculate damage at the instant the arrow is fired - int arrowDamage = (int)Owner.GetTotalDamage().ApplyTo(heldItem.damage); + int arrowDamage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); float shootSpeed = heldItem.shootSpeed; float knockback = heldItem.knockBack; diff --git a/Projectiles/Ranged/MagnomalyBeam.cs b/Projectiles/Ranged/MagnomalyBeam.cs index 1457c443a2..5135e375e6 100644 --- a/Projectiles/Ranged/MagnomalyBeam.cs +++ b/Projectiles/Ranged/MagnomalyBeam.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -66,8 +67,8 @@ namespace CalamityMod.Projectiles.Ranged public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 75, Projectile.alpha); - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); - public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Ranged/MagnomalyExplosion.cs b/Projectiles/Ranged/MagnomalyExplosion.cs index cd47d5fa92..a39f86aaac 100644 --- a/Projectiles/Ranged/MagnomalyExplosion.cs +++ b/Projectiles/Ranged/MagnomalyExplosion.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -28,12 +29,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index da4468841f..a2e9c2d328 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -170,13 +171,13 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { OnHitEffects(); - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { OnHitEffects(); - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } private void OnHitEffects() diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index 83d895771d..f1ba2b3f57 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -23,5 +23,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 255; Projectile.DamageType = DamageClass.Ranged; } + + // This needs to happen retroactively due to Deadshot Brooch and other potential items boosting updates + public override void AI() => Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; } } diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index fea9024ee1..6b1eaa0723 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -106,7 +106,6 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - target.AddBuff(BuffID.Frostburn, 180); } } } diff --git a/Projectiles/Ranged/MeowFire2.cs b/Projectiles/Ranged/MeowFire2.cs index d7a07aba29..0330e3ce81 100644 --- a/Projectiles/Ranged/MeowFire2.cs +++ b/Projectiles/Ranged/MeowFire2.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -106,7 +106,6 @@ namespace CalamityMod.Projectiles.Ranged num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 73, 0f, 0f, 100, default, 1f); Main.dust[num624].velocity *= 2f; } - target.AddBuff(BuffID.OnFire, 180); } } } diff --git a/Projectiles/Ranged/MidasBlast.cs b/Projectiles/Ranged/MidasBlast.cs index c4fb4b7897..079a41756f 100644 --- a/Projectiles/Ranged/MidasBlast.cs +++ b/Projectiles/Ranged/MidasBlast.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - DisplayName.SetDefault("Blast"); + DisplayName.SetDefault("Marksman Shot"); ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 4000; } diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 379f8e16dd..7f0cce84fe 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); } } diff --git a/Projectiles/Ranged/NeedlerProj.cs b/Projectiles/Ranged/NeedlerProj.cs index f74251e2e0..3b2621d61b 100644 --- a/Projectiles/Ranged/NeedlerProj.cs +++ b/Projectiles/Ranged/NeedlerProj.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; @@ -47,6 +48,10 @@ namespace CalamityMod.Projectiles.Ranged } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Venom, 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.Venom, 180); + public override void Kill(int timeLeft) { Projectile.position = Projectile.Center; diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 6a7c8c2c01..6f01235438 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -6,6 +6,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; + namespace CalamityMod.Projectiles.Ranged { public class Nuke : ModProjectile @@ -57,16 +59,16 @@ namespace CalamityMod.Projectiles.Ranged 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; - flarePowderTimer--; if (flarePowderTimer <= 0) { if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); } flarePowderTimer = 12; } + if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) { float num247 = Projectile.velocity.X * 0.5f; @@ -78,12 +80,12 @@ namespace CalamityMod.Projectiles.Ranged num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; - } // Construct a fake item to use with vanilla code for the sake of picking ammo. if (FalseLauncher is null) DefineFalseLauncher(); + Player player = Main.player[Projectile.owner]; int projID = ProjectileID.RocketI; float shootSpeed = 0f; @@ -98,6 +100,16 @@ namespace CalamityMod.Projectiles.Ranged } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + public override void Kill(int timeLeft) { Projectile.ExpandHitboxBy(192); diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs index 320386bb67..7e64ff06c5 100644 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ b/Projectiles/Ranged/OnyxSharkBomb.cs @@ -4,6 +4,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Ranged { @@ -51,6 +53,10 @@ namespace CalamityMod.Projectiles.Ranged } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Ranged/PrismExplosionLarge.cs b/Projectiles/Ranged/PrismExplosionLarge.cs index d670f44646..bc2089737f 100644 --- a/Projectiles/Ranged/PrismExplosionLarge.cs +++ b/Projectiles/Ranged/PrismExplosionLarge.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.ModLoader; @@ -56,5 +57,9 @@ namespace CalamityMod.Projectiles.Ranged Main.EntitySpriteDraw(texture, drawPosition, frame, Color.White, 0f, origin, 1.6f, SpriteEffects.None, 0); return false; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Ranged/PrismaticEnergyBlast.cs b/Projectiles/Ranged/PrismaticEnergyBlast.cs index 5b0eab2dee..bc076ce16c 100644 --- a/Projectiles/Ranged/PrismaticEnergyBlast.cs +++ b/Projectiles/Ranged/PrismaticEnergyBlast.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -80,8 +81,11 @@ namespace CalamityMod.Projectiles.Ranged { LaserLength = Projectile.Distance(target.Center); CreateExplosion(target.Center); + target.AddBuff(ModContent.BuffType(), 300); } + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + public override void Kill(int timeLeft) { Vector2 laserEnd = Projectile.Center + Projectile.velocity * LaserLength; diff --git a/Projectiles/Ranged/PumplerHoldout.cs b/Projectiles/Ranged/PumplerHoldout.cs index ef6c4eb8dd..6f4c0ceb65 100644 --- a/Projectiles/Ranged/PumplerHoldout.cs +++ b/Projectiles/Ranged/PumplerHoldout.cs @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Ranged Item heldItem = Owner.ActiveItem(); int projectileType = ModContent.ProjectileType(); - int PumpkinDamage = (int)Owner.GetTotalDamage().ApplyTo(heldItem.damage); + int PumpkinDamage = heldItem is null ? 0 : Owner.GetWeaponDamage(heldItem); float shootSpeed = heldItem.shootSpeed * 1.5f; float knockback = Owner.GetWeaponKnockback(heldItem, heldItem.knockBack); Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(projectileRotation) * shootSpeed; diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index 5591d21e1c..5f2b41ed49 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -45,13 +44,6 @@ namespace CalamityMod.Projectiles.Ranged CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override Color? GetAlpha(Color lightColor) { Color color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); diff --git a/Projectiles/Ranged/RocketFire.cs b/Projectiles/Ranged/RocketFire.cs index d332d57efd..af41597a1f 100644 --- a/Projectiles/Ranged/RocketFire.cs +++ b/Projectiles/Ranged/RocketFire.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -127,16 +127,6 @@ namespace CalamityMod.Projectiles.Ranged return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 120); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index 76832facb1..cf7fa33a31 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -49,6 +51,10 @@ namespace CalamityMod.Projectiles.Ranged CalamityUtils.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Ranged/SeasSearingSecondary.cs b/Projectiles/Ranged/SeasSearingSecondary.cs index 30d172d1d2..7becfa3fd4 100644 --- a/Projectiles/Ranged/SeasSearingSecondary.cs +++ b/Projectiles/Ranged/SeasSearingSecondary.cs @@ -23,8 +23,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/SepticSkewerBacteria.cs b/Projectiles/Ranged/SepticSkewerBacteria.cs index de0177edc7..ed0cec31f3 100644 --- a/Projectiles/Ranged/SepticSkewerBacteria.cs +++ b/Projectiles/Ranged/SepticSkewerBacteria.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -157,7 +158,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Venom, 120); + target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/Sickness.cs b/Projectiles/Ranged/Sickness.cs index 6e0bb776e9..243280b42f 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; Projectile.timeLeft = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() diff --git a/Projectiles/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index f9f7e2f759..28b55613b5 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.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; @@ -27,6 +28,8 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 2; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -54,10 +57,9 @@ namespace CalamityMod.Projectiles.Ranged return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 1; - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Venom, 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.Venom, 180); public override void Kill(int timeLeft) { diff --git a/Projectiles/Ranged/SulphuricBlast.cs b/Projectiles/Ranged/SulphuricBlast.cs index b482c124a1..f97c6cc7ed 100644 --- a/Projectiles/Ranged/SulphuricBlast.cs +++ b/Projectiles/Ranged/SulphuricBlast.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -61,6 +62,10 @@ namespace CalamityMod.Projectiles.Ranged } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { Projectile.ModifyHitNPCSticky(2, true); diff --git a/Projectiles/Ranged/TerraFireGreen2.cs b/Projectiles/Ranged/TerraFireGreen2.cs index 785b926ced..a4e52a8967 100644 --- a/Projectiles/Ranged/TerraFireGreen2.cs +++ b/Projectiles/Ranged/TerraFireGreen2.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -79,14 +79,5 @@ namespace CalamityMod.Projectiles.Ranged } Projectile.rotation += 0.3f * (float)Projectile.direction; } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.CursedInferno, 90); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Frostburn, 120); - } } } diff --git a/Projectiles/Ranged/TheMaelstromExplosion.cs b/Projectiles/Ranged/TheMaelstromExplosion.cs index dddc434bf3..3821a9d90b 100644 --- a/Projectiles/Ranged/TheMaelstromExplosion.cs +++ b/Projectiles/Ranged/TheMaelstromExplosion.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -58,6 +59,10 @@ namespace CalamityMod.Projectiles.Ranged } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; diff --git a/Projectiles/Ranged/TitaniumRailgunScope.cs b/Projectiles/Ranged/TitaniumRailgunScope.cs index 4a676f94f4..43420c0318 100644 --- a/Projectiles/Ranged/TitaniumRailgunScope.cs +++ b/Projectiles/Ranged/TitaniumRailgunScope.cs @@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles.Ranged Color sightsColor = Color.Lerp(Color.LightBlue, Color.Crimson, ChargePercent); //Setup the spread gradient effect. - Effect spreadEffect = Filters.Scene["SpreadTelegraph"].GetShader().Shader; + Effect spreadEffect = Filters.Scene["CalamityMod:SpreadTelegraph"].GetShader().Shader; spreadEffect.Parameters["centerOpacity"].SetValue(0.9f); spreadEffect.Parameters["mainOpacity"].SetValue(ChargePercent); spreadEffect.Parameters["halfSpreadAngle"].SetValue(halfAngle); @@ -193,7 +193,7 @@ namespace CalamityMod.Projectiles.Ranged Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), sightsSize, 0, 0); //Setup the laser sights effect. - Effect laserScopeEffect = Filters.Scene["PixelatedSightLine"].GetShader().Shader; + Effect laserScopeEffect = Filters.Scene["CalamityMod:PixelatedSightLine"].GetShader().Shader; laserScopeEffect.Parameters["sampleTexture2"].SetValue(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/CertifiedCrustyNoise").Value); laserScopeEffect.Parameters["noiseOffset"].SetValue(Main.GameUpdateCount * -0.003f); diff --git a/Projectiles/Ranged/ToxicArrow.cs b/Projectiles/Ranged/ToxicArrow.cs index 7cc4901f04..5db14e974c 100644 --- a/Projectiles/Ranged/ToxicArrow.cs +++ b/Projectiles/Ranged/ToxicArrow.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 480); } } } diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs index 4b36ad7a24..c9ffe4df66 100644 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ b/Projectiles/Ranged/ToxicannonDrop.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 17; } + public override void AI() { NPC potentialTarget = Projectile.Center.ClosestNPCAt(600f, !Projectile.tileCollide); @@ -44,6 +45,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; Projectile.tileCollide = Projectile.timeLeft <= 300; } + public override bool OnTileCollide(Vector2 oldVelocity) { // Water drip diff --git a/Projectiles/Ranged/ToxicannonShot.cs b/Projectiles/Ranged/ToxicannonShot.cs index f63bbf2191..ccf7a3d46c 100644 --- a/Projectiles/Ranged/ToxicannonShot.cs +++ b/Projectiles/Ranged/ToxicannonShot.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = true; Projectile.ignoreWater = false; } + public override void AI() { if (Projectile.ai[0]++ <= 30f) @@ -48,6 +49,7 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 240); } + public override void Kill(int timeLeft) { Projectile.ExpandHitboxBy(180); diff --git a/Projectiles/Ranged/UniversalGenesisStar.cs b/Projectiles/Ranged/UniversalGenesisStar.cs index 7ceed02bec..b37477df6b 100644 --- a/Projectiles/Ranged/UniversalGenesisStar.cs +++ b/Projectiles/Ranged/UniversalGenesisStar.cs @@ -59,16 +59,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - public override Color? GetAlpha(Color lightColor) { return new Color(200, 200, 200, Projectile.alpha); @@ -85,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 spriteOrigin = spriteRec.Size() / 2f; SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D aura = ModContent.Request("CalamityMod/Projectiles/Ranged/FallenStarAura").Value; + Texture2D aura = ModContent.Request("CalamityMod/Projectiles/StarTrail").Value; Vector2 drawStart = Projectile.Center + Projectile.velocity; Vector2 drawStart2 = Projectile.Center - Projectile.velocity * 0.5f; Vector2 spinPoint = new Vector2(0f, -10f); diff --git a/Projectiles/Ranged/UniversalGenesisStarcaller.cs b/Projectiles/Ranged/UniversalGenesisStarcaller.cs index 7dad4c676f..7378a07b54 100644 --- a/Projectiles/Ranged/UniversalGenesisStarcaller.cs +++ b/Projectiles/Ranged/UniversalGenesisStarcaller.cs @@ -77,15 +77,9 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); SpawnStars(); } - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - } - private void SpawnStars() { // The patron said 10 blocks, but 10 blocks is like nothing... I'm sure they won't mind. diff --git a/Projectiles/Ranged/VoidragonTentacle.cs b/Projectiles/Ranged/VoidragonTentacle.cs index 0dce204163..5eb6a1ba85 100644 --- a/Projectiles/Ranged/VoidragonTentacle.cs +++ b/Projectiles/Ranged/VoidragonTentacle.cs @@ -98,10 +98,5 @@ namespace CalamityMod.Projectiles.Ranged } } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); //Apotheosis also inflicts this, so this weapon might as well - } } } diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile.cs b/Projectiles/Rogue/AbyssalMirrorProjectile.cs index 5d69f6a6d5..dec86e3775 100644 --- a/Projectiles/Rogue/AbyssalMirrorProjectile.cs +++ b/Projectiles/Rogue/AbyssalMirrorProjectile.cs @@ -1,6 +1,8 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { public class AbyssalMirrorProjectile : ModProjectile @@ -29,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { if (Projectile.timeLeft < 25) - { Projectile.alpha += 10; } + Projectile.alpha += 10; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -37,6 +39,7 @@ namespace CalamityMod.Projectiles.Rogue if (!target.friendly) { target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index 8efee71afc..8782c1f06f 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -17,14 +17,15 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 30; + Projectile.height = 30; Projectile.friendly = true; - Projectile.penetrate = 6; + Projectile.penetrate = 4; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.Shuriken; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } @@ -35,14 +36,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.Center.X, (int)Projectile.Center.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { OnHitEffects(); diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index 32f60474f9..616d61b35e 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -24,11 +24,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 1; + Projectile.MaxUpdates = 2; Projectile.aiStyle = ProjAIStyleID.StickProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 20 total } public override void AI() @@ -61,14 +63,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Projectile.damage /= 2; @@ -76,7 +70,6 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.damage = 1; } - target.immune[Projectile.owner] = 2; } public override void OnHitPvp(Player target, int damage, bool crit) diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index 226c2cf4ef..d36d039bbd 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Rogue for (float i = 0; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i; - int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.87), Projectile.knockBack, Projectile.owner, 0f, 0f); + int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); Main.projectile[star].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } Projectile.position = Projectile.Center; diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index 0c8f4a6a5a..0a363e49a5 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.alpha = 100; Projectile.penetrate = 1; - Projectile.timeLeft = 485; + Projectile.timeLeft = 360; Projectile.DamageType = RogueDamageClass.Instance; } @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue } //Home in - float maxDistance = 500f; + float maxDistance = 800f; int targetIndex = -1; int i; for (i = 0; i < Main.maxNPCs; i++) @@ -88,29 +88,21 @@ namespace CalamityMod.Projectiles.Rogue } if (targetIndex != -1) { - Vector2 targetVec = Main.npc[i].Center - Projectile.Center; - if (targetVec.Length() < 60f) - { - Projectile.Kill(); - return; - } - if (Projectile.ai[0] >= 120f) + Vector2 targetVec = Main.npc[targetIndex].Center - Projectile.Center; + if (Projectile.ai[0] >= 30f) { Projectile.ai[1] += 1f; - if (Projectile.ai[1] < 120f) + if (Projectile.ai[1] < 90f) { - float speedMult = 25f; + float speedMult = 16f; targetVec.Normalize(); targetVec *= speedMult; Projectile.velocity = (Projectile.velocity * 15f + targetVec) / 16f; Projectile.velocity.Normalize(); Projectile.velocity *= speedMult; } - else if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 18f) - { - Projectile.velocity.X *= 1.01f; - Projectile.velocity.Y *= 1.01f; - } + else // Chase after the target more straightforwardly + Projectile.velocity = (Main.npc[targetIndex].Center - Projectile.Center) / 12f; } } } @@ -135,8 +127,7 @@ namespace CalamityMod.Projectiles.Rogue { Vector2 pos = new Vector2(targetPos.X + width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (targetPos - pos) / 40f; - int dmg = Projectile.damage / 2; - int comet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, velocity, ModContent.ProjectileType(), dmg, Projectile.knockBack, Projectile.owner); + int comet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25), Projectile.knockBack, Projectile.owner); if (comet.WithinBounds(Main.maxProjectiles)) { Main.projectile[comet].DamageType = RogueDamageClass.Instance; @@ -154,10 +145,6 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - Projectile.ExpandHitboxBy(96); - Projectile.localNPCHitCooldown = 10; - Projectile.usesLocalNPCImmunity = true; - Projectile.Damage(); for (int d = 0; d < 2; d++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.Next(dustTypes), 0f, 0f, 50, default, 1f); diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index c3fe454283..b64f185018 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using System; using Terraria; @@ -69,13 +69,13 @@ namespace CalamityMod.Projectiles.Rogue for (int s = 0; s < projAmt; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); } int cloudAmt = Main.rand.Next(8, 13); for (int c = 0; c < cloudAmt; c++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 1f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner); } } for (int d = 0; d < 5; d++) diff --git a/Projectiles/Rogue/BallisticPoisonBombSpike.cs b/Projectiles/Rogue/BallisticPoisonBombSpike.cs index 43b0ee640d..da5bc888e3 100644 --- a/Projectiles/Rogue/BallisticPoisonBombSpike.cs +++ b/Projectiles/Rogue/BallisticPoisonBombSpike.cs @@ -20,11 +20,12 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 3; - Projectile.alpha = 255; - Projectile.extraUpdates = 2; + Projectile.MaxUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Nail; AIType = ProjectileID.NailFriendly; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 30 total } public override void AI() @@ -46,7 +47,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 120); - target.immune[Projectile.owner] = 1; } public override void OnHitPvp(Player target, int damage, bool crit) diff --git a/Projectiles/Rogue/BarrelShrapnel.cs b/Projectiles/Rogue/BarrelShrapnel.cs index e947e5ade0..26e97482d1 100644 --- a/Projectiles/Rogue/BarrelShrapnel.cs +++ b/Projectiles/Rogue/BarrelShrapnel.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -46,12 +46,12 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 60 * 4); + target.AddBuff(BuffID.OnFire3, 60 * 4); Projectile.Kill(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 60 * 4); + target.AddBuff(BuffID.OnFire3, 60 * 4); Projectile.Kill(); } } diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index d20ded0c3e..a2d038739e 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; @@ -27,13 +27,16 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - //projectile.ai[0] == 1f means spawned by Skyfin Bombers SS + // projectile.ai[0] == 1f means spawned by Skyfin Bombers SS Projectile.position = Projectile.Center; + if (Projectile.Calamity().stealthStrike || Projectile.ai[0] == 1f) Projectile.width = Projectile.height = 120; else Projectile.width = Projectile.height = 70; + Projectile.position -= Projectile.Size / 2f; + for (int i = 0; i < 15; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); @@ -46,15 +49,14 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (Projectile.ai[0] != 1f) - { target.immune[Projectile.owner] = 9; - } - target.AddBuff(ModContent.BuffType(), 180); + + target.AddBuff(ModContent.BuffType(), 480); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 480); } } } diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index 99fe2c127b..43e979420d 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -1,9 +1,10 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -106,11 +107,23 @@ namespace CalamityMod.Projectiles.Rogue } } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire3, 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire3, 180); + } + public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } + // Make the star bounce on tiles. public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 7f35f23e13..4e7d8b9859 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -85,13 +85,11 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(!target.canGhostHeal || Main.player[Projectile.owner].moonLeech); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(Main.player[Projectile.owner].moonLeech); } diff --git a/Projectiles/Rogue/BlueFlamePillar.cs b/Projectiles/Rogue/BlueFlamePillar.cs index e78f8d08ce..294e622cd3 100644 --- a/Projectiles/Rogue/BlueFlamePillar.cs +++ b/Projectiles/Rogue/BlueFlamePillar.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.alpha = 255; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() { diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index d91abe94fd..2371f48eb8 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -66,13 +66,11 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } } } diff --git a/Projectiles/Rogue/BrackishSpear.cs b/Projectiles/Rogue/BrackishSpear.cs index 73fda5133f..5421f04c96 100644 --- a/Projectiles/Rogue/BrackishSpear.cs +++ b/Projectiles/Rogue/BrackishSpear.cs @@ -87,13 +87,11 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/BrackishSpear2.cs b/Projectiles/Rogue/BrackishSpear2.cs index 0a92f63488..b18e089430 100644 --- a/Projectiles/Rogue/BrackishSpear2.cs +++ b/Projectiles/Rogue/BrackishSpear2.cs @@ -74,13 +74,11 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index c670968b65..a9e459bb7a 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -57,13 +57,11 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } } } diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index b53891e968..90436b2d94 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -102,13 +102,11 @@ namespace CalamityMod.Projectiles.Rogue { target.immune[Projectile.owner] = 6; target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 90); - target.AddBuff(BuffID.Poisoned, 180); } } } diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index f9c684e74f..60591eaafb 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -41,11 +41,6 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - SoundEngine.PlaySound(SoundID.Item50, Projectile.position); //Dust on impact int dust_splash = 0; @@ -58,23 +53,23 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[0] == 1) { int split = 0; - while (split < 3) + while (split < 5) { //Calculate the velocity of the projectile - float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; + float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.1f, .15f) + Main.rand.NextFloat(-3f, 3f); + float shardspeedY = -Projectile.velocity.Y * Main.rand.NextFloat(.5f, .9f) + Main.rand.NextFloat(-6f, -3f); //Prevents the projectile speed from being too low - if (shardspeedX < 2f && shardspeedX > -2f) + if (shardspeedX < 1f && shardspeedX > -1f) { shardspeedX += -Projectile.velocity.X; } - if (shardspeedY > 2f && shardspeedY < 2f) + if (shardspeedY > -3f) { shardspeedY += -Projectile.velocity.Y; } //Spawn the projectile - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), Projectile.knockBack / 2f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner); split += 1; } } diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index b5a0278fc2..38db38046d 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -124,20 +124,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[Projectile.owner]; - if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) - player.AddBuff(BuffID.WellFed, 180); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - Player player = Main.player[Projectile.owner]; - if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) - player.AddBuff(BuffID.WellFed, 180); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index cf7e3d9b30..74fe6d7a54 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -40,20 +40,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[Projectile.owner]; - if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) - player.AddBuff(BuffID.WellFed, 180); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - Player player = Main.player[Projectile.owner]; - if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) - player.AddBuff(BuffID.WellFed, 180); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Rogue/Celestus2.cs b/Projectiles/Rogue/Celestus2.cs index 144d8c9034..43f3ede91d 100644 --- a/Projectiles/Rogue/Celestus2.cs +++ b/Projectiles/Rogue/Celestus2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -50,12 +51,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/CelestusBoomerang.cs b/Projectiles/Rogue/CelestusBoomerang.cs index 524ba6dba5..2587ba0ba1 100644 --- a/Projectiles/Rogue/CelestusBoomerang.cs +++ b/Projectiles/Rogue/CelestusBoomerang.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -137,13 +138,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); OnHitEffects(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); OnHitEffects(); } diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index 8e2d67a861..347403306b 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -17,14 +17,16 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 14; + Projectile.height = 14; Projectile.friendly = true; Projectile.penetrate = 3; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -54,13 +56,5 @@ namespace CalamityMod.Projectiles.Rogue Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } - - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } } } diff --git a/Projectiles/Rogue/ContaminatedBileFlask.cs b/Projectiles/Rogue/ContaminatedBileFlask.cs index f0642917e4..8f3160984c 100644 --- a/Projectiles/Rogue/ContaminatedBileFlask.cs +++ b/Projectiles/Rogue/ContaminatedBileFlask.cs @@ -25,20 +25,22 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 0; Projectile.DamageType = RogueDamageClass.Instance; } + public override void AI() { if (Projectile.ai[0]++ > 45f) { if (Projectile.velocity.Y < 10f) - { Projectile.velocity.Y += 0.15f; - } } + Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.Length()); } + public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item107, Projectile.Bottom); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) { diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 934ad71a81..a775694388 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -57,8 +57,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int buffType = Projectile.ai[0] == 1f ? BuffID.ShadowFlame : ModContent.BuffType(); - target.AddBuff(buffType, 60, false); Projectile.Kill(); } diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index 7110859c8c..c20ae4ee78 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Main.rand.NextFloat(-15f, 15f), Projectile.Center.Y + Main.rand.NextFloat(-15f, 15f), Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Main.rand.NextFloat(-15f, 15f), Projectile.Center.Y + Main.rand.NextFloat(-15f, 15f), Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack * 0.7f, Projectile.owner, 0f, 0f); } } } @@ -72,20 +72,16 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.Frostburn2, 120); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.Frostburn2, 120); } } } diff --git a/Projectiles/Rogue/CursedDaggerProj.cs b/Projectiles/Rogue/CursedDaggerProj.cs index 47ab20ce20..70fed5d718 100644 --- a/Projectiles/Rogue/CursedDaggerProj.cs +++ b/Projectiles/Rogue/CursedDaggerProj.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } @@ -38,12 +39,12 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Calamity().stealthStrike) { - if (Projectile.timeLeft % 8 == 0) + if (Projectile.timeLeft % 6 == 0) { if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-14f, 14f), Main.rand.NextFloat(-14f, 14f)); - int flame = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, Main.rand.NextBool(2) ? ProjectileID.CursedFlameFriendly : ProjectileID.CursedDartFlame, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); + int flame = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, Main.rand.NextBool(2) ? ProjectileID.CursedFlameFriendly : ProjectileID.CursedDartFlame, Projectile.damage, Projectile.knockBack, Projectile.owner); if (flame.WithinBounds(Main.maxProjectiles)) { Main.projectile[flame].DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/DeepWounderProjectile.cs b/Projectiles/Rogue/DeepWounderProjectile.cs index 7f906758dc..59652f4191 100644 --- a/Projectiles/Rogue/DeepWounderProjectile.cs +++ b/Projectiles/Rogue/DeepWounderProjectile.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() @@ -50,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 waterVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); waterVelocity.Normalize(); waterVelocity *= 3; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spriteCenter, waterVelocity, ModContent.ProjectileType(), 20, 1, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spriteCenter, waterVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 1, Projectile.owner, 0, 0); } } } @@ -58,20 +60,20 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 150); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 150); } } diff --git a/Projectiles/Rogue/DeepWounderWater.cs b/Projectiles/Rogue/DeepWounderWater.cs index 9ffe1895fc..6f46881553 100644 --- a/Projectiles/Rogue/DeepWounderWater.cs +++ b/Projectiles/Rogue/DeepWounderWater.cs @@ -1,4 +1,4 @@ - + using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 1; Projectile.timeLeft = 50; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Rogue/DesecratedWaterProj.cs b/Projectiles/Rogue/DesecratedWaterProj.cs index d4cd154fab..21a532dd5d 100644 --- a/Projectiles/Rogue/DesecratedWaterProj.cs +++ b/Projectiles/Rogue/DesecratedWaterProj.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue Dust dust2 = Main.dust[index3]; dust2.velocity = dust2.velocity * 3f; } - int num220 = (Projectile.Calamity().stealthStrike ? Main.rand.Next(10, 16) : Main.rand.Next(5, 11)); + int num220 = (Projectile.Calamity().stealthStrike ? 12 : 5); if (Projectile.owner == Main.myPlayer) { for (int num221 = 0; num221 < num220; num221++) @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); value17.Normalize(); value17 *= (float)Main.rand.Next(10, 201) * 0.01f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 1f, Projectile.owner, (Projectile.Calamity().stealthStrike ? 1f : 0f), 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.6f, Projectile.owner, (Projectile.Calamity().stealthStrike ? 1f : 0f), 1f); } } } diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 4877ef45f1..de3d439ed2 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 420; + Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; } @@ -93,6 +94,11 @@ namespace CalamityMod.Projectiles.Rogue return false; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); diff --git a/Projectiles/Rogue/DuneHopperProjectile.cs b/Projectiles/Rogue/DuneHopperProjectile.cs index fdba0d84ba..56c7f3e776 100644 --- a/Projectiles/Rogue/DuneHopperProjectile.cs +++ b/Projectiles/Rogue/DuneHopperProjectile.cs @@ -22,6 +22,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.penetrate = 6; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 40a09015b3..c94b03f9ba 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -6,7 +6,7 @@ namespace CalamityMod.Projectiles.Rogue { public override void SetStaticDefaults() { - DisplayName.SetDefault("Cloud"); + DisplayName.SetDefault("Dust Cloud"); Main.projFrames[Projectile.type] = 4; } @@ -19,10 +19,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 3600; + Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; + Projectile.idStaticNPCHitCooldown = 6; } public override void AI() diff --git a/Projectiles/Rogue/DuststormCloudStealth.cs b/Projectiles/Rogue/DuststormCloudStealth.cs index 4d183af08d..94ab1f8d5b 100644 --- a/Projectiles/Rogue/DuststormCloudStealth.cs +++ b/Projectiles/Rogue/DuststormCloudStealth.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - DisplayName.SetDefault("Cloud"); + DisplayName.SetDefault("Dust Cloud"); Main.projFrames[Projectile.type] = 4; } @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 3600; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 4; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() diff --git a/Projectiles/Rogue/DynamicPursuerElectricity.cs b/Projectiles/Rogue/DynamicPursuerElectricity.cs index f77dd98bbb..16e008b676 100644 --- a/Projectiles/Rogue/DynamicPursuerElectricity.cs +++ b/Projectiles/Rogue/DynamicPursuerElectricity.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue public const int MaximumBranchingIterations = 3; public const float LightningTurnRandomnessFactor = 1.7f; public ref float InitialVelocityAngle => ref Projectile.ai[0]; - // Technically not a ratio, and more of a seed, but it is used in a 0-2pi squash + // Technically not a ratio, and more of a seed, but its used in a 0-2pi squash // later in the code to get an arbitrary unit vector (which is then checked). public ref float BaseTurnAngleRatio => ref Projectile.ai[1]; public ref float AccumulatedXMovementSpeeds => ref Projectile.localAI[0]; @@ -29,21 +29,24 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Electricity"); - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 50; + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - Projectile.width = 14; - Projectile.height = 14; + Projectile.width = 30; + Projectile.height = 30; Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = 2; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 20; - Projectile.timeLeft = 45 * Projectile.extraUpdates; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 60 * Projectile.extraUpdates; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 3600; //Adjusted to take note of the extra updates // Readjust the velocity magnitude the moment this projectile is created // to make velocity setting outside the scope of this projectile less irritating @@ -57,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.frameCounter++; - + float adjustedTimeLife = Projectile.timeLeft / Projectile.MaxUpdates; Projectile.scale = (float)Math.Sin(MathHelper.Pi * Projectile.timeLeft / (45f * (Projectile.MaxUpdates - 1))) * 4f; if (Projectile.scale > 1f) Projectile.scale = 1f; @@ -102,7 +105,7 @@ namespace CalamityMod.Projectiles.Rogue turnTries++; } - while (turnTries < 100); + while (turnTries < 20); if (Projectile.velocity != Vector2.Zero) { @@ -113,16 +116,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void Kill(int timeLeft) - { - Projectile.ExpandHitboxBy(60); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - } - internal float WidthFunction(float completionRatio) { float baseWidth = MathHelper.Lerp(2f, 6f, (float)Math.Sin(MathHelper.Pi * 4f * completionRatio) * 0.5f + 0.5f) * Projectile.scale; diff --git a/Projectiles/Rogue/DynamicPursuerLaser.cs b/Projectiles/Rogue/DynamicPursuerLaser.cs index 7121dab38d..f43008a835 100644 --- a/Projectiles/Rogue/DynamicPursuerLaser.cs +++ b/Projectiles/Rogue/DynamicPursuerLaser.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 20; Projectile.Damage(); } } diff --git a/Projectiles/Rogue/DynamicPursuerProjectile.cs b/Projectiles/Rogue/DynamicPursuerProjectile.cs index 76f634a3ca..0c799a7eee 100644 --- a/Projectiles/Rogue/DynamicPursuerProjectile.cs +++ b/Projectiles/Rogue/DynamicPursuerProjectile.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Rogue set => Projectile.ai[1] = value; } public const float MaxTargetSearchDistance = 480f; - public float ReturnAcceleration = 0.15f; - public float ReturnMaxSpeed = 12f; + public float ReturnAcceleration = 0.5f; + public float ReturnMaxSpeed = 24f; public float ElectricVelocityCharge = 0f; public float LaserVelocityCharge = 0f; public bool Ricochet = false; @@ -42,12 +42,14 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = 42; + Projectile.height = 42; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 360; } public override void AI() @@ -68,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue Time++; if (!ReturningToPlayer) { - if (Time >= 45f && !Ricochet) + if (Time >= 40f && !Ricochet) { ReturningToPlayer = true; Projectile.tileCollide = false; @@ -77,13 +79,13 @@ namespace CalamityMod.Projectiles.Rogue else if (Ricochet) { if (nextTarget != null) - Projectile.velocity = (float)Math.Pow(Math.E, Time / 100)*(nextTarget.Center - Projectile.Center).SafeNormalize(Vector2.One); + Projectile.velocity = (float)Math.Pow(Math.E, Time / 250)*(nextTarget.Center - Projectile.Center).SafeNormalize(Vector2.One); ElectricVelocityCharge += Projectile.velocity.Length(); if (ElectricVelocityCharge >= 300f) { - ElectricVelocityCharge -= 300f; + ElectricVelocityCharge = 0f; AttemptToFireElectricity((int)(Projectile.damage * 0.25)); } } @@ -95,7 +97,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Kill(); // This is done instead of a Normalize or DirectionTo call because the variables needed are already present and calculating the square root again would be unnecessary. - ReturnMaxSpeed = (float)Math.Pow(Math.E, Time / 175); + ReturnMaxSpeed = (float)Math.Pow(Math.E, Time / 150); if (Projectile.Calamity().stealthStrike) { @@ -167,7 +169,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.myPlayer == Projectile.owner) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2f, Projectile.owner); - if (!Main.dedServ) + { for (int i = 0; i < 220; i++) { @@ -192,7 +194,7 @@ namespace CalamityMod.Projectiles.Rogue //Retarget Ricochet = true; NPC newTarget = null; - float closestNPCDistance = 10000f; + float closestNPCDistance = 3000f; float targettingDistance = 1000f; diff --git a/Projectiles/Typeless/HolyEruption.cs b/Projectiles/Rogue/EGloveSpark.cs similarity index 59% rename from Projectiles/Typeless/HolyEruption.cs rename to Projectiles/Rogue/EGloveSpark.cs index b2447b1e65..60f8089858 100644 --- a/Projectiles/Typeless/HolyEruption.cs +++ b/Projectiles/Rogue/EGloveSpark.cs @@ -1,42 +1,42 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless +namespace CalamityMod.Projectiles.Rogue { - public class HolyEruption : ModProjectile + public class EGloveSpark : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Eruption"); + DisplayName.SetDefault("Spark"); } public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 96; + Projectile.width = 6; + Projectile.height = 12; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.timeLeft = 360; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = 60; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 20; + Projectile.DamageType = DamageClass.Generic; //No triggering nanoblades } public override void AI() { if (Projectile.velocity.X != Projectile.velocity.X) { - Projectile.velocity.X = Projectile.velocity.X * -0.1f; + Projectile.velocity.X = Projectile.velocity.X * -0.05f; } if (Projectile.velocity.X != Projectile.velocity.X) { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; + Projectile.velocity.X = Projectile.velocity.X * -0.3f; } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 0.5f) { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; + Projectile.velocity.Y = Projectile.velocity.Y * -0.3f; } Projectile.ai[0] += 1f; if (Projectile.ai[0] > 5f) @@ -54,22 +54,25 @@ namespace CalamityMod.Projectiles.Typeless Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; } Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[num199]; - dust.position.X -= 2f; - dust.position.Y += 2f; - dust.scale += (float)Main.rand.Next(50) * 0.01f; - dust.noGravity = true; - dust.velocity.Y -= 16f; + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X -= 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y += 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y -= 2f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 1f); - Dust dust2 = Main.dust[num200]; - dust2.position.X -= 2f; - dust2.position.Y += 2f; - dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - dust2.noGravity = true; - dust2.velocity *= 0.8f; + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X -= 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y += 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; } if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) { @@ -83,15 +86,5 @@ namespace CalamityMod.Projectiles.Typeless } public override bool OnTileCollide(Vector2 oldVelocity) => false; - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } } } diff --git a/Projectiles/Rogue/ElementalDiskProj.cs b/Projectiles/Rogue/ElementalDiskProj.cs index 9c802e4b5b..450a5e03c0 100644 --- a/Projectiles/Rogue/ElementalDiskProj.cs +++ b/Projectiles/Rogue/ElementalDiskProj.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -177,18 +176,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); if (!Projectile.Calamity().stealthStrike) Projectile.ai[0] = 1f; } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); if (!Projectile.Calamity().stealthStrike) Projectile.ai[0] = 1f; } diff --git a/Projectiles/Rogue/ElementalDiskSplit.cs b/Projectiles/Rogue/ElementalDiskSplit.cs index 6090bd949f..bfb537608b 100644 --- a/Projectiles/Rogue/ElementalDiskSplit.cs +++ b/Projectiles/Rogue/ElementalDiskSplit.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,20 +41,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); diff --git a/Projectiles/Rogue/EpidemicShredderProjectile.cs b/Projectiles/Rogue/EpidemicShredderProjectile.cs index d5b11a4893..481676e039 100644 --- a/Projectiles/Rogue/EpidemicShredderProjectile.cs +++ b/Projectiles/Rogue/EpidemicShredderProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 34; Projectile.friendly = true; Projectile.penetrate = 6; - Projectile.timeLeft = 600; + Projectile.timeLeft = 180; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 40; Projectile.DamageType = RogueDamageClass.Instance; @@ -36,15 +36,15 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ai[0] -= 1f; } - if (Projectile.timeLeft < 580f) + if (Projectile.timeLeft < 160f) { Projectile.velocity = (Projectile.velocity * 18f + Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center) * 18f) / 19f; if (Main.player[Projectile.owner].Hitbox.Intersects(Projectile.Hitbox)) Projectile.Kill(); } - if (Projectile.timeLeft % 5 == 0 && Projectile.Calamity().stealthStrike) + if (Projectile.timeLeft % 4 == 0 && Projectile.Calamity().stealthStrike) { - int projIndex2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity * -1f).RotatedByRandom(MathHelper.ToRadians(15f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 2f, Projectile.owner); + int projIndex2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity * -1f).RotatedByRandom(MathHelper.ToRadians(15f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.6f, Projectile.owner); if (projIndex2.WithinBounds(Main.maxProjectiles)) Main.projectile[projIndex2].DamageType = RogueDamageClass.Instance; } @@ -62,13 +62,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity.Y = -oldVelocity.Y; } - if (Projectile.ai[0] == 0f) - { - int projIndex1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 2f, Projectile.owner); - if (projIndex1.WithinBounds(Main.maxProjectiles)) - Main.projectile[projIndex1].DamageType = RogueDamageClass.Instance; - Projectile.ai[0] = 12f; //0.2th of a second cooldown - } + SpawnSeeker(); Projectile.penetrate--; } else @@ -79,26 +73,25 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Projectile.ai[0] == 0f) - { - int projectileIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 2f, Projectile.owner); - if (projectileIndex.WithinBounds(Main.maxProjectiles)) - Main.projectile[projectileIndex].DamageType = RogueDamageClass.Instance; - Projectile.ai[0] = 12f; //0.2th of a second cooldown - } + SpawnSeeker(); target.AddBuff(ModContent.BuffType(), 240); } public override void OnHitPvp(Player target, int damage, bool crit) + { + SpawnSeeker(); + target.AddBuff(ModContent.BuffType(), 240); + } + + public void SpawnSeeker() { if (Projectile.ai[0] == 0f) { - int projectileIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 2f, Projectile.owner); + int projectileIndex = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.6f, Projectile.owner); if (projectileIndex.WithinBounds(Main.maxProjectiles)) Main.projectile[projectileIndex].DamageType = RogueDamageClass.Instance; Projectile.ai[0] = 12f; //0.2th of a second cooldown } - target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/Projectiles/Rogue/EquanimityProj.cs b/Projectiles/Rogue/EquanimityProj.cs index 8d972f34bb..1a32e1a104 100644 --- a/Projectiles/Rogue/EquanimityProj.cs +++ b/Projectiles/Rogue/EquanimityProj.cs @@ -49,10 +49,10 @@ namespace CalamityMod.Projectiles.Rogue Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); shardVelocity.Normalize(); shardVelocity *= 5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); } } @@ -83,10 +83,10 @@ namespace CalamityMod.Projectiles.Rogue Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); shardVelocity.Normalize(); shardVelocity *= 5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); } } } @@ -104,10 +104,10 @@ namespace CalamityMod.Projectiles.Rogue Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); shardVelocity.Normalize(); shardVelocity *= 5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shardVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner); } } } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 3465b31cb8..9e52a6f4dc 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -168,14 +169,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 90); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 180); - target.AddBuff(BuffID.Frostburn, 90); + target.AddBuff(ModContent.BuffType(), 180); } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) => OnHit(); diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index 58e1de0a12..6b99beab65 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); for (int i = 0; i < 20; i++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(position.X + (-600 + i * 60), position.Y - 800), new Vector2(0f, 2.5f), ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(position.X + (-600 + i * 60), position.Y - 800), new Vector2(0f, 2.5f), ModContent.ProjectileType(), Projectile.damage * 4, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index a6ac8a8a9c..94be2b397c 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -109,18 +109,17 @@ namespace CalamityMod.Projectiles.Rogue //Crystal smash sound SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); // Light burst - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0, Projectile.owner, Projectile.ai[0] - 1f, 0); + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, Projectile.ai[0] - 1f, 0); Main.projectile[p].rotation = Projectile.rotation; // Stars if (Projectile.Calamity().stealthStrike) { - int numStars = Main.rand.Next(4, 7); - for (int i = 0; i < numStars; i++) + for (int i = 0; i < 9; i++) { Vector2 pos = new Vector2(Projectile.Center.X + (float)Projectile.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); float speedX = (Projectile.Center.X - pos.X) / 20f; float speedY = (Projectile.Center.Y - pos.Y) / 20f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), Projectile.damage / 2, 3, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); } } } diff --git a/Projectiles/Rogue/ExorcismStar.cs b/Projectiles/Rogue/ExorcismStar.cs index 72b67667b7..b66d6f5df8 100644 --- a/Projectiles/Rogue/ExorcismStar.cs +++ b/Projectiles/Rogue/ExorcismStar.cs @@ -1,10 +1,11 @@ - + using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -42,6 +43,16 @@ namespace CalamityMod.Projectiles.Rogue } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 9473f1e1bf..cb9bbb5db9 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -53,11 +53,5 @@ namespace CalamityMod.Projectiles.Rogue if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].DamageType = RogueDamageClass.Instance; } - - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2) && !Projectile.noDropItem) - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } } } diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index a1fad0626e..4aa74811a9 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -38,23 +38,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[Projectile.owner]; - target.AddBuff(ModContent.BuffType(), 180); - if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) - player.AddBuff(BuffID.WellFed, 180); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - Player player = Main.player[Projectile.owner]; - target.AddBuff(BuffID.Bleeding, 300); - target.AddBuff(ModContent.BuffType(), 180); - if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) - player.AddBuff(BuffID.WellFed, 180); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index 0f45646fac..ba8597c529 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); target.immune[Projectile.owner] = 0; Projectile.ai[0] = 1f; @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); } diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index b56cb4e965..cd59e1ec22 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); target.immune[Projectile.owner] = 0; Projectile.ai[0] = 1f; @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); } diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index 80a5f14bbf..da36d632da 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -46,6 +46,16 @@ namespace CalamityMod.Projectiles.Rogue CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 250f, 12f, 20f); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Electrified, 120); + } + public override void Kill(int timeLeft) { for (int i = 0; i <= 10; i++) diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index b2950f9eb7..ef1fe96d81 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -27,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -37,13 +40,9 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft % 8 == 0) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int slime = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ProjectileID.SlimeGun, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); + int slime = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(2), 1f); if (slime.WithinBounds(Main.maxProjectiles)) - { Main.projectile[slime].DamageType = RogueDamageClass.Instance; - Main.projectile[slime].usesLocalNPCImmunity = true; - Main.projectile[slime].localNPCHitCooldown = 10; - } } } } @@ -87,26 +86,14 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Slimed, 120); - if (Projectile.Calamity().stealthStrike) - target.AddBuff(BuffID.Slow, 120); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Slimed, 120); - if (Projectile.Calamity().stealthStrike) - target.AddBuff(BuffID.Slow, 120); } } } diff --git a/Projectiles/Rogue/GraveGrimreaverProjectile.cs b/Projectiles/Rogue/GraveGrimreaverProjectile.cs index c2cbb911e6..183874ef9e 100644 --- a/Projectiles/Rogue/GraveGrimreaverProjectile.cs +++ b/Projectiles/Rogue/GraveGrimreaverProjectile.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.penetrate = 1; - Projectile.timeLeft = 310; + Projectile.timeLeft = 210; Projectile.DamageType = RogueDamageClass.Instance; } @@ -38,15 +38,15 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item7, Projectile.position); } - //Spawn a skull ever 20 frames - if (Projectile.timeLeft % 20 == 0) + //Spawn a skull every 30 frames + if (Projectile.timeLeft % 30 == 0) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f, 0f); } CalamityUtils.HomeInOnNPC(Projectile, true, 250f, 4f, 14f); - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 1).ToDirectionInt(); Projectile.rotation += 0.1f * Projectile.spriteDirection; } diff --git a/Projectiles/Rogue/GreenDonkeyKongReference.cs b/Projectiles/Rogue/GreenDonkeyKongReference.cs index 70c71b4366..0af66a8910 100644 --- a/Projectiles/Rogue/GreenDonkeyKongReference.cs +++ b/Projectiles/Rogue/GreenDonkeyKongReference.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Rogue public float cooldown = 0f; public float oldVelocityX = 0f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Barrel"); @@ -32,7 +33,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.localNPCHitCooldown = -1; Projectile.DamageType = RogueDamageClass.Instance; } + public bool CollideX => Projectile.oldPosition.X == Projectile.position.X; + public override void AI() { bool stealthS = Projectile.Calamity().stealthStrike; @@ -60,7 +63,9 @@ namespace CalamityMod.Projectiles.Rogue oldVelocityX = Math.Sign(Projectile.velocity.X) * 12f; } } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public void BounceEffects() { bool stealthS = Projectile.Calamity().stealthStrike; diff --git a/Projectiles/Rogue/GrimreaverBat.cs b/Projectiles/Rogue/GrimreaverBat.cs index 107bf3eebe..ddce48cc32 100644 --- a/Projectiles/Rogue/GrimreaverBat.cs +++ b/Projectiles/Rogue/GrimreaverBat.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = 2; - Projectile.timeLeft = 320; + Projectile.timeLeft = 210; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Rogue/GrimreaverSkull.cs b/Projectiles/Rogue/GrimreaverSkull.cs index fbba3e6ee4..48496a8639 100644 --- a/Projectiles/Rogue/GrimreaverSkull.cs +++ b/Projectiles/Rogue/GrimreaverSkull.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 210; Projectile.tileCollide = false; } @@ -68,12 +68,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.CursedInferno, 240); + target.AddBuff(BuffID.CursedInferno, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.CursedInferno, 240); + target.AddBuff(BuffID.CursedInferno, 180); } } } diff --git a/Projectiles/Rogue/HeavenfallenEnergy.cs b/Projectiles/Rogue/HeavenfallenEnergy.cs index 36bff03fed..febb558ad8 100644 --- a/Projectiles/Rogue/HeavenfallenEnergy.cs +++ b/Projectiles/Rogue/HeavenfallenEnergy.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool raining => Projectile.ai[1] == 0f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heavenfallen Energy"); @@ -29,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue { int num154 = 14; int coolDust; - Projectile.ai[0] += 1; + Projectile.ai[0]++; if (Projectile.ai[0] % 2 == 0) { if (Projectile.ai[0] % 4 == 0) @@ -44,16 +46,17 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[coolDust].velocity *= 0.1f; Main.dust[coolDust].velocity += Projectile.velocity * 0.5f; } + + float homingRange = raining ? 480f : 240f; + + if (Projectile.ai[0] >= 15f || raining) + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingRange, 12f, 20f); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + + public override bool? CanDamage() => Projectile.ai[0] >= 15f || raining; } } diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index 34b6f673d8..c58af9ae7b 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public class HeavenfallenStardiskBoomerang : ModProjectile { public override string Texture => "CalamityMod/Items/Weapons/Rogue/HeavenfallenStardisk"; - - private bool explode = false; + public Player Owner => Main.player[Projectile.owner]; public override void SetStaticDefaults() { @@ -31,29 +30,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.netImportant = true; Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - Player player = Main.player[Projectile.owner]; - - if (Projectile.Calamity().stealthStrike) - { - if (Projectile.timeLeft % 5f == 0f) //every 5 ticks - { - var source = Projectile.GetSource_FromThis(); - if (Main.rand.NextBool(2)) - { - int energyAmt = Main.rand.Next(1, 4); //1 to 3 energy - for (int n = 0; n < energyAmt; n++) - { - CalamityUtils.ProjectileRain(source, Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner); - } - } - } - } + if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 5f == 4f) // every 5 frames + CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (Projectile.alpha > 0) { @@ -79,21 +63,19 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += 0.5f; - if (player.position.Y != player.oldPosition.Y && Projectile.ai[0] == 0f) - { - explode = true; - } + if (Owner.position.Y != Owner.oldPosition.Y && Projectile.ai[0] == 0f) + Projectile.ai[1]++; - Projectile.ai[0] += 1f; + Projectile.ai[0]++; if (Main.myPlayer == Projectile.owner && Projectile.ai[0] == 20f) { - if (player.channel) + if (Owner.channel) { float num115 = 20f; float num116 = (float)Main.mouseX + Main.screenPosition.X - Projectile.Center.X; float num117 = (float)Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; - if (player.gravDir == -1f) + if (Owner.gravDir == -1f) { num117 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - Projectile.Center.Y; } @@ -135,14 +117,14 @@ namespace CalamityMod.Projectiles.Rogue Vector2 vector11 = Projectile.Center; float num128 = (float)Main.mouseX + Main.screenPosition.X - vector11.X; float num129 = (float)Main.mouseY + Main.screenPosition.Y - vector11.Y; - if (player.gravDir == -1f) + if (Owner.gravDir == -1f) { num129 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector11.Y; } float num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); if (num130 == 0f || Projectile.ai[0] < 0f) { - vector11 = player.Center; + vector11 = Owner.Center; num128 = Projectile.Center.X - vector11.X; num129 = Projectile.Center.Y - vector11.Y; num130 = (float)Math.Sqrt((double)(num128 * num128 + num129 * num129)); @@ -168,8 +150,6 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Player player = Main.player[Projectile.owner]; - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int i = 0; i < 10; i++) { @@ -183,21 +163,13 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } - - if (explode && player.position.Y != player.oldPosition.Y) + + if (Projectile.owner == Main.myPlayer && Projectile.ai[1] > 0) { - if (Projectile.owner == Main.myPlayer) + for (int i = 0; i < 5; i++) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack * 0.4f, Projectile.owner, 0f, 0f); - } + Vector2 velocity = ((MathHelper.TwoPi * i / 5f) - MathHelper.PiOver2).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 1f); } } } diff --git a/Projectiles/Rogue/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index 92ac307791..cb98f49956 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -43,26 +43,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { - int split = 0; - while (split < 3) - { - //Calculate the velocity of the projectile - float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; - //Prevents the projectile speed from being too low - if (shardspeedX < 2f && shardspeedX > -2f) - { - shardspeedX += -Projectile.velocity.X; - } - if (shardspeedY > 2f && shardspeedY < 2f) - { - shardspeedY += -Projectile.velocity.Y; - } - - //Spawn the projectile - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 2f, Projectile.owner, Main.rand.Next(3), 0f); - split += 1; - } + SpawnFragments(); Projectile.penetrate--; if (Projectile.penetrate <= 0) { @@ -84,36 +65,22 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + SpawnFragments(); Projectile.velocity.X = -Projectile.velocity.X; Projectile.velocity.Y = -Projectile.velocity.Y; - int split = 0; - while (split < 3) - { - //Calculate the velocity of the projectile - float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -Projectile.velocity.Y * Main.rand.Next(50, 70) * 0.01f + Main.rand.Next(-8, 9) * 0.2f; - //Prevents the projectile speed from being too low - if (shardspeedX < 2f && shardspeedX > -2f) - { - shardspeedX += -Projectile.velocity.X; - } - if (shardspeedY > 2f && shardspeedY < 2f) - { - shardspeedY += -Projectile.velocity.Y; - } - - //Spawn the projectile - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 2f, Projectile.owner, Main.rand.Next(3), 0f); - split += 1; - } } public override void OnHitPvp(Player target, int damage, bool crit) { + SpawnFragments(); Projectile.velocity.X = -Projectile.velocity.X; Projectile.velocity.Y = -Projectile.velocity.Y; + } + + public void SpawnFragments() + { int split = 0; - while (split < 3) + while (split < 2) { //Calculate the velocity of the projectile float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.5f, .7f) + Main.rand.NextFloat(-3f, 3f); @@ -129,7 +96,7 @@ namespace CalamityMod.Projectiles.Rogue } //Spawn the projectile - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 2f, Projectile.owner, Main.rand.Next(3), 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0f); split += 1; } } @@ -151,10 +118,6 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 159, default, 1.5f); dust_splash += 1; } - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } } } } diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index 0cc107972c..ba57654c00 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -2,6 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Rogue { @@ -74,11 +75,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(ModContent.BuffType(), 120); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 8b7fc2ded3..982b622291 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -1,7 +1,5 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,10 +25,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.penetrate = 3; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.timeLeft = 280; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; Projectile.coldDamage = true; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 60 * Projectile.MaxUpdates; //60 effective, 120 total + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; //30 effective, 60 total } public override void AI() @@ -38,14 +39,14 @@ namespace CalamityMod.Projectiles.Rogue if (!initStealth && Projectile.Calamity().stealthStrike) { Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 9; Projectile.tileCollide = false; + Projectile.timeLeft = 90 * Projectile.MaxUpdates; initialVelocity = Projectile.velocity; initStealth = true; } - Projectile.rotation += 0.5f; + //Projectile.rotation = Projectile.velocity.ToRotation(); + if (Main.rand.NextBool(3)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); @@ -72,18 +73,11 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 14f) / (21f); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 14f) / 21f; } Projectile.velocity = initStealth && !homeIn ? initialVelocity : Projectile.velocity; } - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item27, Projectile.position); @@ -93,52 +87,18 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffects(); + + public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffects(); + + public void OnHitEffects() { - if (initStealth) - { - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 15) + if (initStealth && Projectile.owner == Main.myPlayer && Projectile.numHits < 1) + { + for (int i = 0; i < 8; i++) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); - } - } - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - if (initStealth) - { - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 15) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); - } + Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index cd265dfe0b..cbc66228d5 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); if (Projectile.Calamity().stealthStrike) { @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); if (Projectile.Calamity().stealthStrike) { diff --git a/Projectiles/Rogue/IchorSpearProj.cs b/Projectiles/Rogue/IchorSpearProj.cs index d6becf3209..52364bab02 100644 --- a/Projectiles/Rogue/IchorSpearProj.cs +++ b/Projectiles/Rogue/IchorSpearProj.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } @@ -44,12 +45,12 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Calamity().stealthStrike) { - if (Projectile.timeLeft % 8 == 0) + if (Projectile.timeLeft % 6 == 0) { if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-14f, 14f), Main.rand.NextFloat(-14f, 14f)); - int ichor = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, Main.rand.NextBool(2) ? ProjectileID.GoldenShowerFriendly : ProjectileID.IchorSplash, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); + int ichor = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, Main.rand.NextBool(2) ? ProjectileID.GoldenShowerFriendly : ProjectileID.IchorSplash, Projectile.damage, Projectile.knockBack, Projectile.owner); if (ichor.WithinBounds(Main.maxProjectiles)) { Main.projectile[ichor].DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index 61f01f7de2..a2fca994dd 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -165,11 +165,6 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - if (Main.rand.Next(4) == 0) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - if (Projectile.Calamity().stealthStrike) { int sparkCount = Main.rand.Next(3, 7); diff --git a/Projectiles/Rogue/IronFranciscaProj.cs b/Projectiles/Rogue/IronFranciscaProj.cs index 05edbd1e86..bb10e241f2 100644 --- a/Projectiles/Rogue/IronFranciscaProj.cs +++ b/Projectiles/Rogue/IronFranciscaProj.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -47,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.damage *= 2; } Projectile.ai[0]++; - if (Projectile.ai[0] == 10) + if (Projectile.ai[0] == 15) { Projectile.damage /= 2; } @@ -62,14 +64,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index f95d78e1c0..55ff48559c 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -64,7 +64,6 @@ namespace CalamityMod.Projectiles.Rogue Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Venom, 120); target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 120); @@ -78,7 +77,6 @@ namespace CalamityMod.Projectiles.Rogue Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Venom, 120); target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Rogue/KelvinCatalystBoomerang.cs b/Projectiles/Rogue/KelvinCatalystBoomerang.cs index 35ded6cb58..b511b3a4e5 100644 --- a/Projectiles/Rogue/KelvinCatalystBoomerang.cs +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -28,9 +28,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 1; + Projectile.MaxUpdates = 2; Projectile.DamageType = RogueDamageClass.Instance; Projectile.coldDamage = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; //20 effective, 40 total } public override void SendExtraAI(BinaryWriter writer) @@ -67,9 +69,9 @@ namespace CalamityMod.Projectiles.Rogue break; case 2: // Will target the targetted NPC that minions use btw - Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 1, 40f, 12f, 6f, new Vector2(0f, -60f), 40f, 12f, true, true); Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 120) + if (Projectile.localAI[0] >= 180) { ResetStats(false); } @@ -129,7 +131,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.soundDelay == 0) { Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); + SoundEngine.PlaySound(SoundID.Item7, Projectile.Center); } int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 1f); @@ -160,35 +162,28 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(BuffID.Frostburn2, 240); OnHitEffects(); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 240); + target.AddBuff(BuffID.Frostburn2, 240); OnHitEffects(); } private void OnHitEffects() { - int projType = ModContent.ProjectileType(); - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[projType] < 25) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + int maxSpawns = Projectile.Calamity().stealthStrike ? 3 : 1; + if (Projectile.owner == Main.myPlayer && Projectile.numHits < maxSpawns) + { + for (int i = 0; i < 5; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), projType, Projectile.damage / 6, Projectile.knockBack * 0.5f, Projectile.owner); - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 4f), (float)(-Math.Cos(offsetAngle) * 4f), projType, Projectile.damage / 6, Projectile.knockBack * 0.5f, Projectile.owner); + Vector2 velocity = (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } + SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); } - SoundEngine.PlaySound(SoundID.Item30, Projectile.position); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index c251bb1092..f314af1a80 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -38,20 +38,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[Projectile.owner]; - if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) - player.AddBuff(BuffID.WellFed, 180); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - Player player = Main.player[Projectile.owner]; - if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1) - player.AddBuff(BuffID.WellFed, 180); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); diff --git a/Projectiles/Rogue/KylieBoomerang.cs b/Projectiles/Rogue/KylieBoomerang.cs index 55848b2e8c..64867aed13 100644 --- a/Projectiles/Rogue/KylieBoomerang.cs +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using System; using Terraria; @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 360; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = 30; Projectile.DamageType = RogueDamageClass.Instance; } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = true; //Decide the range of the boomerang depending on stealth if (Projectile.Calamity().stealthStrike) - ReboundTime = 27f; + ReboundTime = 36f; else ReboundTime = 55f; diff --git a/Projectiles/Rogue/LeadTomahawkProj.cs b/Projectiles/Rogue/LeadTomahawkProj.cs index e52a3b0f56..09d67a6cf6 100644 --- a/Projectiles/Rogue/LeadTomahawkProj.cs +++ b/Projectiles/Rogue/LeadTomahawkProj.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -47,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.damage *= 2; } Projectile.ai[0]++; - if (Projectile.ai[0] == 10) + if (Projectile.ai[0] == 15) { Projectile.damage /= 2; } @@ -62,14 +64,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index 6a8bb7bdaa..2292b9c487 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -31,8 +31,10 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); + if (Main.rand.NextBool(5)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 44, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (Projectile.Calamity().stealthStrike) { // Die early. @@ -60,12 +62,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[Projectile.owner] = 6; - target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Venom, 120); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Venom, 120); } } } diff --git a/Projectiles/Rogue/MoltenAmputatorProj.cs b/Projectiles/Rogue/MoltenAmputatorProj.cs index 95084f4e1b..69474e324f 100644 --- a/Projectiles/Rogue/MoltenAmputatorProj.cs +++ b/Projectiles/Rogue/MoltenAmputatorProj.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -165,6 +166,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); if (Projectile.owner == Main.myPlayer) { int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; @@ -179,6 +181,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); if (Projectile.owner == Main.myPlayer) { int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index 7df934067e..e18c4208ad 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -3,6 +3,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; + namespace CalamityMod.Projectiles.Rogue { public class MoltenBlobThrown : ModProjectile @@ -65,6 +67,16 @@ namespace CalamityMod.Projectiles.Rogue return new Color(250, 150, 0, Projectile.alpha); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 90); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 90); + } + public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Item20, Projectile.position); diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index 48a0e42786..40a886d96a 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -51,12 +51,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - //Add the venom debuff - target.AddBuff(BuffID.Venom, 180); - } - public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Dig, Projectile.position); @@ -68,12 +62,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[d].position = Projectile.Center; dustsplash += 1; } - - //Randomly not consume item if it wasnt a stealth strike - if (Main.rand.Next(4) == 0 && Projectile.ai[0] != 1) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, 27, 27, ModContent.ItemType()); - } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index e926f54fac..9519b9c947 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -77,22 +77,14 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (!Projectile.Calamity().stealthStrike) return; - target.AddBuff(BuffID.Poisoned, 300); - target.AddBuff(BuffID.Venom, 120); - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffID.Poisoned, 480); + target.AddBuff(BuffID.Venom, 480); + target.AddBuff(ModContent.BuffType(), 480); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -100,9 +92,9 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike) return; - target.AddBuff(BuffID.Poisoned, 300); - target.AddBuff(BuffID.Venom, 120); - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffID.Poisoned, 480); + target.AddBuff(BuffID.Venom, 480); + target.AddBuff(ModContent.BuffType(), 480); } } } diff --git a/Projectiles/Rogue/NanoblackMain.cs b/Projectiles/Rogue/NanoblackMain.cs index d00137691d..0f10b4ebcc 100644 --- a/Projectiles/Rogue/NanoblackMain.cs +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 56; - Projectile.height = 56; + Projectile.width = 64; + Projectile.height = 64; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; diff --git a/Projectiles/Rogue/NanoblackSplit.png b/Projectiles/Rogue/NanoblackSplit.png index 5f802a3434..5ec48df287 100644 Binary files a/Projectiles/Rogue/NanoblackSplit.png and b/Projectiles/Rogue/NanoblackSplit.png differ diff --git a/Projectiles/Rogue/NanoblackSplitGlow.png b/Projectiles/Rogue/NanoblackSplitGlow.png index bfe45bc59f..eb55f0f37b 100644 Binary files a/Projectiles/Rogue/NanoblackSplitGlow.png and b/Projectiles/Rogue/NanoblackSplitGlow.png differ diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 82e875af31..0c1ad9de79 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -91,7 +91,8 @@ namespace CalamityMod.Projectiles.Rogue for (int n = 0; n < needleAmt; n++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int damage = (int)player.GetTotalDamage().ApplyTo(0.25f * NastyCholla.BaseDamage); + // Since damage is reset on stick, this needs new damage calculations or stored damage in some way. + int damage = Projectile.Calamity().stealthStrike ? Projectile.originalDamage / 2 : (int)player.GetTotalDamage().ApplyTo(0.5f * NastyCholla.BaseDamage); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), damage, 0f, Projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index 1630b98085..92ab7037fc 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Weapons.Rogue; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -22,10 +21,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.penetrate = 5; - Projectile.timeLeft = 600; + Projectile.penetrate = 4; + Projectile.timeLeft = 360; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } @@ -89,13 +89,5 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[petal].DamageType = RogueDamageClass.Instance; } } - - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } } } diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index 49470f1369..cd005f0330 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.Calamity().lineColor >= 2) return; Projectile.localAI[0]++; - if (Projectile.localAI[0] >= 30f) + if (Projectile.localAI[0] >= 15f) { Vector2 vector2 = new Vector2(20f, 20f); for (int index1 = 0; index1 < 10; ++index1) @@ -75,12 +75,13 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffects(); + public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffects(); + + public void OnHitEffects() { - if (Main.rand.NextBool(2) && !Projectile.Calamity().stealthStrike) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) + Main.player[Projectile.owner].AddBuff(BuffID.RapidHealing, 300); } } } diff --git a/Projectiles/Rogue/PanSpark.cs b/Projectiles/Rogue/PanSpark.cs index c1e4e1cb1b..aa2ed610d5 100644 --- a/Projectiles/Rogue/PanSpark.cs +++ b/Projectiles/Rogue/PanSpark.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -128,12 +128,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 90); + target.AddBuff(BuffID.Daybreak, 90); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 90); + target.AddBuff(BuffID.Daybreak, 90); } public override Color? GetAlpha(Color lightColor) => new Color(255, 230, 130); diff --git a/Projectiles/Rogue/PlaguedFuelPackCloud.cs b/Projectiles/Rogue/PlaguedFuelPackCloud.cs index 0e6ddd1045..85f9fefe08 100644 --- a/Projectiles/Rogue/PlaguedFuelPackCloud.cs +++ b/Projectiles/Rogue/PlaguedFuelPackCloud.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.timeLeft = 100; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; + Projectile.localNPCHitCooldown = 6; Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/PrismRocket.cs b/Projectiles/Rogue/PrismRocket.cs index 36a638d31d..fc1756aa83 100644 --- a/Projectiles/Rogue/PrismRocket.cs +++ b/Projectiles/Rogue/PrismRocket.cs @@ -26,8 +26,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.timeLeft = Lifetime; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 9; Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/PrismallineProj.cs b/Projectiles/Rogue/PrismallineProj.cs index a2f4e21a81..5eb37f06d7 100644 --- a/Projectiles/Rogue/PrismallineProj.cs +++ b/Projectiles/Rogue/PrismallineProj.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 180; AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -50,19 +52,18 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); if (numSpecProj < 2 && !hitEnemy) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.1), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); ++numSpecProj; } else { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } else //stealth strike { - int shardCount = Main.rand.Next(2,5); - for (int num252 = 0; num252 < shardCount; num252++) + for (int num252 = 0; num252 < 5; num252++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < numProj + 1; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f, 0.2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.15), Projectile.knockBack, Projectile.owner, 1f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f, 0f); } } } @@ -99,8 +100,7 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.Calamity().stealthStrike) { - int shardCount = Main.rand.Next(1,4); - for (int s = 0; s < shardCount; s++) + for (int s = 0; s < 5; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); diff --git a/Projectiles/Rogue/RadiantExplosion.cs b/Projectiles/Rogue/RadiantExplosion.cs index f7830aea92..9102eb6779 100644 --- a/Projectiles/Rogue/RadiantExplosion.cs +++ b/Projectiles/Rogue/RadiantExplosion.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = 10; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 35; // Hits 3 times when stealth } public override void AI() @@ -114,10 +116,10 @@ namespace CalamityMod.Projectiles.Rogue int projType = Utils.SelectRandom(Main.rand, new int[] { ModContent.ProjectileType(), - ProjectileID.HallowStar, + ProjectileID.StarCloakStar, ModContent.ProjectileType() }); - Projectile star = CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 25f, projType, (int)(Projectile.damage * 0.75), 5f, Projectile.owner); + Projectile star = CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 25f, projType, (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.75f, Projectile.owner); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) { star.DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/RadiantStarKnife.cs b/Projectiles/Rogue/RadiantStarKnife.cs index 9c8c4c4ebd..a45bf1c10a 100644 --- a/Projectiles/Rogue/RadiantStarKnife.cs +++ b/Projectiles/Rogue/RadiantStarKnife.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 4; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() @@ -73,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[1] += 1f; if (Projectile.ai[1] == 25f) { - int numProj = Projectile.Calamity().stealthStrike ? 5 : 3; + int numProj = Projectile.Calamity().stealthStrike ? 7 : 3; float rotation = MathHelper.ToRadians(50); if (Projectile.owner == Main.myPlayer) { @@ -86,12 +88,12 @@ namespace CalamityMod.Projectiles.Rogue } speed.Normalize(); speed *= (float)Main.rand.Next(30, 61) * 0.1f * 2.5f; - int stabber2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, + int stabber2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speed.X, speed.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] == 1f ? 1f : 0f, 0f); Main.projectile[stabber2].Calamity().stealthStrike = Projectile.Calamity().stealthStrike; } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - int boomer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); + int boomer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); if (Projectile.Calamity().stealthStrike && boomer.WithinBounds(Main.maxProjectiles)) { Main.projectile[boomer].Calamity().stealthStrike = true; diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index ffa7c2e940..41f848ac53 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Rogue { @@ -153,11 +154,15 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index 399380c5c9..43afdb458d 100644 --- a/Projectiles/Rogue/RotBallProjectile.cs +++ b/Projectiles/Rogue/RotBallProjectile.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } @@ -35,14 +36,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index 5cf4f6f4ad..85e5d2e640 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System.IO; using Terraria; using Terraria.ID; @@ -42,16 +42,17 @@ namespace CalamityMod.Projectiles.Rogue { if (ReturningToOwner) { - Projectile.timeLeft = 2; - Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * 24f; + Projectile.timeLeft = 15; + Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * 28f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + MathHelper.PiOver4; + Projectile.damage = 0; // Heal the player and disappear when touching them. if (Projectile.Hitbox.Intersects(Owner.Hitbox)) { if (!Owner.moonLeech && AbleToHealOwner) { - int healAmount = Projectile.Calamity().stealthStrike ? 50 : 4; + int healAmount = Projectile.Calamity().stealthStrike ? 35 : 3; Owner.HealEffect(healAmount); Owner.statLife += healAmount; @@ -76,10 +77,14 @@ namespace CalamityMod.Projectiles.Rogue } } - if (StickingToAnything && Projectile.timeLeft > 90) - Projectile.timeLeft = 90; - - Projectile.StickyProjAI(50); + if (StickingToAnything) + { + if (Projectile.timeLeft > 90 && !Projectile.Calamity().stealthStrike) + Projectile.timeLeft = 90; + else if (Projectile.timeLeft > 120 && Projectile.Calamity().stealthStrike) + Projectile.timeLeft = 120; + } + Projectile.StickyProjAI(50); } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index fdc7b0f8af..d85e9b7373 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using System; using Terraria; using Terraria.ID; @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.timeLeft = 3600; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; + Projectile.localNPCHitCooldown = 45; Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/ScourgeVenomCloud.png b/Projectiles/Rogue/ScourgeVenomCloud.png index 2a1c0b9502..8016f748ac 100644 Binary files a/Projectiles/Rogue/ScourgeVenomCloud.png and b/Projectiles/Rogue/ScourgeVenomCloud.png differ diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index 5f721802e9..9513d85556 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -38,6 +38,10 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(5)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 85, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + if (Projectile.Calamity().stealthStrike) //stealth strike attack + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 116, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + } } Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 0.785f; Projectile.velocity.X *= 1.015f; @@ -74,11 +78,11 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.owner == Main.myPlayer) { - int cloudNumber = Main.rand.Next(2, 6); + int cloudNumber = Main.rand.Next(3, 5); for (int cloudIndex = 0; cloudIndex < cloudNumber; cloudIndex++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 1f, Projectile.owner, 0f, Projectile.Calamity().stealthStrike ? 1f : 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3), 1f, Projectile.owner, 0f, Projectile.Calamity().stealthStrike ? 1f : 0f); } } } diff --git a/Projectiles/Rogue/SearedPanProjectile.cs b/Projectiles/Rogue/SearedPanProjectile.cs index 0552fb5432..02a6f6f3ac 100644 --- a/Projectiles/Rogue/SearedPanProjectile.cs +++ b/Projectiles/Rogue/SearedPanProjectile.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); // Don't increment the Seared Pan counter when hitting dummies bool dummy = target.type != NPCID.TargetDummy && target.type != ModContent.NPCType(); OnHitEffects(target.whoAmI, target.life, dummy); @@ -63,9 +62,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - Player player = Main.player[Projectile.owner]; target.AddBuff(BuffID.Bleeding, 300); - target.AddBuff(ModContent.BuffType(), 180); OnHitEffects(-1, target.statLife, true); } diff --git a/Projectiles/Rogue/SeraphimBeamLarge.cs b/Projectiles/Rogue/SeraphimBeamLarge.cs index 0948cdbf3c..691ac92007 100644 --- a/Projectiles/Rogue/SeraphimBeamLarge.cs +++ b/Projectiles/Rogue/SeraphimBeamLarge.cs @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Rogue } } - Vector2 laserEndCenter = centerOnLaser + Projectile.velocity * endFrameArea.Height - Main.screenPosition; + Vector2 laserEndCenter = centerOnLaser + Projectile.velocity * endFrameArea.Height * Projectile.scale - Main.screenPosition; Main.EntitySpriteDraw(LaserEndTexture, laserEndCenter, endFrameArea, diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index ddb19281ca..dfdead1f7b 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -3,7 +3,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Rogue { @@ -24,6 +23,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; + Projectile.MaxUpdates = 5; Projectile.DamageType = RogueDamageClass.Instance; } @@ -39,14 +39,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - Projectile.Kill(); - return false; - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); @@ -54,7 +46,20 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + { + NPC firstTarget = Main.npc[(int)Projectile.ai[0]]; + + // 7 hits total + if (Projectile.Calamity().stealthStrike && Projectile.ai[1] <= 7f && (Projectile.ai[1] == 0f || firstTarget != null)) + { + Vector2 targetPos = Projectile.ai[1] == 0f ? target.Center : firstTarget.Center; + Vector2 offset = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(80f, 120f); + Vector2 eVelocity = Vector2.UnitX.RotatedBy(offset.ToRotation() + MathHelper.Pi) * 4f; + int realTarget = Projectile.ai[1] == 0f ? target.whoAmI : firstTarget.whoAmI; + Projectile echo = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targetPos + offset, eVelocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, realTarget, Projectile.ai[1] + 1); + echo.Calamity().stealthStrike = true; + } + if (target.life <= 0) CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), 1200f, 0f); } diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs index 2a217a1d43..cbe45bd1dd 100644 --- a/Projectiles/Rogue/ShockTeslaAura.cs +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -95,6 +96,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Electrified, 180); + target.AddBuff(ModContent.BuffType(), 60); if (target.knockBackResist <= 0f) return; @@ -115,6 +117,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Electrified, 180); + target.AddBuff(ModContent.BuffType(), 60); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); diff --git a/Projectiles/Rogue/SludgeSplotchProj1.cs b/Projectiles/Rogue/SludgeSplotchProj1.cs index b09f18736e..0b83fe54d5 100644 --- a/Projectiles/Rogue/SludgeSplotchProj1.cs +++ b/Projectiles/Rogue/SludgeSplotchProj1.cs @@ -1,5 +1,4 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +8,7 @@ namespace CalamityMod.Projectiles.Rogue { public class SludgeSplotchProj1 : ModProjectile { + public static int sludgeDustType = 191; public override void SetStaticDefaults() { DisplayName.SetDefault("Sludge Splotch"); @@ -16,8 +16,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = Projectile.height = 14; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; @@ -27,105 +26,45 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.velocity.Y += 0.1f; - if (Projectile.velocity.Y >= 16f) - { + if (Projectile.velocity.Y > 16f) Projectile.velocity.Y = 16f; - } - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + Projectile.rotation = Projectile.velocity.ToRotation(); int numDust = 2; for (int i = 0; i < numDust; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 191, 0f, 0f, 225, new Color(255, 255, 255), 3); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, sludgeDustType, 0f, 0f, 225, new Color(255, 255, 255), 3); Main.dust[dust].noGravity = true; Main.dust[dust].noLight = true; Main.dust[dust].velocity = Main.dust[dust].velocity * 0.25f; } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.Calamity().stealthStrike) - { - Projectile.ai[0] = 0; - Projectile.ai[1] = 0; + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Slimed, 120); - if (Projectile.velocity.X != oldVelocity.X) - { - if (oldVelocity.X < 0) - { - Projectile.ai[0] = 1; - } - if (oldVelocity.X > 0) - { - Projectile.ai[0] = -1; - } - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - if (oldVelocity.Y < 0) - { - Projectile.ai[1] = 1; - } - if (oldVelocity.Y > 0) - { - Projectile.ai[1] = -1; - } - } - } - - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - SoundEngine.PlaySound(SoundID.NPCDeath9 with { Volume = SoundID.NPCDeath9.Volume * 2f }, Projectile.position); - Projectile.Kill(); - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Slow, 120); - SoundEngine.PlaySound(SoundID.NPCDeath9 with { Volume = SoundID.NPCDeath9.Volume * 2 }, Projectile.position); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Slow, 120); - SoundEngine.PlaySound(SoundID.NPCDeath9 with { Volume = SoundID.NPCDeath9.Volume * 2 }, Projectile.position); - } + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.Slimed, 120); public override void Kill(int timeLeft) { if (Projectile.Calamity().stealthStrike) { - int sparkCount = Main.rand.Next(3, 6); - for (int i = 0; i < sparkCount; i++) + for (int i = 0; i < 3; i++) { - int sparkScatter = 1; - Vector2 sparkVelocity = new Vector2(Main.rand.NextFloat(-sparkScatter, sparkScatter), Main.rand.NextFloat(-sparkScatter - 2, sparkScatter + 2)); - - sparkVelocity.Normalize(); - sparkVelocity *= 7; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkVelocity, ModContent.ProjectileType(), 7, 0, Projectile.owner, 0, 0); + Vector2 sparkVelocity = CalamityUtils.RandomVelocity(100f, 40f, 60f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkVelocity, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); } } + SoundEngine.PlaySound(SoundID.NPCDeath9 with { Volume = SoundID.NPCDeath9.Volume * 2 }, Projectile.position); + int numDust = 20; - int dustType = 191; float spread = 3f; for (int i = 0; i < numDust; i++) { Vector2 velocity = Projectile.velocity + new Vector2(Main.rand.NextFloat(-spread, spread), Main.rand.NextFloat(-spread, spread)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, velocity.X, velocity.Y, 175, default, 3f); + int dust = Dust.NewDust(Projectile.Center, 1, 1, sludgeDustType, velocity.X, velocity.Y, 175, default, 3f); Main.dust[dust].noGravity = true; } } diff --git a/Projectiles/Rogue/SludgeSplotchProj2.cs b/Projectiles/Rogue/SludgeSplotchProj2.cs index f99f97ea30..1a7f267283 100644 --- a/Projectiles/Rogue/SludgeSplotchProj2.cs +++ b/Projectiles/Rogue/SludgeSplotchProj2.cs @@ -60,12 +60,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Slow, 60); + target.AddBuff(BuffID.Slimed, 60); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Slow, 60); + target.AddBuff(BuffID.Slimed, 60); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/StormfrontLightning.cs b/Projectiles/Rogue/StormfrontLightning.cs new file mode 100644 index 0000000000..59df292827 --- /dev/null +++ b/Projectiles/Rogue/StormfrontLightning.cs @@ -0,0 +1,214 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +//Yes, this is Heavenly Gale's lightning code but modified - Shade + +namespace CalamityMod.Projectiles.Rogue +{ + public class StormfrontLightning : ModProjectile + { + internal PrimitiveTrail LightningDrawer; + + private int noTileHitCounter = 81; //Using other projectile's methods to not collide until a certain time has passed, allowing use inside caves + + public bool HasPlayedSound; + + public const int Lifetime = 45; + + // Technically not a ratio, and more of a seed, but it is used in a 0-2pi squash + // later in the code to get an arbitrary unit vector (which is then checked). + public ref float BaseTurnAngleRatio => ref Projectile.ai[1]; + public ref float AccumulatedXMovementSpeeds => ref Projectile.localAI[0]; + public ref float BranchingIteration => ref Projectile.localAI[1]; + public ref float InitialVelocityAngle => ref Projectile.ai[0]; + public override string Texture => "CalamityMod/Projectiles/LightningProj"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lightning"); + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 50; + } + + public override void SetDefaults() + { + Projectile.width = 35; + Projectile.height = 35; + Projectile.alpha = 255; + Projectile.penetrate =4; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.MaxUpdates = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.timeLeft = Projectile.MaxUpdates * Lifetime; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(AccumulatedXMovementSpeeds); + writer.Write(BranchingIteration); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + AccumulatedXMovementSpeeds = reader.ReadSingle(); + BranchingIteration = reader.ReadSingle(); + } + + public override void AI() + { + //Pass through tiles until certain time has passed + noTileHitCounter -= 1; + if (noTileHitCounter == 0) + { + Projectile.tileCollide = true; + } + + //dust sparks are now a feature + if (Main.rand.NextBool(10)) + { + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[d].noGravity = true; + Main.dust[d].position = Projectile.Center; + } + + // FrameCounter in this context is really just an arbitrary timer + // which allows random turning to occur. + Projectile.frameCounter++; + Projectile.oldPos[1] = Projectile.oldPos[0]; + + // Adjust opacity and scale. + float adjustedTimeLife = Projectile.timeLeft / Projectile.MaxUpdates; + Projectile.Opacity = Utils.GetLerpValue(0f, 9f, adjustedTimeLife, true) * Utils.GetLerpValue(Lifetime, Lifetime - 3f, adjustedTimeLife, true); + Projectile.scale = Projectile.Opacity; + + // Play a strike sound on the first frame. + if (!HasPlayedSound) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound with { Volume = 0.5f }, Main.player[Projectile.owner].Center); + HasPlayedSound = true; + } + + Lighting.AddLight(Projectile.Center, new Color(Main.rand.Next(20, 100), 204, 250).ToVector3()); + if (Projectile.frameCounter >= Projectile.extraUpdates * 2) + { + Projectile.frameCounter = 0; + float originalSpeed = MathHelper.Min(20f, Projectile.velocity.Length()); + UnifiedRandom unifiedRandom = new((int)BaseTurnAngleRatio); + int turnTries = 0; + Vector2 newBaseDirection = -Vector2.UnitY; + Vector2 potentialBaseDirection; + + do + { + BaseTurnAngleRatio = unifiedRandom.Next() % 100; + potentialBaseDirection = (BaseTurnAngleRatio / 100f * MathHelper.TwoPi).ToRotationVector2(); + + // Ensure that the new potential direction base is always moving downwards (this is supposed to be somewhat similar to a -UnitY + RotatedBy). + potentialBaseDirection.Y = -Math.Abs(potentialBaseDirection.Y); + + bool canChangeLightningDirection = true; + + // Potential directions with very little Y speed should not be considered, because this + // consequentially means that the X speed would be quite large. + if (potentialBaseDirection.Y > -0.2f) + canChangeLightningDirection = false; + + //No very fast X speeds either, its gotta hit at least consistently y'know + if (potentialBaseDirection.X < -0.2f || potentialBaseDirection.X > 0.2f) + canChangeLightningDirection = false; + + // If the above checks were all passed, redefine the base direction of the lightning. + if (canChangeLightningDirection) + newBaseDirection = potentialBaseDirection; + + turnTries++; + } + while (turnTries < 20); + + // Rotation and speed ajustment + if (Projectile.velocity != Vector2.Zero) + { + //AccumulatedXMovementSpeeds += newBaseDirection.X * (Projectile.extraUpdates + 1) * originalSpeed; + Projectile.velocity = newBaseDirection.RotatedBy(InitialVelocityAngle + MathHelper.PiOver2) * originalSpeed; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + } + } + + public float PrimitiveWidthFunction(float completionRatio) => CalamityUtils.Convert01To010(completionRatio) * Projectile.scale * Projectile.width; + + public Color PrimitiveColorFunction(float completionRatio) + { + //Why did you have to overcomplicate it Dom, I could have just fucking used "lightningColor = new Color(Main.rand.Next(20,100), 204, 250);" and shove it in PreDraw - Shade + float colorInterpolant = (float)Math.Sin(Projectile.identity / 3f + completionRatio * 20f + Main.GlobalTimeWrappedHourly * 1.1f) * 0.5f + 0.5f; + Color color = CalamityUtils.MulticolorLerp(colorInterpolant, new Color(Main.rand.Next(20, 100), 204, 250), new Color(Main.rand.Next(20, 100), 204, 250)); + return color; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + SoundEngine.PlaySound(SoundID.Item93, Projectile.position); + target.AddBuff(BuffID.Electrified, 150); + Sparks(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + SoundEngine.PlaySound(SoundID.Item93, Projectile.position); + target.AddBuff(BuffID.Electrified, 150); + Sparks(); + } + + public override bool PreDraw(ref Color lightColor) + { + //Just gonna use Dom's work on Heavenly Gale, tried to do a new one myself but I barely understand the .fx files and how they work, might revist it again eventually - Shade + if (LightningDrawer is null) + LightningDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"]); + + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].UseImage1("Images/Misc/Perlin"); + GameShaders.Misc["CalamityMod:HeavenlyGaleLightningArc"].Apply(); + + LightningDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.3f - Main.screenPosition, 10); + return false; + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.NPCHit53, Projectile.Center); + Sparks(); + } + public void Sparks() + { + if (Projectile.owner == Main.myPlayer) + { + for (int index = 0; index < 4; index++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(-100f, 10f, 200f, 0.01f); + //Visual sparks on death + Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-10f, 0f)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), 0, 0f, Projectile.owner); + } + } + } + } + + +} diff --git a/Projectiles/Rogue/StormfrontRazorProjectile.cs b/Projectiles/Rogue/StormfrontRazorProjectile.cs index e98d91a42f..f16ef11f7a 100644 --- a/Projectiles/Rogue/StormfrontRazorProjectile.cs +++ b/Projectiles/Rogue/StormfrontRazorProjectile.cs @@ -3,6 +3,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Items.Weapons.Rogue; +using Terraria.Utilities; namespace CalamityMod.Projectiles.Rogue { @@ -12,7 +14,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - DisplayName.SetDefault("Stormfront Knife"); + DisplayName.SetDefault("Stormfront Razor"); Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; @@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 5; + Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; @@ -32,6 +34,13 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + if (Main.rand.NextBool(10)) + { + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[d].noGravity = true; + Main.dust[d].position = Projectile.Center; + } Projectile.frameCounter++; if (Projectile.frameCounter >= 6) { @@ -48,30 +57,103 @@ namespace CalamityMod.Projectiles.Rogue Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); - if (Projectile.ai[1] == 0) - { - Projectile.ai[1] = 1; - } - float sparkFreq = 125f / Projectile.ai[1]; - if (Projectile.ai[0] >= sparkFreq) - { - Vector2 sparkS = new Vector2(Main.rand.NextFloat(-14f, 14f), Main.rand.NextFloat(-14f, 14f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner); - Projectile.ai[0] = 0; - } + + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 45); if (Main.rand.NextBool(10)) { - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[d].noGravity = true; Main.dust[d].position = Projectile.Center; } + int times = 1; + if (Projectile.Calamity().stealthStrike) + { + times = 3; + } + // Create lightning, uses some of Dom's Heavenly Gale code + for (int i = 0; i < times; i++) + { + int lightningDamage = (int)(Projectile.damage * StormfrontRazor.LightningDamageFactor); + Vector2 lightningSpawnPosition = Projectile.Center - Vector2.UnitY.RotatedByRandom(0.2f) * 1000f; + Vector2 lightningShootVelocity = (target.Center - lightningSpawnPosition + target.velocity * 7.5f).SafeNormalize(Vector2.UnitY) * 15f; + int lightning = Projectile.NewProjectile(Projectile.GetSource_FromThis(), lightningSpawnPosition, lightningShootVelocity, ModContent.ProjectileType(), lightningDamage, 0f, Projectile.owner); + if (Main.projectile.IndexInRange(lightning)) + { + Main.projectile[lightning].CritChance = Projectile.CritChance; + Main.projectile[lightning].ai[0] = lightningShootVelocity.ToRotation(); + Main.projectile[lightning].ai[1] = Main.rand.Next(100); + //I'll probably need some delay here + } + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Electrified, 45); + if (Main.rand.NextBool(10)) + { + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); + Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[d].noGravity = true; + Main.dust[d].position = Projectile.Center; + } + int times = 1; + if (Projectile.Calamity().stealthStrike) + { + times = 3; + } + // Create lightning, uses some of Dom's Heavenly Gale code + for (int i = 0; i < times; i++) + { + int lightningDamage = (int)(Projectile.damage * StormfrontRazor.LightningDamageFactor); + Vector2 lightningSpawnPosition = Projectile.Center - Vector2.UnitY.RotatedByRandom(0.2f) * 1000f; + Vector2 lightningShootVelocity = (target.Center - lightningSpawnPosition + target.velocity * 7.5f).SafeNormalize(Vector2.UnitY) * 15f; + int lightning = Projectile.NewProjectile(Projectile.GetSource_FromThis(), lightningSpawnPosition, lightningShootVelocity, ModContent.ProjectileType(), lightningDamage, 0f, Projectile.owner); + if (Main.projectile.IndexInRange(lightning)) + { + Main.projectile[lightning].CritChance = Projectile.CritChance; + Main.projectile[lightning].ai[0] = lightningShootVelocity.ToRotation(); + Main.projectile[lightning].ai[1] = Main.rand.Next(100); + //I'll probably need some delay here + } + } } public override bool OnTileCollide(Vector2 oldVelocity) { + if (Main.rand.NextBool(10)) + { + int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20,100), 204, 250), 1f); + Main.dust[d].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[d].noGravity = true; + Main.dust[d].position = Projectile.Center; + } Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + int times = 1; + if (Projectile.Calamity().stealthStrike) + { + times = 3; + } + // Create lightning, uses some of Dom's Heavenly Gale code + for (int i = 0; i < times; i++) + { + int lightningDamage = (int)(Projectile.damage * StormfrontRazor.LightningDamageFactor); + Vector2 lightningSpawnPosition = Projectile.Center - Vector2.UnitY.RotatedByRandom(0.2f) * 1100f; + Vector2 lightningShootVelocity = (Projectile.Center - lightningSpawnPosition + Projectile.velocity * 7.5f).SafeNormalize(Vector2.UnitY) * 14f; + int lightning = Projectile.NewProjectile(Projectile.GetSource_FromThis(), lightningSpawnPosition, lightningShootVelocity, ModContent.ProjectileType(), lightningDamage, 0f, Projectile.owner); + if (Main.projectile.IndexInRange(lightning)) + { + Main.projectile[lightning].CritChance = Projectile.CritChance; + Main.projectile[lightning].ai[0] = lightningShootVelocity.ToRotation(); + Main.projectile[lightning].ai[1] = Main.rand.Next(100); + } + } return true; } diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index c26fce69b9..abd0056de4 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class Stormfrontspark : ModProjectile { + //At first I thought about deleting em but then had an idea to give em some flair. public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() @@ -17,29 +18,27 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.width = 6; - Projectile.height = 12; - Projectile.timeLeft = 240; - Projectile.penetrate = -1; - Projectile.DamageType = RogueDamageClass.Instance; + Projectile.height = 6; + Projectile.timeLeft = 5; } public override void AI() { Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Dust dust = Main.dust[num199]; - dust.position.X -= 2f; - dust.position.Y += 2f; + dust.position.X -= 1f; + dust.position.Y -= 1f; dust.scale += (float)Main.rand.Next(50) * 0.01f; dust.noGravity = true; - dust.velocity.Y -= 2f; + dust.velocity.Y += 1f; if (Main.rand.NextBool(2)) { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 226, 0f, 0f, 100, new Color(Main.rand.Next(20, 100), 204, 250), 1f); Dust dust2 = Main.dust[num200]; - dust2.position.X -= 2f; - dust2.position.Y += 2f; - dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + dust2.position.X += 1f; + dust2.position.Y -= 1f; + dust2.scale += 0.2f + (float)Main.rand.Next(50) * 0.01f; dust2.noGravity = true; dust2.velocity *= 0.1f; } @@ -47,14 +46,12 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity.X = Projectile.velocity.X * 0.8f; } - Projectile.rotation = -Projectile.velocity.X * 0.05f; + Projectile.rotation = Projectile.velocity.X * 0.05f; Projectile.velocity.Y += 0.15f; if (Projectile.velocity.Y > 16f) { Projectile.velocity.Y = 16f; } } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Rogue/SubductionFlameburst.cs b/Projectiles/Rogue/SubductionFlameburst.cs index bbd6503df6..b77d25126e 100644 --- a/Projectiles/Rogue/SubductionFlameburst.cs +++ b/Projectiles/Rogue/SubductionFlameburst.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -63,13 +63,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 240); - target.AddBuff(BuffID.Daybreak, 120); + target.AddBuff(BuffID.OnFire3, 240); + target.AddBuff(BuffID.Daybreak, 420); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } } } diff --git a/Projectiles/Rogue/SubductionSlicerProj.cs b/Projectiles/Rogue/SubductionSlicerProj.cs index 5d5ef42fb8..02cfcd92db 100644 --- a/Projectiles/Rogue/SubductionSlicerProj.cs +++ b/Projectiles/Rogue/SubductionSlicerProj.cs @@ -57,13 +57,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[Projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire3, 240); OnHitEffects(target.Center); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire3, 240); OnHitEffects(target.Center); } diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index a2fbcd8132..1fea25cac2 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -171,12 +172,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index 4eb3790154..803d2d59b0 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -84,12 +85,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs index b92cec18d9..c054dc41e3 100644 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ b/Projectiles/Rogue/SupernovaHoming.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -102,12 +103,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Rogue/SupernovaSpike.cs b/Projectiles/Rogue/SupernovaSpike.cs index 3e4efedc77..0257e57dfa 100644 --- a/Projectiles/Rogue/SupernovaSpike.cs +++ b/Projectiles/Rogue/SupernovaSpike.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; @@ -63,12 +64,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } internal static void Visuals(Projectile projectile, ref Color c) diff --git a/Projectiles/Rogue/TalonLargeProj.cs b/Projectiles/Rogue/TalonLargeProj.cs index bbfc969799..a336cb8f25 100644 --- a/Projectiles/Rogue/TalonLargeProj.cs +++ b/Projectiles/Rogue/TalonLargeProj.cs @@ -20,13 +20,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 10; + Projectile.penetrate = 5; Projectile.tileCollide = false; Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.extraUpdates = 2; + Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 30 total } public override void AI() diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index 25d6fe82a1..41db3fbc2f 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 10; Projectile.extraUpdates = 1; } @@ -49,14 +49,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (Main.myPlayer == Projectile.owner) diff --git a/Projectiles/Rogue/TerraDiskProjectile.cs b/Projectiles/Rogue/TerraDiskProjectile.cs index 3a4f31b596..ddb3119f41 100644 --- a/Projectiles/Rogue/TerraDiskProjectile.cs +++ b/Projectiles/Rogue/TerraDiskProjectile.cs @@ -131,8 +131,6 @@ namespace CalamityMod.Projectiles.Rogue { int disk = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4f, Projectile.owner, Projectile.identity, Main.rand.NextFloat(0.02f, 0.1f)); Main.projectile[disk].timeLeft *= 2; - Main.projectile[disk].idStaticNPCHitCooldown = 8; - Main.projectile[disk].usesIDStaticNPCImmunity = true; Main.projectile[disk].aiStyle = -1; } } @@ -175,11 +173,10 @@ namespace CalamityMod.Projectiles.Rogue double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 6f; double offsetAngle; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - MathHelper.PiOver2).ToRotationVector2() * 6f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } } } diff --git a/Projectiles/Rogue/TerraDiskProjectile2.cs b/Projectiles/Rogue/TerraDiskProjectile2.cs index 573571cbc9..4c14c9cb6f 100644 --- a/Projectiles/Rogue/TerraDiskProjectile2.cs +++ b/Projectiles/Rogue/TerraDiskProjectile2.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 60; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 6; } public override void AI() diff --git a/Projectiles/Rogue/ThiefsDimeProj.cs b/Projectiles/Rogue/ThiefsDimeProj.cs deleted file mode 100644 index a1020b0580..0000000000 --- a/Projectiles/Rogue/ThiefsDimeProj.cs +++ /dev/null @@ -1,99 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Rogue -{ - public class ThiefsDimeProj : ModProjectile - { - private double rotation = 0; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Thief's Dime"); - Main.projFrames[Projectile.type] = 5; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.ignoreWater = true; - Projectile.minionSlots = 0f; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.timeLeft = 18000; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.timeLeft *= 5; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 4) - { - Projectile.frame = 0; - } - bool flag64 = Projectile.type == ModContent.ProjectileType(); - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.thiefsDime) - { - Projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.tDime = false; - } - if (modPlayer.tDime) - { - Projectile.timeLeft = 2; - } - } - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); - Vector2 vector = player.Center - Projectile.Center; - Projectile.rotation = vector.ToRotation() - 1.57f; - Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - rotation += 0.03; - if (rotation >= 360) - { - rotation = 0; - } - Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Midas, 360); - Player player = Main.player[Projectile.owner]; - if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) - { - if (Main.rand.NextBool(5)) - { - Item.NewItem(Projectile.GetSource_FromThis(), (int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.SilverCoin, Main.rand.Next(10, 21)); - } - if (Main.rand.NextBool(10)) - { - Item.NewItem(Projectile.GetSource_FromThis(), (int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.GoldCoin); - } - } - else - { - return; - } - } - } -} diff --git a/Projectiles/Rogue/TitaniumClone.cs b/Projectiles/Rogue/TitaniumClone.cs index d17e75941a..149d2c3502 100644 --- a/Projectiles/Rogue/TitaniumClone.cs +++ b/Projectiles/Rogue/TitaniumClone.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 28; - Projectile.height = 28; + Projectile.width = 34; + Projectile.height = 34; Projectile.alpha = 150; Projectile.friendly = true; Projectile.penetrate = 1; diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 8bbfd8bc95..05f313b883 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -23,14 +23,15 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 34; + Projectile.height = 34; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; Projectile.timeLeft = 600; AIType = ProjectileID.ThrowingKnife; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; } @@ -144,20 +145,11 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2) && !Projectile.Calamity().stealthStrike) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike && Projectile.numHits < 3) { - int projNumber = Main.rand.Next(1,3); - for (int index2 = 0; index2 < projNumber; index2++) + for (int index2 = 0; index2 < 4; index2++) { float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; @@ -170,10 +162,9 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) + if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike && Projectile.numHits < 3) { - int projNumber = Main.rand.Next(1,3); - for (int index2 = 0; index2 < projNumber; index2++) + for (int index2 = 0; index2 < 4; index2++) { float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index ec6d3bd305..a5534e4f30 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -35,16 +36,14 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void Kill(int timeLeft) + public override void OnHitPvp(Player target, int damage, bool crit) { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); if (Projectile.owner == Main.myPlayer && Projectile.Calamity().stealthStrike) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, -10f, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner, 1f, 0f); diff --git a/Projectiles/Rogue/TotalMeltdown.cs b/Projectiles/Rogue/TotalMeltdown.cs index 39cf8e8f1a..8925a99b20 100644 --- a/Projectiles/Rogue/TotalMeltdown.cs +++ b/Projectiles/Rogue/TotalMeltdown.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -31,12 +31,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } } } diff --git a/Projectiles/Rogue/TotalityFire.cs b/Projectiles/Rogue/TotalityFire.cs index d8f4892e6f..cad4f5672e 100644 --- a/Projectiles/Rogue/TotalityFire.cs +++ b/Projectiles/Rogue/TotalityFire.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -128,12 +128,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.OnFire3, 150); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.OnFire3, 150); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/TotalityTar.cs b/Projectiles/Rogue/TotalityTar.cs index 44ea324743..d989a9d148 100644 --- a/Projectiles/Rogue/TotalityTar.cs +++ b/Projectiles/Rogue/TotalityTar.cs @@ -74,12 +74,12 @@ namespace CalamityMod.Projectiles.Rogue target.buffImmune[BuffID.Oiled] = false; } target.AddBuff(BuffID.Oiled, 600); - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire3, 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 240); + target.AddBuff(BuffID.OnFire3, 300); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/UmbraphileBoom.cs b/Projectiles/Rogue/UmbraphileBoom.cs index 29bcff299e..a9bffb0078 100644 --- a/Projectiles/Rogue/UmbraphileBoom.cs +++ b/Projectiles/Rogue/UmbraphileBoom.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -48,16 +48,19 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (Main.dayTime || Main.rand.NextBool(3)) //100% during day, 33.33% chance at night - target.AddBuff(BuffID.Daybreak, 60); + target.AddBuff(BuffID.Daybreak, 45); if (!Main.dayTime || Main.rand.NextBool(3)) //100% at night, 33.33% chance during day - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 45); } public override void OnHitPvp(Player target, int damage, bool crit) { + if (Main.dayTime || Main.rand.NextBool(3)) //100% during day, 33.33% chance at night + target.AddBuff(BuffID.Daybreak, 45); + if (!Main.dayTime || Main.rand.NextBool(3)) //100% at night, 33.33% chance during day - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 45); } } } diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index be439d469f..8d3bc1b197 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -99,13 +99,5 @@ namespace CalamityMod.Projectiles.Rogue Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } - - public override void Kill(int timeLeft) - { - if (Main.rand.NextBool(2)) - { - Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType()); - } - } } } diff --git a/Projectiles/Rogue/ValariBoomerang.cs b/Projectiles/Rogue/ValariBoomerang.cs index cf6b4d5ad3..cd20414cc2 100644 --- a/Projectiles/Rogue/ValariBoomerang.cs +++ b/Projectiles/Rogue/ValariBoomerang.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = 60; Projectile.coldDamage = true; Projectile.DamageType = RogueDamageClass.Instance; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = true; //Decide the range of the boomerang depending on stealth if (Projectile.Calamity().stealthStrike) - ReboundTime = 27f; + ReboundTime = 36f; else ReboundTime = 55f; @@ -131,35 +131,38 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { - //Start homing at player if you hit an enemy - Projectile.ai[0] = 1; + // Start homing at player if you hit an enemy, UNLESS its a stealth strike + if (!Projectile.Calamity().stealthStrike) - int icicleAmt = Main.rand.Next(2, 4); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < icicleAmt; i++) + Projectile.ai[0] = 1; + + int icicleAmt = Main.rand.Next(2, 4); + if (Projectile.owner == Main.myPlayer) { + for (int i = 0; i < icicleAmt; i++) + { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); + } } - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { OnHitEffects(); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(BuffID.Frostburn2, 120); + if (Projectile.Calamity().stealthStrike) + target.AddBuff(ModContent.BuffType(), 45); + } public override void OnHitPvp(Player target, int damage, bool crit) { OnHitEffects(); - target.AddBuff(BuffID.Frostburn, 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(BuffID.Frostburn2, 120); + if (Projectile.Calamity().stealthStrike) + target.AddBuff(ModContent.BuffType(), 45); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/Valaricicle.cs b/Projectiles/Rogue/Valaricicle.cs index 46783abf4f..50121f92ca 100644 --- a/Projectiles/Rogue/Valaricicle.cs +++ b/Projectiles/Rogue/Valaricicle.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; @@ -43,15 +43,5 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } } } diff --git a/Projectiles/Rogue/Valaricicle2.cs b/Projectiles/Rogue/Valaricicle2.cs index d190f103f4..eb1fbb68d8 100644 --- a/Projectiles/Rogue/Valaricicle2.cs +++ b/Projectiles/Rogue/Valaricicle2.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; @@ -43,15 +43,5 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 120); - } } } diff --git a/Projectiles/Rogue/VeneratedKnife.cs b/Projectiles/Rogue/VeneratedKnife.cs index 30dcdea01c..ba2aa293bc 100644 --- a/Projectiles/Rogue/VeneratedKnife.cs +++ b/Projectiles/Rogue/VeneratedKnife.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -98,6 +99,11 @@ namespace CalamityMod.Projectiles.Rogue } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 150); + } + public override void Kill(int timeLeft) { for (int i = 0; i < 5; i++) diff --git a/Projectiles/Rogue/WebBallBol.cs b/Projectiles/Rogue/WebBallBol.cs index 274598cfa5..48f3d58a56 100644 --- a/Projectiles/Rogue/WebBallBol.cs +++ b/Projectiles/Rogue/WebBallBol.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Ranged/FallenStarAura.png b/Projectiles/StarTrail.png similarity index 100% rename from Projectiles/Ranged/FallenStarAura.png rename to Projectiles/StarTrail.png diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index 8cf239ad5b..85db83bbed 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -6,6 +6,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.StatDebuffs; namespace CalamityMod.Projectiles.Summon { @@ -245,6 +246,9 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 90); + SoundEngine.PlaySound(SoundID.Item70 with { Volume = SoundID.Item70.Volume * 0.5f}, Projectile.Center); Projectile.velocity = new Vector2(0f, 5f).RotatedBy(Projectile.velocity.ToRotation() + 1.5f); int sand = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), (int)(Projectile.knockBack * 0.7f), Projectile.owner, 0f, 0f); diff --git a/Projectiles/Summon/AquasScepterCloud.cs b/Projectiles/Summon/AquasScepterCloud.cs new file mode 100644 index 0000000000..91acccd2d2 --- /dev/null +++ b/Projectiles/Summon/AquasScepterCloud.cs @@ -0,0 +1,102 @@ +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AquasScepterCloud : ModProjectile + { + public ref float LightningTimer => ref Projectile.ai[0]; + public ref float RainTimer => ref Projectile.ai[1]; + + public override void SetStaticDefaults() { + DisplayName.SetDefault("Storm Cloud"); + // Sets the amount of frames this minion has on its spritesheet + Main.projFrames[Projectile.type] = 5; + } + + public sealed override void SetDefaults() { + Projectile.width = 252; + Projectile.height = 78; + Projectile.hide = true; + Projectile.tileCollide = false; + Projectile.timeLeft = Projectile.SentryLifeTime; + Projectile.friendly = true; + Projectile.sentry = true; + Projectile.DamageType = DamageClass.Summon; + Projectile.penetrate = -1; + Projectile.light = 1f; + } + + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindProjectiles.Add(index); + behindNPCs.Add(index); + } + + public override bool? CanDamage() => false; + + public override Color? GetAlpha(Color drawColor) + { + return Color.White; + } + + public override void AI() { + float distanceFromTarget = 700f; + var targetCenter = Projectile.position; + bool foundTarget = false; + + LightningTimer++; + RainTimer++; + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + if (RainTimer >= 3f) // Spawns a raindrop every 3 frames, displaced down and randomly along the length of the cloud + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), (Projectile.Center.X + Main.rand.Next(-110, 111)), (Projectile.Center.Y + 57f), 0f, 15f, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + + RainTimer = 0f; + } + + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + + if (npc.CanBeChasedBy()) + { + float between = Vector2.Distance(npc.Center, Projectile.Center); + bool closest = Vector2.Distance(Projectile.Center, targetCenter) > between; + bool inRange = between < distanceFromTarget; + + if ((closest && inRange) || !foundTarget) + { + distanceFromTarget = between; + targetCenter = npc.Center; + foundTarget = true; + } + } + } + if (foundTarget) { + if (distanceFromTarget < 300) { + if (LightningTimer >= 60f) { //Every 60 AI cycles, plays the lightning sound and spawns 2 projectiles: the tesla aura for dealing damage in an aoe, and the cloud flash to simulate the brightness of the main cloud changing. + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura")); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (Projectile.damage*8), 16, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0, Projectile.owner); + LightningTimer = 0f; + } + } + } + } + } +} diff --git a/Projectiles/Summon/AquasScepterCloud.png b/Projectiles/Summon/AquasScepterCloud.png new file mode 100644 index 0000000000..f51a5db6ae Binary files /dev/null and b/Projectiles/Summon/AquasScepterCloud.png differ diff --git a/Projectiles/Summon/AquasScepterCloudFlash.cs b/Projectiles/Summon/AquasScepterCloudFlash.cs new file mode 100644 index 0000000000..22f63bde39 --- /dev/null +++ b/Projectiles/Summon/AquasScepterCloudFlash.cs @@ -0,0 +1,30 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AquasScepterCloudFlash : ModProjectile + { + public override void SetStaticDefaults() { + DisplayName.SetDefault("Storm Cloud Flash"); + // Sets the amount of frames this minion has on its spritesheet + Main.projFrames[Projectile.type] = 1; + } + + public sealed override void SetDefaults() { + Projectile.width = 252; + Projectile.height = 78; + Projectile.tileCollide = false; + Projectile.timeLeft = 27; + Projectile.penetrate = -1; + Projectile.alpha = 125; + } + + public override bool? CanDamage() => false; + + public override void AI() { + Projectile.alpha += 5; + } + } +} diff --git a/Projectiles/Summon/AquasScepterCloudFlash.png b/Projectiles/Summon/AquasScepterCloudFlash.png new file mode 100644 index 0000000000..d2deca9c47 Binary files /dev/null and b/Projectiles/Summon/AquasScepterCloudFlash.png differ diff --git a/Projectiles/Summon/AquasScepterRaindrop.cs b/Projectiles/Summon/AquasScepterRaindrop.cs new file mode 100644 index 0000000000..a8206412f7 --- /dev/null +++ b/Projectiles/Summon/AquasScepterRaindrop.cs @@ -0,0 +1,43 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AquasScepterRaindrop : ModProjectile + { + public override void SetStaticDefaults() { + DisplayName.SetDefault("Rain Droplet"); + // Sets the amount of frames this minion has on its spritesheet + Main.projFrames[Projectile.type] = 1; + } + + public sealed override void SetDefaults() //If you want to change the damage of this projectile, just change the base damage of AquasScepter, the item. Note that this will affect the damage of AquasScepterTeslaAura as well, because the damage of said projectile is set as a multiple of the base damage at the bottom of AquasScepterCloud.cs + { + Projectile.width = 20; //The sprite for the raindrop deliberately has invisible pixels added on each side of it to increase the width of the hitbox easily + Projectile.height = 48; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Summon; + Projectile.penetrate = 1; + Projectile.timeLeft = 120; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override bool? CanCutTiles() { + return false; + } + public override bool MinionContactDamage() { + return true; + } + public override void AI() + { + if (Projectile.timeLeft <= 8) + { + Projectile.Opacity -= 0.125f; + Projectile.velocity *= 0.92f; + } + } + } +} diff --git a/Projectiles/Summon/AquasScepterRaindrop.png b/Projectiles/Summon/AquasScepterRaindrop.png new file mode 100644 index 0000000000..78df290d74 Binary files /dev/null and b/Projectiles/Summon/AquasScepterRaindrop.png differ diff --git a/Projectiles/Summon/AquasScepterTeslaAura.cs b/Projectiles/Summon/AquasScepterTeslaAura.cs new file mode 100644 index 0000000000..508c1b3ffc --- /dev/null +++ b/Projectiles/Summon/AquasScepterTeslaAura.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AquasScepterTeslaAura : ModProjectile + { + static float TeslaAuraScale = 3f; //Changing this float will change the radius of the hitbox and scale of the sprite at the same time, making the visual match the hitbox no matter what size is chosen. + public bool ableToHit = true; // bool that controls the state of CanDamage() + public override void SetStaticDefaults() { + DisplayName.SetDefault("Tesla Aura"); + // Sets the amount of frames this minion has on its spritesheet + Main.projFrames[Projectile.type] = 5; + } + + public sealed override void SetDefaults() //If you want to change the damage of this projectile, look near the bottom of AquasScepterCloud.cs because this projectile's damage is set in Projectile.NewProjectile as a multiple of the AquasScepterCloud damage value + { + Projectile.width = 216; + Projectile.height = 216; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Summon; + Projectile.penetrate = -1; + Projectile.timeLeft = 27; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 28; + Projectile.alpha = 0; + } + + public override bool? CanDamage() => ableToHit ? (bool?)null : false; + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (TeslaAuraScale * 96.0f), targetHitbox); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + Projectile.damage = (int)(Projectile.damage * 0.6f); + } + + public override void AI() { + Projectile.scale = TeslaAuraScale; + Projectile.alpha += 11; + Projectile.ai[0]++; + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + if (Projectile.ai[0] > 8f) //After the Tesla Aura has been alive for 8 frames, disables it's ability to deal damage. This is done so that there is some leniency on allowing new enemies to enter the damaging range for a bit to make the sentry feel better to use. + { + ableToHit = false; + } + } + } +} diff --git a/Projectiles/Summon/AquasScepterTeslaAura.png b/Projectiles/Summon/AquasScepterTeslaAura.png new file mode 100644 index 0000000000..ff1ca22977 Binary files /dev/null and b/Projectiles/Summon/AquasScepterTeslaAura.png differ diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index fb5b76ab0e..bc4f44ba07 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -9,6 +9,12 @@ namespace CalamityMod.Projectiles.Summon { public class AquaticStarMinion : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public ref float CheckForSpawning => ref Projectile.localAI[0]; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Star"); @@ -18,46 +24,52 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = Projectile.height = 32; + Projectile.width = 34; + Projectile.height = 32; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.minionSlots = 1; - Projectile.timeLeft = 18000; Projectile.penetrate = -1; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 35; } public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - bool flag64 = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) { - if (player.dead) - { - modPlayer.aStar = false; - } - if (modPlayer.aStar) - { + if (Owner.dead) + moddedOwner.aquaticStar = false; + if (moddedOwner.aquaticStar) Projectile.timeLeft = 2; - } } - Projectile.rotation += Projectile.velocity.X * 0.04f; + // Checks if the minion can still exist. - Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 9.5f, false, false); + if (CheckForSpawning == 0f) + { + for (int i = 0; i < 45; i++) + { + float angle = MathHelper.TwoPi / 45f * i; + Vector2 direction = angle.ToRotationVector2() * 10f; + + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 33, direction); + spawnDust.noGravity = true; + } + CheckForSpawning++; + } + // Does a dust effect where the minion spawns. + + Projectile.rotation += Projectile.velocity.X * 0.04f; + // Make the minion spin depending on how fast it is. + + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, false, false, 1); } public override bool OnTileCollide(Vector2 oldVelocity) => false; - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 5; - } } } diff --git a/Projectiles/Summon/AstralProbeRound.cs b/Projectiles/Summon/AstralProbeRound.cs index 5d0afa6a98..9c2ca80687 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -5,65 +5,68 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; + namespace CalamityMod.Projectiles.Summon { public class AstralProbeRound : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/Ranged/AstralRound"; + public override string Texture => "CalamityMod/Projectiles/Boss/AstralLaser"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Blast"); - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + DisplayName.SetDefault("Astral Probe Laser"); + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.timeLeft = 600; + Projectile.penetrate = 1; + + Projectile.width = 62; + Projectile.height = 20; + Projectile.alpha = 125; + + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.minionSlots = 0f; Projectile.minion = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 2; - Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0.3f, 0.5f, 0.1f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Main.rand.NextBool(3)) + Projectile.rotation = Projectile.velocity.ToRotation(); // The projectile looks at where it's going. + + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 3 % Main.projFrames[Projectile.type]; + // The projectile does it's animation. + + Lighting.AddLight(Projectile.Center, Vector3.One * 0.1f); // The projectile emtis light. + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + for (int i = 0; i < Projectile.oldPos.Length; i++) { - int randomDust = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.DustType(), - ModContent.DustType() - }); - int astral = Dust.NewDust(Projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); - Main.dust[astral].alpha = Projectile.alpha; - Main.dust[astral].velocity *= 0f; - Main.dust[astral].noGravity = true; + Color afterimageDrawColor = Color.White with { A = 25 } * Projectile.Opacity * (1f - i / (float)Projectile.oldPos.Length); + Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(texture, afterimageDrawPosition, frame, afterimageDrawColor, Projectile.rotation, origin, Projectile.scale, direction, 0); } - NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Main.player[Projectile.owner]); - if (potentialTarget != null) - Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 17f) / 21f; - } + // Makes the projectile have afterimages. - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; + return true; } public override void Kill(int timeLeft) @@ -71,15 +74,11 @@ namespace CalamityMod.Projectiles.Summon SoundEngine.PlaySound(SoundID.Item10, Projectile.position); for (int k = 0; k < 5; k++) { - int randomDust = Main.rand.Next(2); - if (randomDust == 0) + int randomDust = Utils.SelectRandom(Main.rand, new int[] { - randomDust = ModContent.DustType(); - } - else - { - randomDust = ModContent.DustType(); - } + ModContent.DustType(), + ModContent.DustType() + }); Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index 986248a916..4f19dc0356 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -11,8 +11,31 @@ namespace CalamityMod.Projectiles.Summon { public class AstralProbeSummon : ModProjectile { - private double rotation = 0; - private double rotationVariation = 0; + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public ref float AITimer => ref Projectile.ai[0]; + + public ref float TimerForShooting => ref Projectile.ai[1]; + + public int ProbeIndex; + + public bool CheckForSpawning = false; + + public float ProbePositionAngle // Calculates where each minion should be placed. + { + get + { + float probeCount = Owner.ownedProjectileCounts[Type]; + if (probeCount <= 1f) + probeCount = 1f; + + return MathHelper.TwoPi * ProbeIndex / probeCount + AITimer * 0.025f; + // "MathHelper.TwoPi / ProbeIndex * probeCount"s the position itself. + // "AITimer * [Modifier]"s how fast it spins. + } + } public override void SetStaticDefaults() { @@ -23,101 +46,112 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 22; - Projectile.height = 22; - Projectile.ignoreWater = true; Projectile.minionSlots = 1f; - Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + + Projectile.width = 36; + Projectile.height = 30; + + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.friendly = true; - Projectile.timeLeft *= 5; - Projectile.penetrate = -1; Projectile.minion = true; - Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - rotationVariation = Main.rand.NextDouble() * 0.015; + NPC target = Projectile.Center.MinionHoming(2500f, Owner); // Detects a target at a certain distance. + + Vector2 idleDestination = Owner.Center + ProbePositionAngle.ToRotationVector2() * 150f; + Projectile.Center = Vector2.Lerp(Projectile.Center, idleDestination, 0.15f); + AITimer++; + // Makes the projectile be around the player and evenly spaced-out from eachother. - int dustAmt = 36; + CheckMinionExistince(); // Checks if the minion can still exist. + SpawnEffect(); // Makes a dust spawn effect where the minion spawns. + LookInCorrectDirection(target); // Looks at the target. + ShootTarget(target); // Shoots at the target if there's one + } + + #region Methods + + public void CheckMinionExistince() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + moddedOwner.astralProbe = false; + if (moddedOwner.astralProbe) + Projectile.timeLeft = 2; + } + } + + public void SpawnEffect() + { + if (CheckForSpawning == false) + { + int dustAmt = 120; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 dustSource = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - dustSource = dustSource.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; - Vector2 dustVel = dustSource - Projectile.Center; - int astral = Dust.NewDust(dustSource + dustVel, 0, 0, (Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType()), dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f); - Main.dust[astral].noGravity = true; - Main.dust[astral].velocity = dustVel; - } - Projectile.localAI[0] += 1f; - } - bool correctMinion = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (correctMinion) - { - if (player.dead) - { - modPlayer.aProbe = false; - } - if (modPlayer.aProbe) - { - Projectile.timeLeft = 2; - } - } - NPC target = Projectile.Center.MinionHoming(1000f, player, true, true); - Vector2 vector = player.Center - Projectile.Center; - if (target != null) - { - Projectile.spriteDirection = Projectile.direction = ((target.Center.X - Projectile.Center.X) > 0).ToDirectionInt(); - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(target.Center) + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi), 0.1f); - } - else - { - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.rotation.AngleLerp(vector.ToRotation() - (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi * Projectile.direction), 0.1f); - } - Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - rotation += 0.03 + rotationVariation; - if (rotation >= 360) - { - rotation = 0; - } - Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; + float angle = MathHelper.TwoPi / dustAmt * dustIndex; + Vector2 velocity = angle.ToRotationVector2() * 10f; + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); - if (Projectile.ai[1] > 0f) - { - Projectile.ai[1] += (float)Main.rand.Next(1, 3); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, randomDust, velocity); + spawnDust.customData = false; + spawnDust.noGravity = true; + spawnDust.velocity *= 0.3f; + spawnDust.scale = velocity.Length() * 0.1f; + } + CheckForSpawning = true; } - if (Projectile.ai[1] > 80f) - { - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } - float speedMult = 6f; - int projType = ModContent.ProjectileType(); - if (target != null && Projectile.ai[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item12 with { Volume = SoundID.Item12.Volume * 0.5f }, Projectile.position); - Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner) - { - Vector2 velocity = target.Center - Projectile.Center; - velocity.Normalize(); - velocity *= speedMult; - int round = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, 0f, Projectile.owner, target.whoAmI, 0f); - if (Main.projectile.IndexInRange(round)) - Main.projectile[round].originalDamage = Projectile.originalDamage; + } + public void LookInCorrectDirection(NPC target) // I feel really fucking proud of how organized I made it. ~Memes + { + Vector2 lookHere = (target is not null) ? target.Center : Main.MouseWorld; // Looks at the mouse if there's no enemy, if there is one, it'll look at the enemy. + int direction = (lookHere.X - Projectile.Center.X > 0).ToDirectionInt(); // If the target is at it's right, look at the right, if not, at it's left. + float rotation = (lookHere - Projectile.Center).ToRotation(); // Points directly at the target. + + Projectile.spriteDirection = direction; + Projectile.rotation = (direction == -1) ? rotation + MathHelper.Pi : rotation; + // When the target is at the left, the sprite will flip, but not the rotation, meaning it'll be looking in the opposite direction, so we rotate it 180º degrees if so. + + Projectile.netUpdate = true; + } + + public void ShootTarget(NPC target) + { + if (target != null && Main.myPlayer == Projectile.owner) + { + if (TimerForShooting == 80f) + { + Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, 35f); + + int laser = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(laser)) + Main.projectile[laser].originalDamage = Projectile.originalDamage; + + SoundEngine.PlaySound(SoundID.Item12 with { Volume = SoundID.Item12.Volume * 0.5f, PitchVariance = 1f }, Projectile.position); + + TimerForShooting = 0f; Projectile.netUpdate = true; } + + if (TimerForShooting < 80f) + TimerForShooting++; } } public override bool? CanDamage() => false; + + #endregion } } diff --git a/Projectiles/Summon/AtlasMunitionsLaser.cs b/Projectiles/Summon/AtlasMunitionsLaser.cs index 0364e96c94..10ac9db9b0 100644 --- a/Projectiles/Summon/AtlasMunitionsLaser.cs +++ b/Projectiles/Summon/AtlasMunitionsLaser.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Exo Pulse Laser"); Main.projFrames[Type] = 4; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/BelladonnaPetal.cs b/Projectiles/Summon/BelladonnaPetal.cs index cf26e0fd6d..4812eb10e4 100644 --- a/Projectiles/Summon/BelladonnaPetal.cs +++ b/Projectiles/Summon/BelladonnaPetal.cs @@ -1,49 +1,146 @@ 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.Summon { public class BelladonnaPetal : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + + public ref float AITimer => ref Projectile.ai[0]; // The timer for the AI to do it's actions. + + public ref float CheckForFiring => ref Projectile.ai[1]; // Check for when it's about to fire, so we can put one-time effects and sounds. + + public NPC targetFound; // A variable where the potential target will be written on. + public override void SetStaticDefaults() { - DisplayName.SetDefault("Bullet"); + DisplayName.SetDefault("Belladonna Petal"); ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 12; + Projectile.width = 14; + Projectile.height = 24; Projectile.friendly = true; Projectile.minion = true; Projectile.minionSlots = 0f; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 360; + Projectile.timeLeft = 130; Projectile.DamageType = DamageClass.Summon; } + public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.velocity.X *= 0.99f; - if (Projectile.velocity.Y < 9f) - Projectile.velocity.Y += 0.085f; - Projectile.tileCollide = Projectile.timeLeft <= 180; + { + if (Owner.HasMinionAttackTargetNPC) // If the Owner has selected for a target manually, go for that one. + { + NPC manualTarget = Main.npc[Owner.MinionAttackTargetNPC]; + Behaviour(manualTarget); + } + else // If not, go for the closest one. + { + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Owner); + Behaviour(potentialTarget); + } + + AITimer++; + AITimer = (AITimer > 60f) ? 60f : AITimer; // AITimer can reach only a maximun of 60. + Lighting.AddLight(Projectile.Center, 0.5f, 1f, 0.3f); // Gives it a jungl-y green color. } + + #region Methods + + public void Behaviour(NPC target) + { + if (target != null && AITimer >= 60f) // If the target is found, and 1 second has passed, do effects and go to the target. + { + Projectile.alpha = 0; + for (int i = 0; i < 5; i++) + { + Dust gotTarget = Dust.NewDustPerfect(Projectile.Center, DustID.Grass); + gotTarget.velocity = Main.rand.NextVector2Circular(2f, 2f); + gotTarget.noGravity = true; + } + if (CheckForFiring == 0f) // Check for it so it doesn't update the velocity indefinetly, meaning it would be homing. + { + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, targetFound, 20f); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + SoundEngine.PlaySound(SoundID.Grass, Projectile.Center); + CheckForFiring = 1f; + Projectile.netUpdate= true; + } + } + else if (target != null && AITimer < 60f) // If there's target, but 1 second hasn't passed, rotate to point at the target, while still having gravity. + { + Projectile.velocity.Y += 0.2f; + Projectile.rotation = MathHelper.Lerp(Projectile.rotation, (target.Center - Projectile.Center).ToRotation() + MathHelper.PiOver2, AITimer / 60f); + // (AITimer / 60f) because 60 is maximum time of the timer. + targetFound = target; + // Puts the potentialTarget on this variable that won't update constantly so the projectile doesn't become incredibly homing. + Projectile.netUpdate = true; + } + else // If there's no target when shot (For example when the enemy has been killed), just fall. + { + AITimer = 0f; // Restart the timer, just so if a target appears again it looks smoother. + Projectile.alpha += 2; + Projectile.velocity.Y += 0.2f; + Projectile.rotation += 0.05f; // Continues spinning until it dies. + Projectile.netUpdate = true; + } + } + public override void Kill(int timeLeft) { for (int i = 0; i < 5; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Grass); - dust.velocity = Main.rand.NextVector2Circular(2f, 2f); - dust.noGravity = true; + Dust projDeath = Dust.NewDustPerfect(Projectile.Center, DustID.Grass); + projDeath.velocity = Main.rand.NextVector2Circular(2f, 2f); + projDeath.noGravity = true; } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + + public override bool? CanDamage() // If the projectile is going to the target, do damage, if not, don't. { - target.AddBuff(BuffID.Poisoned, 240); + if (targetFound != null && AITimer >= 60f) + { + return null; + } + + return false; } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool PreDraw(ref Color lightColor) // Code taken from ExampleMod to make the trail. + { + Main.instance.LoadProjectile(Projectile.type); + Texture2D texture = TextureAssets.Projectile[Projectile.type].Value; + + if (CheckForFiring == 1f) + { + Vector2 drawOrigin = new Vector2(texture.Width * 0.5f, Projectile.height * 0.5f); + for (int k = 0; k < Projectile.oldPos.Length; k++) + { + Vector2 drawPos = (Projectile.oldPos[k] - Main.screenPosition) + drawOrigin + new Vector2(0f, Projectile.gfxOffY); + Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - k) / (float)Projectile.oldPos.Length); + Main.EntitySpriteDraw(texture, drawPos, null, color, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0); + } + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Poisoned, 240); + + #endregion } } diff --git a/Projectiles/Summon/BelladonnaPetal.png b/Projectiles/Summon/BelladonnaPetal.png index ddd5d1aac1..43bc9ac92d 100644 Binary files a/Projectiles/Summon/BelladonnaPetal.png and b/Projectiles/Summon/BelladonnaPetal.png differ diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index e8bece3e85..bcc9d6af2a 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -5,15 +5,19 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class BelladonnaSpirit : ModProjectile { - public float PetalFireTimer - { - get => Projectile.ai[0]; - set => Projectile.ai[0] = value; - } + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public ref float PetalFireTimer => ref Projectile.ai[0]; + + public bool CheckForSpawning = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Belladonna Spirit"); @@ -24,139 +28,138 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { + Projectile.minionSlots = 1; + Projectile.penetrate = -1; + Projectile.width = 28; Projectile.height = 48; + + Projectile.DamageType = DamageClass.Summon; Projectile.netImportant = true; Projectile.friendly = true; - Projectile.minionSlots = 1; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.tileCollide = false; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Owner); + if (potentialTarget is not null) + TargetNPC(); + + CheckMinionExistance(); // Checks if the minion can still exist. + SpawnEffect(); // Makes a dust effect where the minion spawns. + DoAnimation(); // Does the animation of the minion. + PointInDirection(potentialTarget); // Points in the right directions. + FollowPlayer(); // Vibes around the player. + Projectile.MinionAntiClump(); // The minions push eachother to not clump + } + + #region Methods + + public void CheckMinionExistance() + { + Owner.AddBuff(ModContent.BuffType(), 1); + if (Projectile.type == ModContent.ProjectileType()) { - Initialize(player); - Projectile.localAI[0] = 1f; - } - if (Projectile.frameCounter++ > 6f) - { - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; - Projectile.frameCounter = 0; - } - bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (isCorrectProjectile) - { - if (player.dead) - { - modPlayer.belladonaSpirit = false; - } - if (modPlayer.belladonaSpirit) - { + if (Owner.dead) + moddedOwner.belladonaSpirit = false; + if (moddedOwner.belladonaSpirit) Projectile.timeLeft = 2; + } + } + + public void SpawnEffect() + { + if (CheckForSpawning == false) + { + for (int i = 0; i < 45; i++) + { + float angle = MathHelper.TwoPi / 45f * i; + Vector2 velocity = angle.ToRotationVector2() * 4f; + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center + velocity * 2.75f, 39, velocity); + spawnDust.noGravity = true; + spawnDust.scale = velocity.Length() * 0.1f; + spawnDust.velocity *= 0.3f; } - } - - if (Projectile.velocity.X > 0.25f) - Projectile.spriteDirection = -1; - else if (Projectile.velocity.X < -0.25f) - Projectile.spriteDirection = 1; - - NPC potentialTarget = Projectile.Center.MinionHoming(1200f, player); - if (potentialTarget is null) - { - Vector2 targetPosition = player.Bottom; - FollowPlayer(player, targetPosition); - } - else - { - TargetNPC(potentialTarget); - } - Projectile.MinionAntiClump(); - } - public void Initialize(Player player) - { - for (int i = 0; i < 45; i++) - { - float angle = MathHelper.TwoPi / 45f * i; - Vector2 velocity = angle.ToRotationVector2() * 4f; - Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2.75f, 39, velocity); - dust.noGravity = true; + CheckForSpawning = true; } } - public void FollowPlayer(Player player, Vector2 targetPosition) + + public void DoAnimation() { - Projectile.velocity.X = (player.Center.X + player.direction * 75f - Projectile.Center.X) / 60f; - if (Projectile.Distance(player.Center) > 2500f || - targetPosition.Y - Projectile.Top.Y > 360f) + Projectile.frameCounter++; + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type]; + } + + public void PointInDirection(NPC target) + { + if (target is not null) // If there's a target look at the target. { - Projectile.Center = player.Center; + Projectile.spriteDirection = ((target.Center.X - Projectile.Center.X) < 0).ToDirectionInt(); + } + else // If there's not a target, the minion just points where it's going. + { + if (Math.Abs(Projectile.velocity.X) > 0.01f) + Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X); + } + } + + public void FollowPlayer() + { + if (Projectile.WithinRange(Owner.Center, 1200f) && !Projectile.WithinRange(Owner.Center, 300f)) // If the minion starts to get far, force the minion to go to you. + { + Projectile.velocity = (Owner.Center - Projectile.Center) / 30f; + Projectile.netUpdate= true; + } + else if (!Projectile.WithinRange(Owner.Center, 160f)) // The minion will change directions to you if it's going away from you, meaning it'll just hover around you. + { + Projectile.velocity = (Projectile.velocity * 37f + Projectile.SafeDirectionTo(Owner.Center) * 17f) / 40f; Projectile.netUpdate = true; } - else if (targetPosition.Y - Projectile.Top.Y < -550f) + + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, 1200f)) { - Projectile.velocity.Y += Math.Sign(targetPosition.Y - targetPosition.Y) * 0.08f; - } - else - { - Projectile.velocity.Y = (targetPosition.Y - Projectile.Center.Y) / 60f; + Projectile.position = Owner.Center; + Projectile.velocity *= 0.3f; + Projectile.netUpdate = true; } } - public void TargetNPC(NPC target) + + public void TargetNPC() { - Vector2 targetPosition = target.Center; - if (Math.Abs(targetPosition.X - Projectile.Center.X) < 180f) - { - Projectile.velocity.X *= 0.95f; - PetalFireTimer++; - if (Main.myPlayer == Projectile.owner) - FirePetals(target); - } - else - { - Projectile.velocity.X += (targetPosition.X - Projectile.Center.X + target.spriteDirection * 75f > 0).ToDirectionInt() * 0.5f; - Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -12f, 12f); - } - Projectile.velocity.Y = (targetPosition.Y - Projectile.Center.Y + target.spriteDirection * 75f) / 90f; + PetalFireTimer++; + Projectile.velocity.Y -= MathHelper.Lerp(0, 0.005f, PetalFireTimer % 75f); + // The minion will slowly go up until it throws the petal. + // This essentially makes the minion stay above you and trigger the "Turn back to player", it'll do this continuously, giving the effect of bouncing. + PetalFireTimer = (PetalFireTimer == 76f) ? 1f : PetalFireTimer; // The timer cannot go above 75f. + if (Main.myPlayer == Projectile.owner) + FirePetals(); + Projectile.netUpdate = true; } - public void FirePetals(NPC target) + + public void FirePetals() { int petalID = ModContent.ProjectileType(); - if (PetalFireTimer % 20f == 19f) + if (PetalFireTimer % 75f == 0f) // Every 75 frames, throws a petal. { - for (int i = -1; i <= 1; i++) + Vector2 petalShootVelocity = (-Vector2.UnitY * Main.rand.NextFloat(7f, 8.5f)) + + Vector2.UnitX * Projectile.velocity.X + + Vector2.UnitY * Projectile.velocity.Y * 0.35f; + // Throws the petal upwards with a random force and inherits the minion's speed. + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, petalShootVelocity, petalID, Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) { - float angle = Main.rand.NextFloat(-0.1f, 0.1f) + i * 0.05f; - Vector2 petalSpawnPosition = Projectile.Center - Vector2.UnitY * 6f; - Vector2 petalShootVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 7.5f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), petalSpawnPosition, petalShootVelocity, petalID, Projectile.damage, Projectile.knockBack, Projectile.owner); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Projectile.originalDamage; - } - } - - if (PetalFireTimer % 180f == 179f) - { - for (int i = 0; i < 5; i++) - { - float angle = MathHelper.Lerp(MathHelper.ToRadians(-Main.rand.NextFloat(30f, 36f)), MathHelper.ToRadians(Main.rand.NextFloat(30f, 36f)), i / 4f); - Vector2 petalSpawnPosition = Projectile.Center - Vector2.UnitY * 6f; - Vector2 petalShootVelocity = -Vector2.UnitY.RotatedBy(angle) * 9f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), petalSpawnPosition, petalShootVelocity, petalID, Projectile.damage, Projectile.knockBack, Projectile.owner); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Projectile.originalDamage; + Main.projectile[p].originalDamage = Projectile.originalDamage; + Main.projectile[p].rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); } + Projectile.netUpdate = true; } } + + public override bool? CanDamage() => false; + + #endregion } } diff --git a/Projectiles/Summon/BloodBreath.cs b/Projectiles/Summon/BloodBreath.cs index d3faffe1a4..d407d7bec7 100644 --- a/Projectiles/Summon/BloodBreath.cs +++ b/Projectiles/Summon/BloodBreath.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -76,5 +77,7 @@ namespace CalamityMod.Projectiles.Summon } Projectile.rotation += 0.3f * Projectile.direction; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index 172b910cc5..fede5a9929 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using System; @@ -223,6 +224,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(ModContent.BuffType(), 120); Projectile.ai[1] = -1f; Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/BrimstoneDartMinion.cs b/Projectiles/Summon/BrimstoneDartMinion.cs index 93d88afdec..8d08d73566 100644 --- a/Projectiles/Summon/BrimstoneDartMinion.cs +++ b/Projectiles/Summon/BrimstoneDartMinion.cs @@ -27,8 +27,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 300; Projectile.penetrate = 1; Projectile.minion = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.alpha = 255; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index 08686ed596..1a3060e7e8 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon bool flag64 = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.brimstoneWaifu && !modPlayer.allWaifus) + if (!modPlayer.brimstoneWaifu && !modPlayer.allWaifus && !modPlayer.brimstoneWaifuVanity && !modPlayer.allWaifusVanity) { Projectile.active = false; return; @@ -70,6 +70,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } + bool passive = modPlayer.brimstoneWaifuVanity || modPlayer.allWaifusVanity; Projectile.frameCounter++; if (Projectile.frameCounter > 9) { @@ -80,9 +81,12 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 0; } - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 1.25f * num, 0f * num, 0.5f * num); + if (!passive) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(Projectile.Center, 1.25f * num, 0f * num, 0.5f * num); + } if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; @@ -100,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.tileCollide = false; } - if (player.HasMinionAttackTargetNPC) + if (player.HasMinionAttackTargetNPC && !passive) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) @@ -113,7 +117,7 @@ namespace CalamityMod.Projectiles.Summon } } } - if (!flag25) + if (!flag25 && !passive) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { @@ -207,5 +211,18 @@ namespace CalamityMod.Projectiles.Summon } } } + public override bool? CanDamage() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.brimstoneWaifuVanity || modPlayer.allWaifusVanity) + { + return false; + } + else + { + return null; + } + } } } diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index b5ccdb6c66..ed097c1fee 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -9,6 +9,9 @@ namespace CalamityMod.Projectiles.Summon { public class BrittleStarMinion : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer moddedOwner => Owner.Calamity(); + public override void SetStaticDefaults() { DisplayName.SetDefault("Brittle Star"); @@ -19,38 +22,37 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { Projectile.width = 30; - Projectile.height = 30; + Projectile.height = 28; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.minionSlots = 1; - Projectile.timeLeft = 18000; Projectile.penetrate = -1; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 35; } public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - bool flag64 = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + Owner.AddBuff(ModContent.BuffType(), 1); + if (Projectile.type == ModContent.ProjectileType()) { - if (player.dead) + if (Owner.dead) { - modPlayer.bStar = false; + moddedOwner.brittleStar = false; } - if (modPlayer.bStar) + if (moddedOwner.brittleStar) { Projectile.timeLeft = 2; } } - Projectile.rotation += Projectile.velocity.X * 0.04f; - Projectile.ChargingMinionAI(600f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 9.5f, false, false); + + Projectile.rotation += Projectile.velocity.X * 0.04f; // Spins faster the faster it moves in the X-axis. + + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, false, false, 1); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/CalamariMinion.cs b/Projectiles/Summon/CalamariMinion.cs index e8990b7fbb..ee31b05bf0 100644 --- a/Projectiles/Summon/CalamariMinion.cs +++ b/Projectiles/Summon/CalamariMinion.cs @@ -33,8 +33,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.tileCollide = false; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/CataclysmSummon.cs b/Projectiles/Summon/CataclysmSummon.cs index 29dbfc0465..6e6feb4eb3 100644 --- a/Projectiles/Summon/CataclysmSummon.cs +++ b/Projectiles/Summon/CataclysmSummon.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -102,6 +103,8 @@ namespace CalamityMod.Projectiles.Summon projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.075f, 0f, 1f); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; @@ -122,7 +125,13 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70; + // TODO -- this damage should be after Terraria vanilla multipliers, so it won't one shot people + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + if (Main.masterMode) damage = 320; + else if (Main.expertMode) damage = 260; + else damage = 200; + } public override bool? CanDamage() => Projectile.Opacity >= 1f; } diff --git a/Projectiles/Summon/CatastropheSummon.cs b/Projectiles/Summon/CatastropheSummon.cs index fcce59d12e..4561740db7 100644 --- a/Projectiles/Summon/CatastropheSummon.cs +++ b/Projectiles/Summon/CatastropheSummon.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -50,6 +51,8 @@ namespace CalamityMod.Projectiles.Summon CataclysmSummon.Behavior(Projectile, Main.player[Projectile.owner], ref Time); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; @@ -70,7 +73,13 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70; + // TODO -- this damage should be after Terraria vanilla multipliers, so it won't one shot people + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + if (Main.masterMode) damage = 320; + else if (Main.expertMode) damage = 260; + else damage = 200; + } public override bool? CanDamage() => Projectile.Opacity >= 1f; } diff --git a/Projectiles/Summon/CausticStaffProjectile.cs b/Projectiles/Summon/CausticStaffProjectile.cs index 7a77de928b..b93ce3b7e7 100644 --- a/Projectiles/Summon/CausticStaffProjectile.cs +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -83,8 +83,8 @@ namespace CalamityMod.Projectiles.Summon target.AddBuff(BuffID.CursedInferno, duration); break; case 4: - if (!target.onFire) - target.AddBuff(BuffID.OnFire, duration); + if (!target.onFire3) + target.AddBuff(BuffID.OnFire3, duration); break; default: break; diff --git a/Projectiles/Summon/Cinder.cs b/Projectiles/Summon/Cinder.cs index a62c60456b..7db9d20e06 100644 --- a/Projectiles/Summon/Cinder.cs +++ b/Projectiles/Summon/Cinder.cs @@ -1,17 +1,17 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class Cinder : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public const float FallAcceleration = 0.185f; - public const float FallSpeedMax = 16; - public const float FallDelay = 300; public override void SetStaticDefaults() { DisplayName.SetDefault("Cinder"); @@ -20,76 +20,59 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 12; - Projectile.friendly = true; + Projectile.idStaticNPCHitCooldown = 10; Projectile.penetrate = 3; Projectile.timeLeft = 300; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; - Projectile.minion = true; + + Projectile.width = 12; + Projectile.height = 12; + Projectile.DamageType = DamageClass.Summon; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.minion = true; } public override void AI() { - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X *= -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X *= -0.5f; - } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y *= -0.5f; - } - Projectile.ai[0]++; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - } + SpawnDust(); + Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3()); + } - if (Projectile.ai[0] >= FallDelay && Projectile.velocity.Y < FallSpeedMax) - { - Projectile.velocity.Y += FallAcceleration; - } - - Projectile.rotation += Projectile.velocity.X * 0.1f; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[idx].position += new Vector2(2f); - Main.dust[idx].scale += Main.rand.NextFloat(0.5f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[idx].position += new Vector2(2f); - Main.dust[idx].scale += 0.3f + Main.rand.NextFloat(0.5f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity.Y -= 2f; - } - if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) - { - Projectile.velocity.X *= 0.8f; - } - Projectile.rotation = -Projectile.velocity.X * 0.05f; - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } + public void SpawnDust() + { + int bootlegTexture = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); + Main.dust[bootlegTexture].position += new Vector2(2f); + Main.dust[bootlegTexture].scale += 0.3f + Main.rand.NextFloat(0.5f); + Main.dust[bootlegTexture].noGravity = true; + Main.dust[bootlegTexture].velocity.Y -= 2f; } public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int flowerPetalCount = Main.rand.Next(3, 5 + 1); + float thetaDelta = Projectile.velocity.ToRotation(); + float weaveDistanceMin = 2f; + float weaveDistanceOutwardMax = 3f; + float weaveDistanceInner = 0.5f; + for (float theta = 0f; theta < MathHelper.TwoPi; theta += 0.05f) + { + Vector2 velocity = theta.ToRotationVector2() * + (weaveDistanceMin + + // The 0.5 in here is to prevent the petal from looping back into itself. With a 0.5 addition, it is perfect, coming back to (0,0) + // instead of weaving backwards. + (float)(Math.Sin(thetaDelta + theta * flowerPetalCount) + 0.5f + weaveDistanceInner) * + weaveDistanceOutwardMax); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Torch, velocity); + dust.noGravity = true; + dust.scale = 1.35f; + } + // Makes an orange flower made out of dust when it hits a target. + + target.AddBuff(BuffID.OnFire, 180); + } } } diff --git a/Projectiles/Summon/CinderBlossom.cs b/Projectiles/Summon/CinderBlossom.cs index 532633b8c6..6a117541a3 100644 --- a/Projectiles/Summon/CinderBlossom.cs +++ b/Projectiles/Summon/CinderBlossom.cs @@ -4,15 +4,19 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class CinderBlossom : ModProjectile { - public float Time - { - get => Projectile.ai[0]; - set => Projectile.ai[0] = value; - } + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public ref float DelayBetweenShooting => ref Projectile.ai[0]; + + public bool CheckForSpawning = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cinder Blossom"); @@ -22,73 +26,76 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 36; - Projectile.height = 40; + Projectile.minionSlots = 1f; + Projectile.penetrate = -1; + + Projectile.width = 42; + Projectile.height = 42; + + Projectile.DamageType = DamageClass.Summon; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft *= 5; Projectile.minion = true; - Projectile.DamageType = DamageClass.Summon; } public override void AI() { - bool isCorrectMinion = Projectile.type == ModContent.ProjectileType(); - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(ModContent.BuffType(), 3600); - if (isCorrectMinion) - { - if (player.dead) - { - modPlayer.cinderBlossom = false; - } - if (modPlayer.cinderBlossom) - { - Projectile.timeLeft = 2; - } - } - Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); - if (player.gravDir == -1f) - Projectile.position.Y += 120f; - Projectile.position.X = (int)Projectile.position.X; - Projectile.position.Y = (int)Projectile.position.Y; - Projectile.position = Projectile.position.Floor(); - Projectile.rotation += MathHelper.ToRadians(1.5f) * player.direction; + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Owner); - if (Projectile.localAI[0] == 0f) - { - Initialize(player); - Projectile.localAI[0] = 1f; - } - if (Projectile.owner == Main.myPlayer) - { - NPC potentialTarget = Projectile.Center.MinionHoming(700f, player); - if (potentialTarget != null) - { - if (Time++ % 35f == 34f && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) - { - Vector2 velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * Main.rand.NextFloat(10f, 18f); - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Projectile.originalDamage; - } - } - } + CheckMinionExistince(); // Checks if the minion can still exist. + EffectWhenSpawned(); // Makes a dust effect when it spawns + ShootTarget(potentialTarget); // Shoots at the target if there's one. + + Projectile.Center = Owner.Center - Vector2.UnitY * 60f; + Projectile.rotation += MathHelper.ToRadians(5f * Owner.direction); // The projectile normally will spin in the direction of the player. Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3()); } - public void Initialize(Player player) + + public void CheckMinionExistince() { - for (int i = 0; i < 36; i++) + Owner.AddBuff(ModContent.BuffType(), 1); + if (Projectile.type == ModContent.ProjectileType()) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 6); - dust.noGravity = true; - dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 6f); + if (Owner.dead) + moddedOwner.cinderBlossom = false; + if (moddedOwner.cinderBlossom) + Projectile.timeLeft = 2; + } + } + + public void EffectWhenSpawned() + { + if (CheckForSpawning == false) + { + for (int i = 0; i < 36; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 6); + dust.noGravity = true; + dust.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 6f); + } + CheckForSpawning = true; + } + } + + public void ShootTarget(NPC target) + { + if (target != null && Projectile.owner == Main.myPlayer) + { + if (DelayBetweenShooting == 35f) // Shoots once every 35 frames. + { + Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, target, 20f); + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + + DelayBetweenShooting = 0f; + Projectile.netUpdate = true; + } + + if (DelayBetweenShooting < 35f) + DelayBetweenShooting++; } } diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 7824b79cfd..77327541ed 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.cloudWaifu && !modPlayer.allWaifus) + if (!modPlayer.cloudWaifu && !modPlayer.allWaifus && !modPlayer.cloudWaifuVanity && !modPlayer.allWaifusVanity) { Projectile.active = false; return; @@ -73,9 +73,6 @@ namespace CalamityMod.Projectiles.Summon { Projectile.spriteDirection = -Projectile.direction; } - float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; - lightScalar *= Main.essScale; - Lighting.AddLight(Projectile.Center, 0.25f * lightScalar, 0.55f * lightScalar, 0.75f * lightScalar); Projectile.frameCounter++; if (Projectile.frameCounter > 6) @@ -88,7 +85,75 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } - Projectile.ChargingMinionAI(500f, 800f, 1200f, 400f, 0, 30f, 8f, 4f, new Vector2(500f, -60f), 40f, 8f, false, true, 1); + if (!modPlayer.cloudWaifuVanity && !modPlayer.allWaifusVanity) + { + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(Projectile.Center, 0.25f * lightScalar, 0.55f * lightScalar, 0.75f * lightScalar); + Projectile.ChargingMinionAI(500f, 800f, 1200f, 400f, 0, 30f, 8f, 4f, new Vector2(500f, -60f), 40f, 8f, false, true, 1); + } + else + { + //Ignore tiles so she doesn't get stuck like Optic Staff + Projectile.tileCollide = false; + + Projectile.ai[0] = 1f; + + //Player distance calculations + Vector2 playerVec = player.Center - Projectile.Center + new Vector2(500f, -60f); + float playerDist = playerVec.Length(); + + //If the minion is actively returning, move faster + float playerHomeSpeed = 6f; + if (Projectile.ai[0] == 1f) + { + playerHomeSpeed = 15f; + } + //Move somewhat faster if the player is kinda far~ish + if (playerDist > 200f && playerHomeSpeed < 8f) + { + playerHomeSpeed = 8f; + } + //Return to normal if close enough to the player + if (playerDist < 400f && Projectile.ai[0] == 1f && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + { + Projectile.ai[0] = 0f; + Projectile.netUpdate = true; + } + //Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); + Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.netUpdate = true; + } + //If more than 70 pixels away, move toward the player + if (playerDist > 70f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 40f + playerVec) / 41f; + } + //Minions never stay still + else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) + { + Projectile.velocity.X = -0.15f; + Projectile.velocity.Y = -0.05f; + } + } + } + public override bool? CanDamage() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.cloudWaifuVanity || modPlayer.allWaifusVanity) + { + return false; + } + else + { + return null; + } } } } diff --git a/Projectiles/Summon/ColdDivinityPointyThing.cs b/Projectiles/Summon/ColdDivinityPointyThing.cs index f76bb7fc72..49b6807fa3 100644 --- a/Projectiles/Summon/ColdDivinityPointyThing.cs +++ b/Projectiles/Summon/ColdDivinityPointyThing.cs @@ -232,7 +232,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Frostburn2, 300); int circlers = 0; for (int i = 0; i < Main.projectile.Length; i++) { @@ -278,7 +278,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 300); + target.AddBuff(BuffID.Frostburn2, 300); if (circlingPlayer) { recharging = 300; diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index 5b37bd165a..2957087d28 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -64,12 +65,12 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 8a7619c313..1c3db438e6 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -79,12 +80,12 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); + target.AddBuff(ModContent.BuffType(), 300); } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index ba036997fe..25c7644f77 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); } } } diff --git a/Projectiles/Summon/DaedalusGolem.cs b/Projectiles/Summon/DaedalusGolem.cs index a671f3cd72..5d1d64adbc 100644 --- a/Projectiles/Summon/DaedalusGolem.cs +++ b/Projectiles/Summon/DaedalusGolem.cs @@ -41,8 +41,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.penetrate = -1; Projectile.minion = true; Projectile.tileCollide = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/DaedalusPellet.cs b/Projectiles/Summon/DaedalusPellet.cs index 005eb70b09..1f69b0bc3b 100644 --- a/Projectiles/Summon/DaedalusPellet.cs +++ b/Projectiles/Summon/DaedalusPellet.cs @@ -27,8 +27,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = 255; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -2; Projectile.DamageType = DamageClass.Summon; } @@ -52,6 +50,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = Utils.Clamp(Projectile.alpha - 50, 0, 255); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Frostburn, 180); + public override Color? GetAlpha(Color lightColor) { return new Color(255, 255, 255, Projectile.alpha); diff --git a/Projectiles/Summon/EXPLODINGFROG.cs b/Projectiles/Summon/EXPLODINGFROG.cs index 810805b60e..d4e37379db 100644 --- a/Projectiles/Summon/EXPLODINGFROG.cs +++ b/Projectiles/Summon/EXPLODINGFROG.cs @@ -3,6 +3,9 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.Projectiles.Summon { public class EXPLODINGFROG : ModProjectile diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/ElementalAxeMinion.cs index 4d6e6a074c..32f1a3696f 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/ElementalAxeMinion.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Summon; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -70,12 +69,5 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } } } diff --git a/Projectiles/Summon/EndoBeam.cs b/Projectiles/Summon/EndoBeam.cs index acc959b21b..13f3bfb203 100644 --- a/Projectiles/Summon/EndoBeam.cs +++ b/Projectiles/Summon/EndoBeam.cs @@ -142,9 +142,9 @@ namespace CalamityMod.Projectiles.Summon { return false; } - Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/LaserBegin", AssetRequestMode.ImmediateLoad).Value; - Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/LaserMid", AssetRequestMode.ImmediateLoad).Value; - Texture2D laserHeadTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/LaserEnd", AssetRequestMode.ImmediateLoad).Value; + Texture2D laserTailTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/EndoLaserBegin", AssetRequestMode.ImmediateLoad).Value; + Texture2D laserBodyTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/EndoLaserMid", AssetRequestMode.ImmediateLoad).Value; + Texture2D laserHeadTexture = ModContent.Request("CalamityMod/ExtraTextures/Lasers/EndoLaserEnd", AssetRequestMode.ImmediateLoad).Value; float laserLength = Projectile.localAI[1]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; diff --git a/Projectiles/Summon/EyeOfNightCell.cs b/Projectiles/Summon/EyeOfNightCell.cs index d58e43514a..08b50348a1 100644 --- a/Projectiles/Summon/EyeOfNightCell.cs +++ b/Projectiles/Summon/EyeOfNightCell.cs @@ -46,9 +46,5 @@ namespace CalamityMod.Projectiles.Summon } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) => Projectile.ModifyHitNPCSticky(4, true); - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.CursedInferno, 120); - - public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.CursedInferno, 120); } } diff --git a/Projectiles/Summon/EyeOfNightSummon.cs b/Projectiles/Summon/EyeOfNightSummon.cs index 3ee41e65d2..6ccd6b51bb 100644 --- a/Projectiles/Summon/EyeOfNightSummon.cs +++ b/Projectiles/Summon/EyeOfNightSummon.cs @@ -32,8 +32,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.extraUpdates = 1; Projectile.tileCollide = false; Projectile.minion = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 19; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index ec91a3cf1c..7ca4bcaa50 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -201,6 +202,8 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); + // Create an explosion and rebound on hitting an NPC if a ram is happening. if (RamCountdown > 0f) { diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 596223165a..5b0b6c99e6 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -3,6 +3,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; + namespace CalamityMod.Projectiles.Summon { public class FlameBlast : ModProjectile @@ -76,6 +78,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 25f) / 21f; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 826ae6c0ca..43c14d46e3 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -3,6 +3,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; + namespace CalamityMod.Projectiles.Summon { public class FlameBurst : ModProjectile @@ -76,6 +78,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (Projectile.velocity * 20f + Projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 21f; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) diff --git a/Projectiles/Summon/FlyingOrthoceraStream.cs b/Projectiles/Summon/FlyingOrthoceraStream.cs index d4c8ff231e..922a9ee888 100644 --- a/Projectiles/Summon/FlyingOrthoceraStream.cs +++ b/Projectiles/Summon/FlyingOrthoceraStream.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -68,9 +69,11 @@ namespace CalamityMod.Projectiles.Summon Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f; } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Summon/FrogGore1.cs b/Projectiles/Summon/FrogGore1.cs index ce6cfeb8a7..e311d3fbe4 100644 --- a/Projectiles/Summon/FrogGore1.cs +++ b/Projectiles/Summon/FrogGore1.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() @@ -36,6 +37,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y += 0.2f; Projectile.rotation += Projectile.velocity.X * 0.03f; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 720); + public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) diff --git a/Projectiles/Summon/FrogGore2.cs b/Projectiles/Summon/FrogGore2.cs index 8ee1094fbb..8addb0e687 100644 --- a/Projectiles/Summon/FrogGore2.cs +++ b/Projectiles/Summon/FrogGore2.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() @@ -36,6 +37,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y += 0.2f; Projectile.rotation += Projectile.velocity.X * 0.03f; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 720); + public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) diff --git a/Projectiles/Summon/FrogGore3.cs b/Projectiles/Summon/FrogGore3.cs index c43fe821e3..c6fe7904e8 100644 --- a/Projectiles/Summon/FrogGore3.cs +++ b/Projectiles/Summon/FrogGore3.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() @@ -36,6 +37,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y += 0.2f; Projectile.rotation += Projectile.velocity.X * 0.03f; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 720); + public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) diff --git a/Projectiles/Summon/FrogGore4.cs b/Projectiles/Summon/FrogGore4.cs index 369e62e5cc..66eac6263f 100644 --- a/Projectiles/Summon/FrogGore4.cs +++ b/Projectiles/Summon/FrogGore4.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() @@ -36,6 +37,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y += 0.2f; Projectile.rotation += Projectile.velocity.X * 0.03f; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 720); + public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) diff --git a/Projectiles/Summon/FrogGore5.cs b/Projectiles/Summon/FrogGore5.cs index 3e73944d7f..21d694c022 100644 --- a/Projectiles/Summon/FrogGore5.cs +++ b/Projectiles/Summon/FrogGore5.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gore from a not frog of the explosive variety"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() @@ -36,6 +37,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity.Y += 0.2f; Projectile.rotation += Projectile.velocity.X * 0.03f; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 720); + public override void Kill(int timeLeft) { for (int i = 0; i < Main.rand.Next(4, 8 + 1); i++) diff --git a/Projectiles/Summon/GastricBelcherVomit.cs b/Projectiles/Summon/GastricBelcherVomit.cs index 9f2f089325..b08b9d4295 100644 --- a/Projectiles/Summon/GastricBelcherVomit.cs +++ b/Projectiles/Summon/GastricBelcherVomit.cs @@ -4,6 +4,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.Projectiles.Summon { public class GastricBelcherVomit : ModProjectile @@ -37,6 +39,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Venom, 120); + public override void Kill(int timeLeft) { SoundEngine.PlaySound(SoundID.Dig, Projectile.position); diff --git a/Projectiles/Summon/GhostFire.cs b/Projectiles/Summon/GhostFire.cs index 855bfd6bce..b8533cfe3a 100644 --- a/Projectiles/Summon/GhostFire.cs +++ b/Projectiles/Summon/GhostFire.cs @@ -1,49 +1,135 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class GhostFire : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool ableToHit = true; + public NPC target; public override void SetStaticDefaults() { - DisplayName.SetDefault("Fire"); + DisplayName.SetDefault("Ghastly Particle"); ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = Projectile.height = 16; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 80; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 50; + Projectile.penetrate = 200; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 600; Projectile.minion = true; Projectile.minionSlots = 0f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 50; Projectile.DamageType = DamageClass.Summon; } + public override bool? CanDamage() => ableToHit ? (bool?)null : false; public override void AI() { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 6f) + Player player = Main.player[Projectile.owner]; + Projectile.localAI[0] += 1f / (Projectile.extraUpdates + 1); + + if (Projectile.penetrate < 200) //If an enemy has already been hit by the projectile, prevents any further homing capabilities { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * 0.25f; - Projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 180, 0f, 0f, 0, default, 0.2f); - Main.dust[num448].position = vector33; - Main.dust[num448].noGravity = true; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; + if (Projectile.timeLeft > 60) { Projectile.timeLeft = 60; } //The projectile start shrinking and slowing down. it can still hit for a bit during this, to allow a bit of multi-target if the enemies are really close to eachother. + Projectile.velocity *= 0.88f; } + else if (Projectile.localAI[0] < 60f) //If the projectile hasn't been alive for 1 second yet, slow it down more every frame and prevent any homing capabilities. + { + Projectile.velocity *= 0.93f; + } + else FindTarget(player); //No barricades stand in our way. FIND AND KILL! + + if (Projectile.timeLeft <= 20) //removes projectile's ability to hit when it is super close to death because it will have been visually shrunk to almost nothing in PreDraw + { + ableToHit = false; + } + } + public void FindTarget(Player player) + { + float maxDistance = 3000f; + bool foundTarget = false; + if (player.HasMinionAttackTargetNPC) //Targetted enemy takes priority for homing no matter what. + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < maxDistance) + { + maxDistance = targetDist; + foundTarget = true; + target = npc; + } + } + } + if (!foundTarget) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < maxDistance) + { + maxDistance = targetDist; + foundTarget = true; + target = npc; + } + } + } + } + if (!foundTarget) //If the enemy that the projectile was heading towards died prematurely, slow down the projectile if there are no new targets. + { + Projectile.velocity *= 0.98f; + } + else KillTheThing(target); //If there is an npc found, seek and destroy. + } + public void KillTheThing(NPC npc) + { + Projectile.velocity = Projectile.SuperhomeTowardsTarget(npc, 50f/(Projectile.extraUpdates+1), 60f / (Projectile.extraUpdates + 1), 1f / (Projectile.extraUpdates + 1)); //predictionStrength is lessened to account for extra updates, otherwise the projectile tends to copy fast NPC movement 1:1. Not Cool. + } + public override bool PreDraw(ref Color lightColor) //photoviscerator ball drawcode, slightly edited + { + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 32f + Main.GlobalTimeWrappedHourly / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + Color color = Color.Lerp(Color.Cyan, Color.LightBlue, colorInterpolation) * 0.4f; + color.A = 0; + Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2 (-28f, -28f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. + Color outerColor = color; + Color innerColor = color * 0.5f; + float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length); + if (Projectile.timeLeft <= 60) //Shrinks to nothing when projectile is nearing death + { + intensity *= Projectile.timeLeft / 60f; + } + // Become smaller the futher along the old positions we are. + Vector2 outerScale = new Vector2(1f) * intensity; + Vector2 innerScale = new Vector2(1f) * intensity * 0.7f; + outerColor *= intensity; + innerColor *= intensity; + Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.6f, SpriteEffects.None, 0); + } + return false; } } } diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index 748d5861c2..4cb30dd88d 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -67,8 +67,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.tileCollide = false; Projectile.alpha = 255; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 11; Projectile.DamageType = DamageClass.Summon; } public override void AI() diff --git a/Projectiles/Summon/HallowedStarSummon.cs b/Projectiles/Summon/HallowedStarSummon.cs index 5c8f0de851..3777619140 100644 --- a/Projectiles/Summon/HallowedStarSummon.cs +++ b/Projectiles/Summon/HallowedStarSummon.cs @@ -1,6 +1,6 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -81,11 +81,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - public override Color? GetAlpha(Color lightColor) { return new Color(200, 45, 250, Projectile.alpha); @@ -93,6 +88,41 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { + Texture2D tex = ModContent.Request(Texture).Value; + Vector2 offsets = new Vector2(0f, Projectile.gfxOffY) - Main.screenPosition; + Color alpha = Projectile.GetAlpha(lightColor); + Rectangle spriteRec = new Microsoft.Xna.Framework.Rectangle(0, 0, tex.Width, tex.Height); + Vector2 spriteOrigin = spriteRec.Size() / 2f; + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D aura = ModContent.Request("CalamityMod/Projectiles/StarTrail").Value; + Vector2 drawStart = Projectile.Center + Projectile.velocity; + Vector2 drawStart2 = Projectile.Center - Projectile.velocity * 0.5f; + Vector2 spinPoint = new Vector2(0f, -10f); + float time = Main.player[Projectile.owner].miscCounter % 216000f / 60f; + Rectangle auraRec = aura.Frame(); + Color purple = Color.Purple * 0.2f; + Color white = Color.White * 0.5f; + white.A = 0; + purple.A = 0; + Vector2 auraOrigin = new Vector2(auraRec.Width / 2f, 10f); + + //Draw the aura + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time), auraRec, purple, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.5f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.TwoPi / 3f), auraRec, purple, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.1f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.Pi * 4f / 3f), auraRec, purple, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.3f, SpriteEffects.None, 0); + for (float d = 0f; d < 1f; d += 0.5f) + { + float scaleMult = time % 0.5f / 0.5f; + scaleMult = (scaleMult + d) % 1f; + float colorMult = scaleMult * 2f; + if (colorMult > 1f) + { + colorMult = 2f - colorMult; + } + Main.EntitySpriteDraw(aura, drawStart2 + offsets, auraRec, white * colorMult, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); + } + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 37fcec9365..1e34673fcd 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -11,7 +10,11 @@ namespace CalamityMod.Projectiles.Summon { public class HerringMinion : ModProjectile { - public int dust = 3; + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public int dustEffect = 3; public override void SetStaticDefaults() { @@ -23,84 +26,74 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = 60; + Projectile.height = 24; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.minionSlots = 0.5f; - Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity= true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (dust > 0) + CheckMinionExistance(); // Checks if the minion can still exist. + SpawnEffect(); // Does a dust effectw where it spawns. + DoAnimation(); // Does the animation of the minion. + PointInRightDirection(); // Points at where it's going. + + Projectile.rotation = Projectile.velocity.X * 0.05f; // Does a little movement effect with it's rotation when it's moving. + + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, true, true, 1); + } + + public void CheckMinionExistance() + { + Owner.AddBuff(ModContent.BuffType(), 1); + if (Projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + moddedOwner.herring = false; + if (moddedOwner.herring) + Projectile.timeLeft = 2; + } + } + + public void SpawnEffect() + { + if (dustEffect > 0) { int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; + Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default) + Projectile.Center; Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 33, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Water, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } - dust--; + dustEffect--; } - if (Math.Abs(Projectile.velocity.X) > 0.2f) - { - Projectile.spriteDirection = Projectile.direction; - } - Projectile.rotation = Projectile.velocity.X * 0.005f; + } + + public void DoAnimation() + { Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - - bool flag64 = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.herring = false; - } - if (modPlayer.herring) - { - Projectile.timeLeft = 2; - } - } - - Projectile.ChargingMinionAI(600f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 7f, false, true); + Projectile.frame = Projectile.frameCounter / 8 % Main.projFrames[Projectile.type]; } - public override bool PreDraw(ref Color lightColor) + public void PointInRightDirection() { - SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = texture2D13.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); - return false; + if (Math.Abs(Projectile.velocity.X) > 0.1f) + Projectile.spriteDirection = Math.Sign(Projectile.velocity.X); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[Projectile.owner] = 8; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Summon/IceSentryFrostBolt.cs b/Projectiles/Summon/IceSentryFrostBolt.cs index d1cafe7f7a..bdd92e95fc 100644 --- a/Projectiles/Summon/IceSentryFrostBolt.cs +++ b/Projectiles/Summon/IceSentryFrostBolt.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 60); + target.AddBuff(BuffID.Frostburn2, 60); } } } diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs index 20434fe039..cd0e7fb9c9 100644 --- a/Projectiles/Summon/IgneousBlade.cs +++ b/Projectiles/Summon/IgneousBlade.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon { Vector2 spawnPosition = target.Center - new Vector2(0f, 550f).RotatedByRandom(MathHelper.ToRadians(8f)); int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, Vector2.Normalize(target.Center - spawnPosition) * 24f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.666), Projectile.knockBack, Projectile.owner); + Projectile.damage, Projectile.knockBack, Projectile.owner); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Projectile.originalDamage; } diff --git a/Projectiles/Summon/IrradiatedAura.cs b/Projectiles/Summon/IrradiatedAura.cs index 27da33b0b3..4a976443d4 100644 --- a/Projectiles/Summon/IrradiatedAura.cs +++ b/Projectiles/Summon/IrradiatedAura.cs @@ -58,12 +58,12 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 480); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 480); } } } diff --git a/Projectiles/Summon/LanternFlame.cs b/Projectiles/Summon/LanternFlame.cs index 94e70654f6..72e965f438 100644 --- a/Projectiles/Summon/LanternFlame.cs +++ b/Projectiles/Summon/LanternFlame.cs @@ -89,7 +89,6 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); if (playSound) { SoundEngine.PlaySound(SoundID.Item74, Projectile.position); diff --git a/Projectiles/Summon/LostSoulGiant.cs b/Projectiles/Summon/LostSoulGiant.cs index 77b5c50114..85f83dde27 100644 --- a/Projectiles/Summon/LostSoulGiant.cs +++ b/Projectiles/Summon/LostSoulGiant.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Summon Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/LostSoulGold.cs b/Projectiles/Summon/LostSoulGold.cs index 6ef69c1fda..5205e7a9a8 100644 --- a/Projectiles/Summon/LostSoulGold.cs +++ b/Projectiles/Summon/LostSoulGold.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Summon Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/LostSoulLarge.cs b/Projectiles/Summon/LostSoulLarge.cs index 3019e30bad..5e05e7fde7 100644 --- a/Projectiles/Summon/LostSoulLarge.cs +++ b/Projectiles/Summon/LostSoulLarge.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Summon Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/LostSoulSmall.cs b/Projectiles/Summon/LostSoulSmall.cs index 5ba4d93582..4d843a4001 100644 --- a/Projectiles/Summon/LostSoulSmall.cs +++ b/Projectiles/Summon/LostSoulSmall.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Summon Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() diff --git a/Projectiles/Summon/MagicAxe.cs b/Projectiles/Summon/MagicAxe.cs deleted file mode 100644 index fbd5ac15d9..0000000000 --- a/Projectiles/Summon/MagicAxe.cs +++ /dev/null @@ -1,88 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class MagicAxe : ModProjectile - { - private int counter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Axe"); - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - ProjectileID.Sets.MinionShot[Projectile.type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 52; - Projectile.height = 52; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.minionSlots = 0; - Projectile.timeLeft = 180; - Projectile.penetrate = -1; - Projectile.minion = true; - Projectile.tileCollide = false; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; - Projectile.alpha = 255; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Projectile.rotation += 0.075f; - Projectile.alpha -= 50; - counter++; - if (counter == 30) - { - Projectile.netUpdate = true; - } - else if (counter < 30) - { - return; - } - - Projectile.ChargingMinionAI(MagicHat.Range, 1200f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true, 3); - } - - public override Color? GetAlpha(Color lightColor) => new Color(0, 255, 111, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - - public override void Kill(int timeLeft) - { - for (int i = 0; i < 10; i++) - { - Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); - Main.dust[dust].noGravity = true; - } - } - } -} diff --git a/Projectiles/Summon/MagicAxe.png b/Projectiles/Summon/MagicAxe.png deleted file mode 100644 index 4790f40a3f..0000000000 Binary files a/Projectiles/Summon/MagicAxe.png and /dev/null differ diff --git a/Projectiles/Summon/MagicBat.cs b/Projectiles/Summon/MagicBat.cs deleted file mode 100644 index 77b75612fa..0000000000 --- a/Projectiles/Summon/MagicBat.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class MagicBat : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Baseball Bat"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = 150; - Projectile.minion = true; - Projectile.minionSlots = 0f; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() => Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - - public override Color? GetAlpha(Color lightColor) => new Color(80, 200, 120, Projectile.alpha); - - public override void Kill(int timeLeft) - { - for (int i = 0; i < 10; i++) - { - Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); - Main.dust[dust].noGravity = true; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Summon/MagicBat.png b/Projectiles/Summon/MagicBat.png deleted file mode 100644 index b574ad0753..0000000000 Binary files a/Projectiles/Summon/MagicBat.png and /dev/null differ diff --git a/Projectiles/Summon/MagicBird.png b/Projectiles/Summon/MagicBird.png deleted file mode 100644 index b9eb9d0c27..0000000000 Binary files a/Projectiles/Summon/MagicBird.png and /dev/null differ diff --git a/Projectiles/Summon/MagicHammer.cs b/Projectiles/Summon/MagicHammer.cs deleted file mode 100644 index 2c9769a734..0000000000 --- a/Projectiles/Summon/MagicHammer.cs +++ /dev/null @@ -1,162 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class MagicHammer : ModProjectile - { - private int counter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = 60; - Projectile.height = 60; - Projectile.alpha = 255; - Projectile.friendly = true; - Projectile.minion = true; - Projectile.penetrate = 6; - Projectile.timeLeft = 180; - Projectile.tileCollide = false; - Projectile.extraUpdates = 1; - Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] > 10f && Main.rand.NextBool(3)) - { - Projectile.alpha -= 5; - if (Projectile.alpha < 50) - { - Projectile.alpha = 50; - } - } - - Projectile.rotation += 0.075f; - - counter++; - if (counter == 30) - { - Projectile.netUpdate = true; - } - else if (counter < 30) - { - return; - } - - int targetIndex = -1; - Vector2 targetVec = Projectile.Center; - float maxDistance = MagicHat.Range; - if (Projectile.localAI[0] > 0f) - { - Projectile.localAI[0] -= 1f; - } - Player player = Main.player[Projectile.owner]; - if (Projectile.ai[0] == 0f && Projectile.localAI[0] == 0f) - { - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(Projectile, false) && (Projectile.ai[0] == 0f || Projectile.ai[0] == player.MinionAttackTargetNPC + 1f)) - { - float targetDist = Vector2.Distance(npc.Center, targetVec); - if (targetDist < maxDistance) - { - targetVec = npc.Center; - targetIndex = player.MinionAttackTargetNPC; - } - } - } - else - { - for (int i = 0; i < Main.npc.Length; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(Projectile, false) && (Projectile.ai[0] == 0f || Projectile.ai[0] == i + 1f)) - { - float targetDist = Vector2.Distance(npc.Center, targetVec); - if (targetDist < maxDistance) - { - targetVec = npc.Center; - targetIndex = i; - } - } - } - } - if (targetIndex >= 0) - { - Projectile.ai[0] = targetIndex + 1f; - Projectile.netUpdate = true; - } - } - if (Projectile.localAI[0] == 0f && Projectile.ai[0] == 0f) - { - Projectile.localAI[0] = 30f; - } - bool canHome = false; - if (Projectile.ai[0] != 0f) - { - int target = (int)(Projectile.ai[0] - 1f); - NPC npc = Main.npc[target]; - if (npc.CanBeChasedBy(Projectile, false) && npc.immune[Projectile.owner] == 0) - { - float targetDist = Vector2.Distance(npc.Center, targetVec); - if (targetDist < maxDistance * 1.25f) - { - canHome = true; - targetVec = npc.Center; - } - } - else - { - Projectile.ai[0] = 0f; - canHome = false; - Projectile.netUpdate = true; - } - } - if (canHome) - { - Vector2 velocity = targetVec - Projectile.Center; - float trajectory = Projectile.velocity.ToRotation(); - float target = velocity.ToRotation(); - float rotateAmt = target - trajectory; - rotateAmt = MathHelper.WrapAngle(rotateAmt); - Projectile.velocity = Projectile.velocity.RotatedBy(rotateAmt * 0.25, default); - } - float speed = Projectile.velocity.Length(); - Projectile.velocity.Normalize(); - Projectile.velocity *= speed + 0.0025f; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override Color? GetAlpha(Color lightColor) => new Color(255, 56, 0, Projectile.alpha); - - public override void Kill(int timeLeft) - { - for (int i = 0; i < 10; i++) - { - Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); - Main.dust[dust].noGravity = true; - } - } - } -} diff --git a/Projectiles/Summon/MagicHammer.png b/Projectiles/Summon/MagicHammer.png deleted file mode 100644 index d29c139954..0000000000 Binary files a/Projectiles/Summon/MagicHammer.png and /dev/null differ diff --git a/Projectiles/Summon/MagicHat.cs b/Projectiles/Summon/MagicHat.cs deleted file mode 100644 index 2ec9cd2951..0000000000 --- a/Projectiles/Summon/MagicHat.cs +++ /dev/null @@ -1,144 +0,0 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class MagicHat : ModProjectile - { - public const float Range = 1500.0001f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magic Hat"); - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.minionSlots = 5f; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.timeLeft *= 5; - Projectile.minion = true; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = Projectile.Calamity(); - - //set up minion buffs and bools - bool hatExists = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (hatExists) - { - if (player.dead) - { - modPlayer.magicHat = false; - } - if (modPlayer.magicHat) - { - Projectile.timeLeft = 2; - } - } - - //projectile movement - Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); - if (player.gravDir == -1f) - { - Projectile.position.Y += 120f; - Projectile.rotation = MathHelper.Pi; - } - else - { - Projectile.rotation = 0f; - } - Projectile.position.X = (int)Projectile.position.X; - Projectile.position.Y = (int)Projectile.position.Y; - - //Change the summons scale size a little bit to make it pulse in and out - float scalar = (float)Main.mouseTextColor / 200f - 0.35f; - scalar *= 0.2f; - Projectile.scale = scalar + 0.95f; - - //on summon dust and flexible damage - if (Projectile.localAI[0] == 0f) - { - int dustAmt = 50; - for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) - { - int dustEffects = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 234, 0f, 0f, 0, default, 1f); - Main.dust[dustEffects].velocity *= 2f; - Main.dust[dustEffects].scale *= 1.15f; - } - Projectile.localAI[0] += 1f; - } - - //finding an enemy, then shooting projectiles if it's detected - if (Projectile.owner == Main.myPlayer) - { - float detectionRange = Range; - bool enemyDetected = false; - - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float extraDistance = (npc.width / 2) + (npc.height / 2); - - if (Vector2.Distance(npc.Center, Projectile.Center) < (detectionRange + extraDistance)) - { - enemyDetected = true; - break; - } - } - } - if (enemyDetected) - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] % 5f == 0f) - { - int amount = Main.rand.Next(1, 2); - for (int i = 0; i < amount; i++) - { - int projType = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - float velocityX = Main.rand.NextFloat(-10f, 10f); - float velocityY = Main.rand.NextFloat(-15f, -8f); - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocityX, velocityY, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Projectile.originalDamage; - } - } - } - } - } - - //glowmask effect - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - - //no contact damage - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Summon/MagicHat.png b/Projectiles/Summon/MagicHat.png deleted file mode 100644 index 6cef86e8d3..0000000000 Binary files a/Projectiles/Summon/MagicHat.png and /dev/null differ diff --git a/Projectiles/Summon/MagicRifle.cs b/Projectiles/Summon/MagicRifle.cs deleted file mode 100644 index e322ddf061..0000000000 --- a/Projectiles/Summon/MagicRifle.cs +++ /dev/null @@ -1,240 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Summon -{ - public class MagicRifle : ModProjectile - { - private int counter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rifle"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.minionSlots = 0f; - Projectile.timeLeft = 180; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.minion = true; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - //Set player namespace - Player player = Main.player[Projectile.owner]; - - //Anti sticky movement to prevent overlapping minions - Projectile.MinionAntiClump(); - - //Try not to do anything at first - counter++; - if (counter == 30) - { - Projectile.netUpdate = true; - } - else if (counter < 30) - { - return; - } - - float homingRange = MagicHat.Range; - Vector2 targetVec = Projectile.position; - bool foundTarget = false; - //If targeting something, prioritize that enemy - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float extraDist = (npc.width / 2) + (npc.height / 2); - //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, Projectile.Center); - if (!foundTarget && targetDist < (homingRange + extraDist)) - { - homingRange = targetDist; - targetVec = npc.Center; - foundTarget = true; - } - } - } - if (!foundTarget) - { - for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) - { - NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float extraDist = (npc.width / 2) + (npc.height / 2); - //Calculate distance between target and the projectile to know if it's too far or not - float targetDist = Vector2.Distance(npc.Center, Projectile.Center); - if (!foundTarget && targetDist < (homingRange + extraDist)) - { - homingRange = targetDist; - targetVec = npc.Center; - foundTarget = true; - } - } - } - } - - //If too far, make the minion start returning to the player. - float separationAnxietyDist = 1600f; - if (foundTarget) - { - //Max travel distance increases if targeting something - separationAnxietyDist = 2600f; - } - if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) - { - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - } - - //If a target is found, move toward it - if (foundTarget && Projectile.ai[0] == 0f) - { - Vector2 vecToTarget = targetVec - Projectile.Center; - float targetDist = vecToTarget.Length(); - vecToTarget.Normalize(); - //If farther than 200 pixels, move toward it - if (targetDist > 200f) - { - float speedMult = 18f; //12 - vecToTarget *= speedMult; - Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; - } - //Otherwise, back it up slowly - else - { - float speedMult = -9f; - vecToTarget *= speedMult; - Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; - } - } - - //If not targeting something, act passively - else - { - bool returningToPlayer = false; - if (!returningToPlayer) - { - returningToPlayer = Projectile.ai[0] == 1f; - } - //Move faster if actively returning to the player - float speedMult = 12f; - if (returningToPlayer) - { - speedMult = 30f; - } - Vector2 vecToPlayer = player.Center - Projectile.Center + new Vector2(0f, -120f); - float playerDist = vecToPlayer.Length(); - //Speed up if near the player - if (playerDist < 200f && speedMult < 16f) - { - speedMult = 16f; - } - //If close enough to the player, return to normal - if (playerDist < 600f && returningToPlayer) - { - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; - } - //If abnormally far, teleport to the player - if (playerDist > 2000f) - { - Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); - Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); - Projectile.netUpdate = true; - } - //Move toward player if more than 70 pixels away - if (playerDist > 70f) - { - vecToPlayer.Normalize(); - vecToPlayer *= speedMult; - Projectile.velocity = (Projectile.velocity * 40f + vecToPlayer) / 41f; - } - //Move if still - else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) - { - Projectile.velocity.X = -0.15f; - Projectile.velocity.Y = -0.05f; - } - } - - //Update rotation - if (foundTarget) - { - Projectile.spriteDirection = Projectile.direction = ((targetVec.X - Projectile.Center.X) > 0).ToDirectionInt(); - Projectile.rotation = Projectile.rotation.AngleTowards(Projectile.AngleTo(targetVec) + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(135)), 0.1f); - } - else - { - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(45) : MathHelper.ToRadians(135)); - } - - //Increment attack cooldown - if (Projectile.ai[1] > 0f) - { - Projectile.ai[1] += Main.rand.Next(1, 4); - } - //Set the minion to be ready for attack - if (Projectile.ai[1] > 90f) - { - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } - - //Return if on attack cooldown, has no target, or returning to the player - if (Projectile.ai[0] != 0f || !foundTarget || Projectile.ai[1] != 0f) - return; - - //Shoot a bullet - if (Main.myPlayer == Projectile.owner) - { - float projSpeed = 6f; - int projType = ModContent.ProjectileType(); - if (Main.rand.NextBool(6)) - { - SoundEngine.PlaySound(SoundID.Item20 with { Volume = SoundID.Item20.Volume * 0.1f}, Projectile.position); - } - Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner) - { - Vector2 velocity = targetVec - Projectile.Center; - velocity.Normalize(); - velocity *= projSpeed; - SoundEngine.PlaySound(SoundID.Item40, Projectile.position); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, 0f, Projectile.owner); - Projectile.netUpdate = true; - } - } - } - - public override Color? GetAlpha(Color lightColor) => new Color(148, 0, 211, Projectile.alpha); - - public override bool? CanDamage() => false; - - public override void Kill(int timeLeft) - { - for (int i = 0; i < 10; i++) - { - Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); - Main.dust[dust].noGravity = true; - } - } - } -} diff --git a/Projectiles/Summon/MagicRifle.png b/Projectiles/Summon/MagicRifle.png deleted file mode 100644 index 5e84792f42..0000000000 Binary files a/Projectiles/Summon/MagicRifle.png and /dev/null differ diff --git a/Projectiles/Summon/MagicUmbrella.cs b/Projectiles/Summon/MagicUmbrella.cs deleted file mode 100644 index 4e9773b5ed..0000000000 --- a/Projectiles/Summon/MagicUmbrella.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class MagicUmbrella : ModProjectile - { - private int counter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Umbrella"); - ProjectileID.Sets.MinionShot[Projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.minionSlots = 0f; - Projectile.timeLeft = 180; - Projectile.penetrate = 10; - Projectile.tileCollide = false; - Projectile.minion = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.alpha = 255; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Projectile.rotation += 0.075f; - Projectile.alpha -= 50; - counter++; - if (counter == 30) - { - Projectile.netUpdate = true; - } - else if (counter < 30) - { - return; - } - - Projectile.ChargingMinionAI(MagicHat.Range, 1600f, 2200f, 150f, 0, 40f, 9f, 4f, new Vector2(0f, -60f), 40f, 9f, true, true); - } - - public override Color? GetAlpha(Color lightColor) => new Color(75, 255, 255, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override void Kill(int timeLeft) - { - for (int i = 0; i < 10; i++) - { - Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); - Main.dust[dust].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.NextBool(4)) - { - SpawnBaseballBats(target.Center); - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - if (Main.rand.NextBool(4)) - { - SpawnBaseballBats(target.Center); - } - } - - private void SpawnBaseballBats(Vector2 targetPos) - { - for (int n = 0; n < Main.rand.Next(1, 3); n++) //1 to 2 baseball bats - { - float x = targetPos.X + Main.rand.Next(-400, 401); - float y = targetPos.Y - Main.rand.Next(500, 801); - Vector2 source = new Vector2(x, y); - Vector2 velocity = targetPos - source; - velocity.X += Main.rand.Next(-100, 101); - float speed = 29f; - float targetDist = velocity.Length(); - targetDist = speed / targetDist; - velocity.X *= targetDist; - velocity.Y *= targetDist; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * Main.rand.NextFloat(0.3f, 0.6f)), Projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), Projectile.owner, 0f, 0f); - } - } - } -} diff --git a/Projectiles/Summon/MagicUmbrella.png b/Projectiles/Summon/MagicUmbrella.png deleted file mode 100644 index 277fb1483e..0000000000 Binary files a/Projectiles/Summon/MagicUmbrella.png and /dev/null differ diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 28bba5d814..6e52c299d5 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; @@ -188,6 +189,8 @@ namespace CalamityMod.Projectiles.Summon SegmentAI(Projectile, 16, ref _); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 476f211cbb..fa040baa91 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -10,6 +10,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -393,6 +394,8 @@ namespace CalamityMod.Projectiles.Summon } #endregion + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + #region Drawing public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Summon/MechwormLaser.cs b/Projectiles/Summon/MechwormLaser.cs index 0b6f27ee72..e545cf565e 100644 --- a/Projectiles/Summon/MechwormLaser.cs +++ b/Projectiles/Summon/MechwormLaser.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -55,6 +56,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.Fuchsia, Color.Cyan, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.9f + Projectile.identity * 2.4f) * 0.5f + 0.5f); public override bool PreDraw(ref Color lightColor) => Projectile.DrawBeam(100f, 3f, lightColor); diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index dd4c98cb9f..6139c9735f 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using Terraria; @@ -55,6 +56,8 @@ namespace CalamityMod.Projectiles.Summon MechwormBody.SegmentAI(Projectile, 16, ref playerMinionSlots); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 90); + public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; diff --git a/Projectiles/Summon/MidnightSunBeam.cs b/Projectiles/Summon/MidnightSunBeam.cs index 587834b350..5f034b0792 100644 --- a/Projectiles/Summon/MidnightSunBeam.cs +++ b/Projectiles/Summon/MidnightSunBeam.cs @@ -175,9 +175,5 @@ namespace CalamityMod.Projectiles.Summon } return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Electrified, 180); - } } } diff --git a/Projectiles/Summon/MortalityBeam.cs b/Projectiles/Summon/MortalityBeam.cs index 98c92d5f37..0ed6662d11 100644 --- a/Projectiles/Summon/MortalityBeam.cs +++ b/Projectiles/Summon/MortalityBeam.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -57,13 +56,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(potentialTarget.Center) * 13f) / 6f; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override void Kill(int timeLeft) { if (Main.myPlayer == Projectile.owner) diff --git a/Projectiles/Summon/MortalityBolt.cs b/Projectiles/Summon/MortalityBolt.cs index c5b85604f0..cb1e274ea4 100644 --- a/Projectiles/Summon/MortalityBolt.cs +++ b/Projectiles/Summon/MortalityBolt.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -44,13 +43,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.Frostburn, 90); - target.AddBuff(ModContent.BuffType(), 90); - } - public override void Kill(int timeLeft) { if (!Main.dedServ) diff --git a/Projectiles/Summon/OldDukeSharkVomit.cs b/Projectiles/Summon/OldDukeSharkVomit.cs index 57a840e7b5..dd072d979d 100644 --- a/Projectiles/Summon/OldDukeSharkVomit.cs +++ b/Projectiles/Summon/OldDukeSharkVomit.cs @@ -1,4 +1,6 @@ -using CalamityMod.Dusts; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -103,6 +105,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index e22c0e9ae4..c72e629c16 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 0.5f; + Projectile.minionSlots = 1f; Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -36,6 +36,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } + public int shootTimeCounter = 0; + bool canShoot = false; + public override void AI() { Player player = Main.player[Projectile.owner]; @@ -80,7 +83,7 @@ namespace CalamityMod.Projectiles.Summon if (npc.CanBeChasedBy(Projectile, false)) { float num646 = Vector2.Distance(npc.Center, Projectile.Center); - if (!flag25 && num646 < num633) + if (num646 < num633) { num633 = num646; vector46 = npc.Center; @@ -194,24 +197,37 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.ai[0] == 0f) { - float scaleFactor3 = 6f; - int num658 = ModContent.ProjectileType(); if (flag25 && Projectile.ai[1] == 0f) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.ai[1] += 1f; if (Main.myPlayer == Projectile.owner) { - Vector2 value19 = vector46 - Projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, value19.X, value19.Y, num658, Projectile.damage, 0f, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Projectile.originalDamage; + canShoot = true; Projectile.netUpdate = true; } } } + if (canShoot) + { + shootTimeCounter++; + + if (shootTimeCounter % 20 == 0 && shootTimeCounter <= 60) + { + SoundEngine.PlaySound(SoundID.Item20, Projectile.position); + float randomRadius = Main.rand.Next(10, 14); + Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(randomRadius, randomRadius); + Projectile.velocity -= randomVelocity*0.22f; //funny recoil + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, randomVelocity.X, randomVelocity.Y, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.netUpdate = true; + } + if (shootTimeCounter > 200) + { + canShoot = false; + shootTimeCounter = 0; + Projectile.netUpdate = true; + } + + } } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs index b62d87dd81..eac5ac4402 100644 --- a/Projectiles/Summon/PhantomicDagger.cs +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - class PhantomicDagger : ModProjectile + public class PhantomicDagger : ModProjectile { private bool homing = false; diff --git a/Projectiles/Summon/PhantomicShield.cs b/Projectiles/Summon/PhantomicShield.cs index d79c892d57..b03247ce98 100644 --- a/Projectiles/Summon/PhantomicShield.cs +++ b/Projectiles/Summon/PhantomicShield.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - class PhantomicShield : ModProjectile + public class PhantomicShield : ModProjectile { public const float floatDist = 50f; diff --git a/Projectiles/Summon/PrincessMissile.cs b/Projectiles/Summon/PrincessMissile.cs deleted file mode 100644 index 8722bf42fd..0000000000 --- a/Projectiles/Summon/PrincessMissile.cs +++ /dev/null @@ -1,176 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Summon -{ - public class PrincessMissile : ModProjectile - { - public override string Texture => "CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissile"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hive Bomb"); - Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.MinionShot[Projectile.type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.minion = true; - Projectile.tileCollide = true; - Projectile.penetrate = 1; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Projectile.velocity *= 1.01f; - - Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - { - Projectile.frame = 0; - } - if (Math.Abs(Projectile.velocity.X) >= 3f || Math.Abs(Projectile.velocity.Y) >= 3f) - { - float num247 = 0f; - float num248 = 0f; - if (Main.rand.Next(2) == 1) - { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.25f); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - else if (Main.rand.NextBool(4)) - { - int num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - num252 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1f); - Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num252].noGravity = true; - Main.dust[num252].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 250, 50, Projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int num621 = 0; num621 < 8; num621++) - { - int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 89, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - 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; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Summon/SageNeedle.cs b/Projectiles/Summon/SageNeedle.cs index 96b6aaa9e7..abd320f838 100644 --- a/Projectiles/Summon/SageNeedle.cs +++ b/Projectiles/Summon/SageNeedle.cs @@ -23,8 +23,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.minionSlots = 0f; Projectile.timeLeft = 150; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index 88df6c2105..51ea88d8cd 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus) + if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus && !modPlayer.sandBoobWaifuVanity && !modPlayer.allWaifusVanity) { Projectile.active = false; return; @@ -91,9 +91,12 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = -Projectile.direction; } - float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; - lightScalar *= Main.essScale; - Lighting.AddLight(Projectile.Center, 0.7f * lightScalar, 0.6f * lightScalar, 0f * lightScalar); + if (!modPlayer.sandBoobWaifuVanity && !modPlayer.allWaifusVanity) + { + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(Projectile.Center, 0.7f * lightScalar, 0.6f * lightScalar, 0f * lightScalar); + } Projectile.MinionAntiClump(); @@ -157,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.localAI[0] += 1f; } - if (Projectile.ai[0] == 0f) + if (Projectile.ai[0] == 0f && !modPlayer.sandBoobWaifuVanity && !modPlayer.allWaifusVanity) { int healProj = ModContent.ProjectileType(); if (Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) @@ -182,5 +185,18 @@ namespace CalamityMod.Projectiles.Summon } } } + public override bool? CanDamage() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.sandBoobWaifuVanity || modPlayer.allWaifusVanity) + { + return false; + } + else + { + return null; + } + } } } diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 50c7d243f4..a0d52eec7e 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sandWaifu && !modPlayer.allWaifus) + if (!modPlayer.sandWaifu && !modPlayer.allWaifus && !modPlayer.sandWaifuVanity && !modPlayer.allWaifusVanity) { Projectile.active = false; return; @@ -69,6 +69,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } + bool passive = modPlayer.sandWaifuVanity || modPlayer.allWaifusVanity; if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; @@ -77,9 +78,12 @@ namespace CalamityMod.Projectiles.Summon float num634 = 800f; float num635 = 1200f; float num636 = 200f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(Projectile.Center, 0.7f * num, 0.6f * num, 0f * num); + if (!passive) + { + float num = (float)Main.rand.Next(90, 111) * 0.01f; + num *= Main.essScale; + Lighting.AddLight(Projectile.Center, 0.7f * num, 0.6f * num, 0f * num); + } Projectile.MinionAntiClump(); Vector2 vector46 = Projectile.position; bool flag25 = false; @@ -91,7 +95,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.tileCollide = false; } - if (player.HasMinionAttackTargetNPC) + if (player.HasMinionAttackTargetNPC && !passive) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(Projectile, false)) @@ -104,7 +108,7 @@ namespace CalamityMod.Projectiles.Summon } } } - if (!flag25) + if (!flag25 && !passive) { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { @@ -122,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon } } float num647 = num634; - if (flag25) + if (flag25 && !passive) { if (Projectile.frame < 6) { @@ -253,5 +257,18 @@ namespace CalamityMod.Projectiles.Summon } } } + public override bool? CanDamage() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.sandWaifuVanity || modPlayer.allWaifusVanity) + { + return false; + } + else + { + return null; + } + } } } diff --git a/Projectiles/Summon/SarosAura.cs b/Projectiles/Summon/SarosAura.cs index 15422d540b..232c7c8d93 100644 --- a/Projectiles/Summon/SarosAura.cs +++ b/Projectiles/Summon/SarosAura.cs @@ -1,8 +1,9 @@ using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,135 +12,128 @@ namespace CalamityMod.Projectiles.Summon public class SarosAura : ModProjectile { public Player Owner => Main.player[Projectile.owner]; - public ref float AllocatedSlots => ref Projectile.ai[0]; - public ref float GeneralTimer => ref Projectile.ai[1]; - public const float TargetCheckDistance = 1600f; - public const int RadiantOrbAppearRateLowerBound = 7; - public const int RadiantOrbDamageUpperBound = 10000; + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public ref float GeneralTimer => ref Projectile.ai[0]; + + public bool CheckForSpawning = false; + + public static readonly SoundStyle SarosDiskThrow = new SoundStyle("CalamityMod/Sounds/Item/SarosDiskThrow", 3) { Volume = 0.4f, PitchVariance = 1 }; + public override void SetStaticDefaults() { DisplayName.SetDefault("Saros Aura"); - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.MinionShot[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = Projectile.height = 66; + Projectile.minionSlots = 8f; + Projectile.penetrate = -1; + + Projectile.width = Projectile.height = 132; + + Projectile.DamageType = DamageClass.Summon; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; - Projectile.timeLeft = 90000; - Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.minion = true; - Projectile.DamageType = DamageClass.Summon; } public override void AI() { - // Emit some light. - Lighting.AddLight(Projectile.Center, Vector3.One * 1.2f); + NPC potentialTarget = Projectile.Center.MinionHoming(5000f, Owner); - // Ensure that the projectile using this AI is the correct projectile and that the owner has the appropriate buffs. - VerifyIdentityOfCaller(); + CheckMinionExistince(); // Ensure that the projectile using this AI is the correct projectile and that the owner has the appropriate buffs. + SpawnEffect(); // Makes a dust spawn effect where the minion spawns. - // Store the allocated slots in the minionSlots field so that the amount of slots the projectile is holding - // is always correct. - Projectile.minionSlots = Projectile.ai[0]; + // Attack nearby targets. + if (potentialTarget != null && Main.myPlayer == Projectile.owner) + AttackTarget(potentialTarget); // Stay near the target and spin around. Projectile.Center = Owner.Center - Vector2.UnitY * 16f; - Projectile.rotation += MathHelper.ToRadians(AllocatedSlots * 0.85f + 3f); + // The projectile spins right at a constant speed. + Projectile.rotation += MathHelper.ToRadians(1.5f); - float damageMultiplier = (float)Math.Log(AllocatedSlots, 3D) + 1f; + // Emit some light. + Lighting.AddLight(Projectile.Center, Vector3.One * 1.2f); - // Softcap the multiplier after it has exceeded 3x the base value. - float softcappedDamageMultiplier = damageMultiplier; - if (softcappedDamageMultiplier > 3f) - softcappedDamageMultiplier = ((damageMultiplier - 3f) * 0.1f) + 3f; - - int radiantOrbDamage = (int)(Projectile.damage * softcappedDamageMultiplier); - int radiantOrbOriginalDamage = (int)(Projectile.originalDamage * softcappedDamageMultiplier); - int radiantOrbAppearRate = (int)(130 * Math.Pow(0.9, AllocatedSlots)); - - // Hard-cap the orb appear rate and damage. - // The latter is basically impossible to reach now due to rebalancing, but it shall remain for the time being. - if (radiantOrbAppearRate < RadiantOrbAppearRateLowerBound) - radiantOrbAppearRate = RadiantOrbAppearRateLowerBound; - - if (radiantOrbDamage > RadiantOrbDamageUpperBound) - radiantOrbDamage = RadiantOrbDamageUpperBound; - - // Attack nearby targets. + // A timer for the AI. GeneralTimer++; - NPC potentialTarget = Projectile.Center.MinionHoming(TargetCheckDistance, Owner); - if (potentialTarget != null && Main.myPlayer == Projectile.owner) - AttackTarget(potentialTarget, radiantOrbAppearRate, radiantOrbDamage, radiantOrbOriginalDamage); } - public void VerifyIdentityOfCaller() + #region Methods + + public void CheckMinionExistince() { Owner.AddBuff(ModContent.BuffType(), 3600); - bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); - if (isCorrectProjectile) + if (Projectile.type == ModContent.ProjectileType()) { if (Owner.dead) - Owner.Calamity().radiantResolution = false; - - if (Owner.Calamity().radiantResolution) + moddedOwner.saros = false; + if (moddedOwner.saros) Projectile.timeLeft = 2; } } - public void AttackTarget(NPC target, int radiantOrbAppearRate, int radiantOrbDamage, int radiantOrbOriginalDamage) + public void SpawnEffect() { - if (GeneralTimer % 35f == 34f) + if (CheckForSpawning == false) { - for (int i = 0; i < 2; i++) + int dustAmount = 360; + for (int d = 0; d < dustAmount; d++) { - float angle = MathHelper.Lerp(-MathHelper.ToRadians(20f), MathHelper.ToRadians(20f), i / 2f); - Vector2 fireVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 15f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = radiantOrbOriginalDamage / 2; + float angle = MathHelper.TwoPi / dustAmount * d; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(20f, 30f); + + Dust spawnDust = Dust.NewDustPerfect(Owner.Center - Vector2.UnitY * 60f, (int)CalamityDusts.ProfanedFire, velocity); + spawnDust.noGravity = true; + spawnDust.color = Color.Lerp(Color.White, Color.Yellow, 0.25f); + spawnDust.scale = velocity.Length() * 0.25f; + spawnDust.velocity *= 0.7f; + } + } + CheckForSpawning = true; + } + + public void AttackTarget(NPC target) + { + if (GeneralTimer % 50f == 49f) + { + for (int i = -1; i < 2; i++) + { + float angle = (target.Center - Projectile.Center).ToRotation() + (MathHelper.PiOver2 * i) + Main.rand.NextFloat(MathHelper.PiOver4, -MathHelper.PiOver4); + Vector2 velocity = angle.ToRotationVector2() * 30f; + + int fire = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(fire)) + Main.projectile[fire].originalDamage = Projectile.originalDamage; + + Projectile.netUpdate = true; } } - if (GeneralTimer % radiantOrbAppearRate == radiantOrbAppearRate - 1) + if (GeneralTimer % 100f == 99f) { - Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(100f, 360f); - Vector2 bootlegRadianceOrbVelocity = Projectile.SafeDirectionTo(target.Center) * 2f; - int p2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, bootlegRadianceOrbVelocity, ModContent.ProjectileType(), radiantOrbDamage, Projectile.knockBack * 4f, Projectile.owner); - if (Main.projectile.IndexInRange(p2)) - Main.projectile[p2].originalDamage = radiantOrbOriginalDamage; - for (int i = 0; i < 3; i++) - { - float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); - Vector2 fireVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 19f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = radiantOrbOriginalDamage / 2; - } + float angle = (target.Center - Projectile.Center).ToRotation() + Main.rand.NextFloat(MathHelper.PiOver2, -MathHelper.PiOver2); + Vector2 velocity = angle.ToRotationVector2() * 25f; + SoundEngine.PlaySound(SarosDiskThrow, Projectile.Center); + + int disk = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(disk)) + Main.projectile[disk].originalDamage = Projectile.originalDamage * 2; + + Projectile.netUpdate = true; } } public override bool? CanDamage() => false; - public override void PostDraw(Color lightColor) - { - Texture2D currentTexture = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(currentTexture, - Projectile.Center - Main.screenPosition, - null, - lightColor, - Projectile.rotation + MathHelper.PiOver2, - currentTexture.Size() / 2f, - 1f, - SpriteEffects.None, - 0); - } + #endregion } } diff --git a/Projectiles/Summon/SarosAura.png b/Projectiles/Summon/SarosAura.png index 9a3de1b6ea..1706469c4f 100644 Binary files a/Projectiles/Summon/SarosAura.png and b/Projectiles/Summon/SarosAura.png differ diff --git a/Projectiles/Summon/SarosMicrosun.cs b/Projectiles/Summon/SarosMicrosun.cs index 08e8a90864..03d45da3e7 100644 --- a/Projectiles/Summon/SarosMicrosun.cs +++ b/Projectiles/Summon/SarosMicrosun.cs @@ -1,62 +1,90 @@ -using Terraria; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class SarosMicrosun : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + public override void SetStaticDefaults() { DisplayName.SetDefault("Saros Microsun"); Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } public override void SetDefaults() { - Projectile.width = 62; - Projectile.height = 64; + Projectile.timeLeft = 600; + + Projectile.width = Projectile.height = 62; + + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; Projectile.tileCollide = false; Projectile.friendly = true; Projectile.minion = true; - Projectile.minionSlots = 0f; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - Projectile.alpha = 255; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; - Projectile.DamageType = DamageClass.Summon; } public override void AI() { - if (Projectile.alpha > 0) + // Tries to detect a target on a certain distance. + NPC target = Projectile.Center.MinionHoming(5000f, Owner); + + DoAnimation(); // Does the animation of the minion. + + // Spins as it was thrown really hard and fast. + Projectile.rotation += MathHelper.ToRadians(20f); + + // If there's a target, go towards the target. + if (target != null) { - Projectile.alpha -= 9; - if (Projectile.alpha < 0) - Projectile.alpha = 0; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 35f, 0.1f); + Projectile.netUpdate = true; } - Player player = Main.player[Projectile.owner]; + } + + public void DoAnimation() + { Projectile.frameCounter++; - if (Projectile.frameCounter > 8) + Projectile.frame = Projectile.frameCounter / 6 % Main.projFrames[Projectile.type]; + } + + public override bool PreDraw(ref Color lightColor) // Makes the afterimages of the disk. + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + for (int i = 0; i < Projectile.oldPos.Length; i++) { - Projectile.frame++; - Projectile.frameCounter = 0; + Color afterimageDrawColor = Color.DarkOrange with { A = 25 } * Projectile.Opacity * (1f - i / (float)Projectile.oldPos.Length); + Vector2 afterimageDrawPosition = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(texture, afterimageDrawPosition, frame, afterimageDrawColor, Projectile.rotation, origin, Projectile.scale, direction, 0); } - if (Projectile.frame >= Main.projFrames[Projectile.type]) + return true; + } + + public override void Kill(int timeLeft) + { + int dustAmount = 180; + for (int d = 0; d < dustAmount; d++) { - Projectile.frame = 0; - } - if (Projectile.ai[0]++ < 30f) - { - Projectile.velocity *= 1.01f; - } - else - { - NPC potentialTarget = Projectile.Center.MinionHoming(2000f, player); - if (potentialTarget != null) - Projectile.velocity = (Projectile.velocity * 7f + Projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 8f; + float angle = MathHelper.TwoPi / dustAmount * d; + Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(20f, 30f); + + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire, velocity); + spawnDust.noGravity = true; + spawnDust.color = Color.Lerp(Color.White, Color.Yellow, 0.25f); + spawnDust.scale = velocity.Length() * 0.25f; + spawnDust.velocity *= 0.5f; } } } diff --git a/Projectiles/Summon/SarosSunfire.cs b/Projectiles/Summon/SarosSunfire.cs index b46d1e8f75..737149f6fb 100644 --- a/Projectiles/Summon/SarosSunfire.cs +++ b/Projectiles/Summon/SarosSunfire.cs @@ -4,10 +4,13 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; + namespace CalamityMod.Projectiles.Summon { public class SarosSunfire : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() @@ -18,40 +21,49 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = Projectile.height = 10; - Projectile.friendly = true; + Projectile.timeLeft = 600; Projectile.light = 1f; - Projectile.timeLeft = 300; + + Projectile.width = Projectile.height = 10; + + Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; + Projectile.friendly = true; Projectile.minion = true; Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Player player = Main.player[Projectile.owner]; - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); - dust.noGravity = true; - NPC potentialTarget = Projectile.Center.MinionHoming(1750f, player); - if (potentialTarget != null) - Projectile.velocity = (Projectile.velocity * 19f + Projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 20f; + NPC target = Projectile.Center.MinionHoming(5000f, Owner); // Detects a target. + + // Makes dust because the projectile's sprite is invisible. + + for (int moreDust = 0; moreDust < 4; moreDust++) + { + Dust bootlegSprite = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); + bootlegSprite.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + bootlegSprite.scale = bootlegSprite.velocity.Length() * 0.25f; + bootlegSprite.color = Color.Lerp(Color.White, Color.DarkOrange, 0.25f); + bootlegSprite.noGravity = true; + } + + // Move towards the target. + if (target != null) + { + Projectile.velocity = Vector2.Lerp(Projectile.velocity, (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 25f, 0.1f); + Projectile.netUpdate = true; + } } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) // Makes a dust explosion effect on death. { - Projectile.ExpandHitboxBy(60); - Projectile.maxPenetrate = Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.damage /= 3; - Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 60; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); - dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 6f); - dust.noGravity = true; + Dust dustExplosion = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.ProfanedFire); + dustExplosion.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 6f); + dustExplosion.noGravity = true; } } } diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index e97648fc2f..22a23edee1 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -673,9 +673,12 @@ namespace CalamityMod.Projectiles.Summon #endregion #region Damage Stuff + // TODO -- this damage should be after Terraria vanilla multipliers, so it won't one shot people public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { - damage = Main.rand.Next(80, 90); + if (Main.masterMode) damage = 450; + else if (Main.expertMode) damage = 375; + else damage = 300; } public override bool? CanHitNPC(NPC target) diff --git a/Projectiles/Summon/SiriusBeam.cs b/Projectiles/Summon/SiriusBeam.cs index 4e8669e2d0..9345c1254f 100644 --- a/Projectiles/Summon/SiriusBeam.cs +++ b/Projectiles/Summon/SiriusBeam.cs @@ -18,35 +18,33 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = Projectile.height = 4; + + Projectile.minionSlots = 0f; + Projectile.penetrate = -1; + Projectile.extraUpdates = 220; // Random number to make it go fast. + Projectile.localNPCHitCooldown = 110; // Random number so it doesn't multi-hit. + Projectile.timeLeft = 1000; // Random number so it doesn't die too fast. + Projectile.friendly = true; Projectile.minion = true; - Projectile.minionSlots = 0f; - Projectile.extraUpdates = 220; - Projectile.timeLeft = 1000; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 110; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 3f) + for (int d = 0; d < 4; d++) { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = Projectile.position; - vector33 -= Projectile.velocity * ((float)num447 * 0.25f); - Projectile.alpha = 255; - int num448 = Dust.NewDust(vector33, 1, 1, 20, 0f, 0f, 0, default, 1f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.2f; - Main.dust[num448].noGravity = true; - } + Vector2 vector33 = Projectile.position; + vector33 -= Projectile.velocity * (d * 0.25f); + Projectile.alpha = 255; + int trailDust = Dust.NewDust(vector33, 1, 1, 20, 0f, 0f, 0, default, 1f); + Main.dust[trailDust].position = vector33; + Main.dust[trailDust].scale = Main.rand.Next(70, 110) * 0.013f; + Main.dust[trailDust].velocity *= 0.2f; + Main.dust[trailDust].noGravity = true; } } diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 34f7deca5e..34e7da682d 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -1,14 +1,24 @@ -using CalamityMod.Buffs.Summon; +using System; +using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; +using rail; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class SiriusMinion : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public ref float TimerForShooting => ref Projectile.ai[0]; + + public bool CheckForSpawning = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sirius"); @@ -20,125 +30,91 @@ namespace CalamityMod.Projectiles.Summon { Projectile.width = 38; Projectile.height = 48; + + Projectile.minionSlots = 6f; + Projectile.penetrate = -1; + Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + NPC target = Projectile.Center.MinionHoming(5000f, Owner); // Constantly tries to find a target. - bool correctMinion = Projectile.type == ModContent.ProjectileType(); - if (correctMinion) - { - if (player.dead) - { - modPlayer.sirius = false; - } - if (modPlayer.sirius) - { - Projectile.timeLeft = 2; - } - } - player.AddBuff(ModContent.BuffType(), 3600); + CheckMinionExistince(); // Checks if the minion can still exist. + SpawnEffect(); // Does a dust spawn effect. + ShootTarget(target); // If there's a target, shoot at the target. - Projectile.minionSlots = Projectile.ai[0]; - Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 1f); + Projectile.Center = Owner.Center - Vector2.UnitY * 60f; // Stays above the player. - Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); - if (player.gravDir == -1f) - { - Projectile.position.Y += 120f; - Projectile.rotation = MathHelper.Pi; - } + Lighting.AddLight(Projectile.Center, 0.5f, 0.5f, 1f); // Passively makes blue light. + + // The timer for the minion shooting. + if (TimerForShooting < 60f) + TimerForShooting++; else + TimerForShooting = 0f; + + // Makes the star oscillate. + Projectile.scale = 0.8f + MathF.Abs(MathF.Cos(MathHelper.Pi * (TimerForShooting / 50f))) / 5f; + } + + #region Methods + + public void CheckMinionExistince() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) { - Projectile.rotation = 0f; + if (Owner.dead) + moddedOwner.sirius = false; + if (moddedOwner.sirius) + Projectile.timeLeft = 2; } - Projectile.position.X = (int)Projectile.position.X; - Projectile.position.Y = (int)Projectile.position.Y; + } - float scalar = (float)Main.mouseTextColor / 200f - 0.35f; - scalar *= 0.2f; - Projectile.scale = scalar + 0.95f; - - if (Projectile.localAI[0] == 0f) + public void SpawnEffect() + { + if (CheckForSpawning == false) { int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { - int sirius = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 20, 0f, 0f, 0, default, 1f); - Main.dust[sirius].velocity *= 2f; - Main.dust[sirius].scale *= 1.15f; + float angle = MathHelper.TwoPi / dustAmt * d; + Vector2 dustVelocity = angle.ToRotationVector2() * 20f; + Dust spawnDust = Dust.NewDustPerfect(Owner.Center - Vector2.UnitY * 60f, 20, dustVelocity); + spawnDust.noGravity = true; } - Projectile.localAI[0] += 1f; + CheckForSpawning = true; } + } - if (Projectile.owner == Main.myPlayer) + public void ShootTarget(NPC target) + { + if (target is not null) { - if (Projectile.ai[1] != 0f) + if (TimerForShooting >= 60f && Projectile.owner == Main.myPlayer) { - Projectile.ai[1] -= 1f; - return; - } - Vector2 targetVec = Projectile.position; - float maxDistance = 7000f; - bool hasTarget = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(Projectile, false)) + // Makes a dust effect on the minion, to make a better effect of it shooting. + int dustAmt = 50; + for (int d = 0; d < dustAmt; d++) { - float extraDistance = (npc.width / 2) + (npc.height / 2); - - if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) - { - targetVec = npc.Center; - hasTarget = true; - } + float angle = MathHelper.TwoPi / dustAmt * d; + Vector2 dustVelocity = angle.ToRotationVector2() * 20f; + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 20, dustVelocity); + spawnDust.noGravity = true; } - } - if (!hasTarget) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(Projectile, false)) - { - float extraDistance = (npc.width / 2) + (npc.height / 2); - if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance)) - { - targetVec = npc.Center; - hasTarget = true; - } - } - } - } - if (hasTarget) - { - float projSpeed = 15f; - Vector2 source = new Vector2(Projectile.Center.X - 4f, Projectile.Center.Y); - Vector2 velocity = targetVec - Projectile.Center; - float targetDist = velocity.Length(); - targetDist = projSpeed / targetDist; - velocity.X *= targetDist; - velocity.Y *= targetDist; - float damageMult = ((float)Math.Log(Projectile.ai[0], MathHelper.E)) + 1f; - int beam = Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner); + // Shoots the beam. + Vector2 velocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 3f; + int beam = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); if (Main.projectile.IndexInRange(beam)) - Main.projectile[beam].originalDamage = (int)(Projectile.originalDamage * damageMult); - Main.projectile[beam].penetrate = (int)Projectile.ai[0]; - Projectile.ai[1] = 30f; + Main.projectile[beam].originalDamage = Projectile.originalDamage; } } } @@ -146,5 +122,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); public override bool? CanDamage() => false; + + #endregion } } diff --git a/Projectiles/Summon/SlimePuppet.cs b/Projectiles/Summon/SlimePuppet.cs index 0eab461dc8..5684624b5f 100644 --- a/Projectiles/Summon/SlimePuppet.cs +++ b/Projectiles/Summon/SlimePuppet.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -71,6 +72,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] = 50f; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Slimed, 300); + public override void Kill(int timeLeft) { Projectile.ExpandHitboxBy(100); diff --git a/Projectiles/Summon/StormMarkSummon.cs b/Projectiles/Summon/StormMarkSummon.cs deleted file mode 100644 index 82e5f27649..0000000000 --- a/Projectiles/Summon/StormMarkSummon.cs +++ /dev/null @@ -1,159 +0,0 @@ -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Summon -{ - public class StormMarkSummon : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mark"); - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.timeLeft = 900; - Projectile.ignoreWater = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.localNPCHitCooldown = 30; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item60, Projectile.position); - } - if (Projectile.localAI[1] < 30f) - { - for (int num1134 = 0; num1134 < 1; num1134++) - { - float value79 = -0.5f; - float value80 = 0.9f; - float amount4 = Main.rand.NextFloat(); - Vector2 value81 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value79, value80, amount4)); - value81.X *= MathHelper.Lerp(2.2f, 0.6f, amount4); - value81.X *= -1f; - Vector2 value82 = new Vector2(2f, 10f); - Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * value81 * 0.5f + value82; - Dust dust34 = Main.dust[Dust.NewDust(position4, 0, 0, 16, 0f, 0f, 0, default, 0.5f)]; - dust34.position = position4; - dust34.customData = Projectile.Center + value82; - dust34.fadeIn = 1f; - dust34.scale = 0.3f; - if (value81.X > -1.2f) - { - dust34.velocity.X = 1f + Main.rand.NextFloat(); - } - dust34.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 0.8f; - Projectile.direction = 1; - Point point9 = Projectile.Center.ToTileCoordinates(); - Projectile.Center = new Vector2((float)(point9.X * 16 + 8), (float)(point9.Y * 16 + 8)); - } - Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; - if (Projectile.localAI[1] < 33f) - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 8; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - } - if (Projectile.localAI[1] > 103f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 16; - } - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - if (Projectile.alpha == 0) - { - Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int num1135 = 0; num1135 < 2; num1135++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value83 = Vector2.UnitY.RotatedBy((double)((float)num1135 * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dust35 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1f)]; - dust35.noGravity = true; - dust35.noLight = true; - dust35.scale = Projectile.Opacity * Projectile.localAI[0]; - dust35.position = Projectile.Center; - dust35.velocity = value83 * 2.5f; - } - } - for (int num1136 = 0; num1136 < 2; num1136++) - { - if (Main.rand.NextBool(10)) - { - Vector2 value84 = Vector2.UnitY.RotatedBy((double)((float)num1136 * 3.14159274f), default); - Dust dust36 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, 16, 0f, 0f, 225, newColor3, 1.5f)]; - dust36.noGravity = true; - dust36.noLight = true; - dust36.scale = Projectile.Opacity * Projectile.localAI[0]; - dust36.position = Projectile.Center; - dust36.velocity = value84 * 2.5f; - } - } - if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) - { - Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; - } - Projectile.velocity = Vector2.Zero; - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) - { - int storm = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 1f, 0f); - Main.projectile[storm].minion = true; - // Main.projectile[storm].melee = false /* tModPorter - this is redundant, for more info see https://github.com/tModLoader/tModLoader/wiki/Update-Migration-Guide#damage-classes */ ; - } - if (Projectile.localAI[1] >= 120f) - { - Projectile.Kill(); - return; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = ModContent.Request(Texture).Value; - Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color alpha5 = Projectile.GetAlpha(color25); - Vector2 origin7 = rectangle11.Size() / 2f; - Color color47 = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.EntitySpriteDraw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), color47, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, Projectile.rotation, origin7, Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D27, vector38, new Microsoft.Xna.Framework.Rectangle?(rectangle11), alpha5, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index c58fc0670e..ad274418d0 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -165,7 +165,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0]++ % TacticalPlagueEngine.BulletShootRate == 24f) { - bool shootRocket = ++Projectile.ai[1] % 20f == 0f; + bool shootRocket = ++Projectile.ai[1] % 2f == 0f; // Rockets never consume ammo. bool dontConsumeAmmo = Main.rand.NextBool() || shootRocket; int projIndex; @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Summon // Vanilla function tricked into using a fake gun item with the appropriate base damage as the "firing item". player.PickAmmo(FalseGun, out int projID, out float shootSpeed, out int damage, out float kb, out _, dontConsumeAmmo); - // One in every 20 shots is a rocket which deals 1.5x total damage and extreme knockback. + // Fires a rocket every other time which deals 1.5x total damage and extreme knockback. if (shootRocket) { int rocketDamage = (int)(damage * 1.5f); diff --git a/Projectiles/Summon/TundraFlameBlossom.cs b/Projectiles/Summon/TundraFlameBlossom.cs index 0ef2ca37dc..639e08a29b 100644 --- a/Projectiles/Summon/TundraFlameBlossom.cs +++ b/Projectiles/Summon/TundraFlameBlossom.cs @@ -1,17 +1,26 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class TundraFlameBlossom : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + + public CalamityPlayer moddedOwner => Owner.Calamity(); + + public ref float FlowerShootTimer => ref Projectile.ai[0]; + + public ref float RotationMovement => ref Projectile.ai[1]; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Frost Blossom"); + DisplayName.SetDefault("Tundra Flame Blossoms"); ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; } @@ -23,10 +32,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.minionSlots = 1f; - Projectile.timeLeft = 18000; Projectile.penetrate = -1; Projectile.tileCollide = false; - Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.coldDamage = true; Projectile.DamageType = DamageClass.Summon; @@ -34,63 +41,77 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool isCorrectMinion = Projectile.type == ModContent.ProjectileType(); - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - player.AddBuff(ModContent.BuffType(), 3600); - if (isCorrectMinion) + NPC potentialTarget = Projectile.Center.MinionHoming(1200f, Owner); + + CheckMinionExistance(); // Checks if the minion can still exist. + SpawnEffect(); // Makes a dust effect when spawning. + TargetNPC(potentialTarget); // Targets the NPC. + + Lighting.AddLight(Projectile.Center, Color.Fuchsia.ToVector3()); // Makes a light with the same color as the flowers. + Projectile.Center = Owner.Center + RotationMovement.ToRotationVector2() * 100f; // Spins around the player. + Projectile.rotation += MathHelper.ToRadians(6.25f * Owner.direction); // Rotates around itself in the direction of the owner + Projectile.scale = MathHelper.Lerp(1f, 1.005f, FlowerShootTimer % 100f); // Expands the closer it is to shooting, goes back to normal once shot; peridoically. + RotationMovement += MathHelper.ToRadians(1.25f * Owner.direction); // The changing variable that moves the flower, changes directions depending on the player. + } + + #region Methods + + public void CheckMinionExistance() + { + Owner.AddBuff(ModContent.BuffType(), 1); + if (Projectile.type == ModContent.ProjectileType()) { - if (player.dead) - { - modPlayer.tundraFlameBlossom = false; - } - if (modPlayer.tundraFlameBlossom) - { + if (Owner.dead) + moddedOwner.tundraFlameBlossom = false; + if (moddedOwner.tundraFlameBlossom) Projectile.timeLeft = 2; - } } - Projectile.Center = player.Center + (Projectile.ai[1] / 32f).ToRotationVector2() * 95f; - Projectile.scale = 1f + (float)Math.Sin(Projectile.ai[1] / 40f) * 0.085f; - Projectile.Opacity = 1f - (float)Math.Sin(Projectile.ai[1] / 45f) * 0.1f - 0.1f; // Range of 1f to 0.8f - Projectile.rotation += MathHelper.ToRadians(5f); + } + + public void SpawnEffect() + { if (Projectile.localAI[0] == 0f) { for (int i = 0; i < 36; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 179); - dust.noGravity = true; - dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 7f); + Dust spawnEffect = Dust.NewDustPerfect(Projectile.Center, 179); + spawnEffect.noGravity = true; + spawnEffect.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(2f, 7f); } Projectile.localAI[0] += 1f; } - int fireRate = 130; - float fireSpeed = 6f; - if (Projectile.owner == Main.myPlayer) + } + + public void ShootFlowers() + { + SoundEngine.PlaySound(SoundID.Item20, Owner.Center); + Vector2 velocity = -Projectile.SafeDirectionTo(Owner.Center) * 10f + Projectile.velocity; + int tundraOrb = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[tundraOrb].originalDamage = Projectile.originalDamage; + Projectile.netUpdate = true; + } + + public void TargetNPC(NPC target) + { + if (target != null) { - NPC potentialTarget = Projectile.Center.MinionHoming(850f, player); - if (potentialTarget != null) + if (Projectile.owner == Main.myPlayer) { - fireRate = 42; - fireSpeed = 14f; - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], Projectile.AngleTo(potentialTarget.Center) + MathHelper.PiOver2, 0.1f); - } - else Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], 0f, 0.1f); - } - if (Projectile.ai[1]++ % fireRate == fireRate - 1) - { - if (Main.myPlayer == Projectile.owner) - { - int count = Projectile.ai[1] % (2 * fireRate) == (2 * fireRate - 1) ? 4 : 3; - for (int i = 0; i < count; i++) - { - int orb = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -Vector2.UnitY.RotatedBy(MathHelper.TwoPi / count * i + Projectile.ai[0]) * fireSpeed, - ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Main.projectile[orb].originalDamage = Projectile.originalDamage; - } + FlowerShootTimer++; + if (FlowerShootTimer % 100f == 0f) + ShootFlowers(); + FlowerShootTimer = (FlowerShootTimer == 101f) ? 1f : FlowerShootTimer; } } + else + FlowerShootTimer--; + + FlowerShootTimer = MathHelper.Clamp(FlowerShootTimer, 0f, 101f); + Projectile.netUpdate = true; } public override bool? CanDamage() => false; + + #endregion } } diff --git a/Projectiles/Summon/TundraFlameBlossomsOrb.cs b/Projectiles/Summon/TundraFlameBlossomsOrb.cs index 9b95ba0f6c..19ed7dbe8d 100644 --- a/Projectiles/Summon/TundraFlameBlossomsOrb.cs +++ b/Projectiles/Summon/TundraFlameBlossomsOrb.cs @@ -3,13 +3,21 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using System; + namespace CalamityMod.Projectiles.Summon { public class TundraFlameBlossomsOrb : ModProjectile { + public Player Owner => Main.player[Projectile.owner]; + + public ref float TimerForCharging => ref Projectile.ai[0]; + + public ref float TypeOfFlowerOrb => ref Projectile.ai[1]; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Blossom Orb"); + DisplayName.SetDefault("Tundra Flame Blossoms Orb"); ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; ProjectileID.Sets.MinionShot[Projectile.type] = true; @@ -23,27 +31,93 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.minionSlots = 0f; Projectile.minion = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 360; Projectile.DamageType = DamageClass.Summon; } public override void AI() { + TypeOfFlowerOrb = Main.rand.Next(2); + TypeOfFlowerOrb = (TypeOfFlowerOrb == 0f) ? 6 : 113; + // DustID 6 is torch dust, DustID 113 is Frost Blossom's dust. + + SpawnDust(); // Makes a dust effect when spawned. + DustTrail(); // When spawned, it'll actively make a dust effect correspondent to their type. + TargetNPC(); // Homes slowly on the target. + Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.X); - // Arc around after a bit of time. - if (Projectile.timeLeft > 110f && Projectile.timeLeft < 150f) - { - Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.PiOver2 / 40f); - } - if (Projectile.timeLeft < 60f) - { - Projectile.alpha = (int)MathHelper.Lerp(0f, 255f, 1f - Projectile.timeLeft / 60f); - } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Frostburn, 180); + #region Methods + + public void SpawnDust() + { + if (Projectile.localAI[0] == 0f) + { + for (int i = 0; i < 45; i++) // Spawns a dust circle with the correspondent color. + { + float angle = MathHelper.TwoPi / 45f * i; + Vector2 velocity = angle.ToRotationVector2() * 4f; + Dust circleSpawn = Dust.NewDustPerfect(Projectile.Center + velocity * 3.5f, (int)TypeOfFlowerOrb, velocity, 0, default, 1.25f); + circleSpawn.noGravity = true; + } + } + Projectile.localAI[0] = 1f; + } + + public void DustTrail() + { + Dust dustTrail = Dust.NewDustPerfect(Projectile.Center, (int)TypeOfFlowerOrb); + dustTrail.velocity = Main.rand.NextVector2Circular(2f, 2f); + dustTrail.noGravity = true; + dustTrail.scale = 2f; + Projectile.netUpdate = true; + } + + public void TargetNPC() // Starts simply going away from the owner and slowly homes towards the target. + { + NPC potentialTarget = Projectile.Center.MinionHoming(1700f, Owner); + if (potentialTarget != null) + { + Projectile.velocity = Vector2.Lerp(Projectile.velocity, (potentialTarget.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 30f, TimerForCharging); + TimerForCharging += 0.001f; + TimerForCharging = (TimerForCharging > 1f) ? 1f : TimerForCharging; + } + Projectile.netUpdate= true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + DustFlowerOnHit(); // Makes a dust effect that looks like a flower. + + target.AddBuff(BuffID.OnFire3, 240); + target.AddBuff(BuffID.Frostburn2, 240); + } + + public void DustFlowerOnHit() + // Copied code from Frost Beam, from the Frost Blossom Staff. + // Modified to have a different color correspondent on the type of flower. + { + int flowerPetalCount = Main.rand.Next(3, 5 + 1); + float thetaDelta = Projectile.velocity.ToRotation(); + float weaveDistanceMin = 2f; + float weaveDistanceOutwardMax = 3f; + float weaveDistanceInner = 0.5f; + for (float theta = 0f; theta < MathHelper.TwoPi; theta += 0.05f) + { + Vector2 velocity = theta.ToRotationVector2() * + (weaveDistanceMin + + // The 0.5 in here is to prevent the petal from looping back into itself. With a 0.5 addition, it is perfect, coming back to (0,0) + // instead of weaving backwards. + (float)(Math.Sin(thetaDelta + theta * flowerPetalCount) + 0.5f + weaveDistanceInner) * + weaveDistanceOutwardMax); + Dust dustFlower = Dust.NewDustPerfect(Projectile.Center, (int)TypeOfFlowerOrb, velocity, 0, default, 1.25f); + dustFlower.noGravity = true; + dustFlower.scale = 1.35f; + } + Projectile.netUpdate = true; + } public override bool PreDraw(ref Color lightColor) { @@ -51,13 +125,6 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Grass, Projectile.position); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 179, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - } + #endregion } } diff --git a/Projectiles/Summon/Umbrella/MagicArrow.cs b/Projectiles/Summon/Umbrella/MagicArrow.cs new file mode 100644 index 0000000000..f6aef3f8be --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicArrow.cs @@ -0,0 +1,226 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicArrow : ModProjectile + { + public float Behavior = 0f; + private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; + public VertexStrip TrailDrawer; + + public float GetOffsetAngle + { + get + { + return MathHelper.TwoPi * 1 / 5 + Main.projectile[(int)Projectile.ai[0]].ai[0] / 27f; + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vermillion Arrow"); + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Summon; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Behavior); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Behavior = reader.ReadSingle(); + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + Projectile.alpha -= 50; + + // Set the timeLeft if the player has the hat + if (player.Calamity().magicHat) + { + Projectile.timeLeft = 2; + } + + float homingRange = MagicHat.Range; + int targetIndex = -1; + // If targeting something, prioritize that enemy + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + // Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetIndex == -1 && targetDist < (homingRange + extraDist)) + { + homingRange = targetDist; + targetIndex = npc.whoAmI; + } + } + } + if (targetIndex == -1) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + // Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < (homingRange + extraDist)) + { + homingRange = targetDist; + targetIndex = npc.whoAmI; + } + } + } + } + + if (targetIndex == -1) + { + IdleAI(); + } + else + { + AttackEnemy(targetIndex); + } + } + + private void AttackEnemy(int targetIndex) + { + NPC npc = Main.npc[targetIndex]; + Behavior = 0f; + // Go to the target + Projectile.velocity = (Projectile.velocity * 5f + Projectile.SafeDirectionTo(npc.Center) * 40f) / 6f; + Projectile.rotation = Projectile.AngleTo(npc.Center) + drawOffset; + } + + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; + + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); + + float playerHomeSpeed = 40f; + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Projectile.Center = returnPos; + Projectile.rotation = GetOffsetAngle + drawOffset; + Behavior = 1f; + } + } + + public override Color? GetAlpha(Color lightColor) => Color.White; + + public Color TrailColorFunction(float completionRatio) + { + float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f; + return new Color(211, 8, 8) * opacity; + } + + public float TrailWidthFunction(float completionRatio) => 2f; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + bool shouldDrawTrail = Behavior != 1f; + if (shouldDrawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } + + // Draw the bat. + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffect(); + + public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffect(); + + private void OnHitEffect() + { + if (Behavior == 1f) + return; + + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + Vector2 returnPos = Main.player[Projectile.owner].Center + GetOffsetAngle.ToRotationVector2() * 180f; + Projectile.Center = returnPos; + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/Umbrella/MagicArrow.png b/Projectiles/Summon/Umbrella/MagicArrow.png new file mode 100644 index 0000000000..686e2a6642 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicArrow.png differ diff --git a/Projectiles/Summon/Umbrella/MagicAxe.cs b/Projectiles/Summon/Umbrella/MagicAxe.cs new file mode 100644 index 0000000000..4d97c9e0dd --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicAxe.cs @@ -0,0 +1,303 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicAxe : ModProjectile + { + public float Behavior = 0f; + public ref float ChargeCooldown => ref Projectile.ai[1]; + public ref float TreeCounter => ref Projectile.localAI[0]; + public ref float TreeReset => ref Projectile.localAI[1]; + private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; + public VertexStrip TrailDrawer; + + public float GetOffsetAngle + { + get + { + return MathHelper.TwoPi * 3 / 5 + Main.projectile[(int)Projectile.ai[0]].ai[0] / 27f; + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jade Axe"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; + ProjectileID.Sets.TrailingMode[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 52; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Summon; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Behavior); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Behavior = reader.ReadSingle(); + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + Projectile.alpha -= 50; + + // Set the timeLeft if the player has the hat + if (player.Calamity().magicHat) + { + Projectile.timeLeft = 2; + } + + float homingRange = MagicHat.Range; + int targetIndex = -1; + // If targeting something, prioritize that enemy + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + // Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetIndex == -1 && targetDist < (homingRange + extraDist)) + { + homingRange = targetDist; + targetIndex = npc.whoAmI; + } + } + } + if (targetIndex == -1) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + // Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < (homingRange + extraDist)) + { + homingRange = targetDist; + targetIndex = npc.whoAmI; + } + } + } + } + + if (targetIndex == -1) + { + CooldownReset(false); + IdleAI(); + } + else + { + Projectile.rotation += 0.15f; + if (!CooldownReset(true)) + return; + AttackEnemy(targetIndex); + } + } + + private bool CooldownReset(bool offense) + { + // Breather time between charges as like a reset + if (Behavior == 2f) + { + TreeReset = 0f; + ChargeCooldown += 1f; + if (ChargeCooldown > 15f) + { + ChargeCooldown = 1f; + Behavior = 0f; + Projectile.netUpdate = true; + } + else + { + return false; + } + } + if (offense && Behavior == 4f) + Behavior = 0f; + return true; + } + + private void AttackEnemy(int targetIndex) + { + NPC npc = Main.npc[targetIndex]; + // Go to the target + if (Behavior == 0f) + { + Vector2 targetSpot = npc.Center - Projectile.Center; + float targetDist = targetSpot.Length(); + targetSpot.Normalize(); + // Tries to get the minion in the sweet spot of 200 pixels away but the minion also charges so idk what good it does + if (targetDist > 200f) + { + float speed = 48f; + targetSpot *= speed; + Projectile.velocity = (Projectile.velocity * 40f + targetSpot) / 41f; + } + else + { + float speed = -24f; + targetSpot *= speed; + Projectile.velocity = (Projectile.velocity * 40f + targetSpot) / 41f; //41 + } + } + + // Increment attack counter randomly + if (ChargeCooldown > 0f) + { + ChargeCooldown++; + } + // If high enough, prepare to attack + if (ChargeCooldown > 15f) + { + ChargeCooldown = 0f; + Projectile.netUpdate = true; + } + + // Charge at an enemy if not on cooldown + if (Behavior == 0f) + { + Vector2 targetVec = npc.Center - Projectile.Center; + float targetDist = targetVec.Length(); + if (ChargeCooldown == 0f && targetDist < 500f) + { + ChargeCooldown += 1f; + if (Main.myPlayer == Projectile.owner) + { + Behavior = 2f; + targetVec.Normalize(); + Projectile.velocity = targetVec * 30f; + Projectile.netUpdate = true; + } + } + } + } + + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; + + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); + + float playerHomeSpeed = 40f; + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Projectile.Center = returnPos; + Projectile.rotation = GetOffsetAngle + drawOffset; + Behavior = 4f; + } + TreeCounter = 0f; + TreeReset = 0f; + } + + public override Color? GetAlpha(Color lightColor) => Color.White; + + public Color TrailColorFunction(float completionRatio) + { + float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f; + return new Color(0, 255, 111) * opacity; + } + + public float TrailWidthFunction(float completionRatio) => 2f; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + bool shouldDrawTrail = Behavior != 4f; + if (shouldDrawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } + + // Draw the axe. + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffect(target.Center, target.whoAmI); + + public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffect(target.Center, -1); + + private void OnHitEffect(Vector2 targetPos, int whoAmI) + { + // Every 20 hits, spawn a tree + // Only 1 hit per charge increments this + if (TreeReset == 0f) + { + TreeCounter++; + TreeReset = 1f; + } + + if (TreeCounter >= 20f) + { + TreeCounter = 0; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), targetPos + new Vector2(0f, -600f), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 10, Projectile.knockBack * 3f, Projectile.owner, whoAmI); + } + } + } +} diff --git a/Projectiles/Summon/Umbrella/MagicAxe.png b/Projectiles/Summon/Umbrella/MagicAxe.png new file mode 100644 index 0000000000..12390274b6 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicAxe.png differ diff --git a/Projectiles/Summon/MagicBird.cs b/Projectiles/Summon/Umbrella/MagicBird.cs similarity index 94% rename from Projectiles/Summon/MagicBird.cs rename to Projectiles/Summon/Umbrella/MagicBird.cs index 684cebe853..9dbc3fdf6b 100644 --- a/Projectiles/Summon/MagicBird.cs +++ b/Projectiles/Summon/Umbrella/MagicBird.cs @@ -3,7 +3,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon +namespace CalamityMod.Projectiles.Summon.Umbrella { public class MagicBird : ModProjectile { @@ -21,11 +21,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.width = 14; Projectile.height = 14; - Projectile.minion = true; - Projectile.minionSlots = 0f; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 1; Projectile.alpha = 255; Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Summon; @@ -130,7 +127,7 @@ namespace CalamityMod.Projectiles.Summon } } - public override Color? GetAlpha(Color lightColor) => new Color(255, 239, 0, Projectile.alpha); + public override Color? GetAlpha(Color lightColor) => Color.White; // new Color(255, 239, 0, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Summon/Umbrella/MagicBird.png b/Projectiles/Summon/Umbrella/MagicBird.png new file mode 100644 index 0000000000..6b1f999c24 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicBird.png differ diff --git a/Projectiles/Summon/MagicBullet.cs b/Projectiles/Summon/Umbrella/MagicBullet.cs similarity index 55% rename from Projectiles/Summon/MagicBullet.cs rename to Projectiles/Summon/Umbrella/MagicBullet.cs index 693169737c..67fcb06360 100644 --- a/Projectiles/Summon/MagicBullet.cs +++ b/Projectiles/Summon/Umbrella/MagicBullet.cs @@ -1,39 +1,48 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Graphics; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon +namespace CalamityMod.Projectiles.Summon.Umbrella { public class MagicBullet : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/Ranged/BloodClotFriendly"; + public VertexStrip TrailDrawer; public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 6; + Projectile.height = 6; + Projectile.extraUpdates = 7; Projectile.light = 0.5f; - Projectile.alpha = 255; - Projectile.extraUpdates = 7; Projectile.scale = 1.18f; Projectile.friendly = true; - Projectile.minion = true; Projectile.ignoreWater = true; - Projectile.aiStyle = ProjAIStyleID.Arrow; - AIType = ProjectileID.BulletHighVelocity; - Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; + Projectile.alpha = 255; } + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.ai[0]++ > 2f) + Projectile.alpha = 0; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (!target.betsysCurse) @@ -56,11 +65,24 @@ namespace CalamityMod.Projectiles.Summon target.AddBuff(ModContent.BuffType(), 180); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(189, 51, 164, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => Color.White; - public override bool PreDraw(ref Color lightColor) => Projectile.timeLeft < 600; + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.alpha != 0) + return false; + + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, 1, 0, 0); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + + // Draw the bullet. + Main.spriteBatch.Draw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + + // Draw Afterimages + CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + return false; + } } } diff --git a/Projectiles/Summon/Umbrella/MagicBullet.png b/Projectiles/Summon/Umbrella/MagicBullet.png new file mode 100644 index 0000000000..8e5ab4a56f Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicBullet.png differ diff --git a/Projectiles/Summon/Umbrella/MagicBulletBig.cs b/Projectiles/Summon/Umbrella/MagicBulletBig.cs new file mode 100644 index 0000000000..8b8378eb05 --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicBulletBig.cs @@ -0,0 +1,93 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicBulletBig : ModProjectile + { + public VertexStrip TrailDrawer; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + ProjectileID.Sets.MinionShot[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.extraUpdates = 12; + Projectile.light = 0.5f; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Summon; + Projectile.alpha = 255; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.penetrate = 4; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (Projectile.FinalExtraUpdate()) + { + if (Projectile.ai[0]++ > 1f) + Projectile.alpha = 0; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!target.betsysCurse) + target.AddBuff(BuffID.BetsysCurse, 180); + if (!target.ichor) + target.AddBuff(BuffID.Ichor, 180); + if (target.Calamity().marked <= 0) + target.AddBuff(ModContent.BuffType(), 180); + if (target.Calamity().aCrunch <= 0) + target.AddBuff(ModContent.BuffType(), 180); + if (target.Calamity().wDeath <= 0) + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Ichor, 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + } + + public override Color? GetAlpha(Color lightColor) => Color.White; + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.alpha != 0) + return false; + + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, 1, 0, 0); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + + // Draw the bullet. + Main.spriteBatch.Draw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + + // Draw Afterimages + CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + return false; + } + } +} diff --git a/Projectiles/Summon/Umbrella/MagicBulletBig.png b/Projectiles/Summon/Umbrella/MagicBulletBig.png new file mode 100644 index 0000000000..7f2e7d6805 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicBulletBig.png differ diff --git a/Projectiles/Summon/Umbrella/MagicBunny.cs b/Projectiles/Summon/Umbrella/MagicBunny.cs new file mode 100644 index 0000000000..062fde0ad1 --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicBunny.cs @@ -0,0 +1,131 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicBunny : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bunny"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.MinionShot[Projectile.type] = true; + } + + public override void SetDefaults() + { + Projectile.friendly = true; + Projectile.width = 28; + Projectile.height = 28; + Projectile.alpha = 255; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + if (Projectile.soundDelay == 0) + { + Projectile.soundDelay = 3000; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + } + + if (Projectile.velocity.X > 0f) + Projectile.direction = 1; + else if (Projectile.velocity.X < 0f) + Projectile.direction = -1; + + Projectile.spriteDirection = Projectile.direction; + Projectile.ai[0] += 1f; + Projectile.rotation += Projectile.velocity.X * 0.05f + (float)Projectile.direction * 0.05f; + if (Projectile.ai[0] >= 18f) + { + Projectile.velocity.Y += 0.28f; + Projectile.velocity.X *= 0.99f; + } + + if (Projectile.velocity.Y > 15.9f) + Projectile.velocity.Y = 15.9f; + + //Fade in + if (Projectile.alpha > 0) + { + Projectile.alpha -= 50; + } + if (Projectile.alpha < 0) + { + Projectile.alpha = 0; + } + + if (Math.Abs(Projectile.velocity.X) < 0.2f && Math.Abs(Projectile.velocity.Y) < 0.2f) + Projectile.Kill(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X * 0.5f; + + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y * 0.5f; + return false; + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position); + int idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), 76); + Gore gore = Main.gore[idx]; + gore.velocity -= Projectile.velocity * 0.5f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)), 77); + gore.velocity -= Projectile.velocity * 0.5f; + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + + for (int i = 0; i < 20; i++) + { + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[index]; + dust.velocity *= 1.4f; + } + + for (int i = 0; i < 10; i++) + { + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 2.5f); + Dust dust = Main.dust[index]; + dust.noGravity = true; + dust.velocity *= 5f; + index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); + dust.velocity *= 3f; + } + + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore.velocity *= 0.4f; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore.velocity *= 0.4f; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore.velocity *= 0.4f; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + idx = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.position, default(Vector2), Main.rand.Next(61, 64)); + gore.velocity *= 0.4f; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; + + Projectile.ExpandHitboxBy(128); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.Damage(); + } + + public override Color? GetAlpha(Color lightColor) => Color.White; // new Color(255, 239, 0, Projectile.alpha); + } +} diff --git a/Projectiles/Summon/Umbrella/MagicBunny.png b/Projectiles/Summon/Umbrella/MagicBunny.png new file mode 100644 index 0000000000..bbcd68df3d Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicBunny.png differ diff --git a/Projectiles/Summon/Umbrella/MagicHammer.cs b/Projectiles/Summon/Umbrella/MagicHammer.cs new file mode 100644 index 0000000000..c2d6ca44aa --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicHammer.cs @@ -0,0 +1,337 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicHammer : ModProjectile + { + public float Behavior = 0f; + public float PivotPointX = 0f; + public float PivotPointY = 0f; + private int counter = 0; + private const int projSize = 60; + private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; + public static readonly SoundStyle StylishSound = new("CalamityMod/Sounds/Custom/Stylish"); + + public VertexStrip TrailDrawer; + + public float GetOffsetAngle + { + get + { + return MathHelper.TwoPi * 2 / 5 + Main.projectile[(int)Projectile.ai[0]].ai[0] / 27f; + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Marmalade Hammer"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; + ProjectileID.Sets.TrailingMode[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = projSize; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.minion = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; + Projectile.DamageType = DamageClass.Summon; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Behavior); + writer.Write(PivotPointX); + writer.Write(PivotPointY); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Behavior = reader.ReadSingle(); + PivotPointX = reader.ReadSingle(); + PivotPointY = reader.ReadSingle(); + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + Projectile.alpha -= 50; + + // Set the timeLeft if the player has the hat + if (player.Calamity().magicHat) + { + Projectile.timeLeft = 2; + } + + float homingRange = MagicHat.Range; + int targetIndex = -1; + // If targeting something, prioritize that enemy + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + // Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetIndex == -1 && targetDist < (homingRange + extraDist)) + { + homingRange = targetDist; + targetIndex = npc.whoAmI; + } + } + } + if (targetIndex == -1) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + // Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < (homingRange + extraDist)) + { + homingRange = targetDist; + targetIndex = npc.whoAmI; + } + } + } + } + + if (targetIndex == -1) + { + Behavior = 0f; + IdleAI(); + } + else + { + MoveToEnemy(targetIndex); + } + } + + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; + + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); + + float playerHomeSpeed = 40f; + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Projectile.Center = returnPos; + Projectile.rotation = GetOffsetAngle + drawOffset; + } + // Return to normal size + if (Projectile.scale != 1f) + { + Projectile.scale = 1f; + Projectile.ExpandHitboxBy((int)(projSize * Projectile.scale)); + } + } + + private void MoveToEnemy(int targetIndex) + { + if (Behavior == 0f) + Behavior = 1f; + + // Target distance calculations + NPC npc = Main.npc[targetIndex]; + Vector2 targetVec = npc.Center - Projectile.Center; + float targetDist = targetVec.Length(); + + float moveSpeed = 40f; + // If more than 60 pixels away, move toward the target + if (targetDist > 60f && Behavior == 1f) + { + targetVec.Normalize(); + targetVec *= moveSpeed; + Projectile.velocity = (Projectile.velocity * 1f + targetVec) / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + // Get bigger and prepare the pivot position + if (Behavior == 1f) + { + if (Projectile.scale == 1f) + { + Projectile.scale = 3f; + Projectile.ExpandHitboxBy(Projectile.scale); + } + Projectile.rotation = drawOffset + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 3f : -3f); + Projectile.ai[1] = drawOffset + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 3f : -3f); + PivotPointX = Projectile.Bottom.X; + PivotPointY = Projectile.Bottom.Y; + Behavior = 2f; + } + // Decide which way to swing + if (Behavior == 2f) + { + Behavior = targetVec.X > 0 ? 3f : 4f; + } + // Big Bonk Energy + if (Behavior == 3f || Behavior == 4f) + { + float swingTime = 20f; + Projectile.ai[1] += MathHelper.ToRadians(200f / swingTime) * (Behavior == 3f ? 1f : -1f); + counter++; + float outwardPosition = 50f; + Vector2 pivot = new Vector2(PivotPointX, PivotPointY); + Projectile.Center = pivot + Projectile.ai[1].ToRotationVector2() * outwardPosition; + Projectile.rotation = Projectile.ai[1] + drawOffset; + if (counter > swingTime) + { + Projectile.ai[1] = MathHelper.PiOver4; + counter = 0; + Behavior = 5f; + } + } + // Head back to the player as a reset between bonks + if (Behavior == 5f) + MoveBackToPlayer(); + } + } + + private void MoveBackToPlayer() + { + Player player = Main.player[Projectile.owner]; + + const float outwardPosition = 180f; + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * outwardPosition; + + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); + + float playerHomeSpeed = 40f; + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 1f + playerVec) / 2f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Behavior = 0f; + } + // Return to normal size + if (Projectile.scale != 1f) + { + Projectile.scale = 1f; + Projectile.ExpandHitboxBy(projSize); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // On bonk, there is a small chance for confetti and Stylish energy + if ((Behavior == 3f || Behavior == 4f) && Main.rand.NextBool(20) && Projectile.soundDelay <= 0) + { + Rectangle location = new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height); + CombatText.NewText(location, new Color(239, 113, 152), "Stylish!", true); + SoundEngine.PlaySound(StylishSound with { Volume = 0.35f }, target.Center); + Projectile.soundDelay = 60; + for (int i = 0; i < 5; i++) + { + int confettiDust = Main.rand.Next(139, 143); + int confetti = Dust.NewDust(target.Center, target.width, target.height, confettiDust, target.velocity.X, target.velocity.Y, 0, new Color(), 1.2f); + Main.dust[confetti].velocity.X *= Main.rand.NextFloat(0.5f, 1.5f); + Main.dust[confetti].velocity.Y *= Main.rand.NextFloat(0.5f, 1.5f); + Main.dust[confetti].velocity.X += Main.rand.NextFloat(-2.5f, 2.5f); + Main.dust[confetti].velocity.Y += Main.rand.NextFloat(-2.5f, 2.5f); + Main.dust[confetti].scale *= Main.rand.NextFloat(0.7f, 1.3f); + if (Main.netMode != NetmodeID.Server && Main.rand.NextBool()) + { + int confettiGore = Main.rand.Next(276, 283); + int idx = Gore.NewGore(Projectile.GetSource_FromThis(), target.Center, target.velocity, confettiGore, 1f); + Main.gore[idx].velocity.X *= Main.rand.NextFloat(0.5f, 1.5f); + Main.gore[idx].velocity.Y *= Main.rand.NextFloat(0.5f, 1.5f); + Main.gore[idx].velocity.X += Main.rand.NextFloat(-2.5f, 2.5f); + Main.gore[idx].velocity.Y += Main.rand.NextFloat(-2.5f, 2.5f); + Main.gore[idx].scale *= Main.rand.NextFloat(0.8f, 1.2f); + } + } + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 67, dspeed.X, dspeed.Y, 50, default, 1.2f); + Main.dust[dust].noGravity = true; + } + } + + public Color TrailColorFunction(float completionRatio) + { + float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f; + return new Color(255, 56, 0) * opacity; + } + + public float TrailWidthFunction(float completionRatio) => 2f; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + bool shouldDrawTrail = Behavior != 0f; + if (shouldDrawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } + + // Draw the hammer. + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; + } + } +} diff --git a/Projectiles/Summon/Umbrella/MagicHammer.png b/Projectiles/Summon/Umbrella/MagicHammer.png new file mode 100644 index 0000000000..3d683c85c4 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicHammer.png differ diff --git a/Projectiles/Summon/Umbrella/MagicHat.cs b/Projectiles/Summon/Umbrella/MagicHat.cs new file mode 100644 index 0000000000..ee12eeb91c --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicHat.cs @@ -0,0 +1,144 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicHat : ModProjectile + { + public const float Range = 1500.0001f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Magic Hat"); + ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 30; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.minionSlots = 5f; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = Projectile.Calamity(); + + // Set up minion buffs and bools + bool hatExists = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (hatExists) + { + if (player.dead) + { + modPlayer.magicHat = false; + } + if (modPlayer.magicHat) + { + Projectile.timeLeft = 2; + } + } + + // On frame 2, spawn the tools + if (Projectile.ai[0] == 1f) + { + List> Projectiles = new List>() + { + new Tuple(ModContent.ProjectileType(), 2f), + new Tuple(ModContent.ProjectileType(), 3f), + new Tuple(ModContent.ProjectileType(), 1f), + new Tuple(ModContent.ProjectileType(), 1f), + new Tuple(ModContent.ProjectileType(), 1f), + }; + for (int i = 0; i < Projectiles.Count; i++) + { + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, Projectiles[i].Item1,(int)(Projectile.damage * Projectiles[i].Item2), + Projectile.knockBack * Projectiles[i].Item2, Projectile.owner, Projectile.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * Projectiles[i].Item2); + } + } + Projectile.ai[0]++; + + // Stick to the player's head, account for shifts in gravity + Projectile.Center = player.MountedCenter + Vector2.UnitY * (player.gfxOffY - 30f); + if (player.gravDir == -1f) + { + Projectile.Center = player.MountedCenter - Vector2.UnitY * (player.gfxOffY - 30f); + Projectile.rotation = MathHelper.Pi; + } + else + { + Projectile.rotation = 0f; + } + Projectile.position.X = (int)Projectile.position.X; + Projectile.position.Y = (int)Projectile.position.Y; + + // Change the summons scale size a little bit to make it pulse in and out + float scalar = (float)Main.mouseTextColor / 200f - 0.35f; + scalar *= 0.2f; + Projectile.scale = scalar + 0.95f; + + // On summon dust + if (Projectile.localAI[0] == 0f) + { + int dustAmt = 50; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { + int dustEffects = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height - 16, 234, 0f, 0f, 0, default, 1f); + Main.dust[dustEffects].velocity *= 2f; + Main.dust[dustEffects].scale *= 1.15f; + } + Projectile.localAI[0] += 1f; + } + } + + // Glowmask effect + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); + + // No contact damage + public override bool? CanDamage() => false; + + // Draw over players + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) => overPlayers.Add(index); + + public override bool PreDraw(ref Color lightColor) + { + Player player = Main.player[Projectile.owner]; + + // Use a different texture if the player is invisible or has at least 50% stealth + Texture2D texture = ModContent.Request(Texture).Value; + float stealthPercent = player.Calamity().rogueStealthMax != 0 ? (player.Calamity().rogueStealth / player.Calamity().rogueStealthMax) : 0f; //0 to 1 + bool hasStealth = player.Calamity().rogueStealth > 0f && stealthPercent > 0.5f && player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisibility; + if (player.ShouldNotDraw || hasStealth) + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/MagicHatInvis").Value; + + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + // Draw the hat. + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; + } + } +} diff --git a/Projectiles/Summon/Umbrella/MagicHat.png b/Projectiles/Summon/Umbrella/MagicHat.png new file mode 100644 index 0000000000..b65d5b56f1 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicHat.png differ diff --git a/Projectiles/Summon/Umbrella/MagicHatInvis.png b/Projectiles/Summon/Umbrella/MagicHatInvis.png new file mode 100644 index 0000000000..a922bc8b20 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicHatInvis.png differ diff --git a/Projectiles/Summon/Umbrella/MagicRifle.cs b/Projectiles/Summon/Umbrella/MagicRifle.cs new file mode 100644 index 0000000000..5fc1773f9a --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicRifle.cs @@ -0,0 +1,307 @@ +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicRifle : ModProjectile + { + public VertexStrip TrailDrawer; + public bool drawTrail = false; + public bool leftSide = false; + public int swapCooldown = 0; + public float sineCounter = 0f; + public ref float SwapSides => ref Projectile.localAI[0]; + public ref float SpinCounter => ref Projectile.localAI[1]; + public ref float ShootCooldown => ref Projectile.ai[1]; + + public float GetOffsetAngle + { + get + { + return MathHelper.TwoPi * 5 / 5 + Main.projectile[(int)Projectile.ai[0]].ai[0] / 27f; + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lavender Rifle"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; + ProjectileID.Sets.TrailingMode[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 50; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + // Set player namespace + Player player = Main.player[Projectile.owner]; + + // Set timeLeft if the hat exists + if (player.Calamity().magicHat) + { + Projectile.timeLeft = 2; + } + + // Increment counters for swap cooldown and sine counter + if (swapCooldown > 0) + swapCooldown--; + if (swapCooldown == 1) + leftSide = !leftSide; + sineCounter++; + + float homingRange = MagicHat.Range; + Vector2 targetVec = Projectile.position; + int targetIndex = -1; + // If targeting something, prioritize that enemy + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + // Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < (homingRange + extraDist)) + { + homingRange = targetDist; + targetVec = npc.Center; + targetIndex = npc.whoAmI; + } + } + } + if (targetIndex == -1) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(Projectile, false)) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + // Calculate distance between target and the projectile to know if it's too far or not + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < (homingRange + extraDist)) + { + homingRange = targetDist; + targetVec = npc.Center; + targetIndex = npc.whoAmI; + } + } + } + } + + if (targetIndex == -1) + { + IdleAI(); + } + else + { + AttackMovement(targetIndex); + } + + // Return if on swap cooldown + if (swapCooldown != 0f) + return; + + // Increment attack cooldown + if (ShootCooldown > 0f) + { + ShootCooldown += 1f; + } + // Set the minion to be ready for attack + if (ShootCooldown > 45f) + { + ShootCooldown = 0f; + Projectile.netUpdate = true; + } + + // Return if on attack cooldown, has no target + if (ShootCooldown != 0f || targetIndex == -1) + return; + + // Do a little spin before firing a big shot + if (SwapSides > 5f) + { + SpinCounter += MathHelper.ToRadians(60f) * Projectile.spriteDirection; + if (Math.Abs(SpinCounter) > MathHelper.ToRadians(720f)) + { + SpinCounter = 0f; + SwapSides = -1f; + } + return; + } + + // Shoot a bullet + if (Main.myPlayer == Projectile.owner) + { + float projSpeed = 6f; + int projType = ModContent.ProjectileType(); + int damage = Projectile.damage; + float kback = 0f; + if (SwapSides == -1f) + { + projType = ModContent.ProjectileType(); + damage *= 2; + swapCooldown = 30; + kback = Projectile.knockBack; + } + ShootCooldown += 1f; + if (Main.myPlayer == Projectile.owner) + { + Vector2 velocity = targetVec - Projectile.Center; + velocity.Normalize(); + velocity *= projSpeed; + + SoundEngine.PlaySound(SwapSides == -1f ? CommonCalamitySounds.LargeWeaponFireSound : SoundID.Item40, Projectile.position); + + int bullet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, damage, kback, Projectile.owner); + // For unknown reasons, the bullet does not spawn at the desired position, so let's set that manually + // I don't think this works regardless + if (Main.projectile.IndexInRange(bullet)) + Main.projectile[bullet].Center = Projectile.Center; + Projectile.netUpdate = true; + } + SwapSides += 1f; + } + } + + private void AttackMovement(int targetIndex) + { + Player player = Main.player[Projectile.owner]; + NPC target = Main.npc[targetIndex]; + + Vector2 returnPos = Vector2.Zero; + Vector2 returnPos1 = target.Right + new Vector2(300f, 0f); + Vector2 returnPos2 = target.Left - new Vector2(300f, 0f); + + // Swap sides after shooting a big bullet + returnPos = !leftSide ? returnPos1 : returnPos2; + if (player.Center.X - target.Center.X < 0) + returnPos = !leftSide ? returnPos2 : returnPos1; + + // Target distance calculations + Vector2 targetVec = returnPos - Projectile.Center; + float targetDist = targetVec.Length(); + + float targetHomeSpeed = 60f; + // If more than 100 pixels away, move toward the target + if (targetDist > 100f) + { + targetVec.Normalize(); + targetVec *= targetHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + targetVec) / 11f; + Projectile.spriteDirection = Projectile.direction = ((returnPos.X - Projectile.Center.X) > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); + ShootCooldown = 40f; + } + else + { + Projectile.spriteDirection = Projectile.direction = ((target.Center.X - Projectile.Center.X) > 0).ToDirectionInt(); + float angle = Projectile.AngleTo(target.Center) + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); + Projectile.rotation = (SpinCounter != 0f ? angle + SpinCounter : Projectile.rotation.AngleTowards(angle, 0.3f)); + Projectile.Center = returnPos + new Vector2(0f, ((float)Math.Sin(MathHelper.TwoPi * 0.5f + sineCounter / 50f) * 0.5f + 0.5f) * 40f); + } + drawTrail = true; + } + + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; + + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); + + float playerHomeSpeed = 40f; + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(-45f)); + } + else + { + Projectile.spriteDirection = Projectile.direction = 0; + Projectile.rotation = GetOffsetAngle + MathHelper.PiOver4; + drawTrail = false; + Projectile.Center = returnPos; + } + SwapSides = 0f; + } + + public override bool? CanDamage() => false; + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + + public override Color? GetAlpha(Color lightColor) => Color.White; + + public Color TrailColorFunction(float completionRatio) + { + float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f; + return new Color(148, 0, 211) * opacity; + } + + public float TrailWidthFunction(float completionRatio) => 2f; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (drawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + + direction |= SpriteEffects.FlipVertically; + } + + // Draw the rifle. + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; + } + } +} diff --git a/Projectiles/Summon/Umbrella/MagicRifle.png b/Projectiles/Summon/Umbrella/MagicRifle.png new file mode 100644 index 0000000000..787406d773 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicRifle.png differ diff --git a/Projectiles/Summon/Umbrella/MagicTree.cs b/Projectiles/Summon/Umbrella/MagicTree.cs new file mode 100644 index 0000000000..5ba4a9bbd1 --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicTree.cs @@ -0,0 +1,214 @@ +using CalamityMod.Gores.Trees; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicTree : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Summon/Umbrella/TreeForest"; + private Tree TreeType = Tree.Forest; + private enum Tree + { + Astral, + Corruption, + Crimson, + Forest, + Hallow, + Jungle, + Ocean, + Snow, + SulphurousSea + } + public static readonly SoundStyle TreeCrashSound = new("CalamityMod/Sounds/Custom/TreeFalling"); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tree"); + ProjectileID.Sets.MinionShot[Projectile.type] = true; + } + + public override void SetDefaults() + { + Projectile.width = 300; + Projectile.height = 300; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = 600; + } + + public override void AI() + { + //Constant rotation and gravity + Projectile.rotation += 0.125f * Projectile.direction; + Projectile.velocity.Y += 0.3f; + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; + } + if (Projectile.ai[1] == 0f) + { + Array values = Enum.GetValues(typeof(Tree)); + Random random = new Random(); + TreeType = (Tree)values.GetValue(random.Next(values.Length)); + Projectile.ai[1]++; + } + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(TreeCrashSound with { Volume = 0.5f }, Projectile.Center); + + int creatureAmt = 3; + for (int t = 0; t < creatureAmt; t++) + { + int projType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); + Vector2 velocity = Vector2.Zero; + if (Main.projectile.IndexInRange((int)Projectile.ai[0])) + { + velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(Projectile.Center, Main.npc[(int)Projectile.ai[0]].Center, 0.28f, 12f); + velocity.X += Main.rand.NextFloat(-3f, 3f); + } + else + { + velocity.X = Main.rand.NextFloat(-10f, 10f); + velocity.Y = Main.rand.NextFloat(-15f, -8f); + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, (int)(Projectile.damage * 0.05f), 0f, Projectile.owner); + } + + int treeGore = GoreID.TreeLeaf_Normal; + string TreeTop = "TreeForestTop"; + string TreeBottom = "TreeForestBottom"; + switch (TreeType) + { + case Tree.Astral: + treeGore = ModContent.GoreType(); + TreeTop = "TreeAstralTop"; + TreeBottom = "TreeAstralBottom"; + break; + case Tree.Corruption: + treeGore = GoreID.TreeLeaf_Corruption; + TreeTop = "TreeCorruptionTop"; + TreeBottom = "TreeCorruptionBottom"; + break; + case Tree.Crimson: + treeGore = GoreID.TreeLeaf_Crimson; + TreeTop = "TreeCrimsonTop"; + TreeBottom = "TreeCrimsonBottom"; + break; + case Tree.Forest: + treeGore = GoreID.TreeLeaf_Normal; + TreeTop = "TreeForestTop"; + TreeBottom = "TreeForestBottom"; + break; + case Tree.Hallow: + treeGore = GoreID.TreeLeaf_Hallow; + TreeTop = "TreeHallowTop"; + TreeBottom = "TreeHallowBottom"; + break; + case Tree.Jungle: + treeGore = GoreID.TreeLeaf_Jungle; + TreeTop = "TreeJungleTop"; + TreeBottom = "TreeJungleBottom"; + break; + case Tree.Ocean: + treeGore = GoreID.TreeLeaf_Palm; + TreeTop = "TreeOceanTop"; + TreeBottom = "TreeOceanBottom"; + break; + case Tree.Snow: + treeGore = GoreID.TreeLeaf_Boreal; + TreeTop = "TreeSnowTop"; + TreeBottom = "TreeSnowBottom"; + break; + case Tree.SulphurousSea: + treeGore = ModContent.GoreType(); + TreeTop = "TreeSulphurousSeaTop"; + TreeBottom = "TreeSulphurousSeaBottom"; + break; + default: + break; + } + + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < 20; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Vector2 spawnSource = Projectile.Center; + spawnSource.X += Main.rand.Next(-Projectile.width / 2, Projectile.width / 2 + 1); + spawnSource.Y += Main.rand.Next(-Projectile.height / 2, Projectile.height / 2 + 1); + int idx = Gore.NewGore(Projectile.GetSource_FromThis(), spawnSource, velocity, treeGore, 1f); + Main.gore[idx].velocity.X *= Main.rand.NextFloat(0.5f, 5f); + Main.gore[idx].velocity.Y *= Main.rand.NextFloat(0.5f, 5f); + Main.gore[idx].velocity.X += Main.rand.NextFloat(-5f, 5f); + Main.gore[idx].velocity.Y += Main.rand.NextFloat(-5f, 5f); + Main.gore[idx].scale *= Main.rand.NextFloat(0.8f, 1.2f); + } + Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, CalamityUtils.RandomVelocity(100f, 70f, 100f) * Main.rand.NextFloat(), Mod.Find(TreeTop).Type, Projectile.scale); + Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, CalamityUtils.RandomVelocity(100f, 70f, 100f) * Main.rand.NextFloat(), Mod.Find(TreeBottom).Type, Projectile.scale); + } + } + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.ai[1] == 0f) + return false; + + Texture2D texture = ModContent.Request(Texture).Value; + switch (TreeType) + { + case Tree.Astral: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeAstral").Value; + break; + case Tree.Corruption: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeCorruption").Value; + break; + case Tree.Crimson: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeCrimson").Value; + break; + case Tree.Forest: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeForest").Value; + break; + case Tree.Hallow: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeHallow").Value; + break; + case Tree.Jungle: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeJungle").Value; + break; + case Tree.Ocean: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeOcean").Value; + break; + case Tree.Snow: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeSnow").Value; + break; + case Tree.SulphurousSea: + texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/TreeSulphurousSea").Value; + break; + default: + break; + } + + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + // Draw the tree. + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; + } + + public override bool? CanDamage() => Projectile.ai[1] == 0f ? false : (bool?)null; + } +} diff --git a/Projectiles/Summon/Umbrella/MagicUmbrella.cs b/Projectiles/Summon/Umbrella/MagicUmbrella.cs new file mode 100644 index 0000000000..200fd52e16 --- /dev/null +++ b/Projectiles/Summon/Umbrella/MagicUmbrella.cs @@ -0,0 +1,360 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.Graphics; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon.Umbrella +{ + public class MagicUmbrella : ModProjectile + { + public float Behavior = 0f; + private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi; + public VertexStrip TrailDrawer; + + public float GetOffsetAngle + { + get + { + return MathHelper.TwoPi * 4 / 5 + Main.projectile[(int)Projectile.ai[0]].ai[0] / 27f; + } + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cyan Umbrella"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; + ProjectileID.Sets.TrailingMode[Projectile.type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 14; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.minion = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.alpha = 255; + Projectile.DamageType = DamageClass.Summon; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Behavior); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + Behavior = reader.ReadSingle(); + } + + public override void AI() + { + Projectile.alpha -= 50; + + // Set timeLeft if the player has the hat + if (Main.player[Projectile.owner].Calamity().magicHat) + { + Projectile.timeLeft = 2; + } + + // Not sure what this is for, a lot of the code is taken from Terraprisma + List blackListedTargets = new List {}; + + DelegateMethods.v3_1 = Color.Transparent.ToVector3(); + Point point = Projectile.Center.ToTileCoordinates(); + DelegateMethods.CastLightOpen(point.X, point.Y); + + blackListedTargets.Clear(); + DecideWhatToDo(blackListedTargets); + } + + private void DecideWhatToDo(List blacklist) + { + int num = 40; + int num2 = num - 1; + int num3 = num + 40; + int num4 = num3 - 1; + int num5 = num + 1; + + Player player = Main.player[Projectile.owner]; + + // Idle AI when too far away from the player + if (player.active && Vector2.Distance(player.Center, Projectile.Center) > 2000f) + { + Behavior = 0f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + } + + // Idle AI when Behavior is -1 + if (Behavior == -1f) + { + IdleAI(); + return; + } + + // Idle AI when Behavior is 0 + if (Behavior == 0f) + { + IdleAI(); + // Look for a target + int targetIdx = FindATarget(blacklist); + if (targetIdx != -1) + { + Behavior = Main.rand.NextFromList(num, num3); + Behavior = num3; + Projectile.ai[1] = targetIdx; + Projectile.netUpdate = true; + } + return; + } + + int num13 = 0; + int num14 = num2; + int num15 = 0; + if (Behavior >= (float)num5) + { + num13 = 1; + num14 = num4; + num15 = num5; + } + + int currentTarget = (int)Projectile.ai[1]; + if (!Main.npc.IndexInRange(currentTarget)) + { + int targetIdx = FindATarget(blacklist); + if (targetIdx != -1) + { + Behavior = Main.rand.NextFromList(num, num3); + Projectile.ai[1] = targetIdx; + Projectile.netUpdate = true; + } + else + { + Behavior = -1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + } + + return; + } + + NPC npc = Main.npc[currentTarget]; + if (!npc.CanBeChasedBy(this)) + { + int targetIdx = FindATarget(blacklist); + if (targetIdx != -1) + { + Behavior = Main.rand.NextFromList(num, num3); + Projectile.ai[1] = targetIdx; + Projectile.netUpdate = true; + } + else + { + Behavior = -1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + } + + return; + } + + Behavior -= 1f; + if (Behavior >= (float)num14) + { + Projectile.direction = ((Projectile.Center.X < npc.Center.X) ? 1 : (-1)); + if (Behavior == (float)num14) + { + Projectile.localAI[0] = Projectile.Center.X; + Projectile.localAI[1] = Projectile.Center.Y; + } + } + + float lerpValue2 = Utils.GetLerpValue(num14, num15, Behavior, clamped: true); + if (num13 == 0) + { + Vector2 vector6 = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); + if (lerpValue2 >= 0.5f) + vector6 = Vector2.Lerp(npc.Center, Main.player[Projectile.owner].Center, 0.5f); + + Vector2 center2 = npc.Center; + float num19 = (center2 - vector6).ToRotation(); + float num20 = (Projectile.direction == 1) ? (-(float)Math.PI) : ((float)Math.PI); + float num21 = num20 + (0f - num20) * lerpValue2 * 2f; + Vector2 vector7 = num21.ToRotationVector2(); + vector7.Y *= 0.5f; + vector7.Y *= 0.8f + (float)Math.Sin((float)Projectile.identity * 2.3f) * 0.2f; + vector7 = vector7.RotatedBy(num19); + float scaleFactor2 = (center2 - vector6).Length() / 2f; + Vector2 vector9 = Projectile.Center = Vector2.Lerp(vector6, center2, 0.5f) + vector7 * scaleFactor2; + float num22 = MathHelper.WrapAngle(num19 + num21); + Projectile.rotation = num22 + drawOffset; + Vector2 vector10 = Projectile.velocity = num22.ToRotationVector2() * 10f; + Projectile.position -= Projectile.velocity; + } + + if (num13 == 1) + { + Vector2 vector11 = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); + vector11 += new Vector2(0f, Utils.GetLerpValue(0f, 0.4f, lerpValue2, clamped: true) * -100f); + Vector2 v = npc.Center - vector11; + Vector2 value = v.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(v.Length(), 60f, 150f); + Vector2 value2 = npc.Center + value; + float lerpValue3 = Utils.GetLerpValue(0.4f, 0.6f, lerpValue2, clamped: true); + float lerpValue4 = Utils.GetLerpValue(0.6f, 1f, lerpValue2, clamped: true); + float targetAngle = v.SafeNormalize(Vector2.Zero).ToRotation() + drawOffset; + Projectile.rotation = Projectile.rotation.AngleTowards(targetAngle, (float)Math.PI / 5f + drawOffset); + Projectile.Center = Vector2.Lerp(vector11, npc.Center, lerpValue3); + if (lerpValue4 > 0f) + Projectile.Center = Vector2.Lerp(npc.Center, value2, lerpValue4); + } + + if (Behavior == (float)num15) + { + int targetIdx = FindATarget(blacklist); + if (targetIdx != -1) + { + Behavior = Main.rand.NextFromList(num, num3); + Projectile.ai[1] = targetIdx; + Projectile.netUpdate = true; + } + else + { + Behavior = -1f; + Projectile.ai[1] = 0f; + Projectile.netUpdate = true; + } + } + } + + private int FindATarget(List blackListedTargets) + { + Vector2 center = Main.player[Projectile.owner].Center; + int target = -1; + float closestDist = -1f; + NPC selectedTarget = Projectile.OwnerMinionAttackTargetNPC; + if (selectedTarget != null && selectedTarget.CanBeChasedBy(this)) + { + bool flag = true; + if (!selectedTarget.boss && blackListedTargets.Contains(selectedTarget.whoAmI)) + flag = false; + + if (selectedTarget.Distance(center) > MagicHat.Range) + flag = false; + + if (flag) + return selectedTarget.whoAmI; + } + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(this) && (npc.boss || !blackListedTargets.Contains(i))) + { + float npcDist = npc.Distance(center); + if (npcDist <= MagicHat.Range && (npcDist <= closestDist || closestDist == -1f)) + { + closestDist = npcDist; + target = i; + } + } + } + + return target; + } + + private void IdleAI() + { + Player player = Main.player[Projectile.owner]; + + Vector2 returnPos = player.Center + GetOffsetAngle.ToRotationVector2() * 180f; + + bool returningToPlayer = Behavior == -1f; + + // Player distance calculations + Vector2 playerVec = returnPos - Projectile.Center; + float playerDist = playerVec.Length(); + + float playerHomeSpeed = 40f; + //Return to normal if close enough to the player + if (playerDist < 150f && returningToPlayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + { + Behavior = 0f; + Projectile.netUpdate = true; + } + // Teleport to the player if abnormally far + if (playerDist > 2000f) + { + Projectile.Center = returnPos; + Projectile.netUpdate = true; + } + // If more than 60 pixels away, move toward the player + if (playerDist > 60f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f; + Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset; + } + else + { + Projectile.Center = returnPos; + Projectile.rotation = GetOffsetAngle + drawOffset; + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 10; i++) + { + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, 66, dspeed.X, dspeed.Y, 160, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.75f); + Main.dust[dust].noGravity = true; + } + } + + public Color TrailColorFunction(float completionRatio) + { + float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f; + return new Color(75, 255, 255) * opacity; + } + + public float TrailWidthFunction(float completionRatio) => 2f; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + bool shouldDrawTrail = Behavior > 0f; + if (shouldDrawTrail) + { + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } + + // Draw the umbrella. + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + return false; + } + } +} diff --git a/Projectiles/Summon/Umbrella/MagicUmbrella.png b/Projectiles/Summon/Umbrella/MagicUmbrella.png new file mode 100644 index 0000000000..1a32873e53 Binary files /dev/null and b/Projectiles/Summon/Umbrella/MagicUmbrella.png differ diff --git a/Projectiles/Summon/Umbrella/TreeAstral.png b/Projectiles/Summon/Umbrella/TreeAstral.png new file mode 100644 index 0000000000..a66b9a3d87 Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeAstral.png differ diff --git a/Projectiles/Summon/Umbrella/TreeCorruption.png b/Projectiles/Summon/Umbrella/TreeCorruption.png new file mode 100644 index 0000000000..756e63edc3 Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeCorruption.png differ diff --git a/Projectiles/Summon/Umbrella/TreeCrimson.png b/Projectiles/Summon/Umbrella/TreeCrimson.png new file mode 100644 index 0000000000..f3d1b7ff7f Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeCrimson.png differ diff --git a/Projectiles/Summon/Umbrella/TreeForest.png b/Projectiles/Summon/Umbrella/TreeForest.png new file mode 100644 index 0000000000..5f4e7abffa Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeForest.png differ diff --git a/Projectiles/Summon/Umbrella/TreeHallow.png b/Projectiles/Summon/Umbrella/TreeHallow.png new file mode 100644 index 0000000000..5539fa661e Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeHallow.png differ diff --git a/Projectiles/Summon/Umbrella/TreeJungle.png b/Projectiles/Summon/Umbrella/TreeJungle.png new file mode 100644 index 0000000000..3df6421c88 Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeJungle.png differ diff --git a/Projectiles/Summon/Umbrella/TreeOcean.png b/Projectiles/Summon/Umbrella/TreeOcean.png new file mode 100644 index 0000000000..9a7ed6ff85 Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeOcean.png differ diff --git a/Projectiles/Summon/Umbrella/TreeSnow.png b/Projectiles/Summon/Umbrella/TreeSnow.png new file mode 100644 index 0000000000..6c6c5f2465 Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeSnow.png differ diff --git a/Projectiles/Summon/Umbrella/TreeSulphurousSea.png b/Projectiles/Summon/Umbrella/TreeSulphurousSea.png new file mode 100644 index 0000000000..a7bdb3e3e1 Binary files /dev/null and b/Projectiles/Summon/Umbrella/TreeSulphurousSea.png differ diff --git a/Projectiles/Summon/UniverseSplitterHugeBeam.cs b/Projectiles/Summon/UniverseSplitterHugeBeam.cs index ad5c1973af..3f9461e1eb 100644 --- a/Projectiles/Summon/UniverseSplitterHugeBeam.cs +++ b/Projectiles/Summon/UniverseSplitterHugeBeam.cs @@ -199,8 +199,7 @@ namespace CalamityMod.Projectiles.Summon } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Electrified, 240); - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(BuffID.Electrified, 300); } } } diff --git a/Projectiles/Summon/VoidConcentrationAura.cs b/Projectiles/Summon/VoidConcentrationAura.cs index 36ddd6c80b..17b1647f24 100644 --- a/Projectiles/Summon/VoidConcentrationAura.cs +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - class VoidConcentrationAura : ModProjectile + public class VoidConcentrationAura : ModProjectile { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public int timer = 0; diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.cs b/Projectiles/Summon/VoidConcentrationBlackhole.cs index b59ecb8e97..6cd541dade 100644 --- a/Projectiles/Summon/VoidConcentrationBlackhole.cs +++ b/Projectiles/Summon/VoidConcentrationBlackhole.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - class VoidConcentrationBlackhole : ModProjectile + public class VoidConcentrationBlackhole : ModProjectile { private int damage = 0; diff --git a/Projectiles/Summon/VoidConcentrationOrb.cs b/Projectiles/Summon/VoidConcentrationOrb.cs index 023b9d2cb1..82c417bc06 100644 --- a/Projectiles/Summon/VoidConcentrationOrb.cs +++ b/Projectiles/Summon/VoidConcentrationOrb.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - class VoidConcentrationOrb : ModProjectile + public class VoidConcentrationOrb : ModProjectile { public override void SetStaticDefaults() diff --git a/Projectiles/Summon/VolcanicFireballSummon.cs b/Projectiles/Summon/VolcanicFireballSummon.cs index e13195ee55..b880e45369 100644 --- a/Projectiles/Summon/VolcanicFireballSummon.cs +++ b/Projectiles/Summon/VolcanicFireballSummon.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index cfc707603a..dd74eb1f8e 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon bool flag64 = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sirenWaifu && !modPlayer.allWaifus) + if (!modPlayer.sirenWaifu && !modPlayer.allWaifus && !modPlayer.sirenWaifuVanity && !modPlayer.allWaifusVanity) { Projectile.active = false; return; @@ -67,7 +67,10 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - Lighting.AddLight(Projectile.Center, 0f, 0.25f, 1.5f); + bool passive = modPlayer.sirenWaifuVanity || modPlayer.allWaifusVanity; + if (!passive) + Lighting.AddLight(Projectile.Center, 0f, 0.25f, 1.5f); + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -90,7 +93,7 @@ namespace CalamityMod.Projectiles.Summon } Projectile.position.X = (int)Projectile.position.X; Projectile.position.Y = (int)Projectile.position.Y; - if (Projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer && !passive) { // Prevent firing immediately if (Projectile.localAI[0] < 120f) diff --git a/Projectiles/Summon/YharonMinionFireball.cs b/Projectiles/Summon/YharonMinionFireball.cs index f210091fe7..3450bc0963 100644 --- a/Projectiles/Summon/YharonMinionFireball.cs +++ b/Projectiles/Summon/YharonMinionFireball.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Summon { @@ -53,6 +54,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * InitialSpeed, 0.15f); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 120); + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Summon/YoungDuke.cs b/Projectiles/Summon/YoungDuke.cs index 9823ac8b4c..ff3403b2ba 100644 --- a/Projectiles/Summon/YoungDuke.cs +++ b/Projectiles/Summon/YoungDuke.cs @@ -31,13 +31,15 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; } public override void AI() { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.miniOldDuke) + if (!modPlayer.miniOldDuke && !modPlayer.miniOldDukeVanity) { Projectile.active = false; return; @@ -78,33 +80,52 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame -= Main.projFrames[Projectile.type] / 2; } - NPC potentialTarget = Projectile.Center.ClosestNPCAt(1600f); - if (potentialTarget != null) + if (!modPlayer.miniOldDukeVanity) { - if (Projectile.Distance(potentialTarget.Center) < DistanceBeforeCharge) + NPC potentialTarget = Projectile.Center.ClosestNPCAt(1600f); + if (potentialTarget != null) { - Projectile.ai[0] += 1f; - int timePerCharge = playerHalfLife ? 25 : 35; - float chargeSpeed = playerHalfLife ? 25f : 20f; - if (Projectile.ai[0] >= timePerCharge) + if (Projectile.Distance(potentialTarget.Center) < DistanceBeforeCharge) { - Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * chargeSpeed; - Projectile.ai[0] = 0f; + Projectile.ai[0] += 1f; + int timePerCharge = playerHalfLife ? 25 : 35; + float chargeSpeed = playerHalfLife ? 25f : 20f; + if (Projectile.ai[0] >= timePerCharge) + { + Projectile.velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * chargeSpeed; + Projectile.ai[0] = 0f; + } + else + Projectile.velocity *= 0.9825f; } else - Projectile.velocity *= 0.9825f; - } - else - { - float intertia = 0.94f; - float homeSpeed = playerHalfLife ? 38f : 32f; - Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * homeSpeed, 1f - intertia); + { + float intertia = 0.94f; + float homeSpeed = playerHalfLife ? 38f : 32f; + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * homeSpeed, 1f - intertia); + } } + else if (!Projectile.WithinRange(player.Center, 140f)) + Projectile.velocity = (Projectile.velocity * 30f + Projectile.SafeDirectionTo(player.Center) * 16f) / 31f; } else if (!Projectile.WithinRange(player.Center, 140f)) Projectile.velocity = (Projectile.velocity * 30f + Projectile.SafeDirectionTo(player.Center) * 16f) / 31f; Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); } + + public override bool? CanDamage() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.miniOldDukeVanity) + { + return false; + } + else + { + return null; + } + } } } diff --git a/Projectiles/Typeless/ArcZap.cs b/Projectiles/Typeless/ArcZap.cs new file mode 100644 index 0000000000..0de35d644f --- /dev/null +++ b/Projectiles/Typeless/ArcZap.cs @@ -0,0 +1,131 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +namespace CalamityMod.Projectiles.Typeless +{ + public class ArcZap : ModProjectile + { + public bool ableToHit = false; + public NPC selectedTarget; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arc Zap"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 90; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.penetrate = 3; + Projectile.timeLeft = 120; + Projectile.extraUpdates = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 25; + } + + public override bool? CanDamage() => ableToHit ? (bool?)null : false; + + public override void AI() + { + NPC target = Main.npc[(int)Projectile.ai[0]]; + Vector2 targetVector = target.Center - Projectile.Center; + if (Projectile.localAI[0] == 0) + { + Projectile.velocity += targetVector / 90f; + Projectile.localAI[0]++; + } + Projectile.velocity.Y += 2f / 45f; + Projectile.position += (target.position - target.oldPosition) / 16; + if (Projectile.timeLeft <= 15) Projectile.position = target.Center; //puts the projectile inside the target if it somehow missed it (*Cough* WORMS) + if (Projectile.penetrate == 3) { CheckNearTarget(target, targetVector); } + else + { + ableToHit = false; + if (Projectile.ai[1] > 1f) { SpawnArc(); } + Projectile.Kill(); + } + } + + public void CheckNearTarget(NPC target, Vector2 targetVector) + { + float targetDist = targetVector.Length(); + if (targetDist < 20f && Projectile.position.X < target.position.X + target.width && Projectile.position.X + Projectile.width > target.position.X && Projectile.position.Y < target.position.Y + target.height && Projectile.position.Y + Projectile.height > target.position.Y) + { + ableToHit = true; + } + + } + + public void SpawnArc() + { + float maxDistance = 300f; + int target = -1; + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + float targetDist = Vector2.Distance(npc.Center, Projectile.Center); + if (targetDist < maxDistance && npc.Calamity().arcZapCooldown == 0 && npc.CanBeChasedBy()) + { + maxDistance = targetDist; + target = npcIndex; + } + } + + if (target > 0) + { + selectedTarget = Main.npc[target]; + selectedTarget.Calamity().arcZapCooldown = 18; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(Projectile.position.X, Projectile.position.Y - 10f), new Vector2(0f, -2f), ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, target, Projectile.ai[1] - 1f); + } + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ChainLightning", 4) { Volume = 0.15f }, Projectile.Center); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/SmallGreyscaleCircle").Value; + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + //Photoviscerator drawcode, edited slightly + float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 13f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; + Color color = Color.Lerp(Color.Cyan, Color.LightBlue, colorInterpolation) * 0.4f; + color.A = 0; + Vector2 drawPosition = Projectile.oldPos[i] + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. + Color outerColor = color; + Color innerColor = color * 0.5f; + float intensity = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); + intensity *= MathHelper.Lerp(0.15f, 1f, 1f - i / (float)Projectile.oldPos.Length); + // Become smaller the futher along the old positions we are. + Vector2 outerScale = new Vector2(1f) * intensity; + Vector2 innerScale = new Vector2(1f) * intensity * 0.7f; + outerColor *= intensity; + innerColor *= intensity; + Vector2 orbitDrawPosition1 = drawPosition + (drawPosition.SafeNormalize(Vector2.UnitY) * 10f).RotatedBy(MathHelper.Pi); + Vector2 orbitDrawPosition2 = drawPosition - (drawPosition.SafeNormalize(Vector2.UnitY) * 10f).RotatedBy(MathHelper.Pi); + if (Projectile.timeLeft > 15) + { + Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 0.15f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.15f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, orbitDrawPosition1, null, outerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.12f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, orbitDrawPosition2, null, outerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 0.12f, SpriteEffects.None, 0); + } + } + return false; + } + } +} diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 1dc82b4472..65e6507434 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -95,12 +96,14 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + if (Projectile.DamageType != DamageClass.Ranged) + target.AddBuff(ModContent.BuffType(), 120); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + if (Projectile.DamageType != DamageClass.Ranged) + target.AddBuff(ModContent.BuffType(), 120); } public override Color? GetAlpha(Color lightColor) @@ -145,6 +148,41 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { + Texture2D tex = ModContent.Request(Texture).Value; + Vector2 offsets = new Vector2(0f, Projectile.gfxOffY) - Main.screenPosition; + Color alpha = Projectile.GetAlpha(lightColor); + Rectangle spriteRec = new Microsoft.Xna.Framework.Rectangle(0, 0, tex.Width, tex.Height); + Vector2 spriteOrigin = spriteRec.Size() / 2f; + SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D aura = ModContent.Request("CalamityMod/Projectiles/StarTrail").Value; + Vector2 drawStart = Projectile.Center + Projectile.velocity; + Vector2 drawStart2 = Projectile.Center - Projectile.velocity * 0.5f; + Vector2 spinPoint = new Vector2(0f, -10f); + float time = Main.player[Projectile.owner].miscCounter % 216000f / 60f; + Rectangle auraRec = aura.Frame(); + Color pink = Color.Coral * 0.2f; + Color white = Color.White * 0.5f; + white.A = 0; + pink.A = 0; + Vector2 auraOrigin = new Vector2(auraRec.Width / 2f, 10f); + + //Draw the aura + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time), auraRec, pink, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.5f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.TwoPi / 3f), auraRec, pink, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.1f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.Pi * 4f / 3f), auraRec, pink, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.3f, SpriteEffects.None, 0); + for (float d = 0f; d < 1f; d += 0.5f) + { + float scaleMult = time % 0.5f / 0.5f; + scaleMult = (scaleMult + d) % 1f; + float colorMult = scaleMult * 2f; + if (colorMult > 1f) + { + colorMult = 2f - colorMult; + } + Main.EntitySpriteDraw(aura, drawStart2 + offsets, auraRec, white * colorMult, Projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); + } + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Typeless/BallisticPoisonCloud.cs b/Projectiles/Typeless/BallisticPoisonCloud.cs index 84fe059061..4ffa1f9f97 100644 --- a/Projectiles/Typeless/BallisticPoisonCloud.cs +++ b/Projectiles/Typeless/BallisticPoisonCloud.cs @@ -9,22 +9,22 @@ namespace CalamityMod.Projectiles.Typeless { public override void SetStaticDefaults() { - DisplayName.SetDefault("Cloud"); + DisplayName.SetDefault("Ballistic Cloud"); Main.projFrames[Projectile.type] = 10; } public override void SetDefaults() { - Projectile.width = 32; - Projectile.height = 32; + Projectile.width = 34; + Projectile.height = 34; Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 3600; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40; + Projectile.timeLeft = 600; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Typeless/ChaoticGeyser.cs b/Projectiles/Typeless/ChaoticGeyser.cs index abbf999d2c..df7d5f40c2 100644 --- a/Projectiles/Typeless/ChaoticGeyser.cs +++ b/Projectiles/Typeless/ChaoticGeyser.cs @@ -107,12 +107,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } } } diff --git a/Projectiles/Typeless/CoralBubble.cs b/Projectiles/Typeless/CoralBubble.cs index 133db9a51b..e452b896e5 100644 --- a/Projectiles/Typeless/CoralBubble.cs +++ b/Projectiles/Typeless/CoralBubble.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -30,40 +30,31 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.alpha -= 5; if (Projectile.alpha < 100) - { Projectile.alpha = 100; - } } else - { Projectile.localAI[0] += 1f; - } + if (Projectile.ai[1] > 30f) { if (Projectile.velocity.Y > -1.5f) - { Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; - } } else - { Projectile.ai[1] += 1f; - } + if (Projectile.wet) { if (Projectile.velocity.Y > 0f) - { Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; - } if (Projectile.velocity.Y > -1f) - { Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; - } } - int closestPlayer = (int)Player.FindClosest(Projectile.Center, 1, 1); - Vector2 distance = Main.player[closestPlayer].Center - Projectile.Center; + + int closestPlayer = Player.FindClosest(Projectile.Center, 1, 1); if (Projectile.Distance(Main.player[closestPlayer].Center) < 14f) { + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); Main.player[closestPlayer].AddBuff(BuffID.Gills, 90); Projectile.Kill(); } @@ -71,26 +62,24 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) + for (int i = 0; i < 10; i++) { - int num192 = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; + int size = 12; + int dustIndex = Dust.NewDust(Projectile.Center - Vector2.One * size, size * 2, size * 2, 212); + Dust dust = Main.dust[dustIndex]; + Vector2 value14 = Vector2.Normalize(dust.position - Projectile.Center); + dust.position = Projectile.Center + value14 * size; + dust.velocity = value14 * dust.velocity.Length(); + dust.color = Main.hslToRgb((float)(0.4000000059604645 + Main.rand.NextDouble() * 0.20000000298023224), 1f, 0.7f); + dust.color = Color.Lerp(dust.color, Color.White, 0.3f); + dust.noGravity = true; + dust.scale = 0.7f; } } } diff --git a/Projectiles/Typeless/CoralBubbleSmall.cs b/Projectiles/Typeless/CoralBubbleSmall.cs index 3f1a05c150..96d602ee41 100644 --- a/Projectiles/Typeless/CoralBubbleSmall.cs +++ b/Projectiles/Typeless/CoralBubbleSmall.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Typeless { @@ -32,58 +33,56 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.alpha -= 5; if (Projectile.alpha < 100) - { Projectile.alpha = 100; - } } else - { Projectile.localAI[0] += 1f; - } + if (Projectile.ai[1] > 30f) { if (Projectile.velocity.Y > -1.5f) - { Projectile.velocity.Y = Projectile.velocity.Y - 0.05f; - } } else - { Projectile.ai[1] += 1f; - } + if (Projectile.wet) { if (Projectile.velocity.Y > 0f) - { Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; - } if (Projectile.velocity.Y > -1f) - { Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; - } } - int closestPlayer = (int)Player.FindClosest(Projectile.Center, 1, 1); - Vector2 distance = Main.player[closestPlayer].Center - Projectile.Center; + + int closestPlayer = Player.FindClosest(Projectile.Center, 1, 1); if (Projectile.Distance(Main.player[closestPlayer].Center) < 7f) { + SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); Main.player[closestPlayer].AddBuff(BuffID.Gills, 30); Projectile.Kill(); } } + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + public override void Kill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int num190 = Main.rand.Next(5, 9); - for (int num191 = 0; num191 < num190; num191++) + for (int i = 0; i < 10; i++) { - int num192 = Dust.NewDust(Projectile.Center, 0, 0, 206, 0f, 0f, 100, default, 1.4f); - Main.dust[num192].velocity *= 0.8f; - Main.dust[num192].position = Vector2.Lerp(Main.dust[num192].position, Projectile.Center, 0.5f); - Main.dust[num192].noGravity = true; + int size = 6; + int dustIndex = Dust.NewDust(Projectile.Center - Vector2.One * size, size * 2, size * 2, 212); + Dust dust = Main.dust[dustIndex]; + Vector2 value14 = Vector2.Normalize(dust.position - Projectile.Center); + dust.position = Projectile.Center + value14 * size; + dust.velocity = value14 * dust.velocity.Length(); + dust.color = Main.hslToRgb((float)(0.4000000059604645 + Main.rand.NextDouble() * 0.20000000298023224), 1f, 0.7f); + dust.color = Color.Lerp(dust.color, Color.White, 0.3f); + dust.noGravity = true; + dust.scale = 0.7f; } } } diff --git a/Projectiles/Typeless/CryonicShield.cs b/Projectiles/Typeless/CryonicShield.cs index ecc83bb9d9..9b8d534e39 100644 --- a/Projectiles/Typeless/CryonicShield.cs +++ b/Projectiles/Typeless/CryonicShield.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs; +using CalamityMod.CalPlayer; +using CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; @@ -35,6 +36,9 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + // Protect against projectile reflection. Projectile.friendly = true; Projectile.hostile = false; @@ -43,7 +47,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.rotation += MathHelper.Pi / 48f; Projectile.Center = Owner.Center; - Lighting.AddLight(Projectile.Center, Projectile.Opacity * 0.2f, Projectile.Opacity * 0.45f, Projectile.Opacity * 0.5f); + if (!modPlayer.CryoStoneVanity) + Lighting.AddLight(Projectile.Center, Projectile.Opacity * 0.2f, Projectile.Opacity * 0.45f, Projectile.Opacity * 0.5f); if (Owner is null || !Owner.active || Owner.dead) Projectile.Kill(); @@ -51,34 +56,47 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 30); + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); - if (target.knockBackResist <= 0f) - return; - - if (CalamityGlobalNPC.ShouldAffectNPC(target)) + if (!modPlayer.CryoStoneVanity) { - float knockbackMultiplier = knockback - (1f - target.knockBackResist); - if (knockbackMultiplier < 0) - knockbackMultiplier = 0; + target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(ModContent.BuffType(), 30); - Vector2 trueKnockback = Projectile.SafeDirectionTo(target.Center); - target.velocity = trueKnockback * knockbackMultiplier; + if (target.knockBackResist <= 0f) + return; + + if (CalamityGlobalNPC.ShouldAffectNPC(target)) + { + float knockbackMultiplier = knockback - (1f - target.knockBackResist); + if (knockbackMultiplier < 0) + knockbackMultiplier = 0; + + Vector2 trueKnockback = Projectile.SafeDirectionTo(target.Center); + target.velocity = trueKnockback * knockbackMultiplier; + } } } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 30); + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.CryoStoneVanity) + { + target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(ModContent.BuffType(), 30); + } } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Size.Length() * 0.5f, targetHitbox); public override bool? CanHitNPC(NPC target) { - if (target.catchItem != 0 && target.type != ModContent.NPCType()) + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if ((target.catchItem != 0 && target.type != ModContent.NPCType()) || modPlayer.CryoStoneVanity) return false; return null; diff --git a/Projectiles/Typeless/DarkIce.cs b/Projectiles/Typeless/DarkIce.cs index b90996d2b0..b56e02b6fb 100644 --- a/Projectiles/Typeless/DarkIce.cs +++ b/Projectiles/Typeless/DarkIce.cs @@ -51,13 +51,13 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); } diff --git a/Projectiles/Typeless/DeepseaBlaze.cs b/Projectiles/Typeless/DeepseaBlaze.cs index 52441cbdbf..d208db274a 100644 --- a/Projectiles/Typeless/DeepseaBlaze.cs +++ b/Projectiles/Typeless/DeepseaBlaze.cs @@ -94,12 +94,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.OnFire3, 300); } } } diff --git a/Projectiles/Typeless/FabsolDust.cs b/Projectiles/Typeless/FabsolDust.cs deleted file mode 100644 index 081199444f..0000000000 --- a/Projectiles/Typeless/FabsolDust.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class FabsolDust : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } - - public override void SetDefaults() - { - Projectile.width = 70; - Projectile.height = 40; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f); - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 66, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - } -} diff --git a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs deleted file mode 100644 index 5e17bbee99..0000000000 --- a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Typeless.FiniteUse -{ - public class ExplosiveShotgunShell : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosive Shotgun Shell"); - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.light = 0.5f; - Projectile.alpha = 255; - Projectile.extraUpdates = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.aiStyle = ProjAIStyleID.Arrow; - AIType = ProjectileID.BulletHighVelocity; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage += target.lifeMax / 400; // 120 + 30 = 150 + (100000 / 400 = 250) = 400 * 8 = 3200 * 2 (explosion) = 6400 = 6.4% of boss HP - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return true; - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 32; - Projectile.position.X = Projectile.position.X - Projectile.width / 2; - Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - } - } -} diff --git a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.png b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.png deleted file mode 100644 index ef327144f8..0000000000 Binary files a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.png and /dev/null differ diff --git a/Projectiles/Typeless/FiniteUse/GrenadeRound.cs b/Projectiles/Typeless/FiniteUse/GrenadeRound.cs deleted file mode 100644 index c774e8d139..0000000000 --- a/Projectiles/Typeless/FiniteUse/GrenadeRound.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Typeless.FiniteUse -{ - public class GrenadeRound : ModProjectile - { - public static readonly SoundStyle RocketSound = new("CalamityMod/Sounds/Custom/BazookaRocket"); - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Grenade Round"); - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - } - - public override void AI() - { - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f; - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 90; - SoundEngine.PlaySound(RocketSound, Projectile.position); - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 30f) - Projectile.velocity.Y = Projectile.velocity.Y + 0.1f; - if (Projectile.velocity.Y > 16f) - Projectile.velocity.Y = 16f; - if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - num247 = Projectile.velocity.X * 0.5f; - num248 = Projectile.velocity.Y * 0.5f; - } - int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 6, 0f, 0f, 100, default, 1f); - Main.dust[num249].scale *= 2f + Main.rand.Next(10) * 0.1f; - Main.dust[num249].velocity *= 0.2f; - Main.dust[num249].noGravity = true; - num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f); - Main.dust[num249].fadeIn = 1f + Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage += target.lifeMax / 100; // 500 + 200 = 700 + (100000 / 100 = 1000) = 1700 * 2 (explosion) = 3400 = 3.4% of boss HP - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item62, Projectile.position); - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 96; - Projectile.position.X = Projectile.position.X - Projectile.width / 2; - Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; - for (int num193 = 0; num193 < 6; num193++) - { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f); - } - for (int num194 = 0; num194 < 60; num194++) - { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 6, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - Projectile.Damage(); - } - } -} diff --git a/Projectiles/Typeless/FiniteUse/GrenadeRound.png b/Projectiles/Typeless/FiniteUse/GrenadeRound.png deleted file mode 100644 index b6fbd0efbb..0000000000 Binary files a/Projectiles/Typeless/FiniteUse/GrenadeRound.png and /dev/null differ diff --git a/Projectiles/Typeless/FiniteUse/MagnumRound.cs b/Projectiles/Typeless/FiniteUse/MagnumRound.cs deleted file mode 100644 index b6a62372f5..0000000000 --- a/Projectiles/Typeless/FiniteUse/MagnumRound.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless.FiniteUse -{ - public class MagnumRound : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Magnum Round"); - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.light = 0.5f; - Projectile.alpha = 255; - Projectile.extraUpdates = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.aiStyle = ProjAIStyleID.Arrow; - AIType = ProjectileID.BulletHighVelocity; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; - } - - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage += target.lifeMax / 75; // 400 + 80 = 480 + (100000 / 75 = 1333) = 1813 = 1.813% of boss HP - } - } -} diff --git a/Projectiles/Typeless/FiniteUse/MagnumRound.png b/Projectiles/Typeless/FiniteUse/MagnumRound.png deleted file mode 100644 index 3f761a0306..0000000000 Binary files a/Projectiles/Typeless/FiniteUse/MagnumRound.png and /dev/null differ diff --git a/Projectiles/Typeless/FlareExplosion.cs b/Projectiles/Typeless/FlareExplosion.cs deleted file mode 100644 index 3f43ebb663..0000000000 --- a/Projectiles/Typeless/FlareExplosion.cs +++ /dev/null @@ -1,54 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class FlareExplosion : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - } - - public override void SetDefaults() - { - Projectile.width = 100; - Projectile.height = 100; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 10; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 3f / 255f, (255 - Projectile.alpha) * 3f / 255f, (255 - Projectile.alpha) * 0f / 255f); - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 5; num468++) - { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 0.5f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index 74bb778d5f..c9327a187d 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -116,13 +116,11 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); Projectile.direction = Main.player[Projectile.owner].direction; } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 180); Projectile.direction = Main.player[Projectile.owner].direction; } } diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 8a71041e9d..0375d2bb70 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Typeless CalamityPlayer modPlayer = player.Calamity(); bool correctMinion = Projectile.type == ModContent.ProjectileType(); - if (!modPlayer.fungalClump) + if (!modPlayer.fungalClump && !modPlayer.fungalClumpVanity) { Projectile.active = false; return; @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Typeless } //Periodically create dust - if (Main.rand.NextBool(16)) + if (Main.rand.NextBool(16) && !modPlayer.fungalClumpVanity) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 56, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f); } @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Typeless float range = 900f; bool npcFound = false; Vector2 half = new Vector2(0.5f); - if (!returnToPlayer) + if (!returnToPlayer && !modPlayer.fungalClumpVanity) { if (player.HasMinionAttackTargetNPC) { @@ -247,5 +247,19 @@ namespace CalamityMod.Projectiles.Typeless } public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool? CanDamage() + { + Player player = Main.player[Projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.fungalClumpVanity) + { + return false; + } + else + { + return null; + } + } } } diff --git a/Projectiles/Typeless/GladiatorSword.cs b/Projectiles/Typeless/GladiatorSword.cs deleted file mode 100644 index 6659e9e8aa..0000000000 --- a/Projectiles/Typeless/GladiatorSword.cs +++ /dev/null @@ -1,66 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GladiatorSword : ModProjectile - { - private double rotation = 0D; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gladiator Sword"); - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 22; - Projectile.ignoreWater = true; - Projectile.timeLeft = 18000; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.timeLeft *= 5; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - bool flag64 = Projectile.type == ModContent.ProjectileType(); - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - if (!modPlayer.gladiatorSword) - { - Projectile.active = false; - return; - } - - if (flag64) - { - if (player.dead) - modPlayer.glSword = false; - if (modPlayer.glSword) - Projectile.timeLeft = 2; - } - - Lighting.AddLight(Projectile.Center, 0.15f, 0.15f, 0f); - - Vector2 vector = player.Center - Projectile.Center; - Projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; - - Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - - rotation += 0.1; - if (rotation >= 360D) - rotation = 0D; - - Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; - } - } -} diff --git a/Projectiles/Typeless/GladiatorSword.png b/Projectiles/Typeless/GladiatorSword.png deleted file mode 100644 index a9f7f7f16f..0000000000 Binary files a/Projectiles/Typeless/GladiatorSword.png and /dev/null differ diff --git a/Projectiles/Typeless/GladiatorSword2.cs b/Projectiles/Typeless/GladiatorSword2.cs deleted file mode 100644 index db4a56b5fd..0000000000 --- a/Projectiles/Typeless/GladiatorSword2.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class GladiatorSword2 : ModProjectile - { - private double rotation = 0D; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gladiator Sword"); - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - } - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - Projectile.ignoreWater = true; - Projectile.timeLeft = 18000; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.timeLeft *= 5; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - bool flag64 = Projectile.type == ModContent.ProjectileType(); - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - if (!modPlayer.gladiatorSword) - { - Projectile.active = false; - return; - } - - if (flag64) - { - if (player.dead) - modPlayer.glSword = false; - if (modPlayer.glSword) - Projectile.timeLeft = 2; - } - - Lighting.AddLight(Projectile.Center, 0.15f, 0.15f, 0f); - - Vector2 vector = player.Center - Projectile.Center; - Projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; - - Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - - // Values are slightly different from the other sword to make this sword marginally slower so the intersection point isn't always at the same spot - rotation -= 0.09; - if (rotation <= 0D) - rotation = 360D; - - Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; - } - } -} diff --git a/Projectiles/Typeless/GladiatorSword2.png b/Projectiles/Typeless/GladiatorSword2.png deleted file mode 100644 index c4f7aae317..0000000000 Binary files a/Projectiles/Typeless/GladiatorSword2.png and /dev/null differ diff --git a/Projectiles/Typeless/GodSlayerOrb.cs b/Projectiles/Typeless/GodSlayerOrb.cs deleted file mode 100644 index 469eec3310..0000000000 --- a/Projectiles/Typeless/GodSlayerOrb.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class GodSlayerOrb : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Orb"); - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 200; - Projectile.extraUpdates = 1; - } - - public override void AI() - { - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Typeless/GodSlayerPhantom.cs b/Projectiles/Typeless/GodSlayerPhantom.cs deleted file mode 100644 index 91595db25d..0000000000 --- a/Projectiles/Typeless/GodSlayerPhantom.cs +++ /dev/null @@ -1,121 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class GodSlayerPhantom : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Phantom"); - Main.projFrames[Projectile.type] = 3; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.alpha = 100; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.penetrate = -1; - Projectile.timeLeft = 300; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 2) - { - Projectile.frame = 0; - } - int num822 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, 0f, 0f, 0, default, 0.5f); - Dust dust = Main.dust[num822]; - dust.velocity *= 0.1f; - dust.scale = 1.3f; - dust.noGravity = true; - float num953 = 40f * Projectile.ai[1]; //100 - float scaleFactor12 = 8f * Projectile.ai[1]; //5 - float num954 = 600f; - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) - 1.57f; - Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); - if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) - { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > num954) - { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (num953 - 1f) + moveDirection * scaleFactor12) / num953; - return; - } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - } - else - { - if (Projectile.timeLeft > 30) - { - Projectile.timeLeft = 30; - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture2D13 = ModContent.Request(Texture).Value; - int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; - int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void Kill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 40; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center; - Vector2 vector7 = vector6 - Projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 173, vector7.X * 1.5f, vector7.Y * 1.5f, 100, default, 0.5f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - Projectile.Damage(); - } - } -} diff --git a/Projectiles/Typeless/GodSlayerPhantom.png b/Projectiles/Typeless/GodSlayerPhantom.png deleted file mode 100644 index 80914fd387..0000000000 Binary files a/Projectiles/Typeless/GodSlayerPhantom.png and /dev/null differ diff --git a/Projectiles/Typeless/GoldenGunProj.cs b/Projectiles/Typeless/GoldenGunProj.cs index 9db1765b68..731cc86912 100644 --- a/Projectiles/Typeless/GoldenGunProj.cs +++ b/Projectiles/Typeless/GoldenGunProj.cs @@ -20,8 +20,6 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 8; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.penetrate = 1; Projectile.alpha = 255; Projectile.timeLeft = 300; diff --git a/Projectiles/Typeless/HolyFlameBomb.cs b/Projectiles/Typeless/HolyFlameBomb.cs deleted file mode 100644 index 24ef487b01..0000000000 --- a/Projectiles/Typeless/HolyFlameBomb.cs +++ /dev/null @@ -1,87 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; -namespace CalamityMod.Projectiles.Typeless -{ - public class HolyFlameBomb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flame"); - Main.projFrames[Projectile.type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Projectile.velocity.Y *= 1.005f; - Projectile.alpha -= 2; - if (Projectile.alpha <= 0) - { - Projectile.Kill(); - } - Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - { - Projectile.frame = 0; - } - Lighting.AddLight(Projectile.Center, 0.5f, 0.35f, 0f); - } - - public override void Kill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int num621 = 0; num621 < 20; num621++) - { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } - } -} diff --git a/Projectiles/Typeless/HolyFlameBomb.png b/Projectiles/Typeless/HolyFlameBomb.png deleted file mode 100644 index 385e7d67b1..0000000000 Binary files a/Projectiles/Typeless/HolyFlameBomb.png and /dev/null differ diff --git a/Projectiles/Typeless/HydrothermicFlare.cs b/Projectiles/Typeless/HydrothermicFlare.cs index f5929d559b..3ffb20e345 100644 --- a/Projectiles/Typeless/HydrothermicFlare.cs +++ b/Projectiles/Typeless/HydrothermicFlare.cs @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); target.AddBuff(ModContent.BuffType(), 90); } } diff --git a/Projectiles/Typeless/HydrothermicFlareRogue.cs b/Projectiles/Typeless/HydrothermicFlareRogue.cs index 399392510e..8898d2d683 100644 --- a/Projectiles/Typeless/HydrothermicFlareRogue.cs +++ b/Projectiles/Typeless/HydrothermicFlareRogue.cs @@ -41,12 +41,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } } } diff --git a/Projectiles/Typeless/HydrothermicSphere.cs b/Projectiles/Typeless/HydrothermicSphere.cs index 53d53d2462..9845f81c32 100644 --- a/Projectiles/Typeless/HydrothermicSphere.cs +++ b/Projectiles/Typeless/HydrothermicSphere.cs @@ -39,12 +39,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.OnFire3, 180); } } } diff --git a/Projectiles/Typeless/KelvinCatalystStar.cs b/Projectiles/Typeless/KelvinCatalystStar.cs index bc08fb8f1a..28e341a8bb 100644 --- a/Projectiles/Typeless/KelvinCatalystStar.cs +++ b/Projectiles/Typeless/KelvinCatalystStar.cs @@ -101,19 +101,16 @@ namespace CalamityMod.Projectiles.Typeless int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 67, vector7.X * 0.5f, vector7.Y * 0.5f, 100, default, 0.75f); Main.dust[num228].noGravity = true; } - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Frostburn, 60); + target.AddBuff(BuffID.Frostburn2, 60); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 60); + target.AddBuff(BuffID.Frostburn2, 60); } } } diff --git a/Projectiles/Typeless/NebulaDust.cs b/Projectiles/Typeless/NebulaDust.cs index 5e7796f7ef..eef2f887be 100644 --- a/Projectiles/Typeless/NebulaDust.cs +++ b/Projectiles/Typeless/NebulaDust.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; @@ -58,6 +59,11 @@ namespace CalamityMod.Projectiles.Typeless } } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 90); + } + public override bool PreDraw(ref Color lightColor) { lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Typeless/NebulaStar.cs b/Projectiles/Typeless/NebulaStar.cs index 64171a1787..f623f790e8 100644 --- a/Projectiles/Typeless/NebulaStar.cs +++ b/Projectiles/Typeless/NebulaStar.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -26,6 +27,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.owner == Main.myPlayer && !FadingOut) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 1f, 1f, 0.3f); diff --git a/Projectiles/Typeless/PurpleLabSeeker.cs b/Projectiles/Typeless/OnyxLabSeeker.cs similarity index 93% rename from Projectiles/Typeless/PurpleLabSeeker.cs rename to Projectiles/Typeless/OnyxLabSeeker.cs index 12e793b707..c85aa109e8 100644 --- a/Projectiles/Typeless/PurpleLabSeeker.cs +++ b/Projectiles/Typeless/OnyxLabSeeker.cs @@ -7,10 +7,10 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class PurpleLabSeeker : ModProjectile + public class OnyxLabSeeker : ModProjectile { public ref float Time => ref Projectile.ai[0]; - public override string Texture => "CalamityMod/Items/LabFinders/PurpleSeekingMechanism"; + public override string Texture => "CalamityMod/Items/LabFinders/OnyxSeekingMechanism"; public override void SetStaticDefaults() { @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = 300; } - public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.PlanetoidLabCenter, Color.Magenta, ref Time); + public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.CavernLabCenter, Color.Magenta, ref Time); public override void Kill(int timeLeft) { diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index a06e02d3fe..a5fcc51427 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -54,13 +54,11 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 60); - target.AddBuff(BuffID.Poisoned, 120); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 60); - target.AddBuff(BuffID.Poisoned, 120); } } } diff --git a/Projectiles/Typeless/SlimeStream.cs b/Projectiles/Typeless/SlimeStream.cs new file mode 100644 index 0000000000..9e4b410573 --- /dev/null +++ b/Projectiles/Typeless/SlimeStream.cs @@ -0,0 +1,35 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class SlimeStream : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silme Stream"); + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.timeLeft = 90; + Projectile.MaxUpdates = 3; + } + + public override void AI() + { + Dust.QuickDust(Projectile.Center, Projectile.ai[0] > 0f ? Color.Magenta : Color.RoyalBlue); + + if (Projectile.ai[1] > 0f && Projectile.timeLeft < 60) + CalamityUtils.HomeInOnNPC(Projectile, false, 320f, 12f, 20f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Slimed, 600); + } +} diff --git a/Projectiles/Typeless/StormBolt.cs b/Projectiles/Typeless/StormBolt.cs deleted file mode 100644 index f5520e0809..0000000000 --- a/Projectiles/Typeless/StormBolt.cs +++ /dev/null @@ -1,38 +0,0 @@ -using CalamityMod.Projectiles.Summon; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class StormBolt : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.light = 1f; - Projectile.timeLeft = 300; - } - - public override void AI() - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 16, Projectile.velocity.X * 0.15f, Projectile.velocity.Y * 0.15f); - } - - public override void Kill(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, 0f); - } - } - } -} diff --git a/Projectiles/Typeless/SuicideBomberDemon.cs b/Projectiles/Typeless/SuicideBomberDemon.cs index ad134992a3..d0dfd6e468 100644 --- a/Projectiles/Typeless/SuicideBomberDemon.cs +++ b/Projectiles/Typeless/SuicideBomberDemon.cs @@ -206,8 +206,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool? CanDamage() => Projectile.Opacity >= 1f ? null : false; - // Ensure damage is not absolutely obscene when hitting players. - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 95; + // TODO -- this damage should be after Terraria vanilla multipliers, so it won't one shot people + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + if (Main.masterMode) damage = 540; + else if (Main.expertMode) damage = 450; + else damage = 360; + } public float FlameTrailWidthFunction(float completionRatio) => MathHelper.SmoothStep(21f, 8f, completionRatio); diff --git a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs index a36ceb513c..3d386211df 100644 --- a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs +++ b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs @@ -114,8 +114,7 @@ namespace CalamityMod.Projectiles.Typeless { return; } - int buffType = (fromArmour || Projectile.ai[0] == 2f) ? ModContent.BuffType() : BuffID.Venom; - target.AddBuff(buffType, fromArmour ? 150 : 120); + target.AddBuff(ModContent.BuffType(), fromArmour ? 150 : 120); Projectile.Kill(); } @@ -125,8 +124,7 @@ namespace CalamityMod.Projectiles.Typeless { return; } - int buffType = (fromArmour || Projectile.ai[0] == 2f) ? ModContent.BuffType() : BuffID.Venom; - target.AddBuff(buffType, fromArmour ? 150 : 120); + target.AddBuff(ModContent.BuffType(), fromArmour ? 150 : 120); Projectile.Kill(); } diff --git a/Projectiles/Typeless/TerminusHoldout.cs b/Projectiles/Typeless/TerminusHoldout.cs index b6f2d4fda8..ada56f83e5 100644 --- a/Projectiles/Typeless/TerminusHoldout.cs +++ b/Projectiles/Typeless/TerminusHoldout.cs @@ -1,13 +1,13 @@ -using CalamityMod.Events; +using System; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.GameContent.Events; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Events; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request(Texture).Value; + Texture2D texture = CalamityWorld.getFixedBoi ? ModContent.Request("CalamityMod/Items/SummonItems/Terminus_GFB").Value : ModContent.Request(Texture).Value; Vector2 baseDrawPosition = Projectile.Center - Main.screenPosition; Vector2 origin = texture.Size() * 0.5f; Color baseColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White, Utils.GetLerpValue(40f, 120f, Time, true)); diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 2396732ba9..d2187f3163 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Electrified, 180); - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 6); if (target.knockBackResist <= 0f) return; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Electrified, 180); - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 6); } public override bool PreDraw(ref Color lightColor) @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool? CanHitNPC(NPC target) { - if (target.catchItem != 0 && target.type != ModContent.NPCType()) + if (NPCID.Sets.ProjectileNPC[target.type] || target.catchItem != 0 && target.type != ModContent.NPCType()) { return false; } diff --git a/Projectiles/Typeless/TrueBattleSpawn.cs b/Projectiles/Typeless/TrueBattleSpawn.cs deleted file mode 100644 index 8b3ff0462b..0000000000 --- a/Projectiles/Typeless/TrueBattleSpawn.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.NPCs.Calamitas; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class TrueBattleSpawn : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spawn"); - } - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 6; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.scale = 1f; - Projectile.penetrate = 1; - Projectile.timeLeft = 20; - Projectile.tileCollide = false; - AIType = ProjectileID.Bullet; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - Projectile.ai[1]++; - - if (Projectile.ai[1] >= 0) - { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - Projectile.ai[1] = -30; - } - } - } -} diff --git a/Projectiles/Typeless/UnstableSpark.cs b/Projectiles/Typeless/UnstableSpark.cs deleted file mode 100644 index 10639aefb9..0000000000 --- a/Projectiles/Typeless/UnstableSpark.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class UnstableSpark : ModProjectile - { - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Unstable Spark"); - } - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 90; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - // Reduce damage of projectiles if more than the cap are active - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type]; - int cap = 5; - int oldDamage = damage; - if (projectileCount > cap) - { - damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); - if (damage < 1) - damage = 1; - } - } - - public override void AI() - { - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; - } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X = Projectile.velocity.X * 0.97f; - if (Projectile.velocity.X > -0.01 && Projectile.velocity.X < 0.01) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; - } - Projectile.rotation += Projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 0.5f); - Dust dust = Main.dust[num199]; - dust.position.X -= 2f; - dust.position.Y += 2f; - dust.scale += Main.rand.Next(50) * 0.01f; - dust.noGravity = true; - dust.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) - { - int num200 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 206, 0f, 0f, 100, default, 0.5f); - Dust dust2 = Main.dust[num200]; - dust2.position.X -= 2f; - dust2.position.Y += 2f; - dust2.scale += 0.3f + Main.rand.Next(50) * 0.01f; - dust2.noGravity = true; - dust2.velocity *= 0.1f; - } - if (Projectile.velocity.Y < 0.25 && Projectile.velocity.Y > 0.15) - { - Projectile.velocity.X = Projectile.velocity.X * 0.8f; - } - Projectile.rotation = -Projectile.velocity.X * 0.05f; - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - } -} diff --git a/Projectiles/Typeless/WhiteLabSeeker.cs b/Projectiles/Typeless/WhiteLabSeeker.cs new file mode 100644 index 0000000000..da4afbad23 --- /dev/null +++ b/Projectiles/Typeless/WhiteLabSeeker.cs @@ -0,0 +1,63 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class WhiteLabSeeker : ModProjectile + { + public ref float Time => ref Projectile.ai[0]; + public override string Texture => "CalamityMod/Items/LabFinders/WhiteSeekingMechanism"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Seeking Mechanism"); + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 24; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + } + + public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.IceLabCenter, Color.White, ref Time); + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 8; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(16f, 16f), 267); + dust.color = Color.White; + dust.scale = Main.rand.NextFloat(0.95f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(2.5f, 2.5f); + dust.velocity.Y -= 1.5f; + dust.fadeIn = 1.2f; + dust.noGravity = true; + } + } + + public override bool? CanCutTiles() => false; + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + if (Time > 80f && Projectile.ai[1] == 0f) + { + for (int i = 0; i < 24; i += 2) + { + Vector2 drawPosition = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.Zero) * i * Utils.GetLerpValue(80f, 125f, Time, true) * 25f - Main.screenPosition; + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor) * (1f - i / 24f), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); + } + } + return true; + } + } +} diff --git a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs index b2a4037428..556a1f4349 100644 --- a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs +++ b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs @@ -208,7 +208,7 @@ namespace CalamityMod.Projectiles.Typeless bool canBreakTileCheck = TileLoader.CanKillTile(x, y, tile.TileType, ref true_) && TileLoader.CanKillTile(x, y, tile.TileType, ref false_); bool shouldBreakTile = tile.ShouldBeMined(); - if (!Owner.noBuilding && shouldBreakTile && pickaxeRequirement < pickPower && canBreakTileCheck) + if (!Owner.noBuilding && shouldBreakTile && pickaxeRequirement <= pickPower && canBreakTileCheck) { WorldGen.KillTile(x, y, false, false, false); if (!Main.tile[x, y].HasTile && Main.netMode != NetmodeID.SinglePlayer) diff --git a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs index 3619d9de6e..7249d5b862 100644 --- a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs +++ b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Typeless Texture2D sprite = ModContent.Request(Texture).Value; - Effect tileEffect = Filters.Scene["WulfrumScaffoldSelection"].GetShader().Shader; + Effect tileEffect = Filters.Scene["CalamityMod:WulfrumScaffoldSelection"].GetShader().Shader; tileEffect.Parameters["mainOpacity"].SetValue(1f); tileEffect.Parameters["tileEdgeBlendStrenght"].SetValue(2f); diff --git a/Projectiles/Typeless/YellowLabSeeker.cs b/Projectiles/Typeless/YellowLabSeeker.cs index 5ff24a7cc8..44e4d72d42 100644 --- a/Projectiles/Typeless/YellowLabSeeker.cs +++ b/Projectiles/Typeless/YellowLabSeeker.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = 300; } - public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.IceLabCenter, Color.Yellow, ref Time); + public override void AI() => RedLabSeeker.Behavior(Projectile, CalamityWorld.PlanetoidLabCenter, Color.Yellow, ref Time); public override void Kill(int timeLeft) { diff --git a/Scenes/BossBackgroundScenes/CalamitasCloneBackgroundScene.cs b/Scenes/BossBackgroundScenes/CalamitasCloneBackgroundScene.cs index 5e4337047f..eb8aaaa389 100644 --- a/Scenes/BossBackgroundScenes/CalamitasCloneBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/CalamitasCloneBackgroundScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using Terraria; using Terraria.ModLoader; diff --git a/Scenes/BossBackgroundScenes/AEWBackgroundScene.cs b/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs similarity index 54% rename from Scenes/BossBackgroundScenes/AEWBackgroundScene.cs rename to Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs index 6d4c027d9a..5c7f048f6b 100644 --- a/Scenes/BossBackgroundScenes/AEWBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs @@ -1,18 +1,19 @@ -using CalamityMod.NPCs.AdultEidolonWyrm; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.World; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Systems { - public class AEWBackgroundScene : ModSceneEffect + public class DrunkCrabBackgroundScene : ModSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; - public override bool IsSceneEffectActive(Player player) => NPC.AnyNPCs(ModContent.NPCType()); + public override bool IsSceneEffectActive(Player player) => NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.getFixedBoi; public override void SpecialVisuals(Player player, bool isActive) { - player.ManageSpecialBiomeVisuals("CalamityMod:AdultEidolonWyrm", isActive); + player.ManageSpecialBiomeVisuals("CalamityMod:DrunkCrabulon", isActive); } } } diff --git a/Scenes/MiscScenes/BrimstoneCragScene.cs b/Scenes/MiscScenes/BrimstoneCragScene.cs new file mode 100644 index 0000000000..6d9151f525 --- /dev/null +++ b/Scenes/MiscScenes/BrimstoneCragScene.cs @@ -0,0 +1,17 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class BrimstoneCragScene : ModSceneEffect + { + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + + public override bool IsSceneEffectActive(Player player) => player.Calamity().ZoneCalamity; + + public override void SpecialVisuals(Player player, bool isActive) + { + player.ManageSpecialBiomeVisuals("CalamityMod:BrimstoneCrag", isActive); + } + } +} diff --git a/Scenes/MiscScenes/DoGPhase2DelayScene.cs b/Scenes/MiscScenes/DoGPhase2DelayScene.cs index 4bb1489e48..190d93d5ed 100644 --- a/Scenes/MiscScenes/DoGPhase2DelayScene.cs +++ b/Scenes/MiscScenes/DoGPhase2DelayScene.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Systems { public class DoGPhase2DelayScene : ModSceneEffect { - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP2") ?? MusicID.LunarBoss; + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("DevourerofGodsPhase2") ?? MusicID.LunarBoss; public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; public override bool IsSceneEffectActive(Player player) diff --git a/Scenes/MusicScenes/LeviathanStartMusicScene.cs b/Scenes/MusicScenes/AnahitasLureMusicScene.cs similarity index 77% rename from Scenes/MusicScenes/LeviathanStartMusicScene.cs rename to Scenes/MusicScenes/AnahitasLureMusicScene.cs index 6e970b27a0..fba7ac4115 100644 --- a/Scenes/MusicScenes/LeviathanStartMusicScene.cs +++ b/Scenes/MusicScenes/AnahitasLureMusicScene.cs @@ -1,16 +1,16 @@ -using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.Leviathan; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Systems { - public class LeviathanStartMusicScene : BaseMusicSceneEffect + public class AnahitasLureMusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossLow; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("AnahitaPreboss"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("AnahitasLure"); public override int VanillaMusic => -1; public override int OtherworldMusic => -1; public override int MusicDistance => 1600; diff --git a/Scenes/MusicScenes/BioLabMusicScene.cs b/Scenes/MusicScenes/BioLabMusicScene.cs new file mode 100644 index 0000000000..80c80e24fa --- /dev/null +++ b/Scenes/MusicScenes/BioLabMusicScene.cs @@ -0,0 +1,68 @@ +using CalamityMod.Systems; +using CalamityMod.Walls; +using CalamityMod.Walls.DraedonStructures; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Scenes.MusicScenes +{ + public class BioLabMusicScene : ModSceneEffect + { + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("BioLab") ?? -1; + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + // This weight is here to ensure this theme plays over most other songs that use the Environment priority, as it's a smaller area and should take higher precedent + public override float GetWeight(Player player) => 0.6f; + + public override bool IsSceneEffectActive(Player player) + { + Tile backWall = Framing.GetTileSafely((int)(player.Center.X / 16), (int)(player.Center.Y / 16)); + Vector2 playerPosition = player.Center; + + float sunkenSeaLabDistance = Vector2.DistanceSquared(CalamityWorld.SunkenSeaLabCenter, playerPosition); + float planetoidLabDistance = Vector2.DistanceSquared(CalamityWorld.PlanetoidLabCenter, playerPosition); + float jungleLabDistance = Vector2.DistanceSquared(CalamityWorld.JungleLabCenter, playerPosition); + float hellLabDistance = Vector2.DistanceSquared(CalamityWorld.HellLabCenter, playerPosition); + float iceLabDistance = Vector2.DistanceSquared(CalamityWorld.IceLabCenter, playerPosition); + float cavernLabDistance = Vector2.DistanceSquared(CalamityWorld.CavernLabCenter, playerPosition); + + // Checks if the player is behind any wall that naturally generates in Bio Labs + bool behindLabWall = + backWall.WallType == WallID.ObsidianBrick || + backWall.WallType == WallID.Glass || + backWall.WallType == WallID.SnowWallUnsafe || + backWall.WallType == WallID.IceUnsafe || + backWall.WallType == WallID.Waterfall || + backWall.WallType == WallID.Lavafall || + backWall.WallType == WallID.IronBrick || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType() || + backWall.WallType == ModContent.WallType(); + + // Checks if the player is within a circular area from the center point of any Bio Lab + bool nearBioLabPoint = + sunkenSeaLabDistance <= 1020f * 1020f || + planetoidLabDistance <= 520f * 520f || + jungleLabDistance <= 620f * 620f || + hellLabDistance <= 700f * 700f || + iceLabDistance <= 720f * 720f || + cavernLabDistance <= 940f * 940f; + + return BiomeTileCounterSystem.ArsenalLabTiles > 150 && behindLabWall && nearBioLabPoint; + } + } +} diff --git a/Scenes/MusicScenes/CalamitasMusicScene.cs b/Scenes/MusicScenes/CalamitasCloneMusicScene.cs similarity index 80% rename from Scenes/MusicScenes/CalamitasMusicScene.cs rename to Scenes/MusicScenes/CalamitasCloneMusicScene.cs index e697339078..7616609d88 100644 --- a/Scenes/MusicScenes/CalamitasMusicScene.cs +++ b/Scenes/MusicScenes/CalamitasCloneMusicScene.cs @@ -1,16 +1,16 @@ -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Systems { - public class CalamitasMusicScene : BaseMusicSceneEffect + public class CalamitasCloneMusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Calamitas"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("CalamitasClone"); public override int VanillaMusic => MusicID.Boss2; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override int[] AdditionalNPCs => new int[] diff --git a/Scenes/MusicScenes/SCalAcceptanceMusicScene.cs b/Scenes/MusicScenes/CalamitasDefeatMusicScene.cs similarity index 81% rename from Scenes/MusicScenes/SCalAcceptanceMusicScene.cs rename to Scenes/MusicScenes/CalamitasDefeatMusicScene.cs index 1770301199..8d63f8dbec 100644 --- a/Scenes/MusicScenes/SCalAcceptanceMusicScene.cs +++ b/Scenes/MusicScenes/CalamitasDefeatMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; using Terraria; using Terraria.ID; @@ -6,12 +6,12 @@ using Terraria.ModLoader; namespace CalamityMod.Systems { - public class SCalAcceptanceMusicScene : BaseMusicSceneEffect + public class CalamitasDefeatMusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas4"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("CalamitasDefeat"); public override int VanillaMusic => MusicID.Eerie; public override int OtherworldMusic => MusicID.OtherworldlyEerie; diff --git a/Scenes/MusicScenes/SCalGriefMusicScene.cs b/Scenes/MusicScenes/CalamitasPhase1MusicScene.cs similarity index 81% rename from Scenes/MusicScenes/SCalGriefMusicScene.cs rename to Scenes/MusicScenes/CalamitasPhase1MusicScene.cs index 4dacaecf57..8dc7722607 100644 --- a/Scenes/MusicScenes/SCalGriefMusicScene.cs +++ b/Scenes/MusicScenes/CalamitasPhase1MusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; using Terraria; using Terraria.ID; @@ -6,12 +6,12 @@ using Terraria.ModLoader; namespace CalamityMod.Systems { - public class SCalGriefMusicScene : BaseMusicSceneEffect + public class CalamitasPhase1MusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas1"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("CalamitasPhase1"); public override int VanillaMusic => MusicID.Boss2; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; diff --git a/Scenes/MusicScenes/SCalLamentMusicScene.cs b/Scenes/MusicScenes/CalamitasPhase2MusicScene.cs similarity index 81% rename from Scenes/MusicScenes/SCalLamentMusicScene.cs rename to Scenes/MusicScenes/CalamitasPhase2MusicScene.cs index 17c749010a..2cbd4eff34 100644 --- a/Scenes/MusicScenes/SCalLamentMusicScene.cs +++ b/Scenes/MusicScenes/CalamitasPhase2MusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; using Terraria; using Terraria.ID; @@ -6,12 +6,12 @@ using Terraria.ModLoader; namespace CalamityMod.Systems { - public class SCalLamentMusicScene : BaseMusicSceneEffect + public class CalamitasPhase2MusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas2"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("CalamitasPhase2"); public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyWoF; diff --git a/Scenes/MusicScenes/SCalEpiphanyMusicScene.cs b/Scenes/MusicScenes/CalamitasPhase3MusicScene.cs similarity index 81% rename from Scenes/MusicScenes/SCalEpiphanyMusicScene.cs rename to Scenes/MusicScenes/CalamitasPhase3MusicScene.cs index 284e05f40e..f92000d1b8 100644 --- a/Scenes/MusicScenes/SCalEpiphanyMusicScene.cs +++ b/Scenes/MusicScenes/CalamitasPhase3MusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; using Terraria; using Terraria.ID; @@ -6,12 +6,12 @@ using Terraria.ModLoader; namespace CalamityMod.Systems { - public class SCalEpiphanyMusicScene : BaseMusicSceneEffect + public class CalamitasPhase3MusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas3"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("CalamitasPhase3"); public override int VanillaMusic => MusicID.LunarBoss; public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; diff --git a/Scenes/MusicScenes/DevourerofGodsMusicScene.cs b/Scenes/MusicScenes/DevourerofGodsPhase1MusicScene.cs similarity index 84% rename from Scenes/MusicScenes/DevourerofGodsMusicScene.cs rename to Scenes/MusicScenes/DevourerofGodsPhase1MusicScene.cs index 42acfa2c2c..6e7d798678 100644 --- a/Scenes/MusicScenes/DevourerofGodsMusicScene.cs +++ b/Scenes/MusicScenes/DevourerofGodsPhase1MusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.DevourerofGods; using Terraria; using Terraria.ID; @@ -6,12 +6,12 @@ using Terraria.ModLoader; namespace CalamityMod.Systems { - public class DevourerofGodsMusicScene : BaseMusicSceneEffect + public class DevourerofGodsPhase1MusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP1"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("DevourerofGodsPhase1"); public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override int[] AdditionalNPCs => new int[] diff --git a/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs b/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs index 3ef0ad5663..83ee46ca49 100644 --- a/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs +++ b/Scenes/MusicScenes/DevourerofGodsPhase2MusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.DevourerofGods; using Terraria; using Terraria.ID; @@ -11,7 +11,7 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("DevourerOfGodsP2"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("DevourerofGodsPhase2"); public override int VanillaMusic => MusicID.LunarBoss; public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; public override int[] AdditionalNPCs => new int[] diff --git a/Scenes/MusicScenes/DraedonMusicScene.cs b/Scenes/MusicScenes/DraedonsAmbienceMusicScene.cs similarity index 79% rename from Scenes/MusicScenes/DraedonMusicScene.cs rename to Scenes/MusicScenes/DraedonsAmbienceMusicScene.cs index 5f1571e221..a30ea2477e 100644 --- a/Scenes/MusicScenes/DraedonMusicScene.cs +++ b/Scenes/MusicScenes/DraedonsAmbienceMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs; using Terraria; using Terraria.ID; @@ -6,12 +6,12 @@ using Terraria.ModLoader; namespace CalamityMod.Systems { - public class DraedonMusicScene : BaseMusicSceneEffect + public class DraedonsAmbienceMusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => MusicLoader.GetMusicSlot(Mod, "Sounds/Music/DraedonAmbience"); + public override int? MusicModMusic => MusicLoader.GetMusicSlot(Mod, "Sounds/Music/DraedonsAmbience"); public override int VanillaMusic => -1; public override int OtherworldMusic => -1; diff --git a/Scenes/MusicScenes/LeviathanMusicScene.cs b/Scenes/MusicScenes/LeviathanMusicScene.cs index 5875d37c7c..a218d39d8b 100644 --- a/Scenes/MusicScenes/LeviathanMusicScene.cs +++ b/Scenes/MusicScenes/LeviathanMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.Leviathan; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,7 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("LeviathanAndAnahita"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Leviathan"); public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; } diff --git a/Scenes/MusicScenes/OldDukeMusicScene.cs b/Scenes/MusicScenes/OldDukeMusicScene.cs index af357c9af3..83dd915f62 100644 --- a/Scenes/MusicScenes/OldDukeMusicScene.cs +++ b/Scenes/MusicScenes/OldDukeMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.OldDuke; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,7 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("BoomerDuke"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("OldDuke"); public override int VanillaMusic => MusicID.DukeFishron; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; } diff --git a/Scenes/MusicScenes/PerforatorMusicScene.cs b/Scenes/MusicScenes/PerforatorsMusicScene.cs similarity index 83% rename from Scenes/MusicScenes/PerforatorMusicScene.cs rename to Scenes/MusicScenes/PerforatorsMusicScene.cs index cb33b7d2f6..0d05ba82e4 100644 --- a/Scenes/MusicScenes/PerforatorMusicScene.cs +++ b/Scenes/MusicScenes/PerforatorsMusicScene.cs @@ -1,11 +1,11 @@ -using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.Perforator; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Systems { - public class PerforatorMusicScene : BaseMusicSceneEffect + public class PerforatorsMusicScene : BaseMusicSceneEffect { public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; diff --git a/Scenes/MusicScenes/ProfanedGuardiansMusicScene.cs b/Scenes/MusicScenes/ProfanedGuardiansMusicScene.cs index 23b69ad91b..3c6e1cc3f5 100644 --- a/Scenes/MusicScenes/ProfanedGuardiansMusicScene.cs +++ b/Scenes/MusicScenes/ProfanedGuardiansMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.ProfanedGuardians; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,7 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Guardians"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("ProfanedGuardians"); public override int VanillaMusic => MusicID.Boss1; public override int OtherworldMusic => MusicID.OtherworldlyBoss1; } diff --git a/Scenes/MusicScenes/StormWeaverMusicScene.cs b/Scenes/MusicScenes/StormWeaverMusicScene.cs index 65ebb299b1..a37b0b2c08 100644 --- a/Scenes/MusicScenes/StormWeaverMusicScene.cs +++ b/Scenes/MusicScenes/StormWeaverMusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.StormWeaver; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +10,7 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Weaver"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("StormWeaver"); public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; public override int[] AdditionalNPCs => new int[] diff --git a/Scenes/MusicScenes/YharonPhase1MusicScene.cs b/Scenes/MusicScenes/YharonPhase1MusicScene.cs index 7cee1b0a40..df9b6bd4d2 100644 --- a/Scenes/MusicScenes/YharonPhase1MusicScene.cs +++ b/Scenes/MusicScenes/YharonPhase1MusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.Yharon; using Terraria; using Terraria.ID; @@ -11,7 +11,7 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("YharonP1"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("YharonPhase1"); public override int VanillaMusic => MusicID.Boss3; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; diff --git a/Scenes/MusicScenes/YharonPhase2MusicScene.cs b/Scenes/MusicScenes/YharonPhase2MusicScene.cs index 7379c7d9cf..fe4d188f22 100644 --- a/Scenes/MusicScenes/YharonPhase2MusicScene.cs +++ b/Scenes/MusicScenes/YharonPhase2MusicScene.cs @@ -1,4 +1,4 @@ -using CalamityMod.NPCs; +using CalamityMod.NPCs; using CalamityMod.NPCs.Yharon; using Terraria; using Terraria.ID; @@ -11,7 +11,7 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("YharonP2"); + public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("YharonPhase2"); public override int VanillaMusic => MusicID.LunarBoss; public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; diff --git a/Schematics/CalamitySchematicIO.cs b/Schematics/CalamitySchematicIO.cs index e20262d8f9..1c67d52f97 100644 --- a/Schematics/CalamitySchematicIO.cs +++ b/Schematics/CalamitySchematicIO.cs @@ -69,10 +69,10 @@ namespace CalamityMod.Schematics Main.tile[x, y].WallType = WallType; Main.tile[x, y].LiquidAmount = LiquidAmount; - ref var targetLiquidState = ref Main.tile[x, y].Get(); + ref var targetLiquidState = ref (Main.tile[x, y].Get()); targetLiquidState.LiquidType = LiquidType; - ref var targetMiscState = ref Main.tile[x, y].Get(); + ref var targetMiscState = ref (Main.tile[x, y].Get()); CalamitySchematicIO.AssignMiscState(ref targetMiscState, miscState.NonFrameBits); targetMiscState.TileFrameX = miscState.TileFrameX; targetMiscState.TileFrameY = miscState.TileFrameY; @@ -83,10 +83,10 @@ namespace CalamityMod.Schematics Main.tile[x, y].WallType = original.WallType; Main.tile[x, y].LiquidAmount = original.LiquidAmount; - ref var targetLiquidState = ref Main.tile[x, y].Get(); - targetLiquidState.LiquidType = LiquidType; + ref var targetLiquidState = ref (Main.tile[x, y].Get()); + targetLiquidState.LiquidType = original.LiquidType; // this line caused the lava->water transmutation bug - ref var targetMiscState = ref Main.tile[x, y].Get(); + ref var targetMiscState = ref (Main.tile[x, y].Get()); CalamitySchematicIO.AssignMiscState(ref targetMiscState, original.miscState.NonFrameBits); targetMiscState.TileFrameX = original.miscState.TileFrameX; targetMiscState.TileFrameY = original.miscState.TileFrameY; @@ -97,10 +97,10 @@ namespace CalamityMod.Schematics Main.tile[x, y].WallType = original.WallType; Main.tile[x, y].LiquidAmount = LiquidAmount; - ref var targetLiquidState = ref Main.tile[x, y].Get(); + ref var targetLiquidState = ref (Main.tile[x, y].Get()); targetLiquidState.LiquidType = LiquidType; - ref var targetMiscState = ref Main.tile[x, y].Get(); + ref var targetMiscState = ref (Main.tile[x, y].Get()); CalamitySchematicIO.AssignMiscState(ref targetMiscState, miscState.NonFrameBits); targetMiscState.TileFrameX = miscState.TileFrameX; targetMiscState.TileFrameY = miscState.TileFrameY; @@ -118,10 +118,12 @@ namespace CalamityMod.Schematics Main.tile[x, y].WallType = WallType; Main.tile[x, y].LiquidAmount = original.LiquidAmount; - ref var targetLiquidState = ref Main.tile[x, y].Get(); - targetLiquidState.LiquidType = LiquidType; + ref var targetLiquidState = ref (Main.tile[x, y].Get()); + // keeping the original tile could mean keeping a full space of liquid that was originally there + // this is fine, of course, because all you are changing is the background wall and the liquid can be on top of that + targetLiquidState.LiquidType = original.LiquidType; - ref var targetMiscState = ref Main.tile[x, y].Get(); + ref var targetMiscState = ref (Main.tile[x, y].Get()); CalamitySchematicIO.AssignMiscState(ref targetMiscState, original.miscState.NonFrameBits); targetMiscState.TileFrameX = original.miscState.TileFrameX; targetMiscState.TileFrameY = original.miscState.TileFrameY; diff --git a/Schematics/CragBridge.csch b/Schematics/CragBridge.csch new file mode 100644 index 0000000000..c6cdd43de8 Binary files /dev/null and b/Schematics/CragBridge.csch differ diff --git a/Schematics/CragRuin1.csch b/Schematics/CragRuin1.csch new file mode 100644 index 0000000000..b6d755e301 Binary files /dev/null and b/Schematics/CragRuin1.csch differ diff --git a/Schematics/CragRuin2.csch b/Schematics/CragRuin2.csch new file mode 100644 index 0000000000..8155c32da4 Binary files /dev/null and b/Schematics/CragRuin2.csch differ diff --git a/Schematics/CragRuin3.csch b/Schematics/CragRuin3.csch new file mode 100644 index 0000000000..e9a1085bf9 Binary files /dev/null and b/Schematics/CragRuin3.csch differ diff --git a/Schematics/CragRuin4.csch b/Schematics/CragRuin4.csch new file mode 100644 index 0000000000..44c5ae92a9 Binary files /dev/null and b/Schematics/CragRuin4.csch differ diff --git a/Schematics/DraedonsLab_Cavern.csch b/Schematics/DraedonsLab_Cavern.csch new file mode 100644 index 0000000000..189f23904a Binary files /dev/null and b/Schematics/DraedonsLab_Cavern.csch differ diff --git a/Schematics/DungeonArchiveBlue.csch b/Schematics/DungeonArchiveBlue.csch new file mode 100644 index 0000000000..d1b3085989 Binary files /dev/null and b/Schematics/DungeonArchiveBlue.csch differ diff --git a/Schematics/DungeonArchiveGreen.csch b/Schematics/DungeonArchiveGreen.csch new file mode 100644 index 0000000000..f347bd4102 Binary files /dev/null and b/Schematics/DungeonArchiveGreen.csch differ diff --git a/Schematics/DungeonArchivePink.csch b/Schematics/DungeonArchivePink.csch new file mode 100644 index 0000000000..7db6c068dd Binary files /dev/null and b/Schematics/DungeonArchivePink.csch differ diff --git a/Schematics/DungeonArena.csch b/Schematics/DungeonArena.csch new file mode 100644 index 0000000000..738055f6e6 Binary files /dev/null and b/Schematics/DungeonArena.csch differ diff --git a/Schematics/MechanicShed.csch b/Schematics/MechanicShed.csch new file mode 100644 index 0000000000..0ef5059d12 Binary files /dev/null and b/Schematics/MechanicShed.csch differ diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index fb4db262ff..1c31ce8f70 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -34,8 +34,62 @@ namespace CalamityMod.Schematics internal const string IceLabKey = "Ice Laboratory"; internal const string IceLabFilename = "Schematics/DraedonsLab_Ice.csch"; + internal const string CavernLabKey = "Cavern Laboratory"; + internal const string CavernLabFilename = "Schematics/DraedonsLab_Cavern.csch"; + + internal const string CorruptionShrineKey = "Corruption Shrine"; + internal const string CorruptionShrineFilename = "Schematics/Shrine_Corruption.csch"; + + internal const string CrimsonShrineKey = "Crimson Shrine"; + internal const string CrimsonShrineFilename = "Schematics/Shrine_Crimson.csch"; + + internal const string DesertShrineKey = "Desert Shrine"; + internal const string DesertShrineFilename = "Schematics/Shrine_Desert.csch"; + + internal const string GraniteShrineKey = "Granite Shrine"; + internal const string GraniteShrineFilename = "Schematics/Shrine_Granite.csch"; + + internal const string IceShrineKey = "Ice Shrine"; + internal const string IceShrineFilename = "Schematics/Shrine_Ice.csch"; + + internal const string MarbleShrineKey = "Marble Shrine"; + internal const string MarbleShrineFilename = "Schematics/Shrine_Marble.csch"; + + internal const string MushroomShrineKey = "Mushroom Shrine"; + internal const string MushroomShrineFilename = "Schematics/Shrine_Mushroom.csch"; + + internal const string SurfaceShrineKey = "Surface Shrine"; + internal const string SurfaceShrineFilename = "Schematics/Shrine_Surface.csch"; + + internal const string VernalKey = "Vernal Pass"; + internal const string VernalFilename = "Schematics/VernalPass.csch"; + + internal const string MechanicShedKey = "Mechanic Key"; + internal const string MechanicShedFilename = "Schematics/MechanicShed.csch"; + internal const string AstralBeaconKey = "Astral Beacon"; internal const string AstralBeaconFilename = "Schematics/AstralBeacon.csch"; + + internal const string CragBridgeKey = "Crags Bridge"; + internal const string CragBridgeFilename = "Schematics/CragBridge.csch"; + + internal const string BlueArchiveKey = "Archive Blue"; + internal const string BlueArchiveFilename = "Schematics/DungeonArchiveBlue.csch"; + + internal const string GreenArchiveKey = "Archive Green"; + internal const string GreenArchiveFilename = "Schematics/DungeonArchiveGreen.csch"; + + internal const string PinkArchiveKey = "Archive Pink"; + internal const string PinkArchiveFilename = "Schematics/DungeonArchivePink.csch"; + + internal const string CragRuinKey1 = "Crag Ruin 1"; + internal const string CragRuinKey1Filename = "Schematics/CragRuin1.csch"; + internal const string CragRuinKey2 = "Crag Ruin 21"; + internal const string CragRuinKey2Filename = "Schematics/CragRuin2.csch"; + internal const string CragRuinKey3 = "Crag Ruin 3"; + internal const string CragRuinKey3Filename = "Schematics/CragRuin3.csch"; + internal const string CragRuinKey4 = "Crag Ruin 4"; + internal const string CragRuinKey4Filename = "Schematics/CragRuin4.csch"; internal static Dictionary TileMaps; internal static Dictionary PilePlacementMaps; @@ -55,10 +109,39 @@ namespace CalamityMod.Schematics [PlagueLabKey] = CalamitySchematicIO.LoadSchematic(PlagueLabFilename), [HellLabKey] = CalamitySchematicIO.LoadSchematic(HellLabFilename), [IceLabKey] = CalamitySchematicIO.LoadSchematic(IceLabFilename), + [CavernLabKey] = CalamitySchematicIO.LoadSchematic(CavernLabFilename), + + // Shrine world gen structures + [CorruptionShrineKey] = CalamitySchematicIO.LoadSchematic(CorruptionShrineFilename), + [CrimsonShrineKey] = CalamitySchematicIO.LoadSchematic(CrimsonShrineFilename), + [DesertShrineKey] = CalamitySchematicIO.LoadSchematic(DesertShrineFilename), + [GraniteShrineKey] = CalamitySchematicIO.LoadSchematic(GraniteShrineFilename), + [IceShrineKey] = CalamitySchematicIO.LoadSchematic(IceShrineFilename), + [MarbleShrineKey] = CalamitySchematicIO.LoadSchematic(MarbleShrineFilename), + [MushroomShrineKey] = CalamitySchematicIO.LoadSchematic(MushroomShrineFilename), + [SurfaceShrineKey] = CalamitySchematicIO.LoadSchematic(SurfaceShrineFilename), + + [VernalKey] = CalamitySchematicIO.LoadSchematic(VernalFilename), + + [MechanicShedKey] = CalamitySchematicIO.LoadSchematic(MechanicShedFilename), // Astral world gen structures [AstralBeaconKey] = CalamitySchematicIO.LoadSchematic(AstralBeaconFilename), + //crag bridge + [CragBridgeKey] = CalamitySchematicIO.LoadSchematic(CragBridgeFilename), + + //dungeon archives + [BlueArchiveKey] = CalamitySchematicIO.LoadSchematic(BlueArchiveFilename), + [GreenArchiveKey] = CalamitySchematicIO.LoadSchematic(GreenArchiveFilename), + [PinkArchiveKey] = CalamitySchematicIO.LoadSchematic(PinkArchiveFilename), + + //crags ruins + [CragRuinKey1] = CalamitySchematicIO.LoadSchematic(CragRuinKey1Filename), + [CragRuinKey2] = CalamitySchematicIO.LoadSchematic(CragRuinKey2Filename), + [CragRuinKey3] = CalamitySchematicIO.LoadSchematic(CragRuinKey3Filename), + [CragRuinKey4] = CalamitySchematicIO.LoadSchematic(CragRuinKey4Filename), + // Sulphurous Sea scrap world gen structures ["Sulphurous Scrap 1"] = CalamitySchematicIO.LoadSchematic("Schematics/SulphurousScrap1.csch").ShaveOffEdge(), ["Sulphurous Scrap 2"] = CalamitySchematicIO.LoadSchematic("Schematics/SulphurousScrap2.csch").ShaveOffEdge(), @@ -171,7 +254,7 @@ namespace CalamityMod.Schematics { Tile t = Main.tile[x + cornerX, y + cornerY]; if (t.TileType == TileID.Trees || t.TileType == TileID.PineTree || t.TileType == TileID.Cactus) - WorldGen.KillTile(x + cornerX, y + cornerY); + WorldGen.KillTile(x + cornerX, y + cornerY, noItem: true); } for (int x = 0; x < width; ++x) @@ -184,7 +267,7 @@ namespace CalamityMod.Schematics for (int x = 0; x < width; ++x) for (int y = 0; y < height; ++y) if (originalTiles[x, y].TileType != TileID.Containers) - WorldGen.KillTile(x + cornerX, y + cornerY); + WorldGen.KillTile(x + cornerX, y + cornerY, noItem: true); // Lay down the schematic. If the schematic calls for it, bring back tiles that are stored in the old tiles array. for (int x = 0; x < width; ++x) diff --git a/Schematics/Shrine_Corruption.csch b/Schematics/Shrine_Corruption.csch new file mode 100644 index 0000000000..1543395aa7 Binary files /dev/null and b/Schematics/Shrine_Corruption.csch differ diff --git a/Schematics/Shrine_Crimson.csch b/Schematics/Shrine_Crimson.csch new file mode 100644 index 0000000000..998ec79a19 Binary files /dev/null and b/Schematics/Shrine_Crimson.csch differ diff --git a/Schematics/Shrine_Desert.csch b/Schematics/Shrine_Desert.csch new file mode 100644 index 0000000000..37205a4d91 Binary files /dev/null and b/Schematics/Shrine_Desert.csch differ diff --git a/Schematics/Shrine_Granite.csch b/Schematics/Shrine_Granite.csch new file mode 100644 index 0000000000..16c10690a2 Binary files /dev/null and b/Schematics/Shrine_Granite.csch differ diff --git a/Schematics/Shrine_Ice.csch b/Schematics/Shrine_Ice.csch new file mode 100644 index 0000000000..ad7c0cfb7d Binary files /dev/null and b/Schematics/Shrine_Ice.csch differ diff --git a/Schematics/Shrine_Marble.csch b/Schematics/Shrine_Marble.csch new file mode 100644 index 0000000000..98b301fda3 Binary files /dev/null and b/Schematics/Shrine_Marble.csch differ diff --git a/Schematics/Shrine_Mushroom.csch b/Schematics/Shrine_Mushroom.csch new file mode 100644 index 0000000000..c5444008c2 Binary files /dev/null and b/Schematics/Shrine_Mushroom.csch differ diff --git a/Schematics/Shrine_Surface.csch b/Schematics/Shrine_Surface.csch new file mode 100644 index 0000000000..3010472517 Binary files /dev/null and b/Schematics/Shrine_Surface.csch differ diff --git a/Schematics/VernalPass.csch b/Schematics/VernalPass.csch new file mode 100644 index 0000000000..378f15bd31 Binary files /dev/null and b/Schematics/VernalPass.csch differ diff --git a/Skies/AstralScreenShaderData.cs b/Skies/AstralScreenShaderData.cs index 833a7ae972..56a7581868 100644 --- a/Skies/AstralScreenShaderData.cs +++ b/Skies/AstralScreenShaderData.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (!Main.LocalPlayer.Calamity().ZoneAstral) + if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) Filters.Scene["CalamityMod:Astral"].Deactivate(Array.Empty()); } } diff --git a/Skies/AstralSky.cs b/Skies/AstralSky.cs index 0da7a285bd..450cedb106 100644 --- a/Skies/AstralSky.cs +++ b/Skies/AstralSky.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (!Main.LocalPlayer.Calamity().ZoneAstral) + if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) skyActive = false; if (skyActive && opacity < 1f) diff --git a/Skies/BossRushSky.cs b/Skies/BossRushSky.cs index dddb4f530e..d6dbaf2463 100644 --- a/Skies/BossRushSky.cs +++ b/Skies/BossRushSky.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Skies public static bool DetermineDrawEligibility() { - bool useEffect = (BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100) || ShouldDrawRegularly; + bool useEffect = ((BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100) || ShouldDrawRegularly) && !Main.gameMenu; if (SkyManager.Instance["CalamityMod:BossRush"] != null && useEffect != SkyManager.Instance["CalamityMod:BossRush"].IsActive()) { diff --git a/Skies/BrimstoneCragSky.cs b/Skies/BrimstoneCragSky.cs new file mode 100644 index 0000000000..81f01080bf --- /dev/null +++ b/Skies/BrimstoneCragSky.cs @@ -0,0 +1,133 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Effects; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Skies +{ + public class BrimstoneCragSky : CustomSky + { + public int skyActiveLeeway = 0; + public class Cinder + { + public int Time; + public int Lifetime; + public int IdentityIndex; + public float Scale; + public float Depth; + public Color DrawColor; + public Vector2 Velocity; + public Vector2 Center; + public Cinder(int lifetime, int identity, float depth, Color color, Vector2 startingPosition, Vector2 startingVelocity) + { + Lifetime = lifetime; + IdentityIndex = identity; + Depth = depth; + DrawColor = color; + Center = startingPosition; + Velocity = startingVelocity; + } + } + + private bool skyActive; + private float opacity; + public List Cinders = new List(); + + public override void Deactivate(params object[] args) => skyActive = false; + + public override void Reset() => skyActive = false; + + public override bool IsActive() => skyActive || opacity > 0f; + + public override void Activate(Vector2 position, params object[] args) => skyActive = true; + + public override void Update(GameTime gameTime) + { + if (!Main.LocalPlayer.Calamity().ZoneCalamity || Main.gameMenu) + { + skyActive = false; + if (skyActiveLeeway > 0) skyActiveLeeway--; + } + else if (skyActiveLeeway < 60) skyActiveLeeway++; + + if (skyActive && opacity < 1f) + { + opacity += 0.02f; + } + else if (!skyActive && opacity > 0f) + { + opacity -= 0.02f; + } + + static Color selectCinderColor() + { + if (Main.rand.NextBool(3)) + return Color.Lerp(Color.DarkGray, Color.LightGray, Main.rand.NextFloat()); + + return Color.Lerp(Color.Red, Color.Yellow, Main.rand.NextFloat(0.9f)); + } + + // Randomly add cinders. + if (Main.rand.NextBool(12) && skyActive) + { + int lifetime = Main.rand.Next(285, 445); + float depth = Main.rand.NextFloat(1.8f, 5f); + Vector2 startingPosition = Main.screenPosition + new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f); + Vector2 startingVelocity = -Vector2.UnitY.RotatedByRandom(0.91f); + Cinders.Add(new Cinder(lifetime, Cinders.Count, depth, selectCinderColor(), startingPosition, startingVelocity)); + } + + // Update all cinders. + if (skyActive || skyActiveLeeway > 0) + { + float cinderSpeed = 5.6f; + for (int i = 0; i < Cinders.Count; i++) + { + Cinders[i].Scale = Utils.GetLerpValue(Cinders[i].Lifetime, Cinders[i].Lifetime / 3, Cinders[i].Time, true); + Cinders[i].Scale *= MathHelper.Lerp(0.6f, 0.9f, Cinders[i].IdentityIndex % 6f / 6f); + + Vector2 idealVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.94f, 0.94f, (float)Math.Sin(Cinders[i].Time / 36f + Cinders[i].IdentityIndex) * 0.5f + 0.5f)) * cinderSpeed; + float movementInterpolant = MathHelper.Lerp(0.01f, 0.08f, Utils.GetLerpValue(45f, 145f, Cinders[i].Time, true)); + Cinders[i].Velocity = Vector2.Lerp(Cinders[i].Velocity, idealVelocity, movementInterpolant); + Cinders[i].Velocity = Cinders[i].Velocity.SafeNormalize(-Vector2.UnitY) * cinderSpeed; + Cinders[i].Time++; + + Cinders[i].Center += Cinders[i].Velocity; + } + } + + // Clear away all dead cinders. + Cinders.RemoveAll(c => c.Time >= c.Lifetime); + + if (!Main.LocalPlayer.Calamity().ZoneCalamity) + Filters.Scene["CalamityMod:BrimstoneCrag"].Deactivate(Array.Empty()); + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (!Main.LocalPlayer.Calamity().ZoneCalamity && skyActiveLeeway == 0) + return; + + // Draw cinders. + Texture2D cinderTexture = ModContent.Request("CalamityMod/Skies/CalamitasCinder").Value; + float scaleFade = skyActiveLeeway / 60f; + for (int i = 0; i < Cinders.Count; i++) + { + Vector2 drawPosition = Cinders[i].Center - Main.screenPosition; + for (int j = 0; j < 3; j++) + { + Vector2 offsetDrawPosition = drawPosition + (MathHelper.TwoPi * j / 3f).ToRotationVector2() * 1.4f; + Color offsetDrawColor = Color.Red * 0.56f; + offsetDrawColor.A = 0; + spriteBatch.Draw(cinderTexture, offsetDrawPosition, null, offsetDrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale * 1.5f * scaleFade, SpriteEffects.None, 0f); + } + spriteBatch.Draw(cinderTexture, drawPosition, null, Cinders[i].DrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale * scaleFade, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Skies/CryogenSky.cs b/Skies/CryogenSky.cs index a1d565eaa0..4f2efb2418 100644 --- a/Skies/CryogenSky.cs +++ b/Skies/CryogenSky.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Skies public static void UpdateDrawEligibility() { - bool useEffect = NPC.AnyNPCs(ModContent.NPCType()) || ShouldDrawRegularly; + bool useEffect = (NPC.AnyNPCs(ModContent.NPCType()) || ShouldDrawRegularly) && !Main.gameMenu; if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useEffect != SkyManager.Instance["CalamityMod:Cryogen"].IsActive()) { diff --git a/Skies/DrunkCrabScreenShaderData.cs b/Skies/DrunkCrabScreenShaderData.cs new file mode 100644 index 0000000000..4a504379e0 --- /dev/null +++ b/Skies/DrunkCrabScreenShaderData.cs @@ -0,0 +1,58 @@ +using CalamityMod.NPCs.Crabulon; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Skies +{ + public class DrunkCrabScreenShaderData : ScreenShaderData + { + public int CrabIndex; + + public DrunkCrabScreenShaderData(string passName) + : base(passName) + { + } + + public void UpdateBossIndex() + { + int CrabType = ModContent.NPCType(); + if (CrabIndex >= 0 && Main.npc[CrabIndex].active && Main.npc[CrabIndex].type == CrabType) + { + return; + } + CrabIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == CrabType) + { + CrabIndex = i; + break; + } + } + } + + public override void Update(GameTime gameTime) + { + if (CrabIndex == -1 || !CalamityWorld.getFixedBoi) + { + UpdateBossIndex(); + if (CrabIndex == -1 || !CalamityWorld.getFixedBoi) + Filters.Scene["CalamityMod:DrunkCrabulon"].Deactivate(); + } + } + + public override void Apply() + { + UpdateBossIndex(); + if (CrabIndex != -1) + { + UseTargetPosition(Main.npc[CrabIndex].Center); + } + base.Apply(); + } + } +} diff --git a/Skies/MonolithSky.cs b/Skies/MonolithSky.cs index f9c9fdda38..235d5429e0 100644 --- a/Skies/MonolithSky.cs +++ b/Skies/MonolithSky.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1) + if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1 || Main.gameMenu) skyActive = false; if (skyActive && opacity < 1f) diff --git a/Skies/SulphurSeaSky.cs b/Skies/SulphurSeaSky.cs new file mode 100644 index 0000000000..b854179f59 --- /dev/null +++ b/Skies/SulphurSeaSky.cs @@ -0,0 +1,121 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Effects; +using Terraria.ID; + +namespace CalamityMod.Skies +{ + public class SulphurSeaSky : CustomSky + { + private bool skyActive; + private float opacity; + + public override void Deactivate(params object[] args) + { + skyActive = Main.LocalPlayer.Calamity().ZoneSulphur; + } + + public override void Reset() + { + skyActive = false; + } + + public override bool IsActive() + { + return skyActive || opacity > 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + skyActive = true; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 4f && minDepth < 4f) + { + spriteBatch.Draw(CalamityMod.SulphurSeaSky, new Rectangle(0, (int)(-Main.screenPosition.Y / 6f) + 1300, Main.screenWidth, Main.screenHeight), Color.Lerp(Main.ColorOfTheSkies, Color.LightSeaGreen, 0.33f) * 0.2f * opacity); + } + //if (maxDepth >= 1f && minDepth < 1f) + //{ + // spriteBatch.Draw(CalamityMod.SulphurSeaSkyFront, new Rectangle(0, (int)(-Main.screenPosition.Y / 6f) + 1300, Main.screenWidth, Main.screenHeight), Color.Lerp(Main.ColorOfTheSkies, Color.White, 0.33f) * 1.5f * opacity); + //} + + //small worlds, default draw height + int sulphurSeaHeight = (World.SulphurousSea.YStart + (int)Main.worldSurface) / 2; + + //medium worlds + if (Main.maxTilesX >= 6400 && Main.maxTilesX < 8400) + { + sulphurSeaHeight = (World.SulphurousSea.YStart + (int)Main.worldSurface) / 5; + } + //large worlds (and anything bigger) + if (Main.maxTilesX >= 8400) + { + sulphurSeaHeight = (World.SulphurousSea.YStart + (int)Main.worldSurface) / 140; + } + + if (maxDepth >= 1f && minDepth < 1f) + { + //Explantion on how to use this BG code for skies + //This changes the speed of the parralax, the closer the layer to the player the faster it should be + float screenParralaxMultiplier = 0.4f; + Texture2D texture = CalamityMod.SulphurSeaSkyFront; + //Vanila scales backgrounds to 250% size. Depending on what you might want to do you can change this if you wanted to make a non scaled bg. + float scale = 2.5f; + + //Keep in mind that y paralex should always be half of x's or it will feel odd compared to how terraria does it. + //keep in mind when you change screen parralax it affects the y offset for the bg in the world. + int x = (int)(Main.screenPosition.X * 1f * screenParralaxMultiplier); + x %= (int)(texture.Width * scale); + int y = (int)(Main.screenPosition.Y * 0.5f * screenParralaxMultiplier); + //Y offset to align with whatever position you want it in the world (is affected by screenParralaxMultiplier as stated before). + y -= 1800; + + //this loops the BG horizontally. + for (int k = -1; k <= 1; k++) + { + var pos = new Vector2(Main.screenWidth / 2f - x + texture.Width * k * scale, Main.screenHeight / 2f - y); + spriteBatch.Draw(texture, pos - texture.Size() / 2f * scale, null, Color.LightSeaGreen * 0.5f * opacity, 0f, new Vector2(0f, (float)sulphurSeaHeight), scale, SpriteEffects.None, 0f); + } + } + if (maxDepth >= 3f && minDepth < 3f) + { + float screenParralaxMultiplier = 0.4f; + Texture2D texture = CalamityMod.SulphurSeaSurface; + float scale = 2.5f; + int x = (int)(Main.screenPosition.X * 1f * screenParralaxMultiplier); + x %= (int)(texture.Width * scale); + int y = (int)(Main.screenPosition.Y * 0.5f * screenParralaxMultiplier); + y -= 1800; //1000 + for (int k = -1; k <= 1; k++) + { + var pos = new Vector2(Main.screenWidth / 2f - x + texture.Width * k * scale, Main.screenHeight / 2f - y); + spriteBatch.Draw(texture, pos - texture.Size() / 2f * scale, null, Main.ColorOfTheSkies * opacity, 0f, new Vector2(0f, (float)sulphurSeaHeight), scale, SpriteEffects.None, 0f); + } + } + } + + public override void Update(GameTime gameTime) + { + if (!Main.LocalPlayer.Calamity().ZoneSulphur || Main.gameMenu) + skyActive = false; + + if (skyActive && opacity < 1f) + { + opacity += 0.02f; + } + else if (!skyActive && opacity > 0f) + { + opacity -= 0.02f; + } + } + + //public override float GetCloudAlpha() + //{ + // return (1f - opacity) * 0.97f + 0.03f; + //} + } +} diff --git a/Skies/SulphurSeaSky.png b/Skies/SulphurSeaSky.png new file mode 100644 index 0000000000..c4e3558a69 Binary files /dev/null and b/Skies/SulphurSeaSky.png differ diff --git a/Skies/SulphurSeaSkyFront.png b/Skies/SulphurSeaSkyFront.png new file mode 100644 index 0000000000..6058c2345d Binary files /dev/null and b/Skies/SulphurSeaSkyFront.png differ diff --git a/Skies/SulphurSeaSurface.png b/Skies/SulphurSeaSurface.png new file mode 100644 index 0000000000..7fcc57576d Binary files /dev/null and b/Skies/SulphurSeaSurface.png differ diff --git a/Sounds/CommonCalamitySounds.cs b/Sounds/CommonCalamitySounds.cs index deeef6dcc8..c82c20afea 100644 --- a/Sounds/CommonCalamitySounds.cs +++ b/Sounds/CommonCalamitySounds.cs @@ -23,6 +23,12 @@ namespace CalamityMod.Sounds public static readonly SoundStyle ELRFireSound = new("CalamityMod/Sounds/Item/ELRFire"); //What does ELR stand for + public static readonly SoundStyle ExoLaserShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/ExoLaserShoot"); + + public static readonly SoundStyle ExoPlasmaExplosionSound = new("CalamityMod/Sounds/Custom/ExoMechs/ExoPlasmaExplosion", 2); + + public static readonly SoundStyle ExoPlasmaShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/ExoPlasmaShoot"); + public static readonly SoundStyle LargeWeaponFireSound = new("CalamityMod/Sounds/Item/LargeWeaponFire"); public static readonly SoundStyle GaussWeaponFire = new("CalamityMod/Sounds/Item/GaussWeaponFire"); diff --git a/Sounds/Custom/AbilitySounds/NanomachinesActivate.ogg b/Sounds/Custom/AbilitySounds/NanomachinesActivate.ogg new file mode 100644 index 0000000000..5f04343d96 Binary files /dev/null and b/Sounds/Custom/AbilitySounds/NanomachinesActivate.ogg differ diff --git a/Sounds/Custom/AstrumAureus/AureusJump.ogg b/Sounds/Custom/AstrumAureus/AureusJump.ogg new file mode 100644 index 0000000000..1599c2eb06 Binary files /dev/null and b/Sounds/Custom/AstrumAureus/AureusJump.ogg differ diff --git a/Sounds/Custom/LegStomp.ogg b/Sounds/Custom/AstrumAureus/LegStomp.ogg similarity index 100% rename from Sounds/Custom/LegStomp.ogg rename to Sounds/Custom/AstrumAureus/LegStomp.ogg diff --git a/Sounds/Custom/ChainLightning1.ogg b/Sounds/Custom/ChainLightning1.ogg new file mode 100644 index 0000000000..51c4a6f8be Binary files /dev/null and b/Sounds/Custom/ChainLightning1.ogg differ diff --git a/Sounds/Custom/ChainLightning2.ogg b/Sounds/Custom/ChainLightning2.ogg new file mode 100644 index 0000000000..b3fb6ece43 Binary files /dev/null and b/Sounds/Custom/ChainLightning2.ogg differ diff --git a/Sounds/Custom/ChainLightning3.ogg b/Sounds/Custom/ChainLightning3.ogg new file mode 100644 index 0000000000..985336cc3a Binary files /dev/null and b/Sounds/Custom/ChainLightning3.ogg differ diff --git a/Sounds/Custom/ChainLightning4.ogg b/Sounds/Custom/ChainLightning4.ogg new file mode 100644 index 0000000000..e2fae872bf Binary files /dev/null and b/Sounds/Custom/ChainLightning4.ogg differ diff --git a/Sounds/Custom/ChainsawEnd.ogg b/Sounds/Custom/ChainsawEnd.ogg new file mode 100644 index 0000000000..cdb79909bb Binary files /dev/null and b/Sounds/Custom/ChainsawEnd.ogg differ diff --git a/Sounds/Custom/ChainsawStart.ogg b/Sounds/Custom/ChainsawStart.ogg new file mode 100644 index 0000000000..b5205d0a72 Binary files /dev/null and b/Sounds/Custom/ChainsawStart.ogg differ diff --git a/Sounds/Custom/Codebreaker/BloodForHekate.ogg b/Sounds/Custom/Codebreaker/BloodForHekate.ogg new file mode 100644 index 0000000000..22368a1fc2 Binary files /dev/null and b/Sounds/Custom/Codebreaker/BloodForHekate.ogg differ diff --git a/Sounds/Custom/Codebreaker/DialogOptionHover.ogg b/Sounds/Custom/Codebreaker/DialogOptionHover.ogg new file mode 100644 index 0000000000..187a952f82 Binary files /dev/null and b/Sounds/Custom/Codebreaker/DialogOptionHover.ogg differ diff --git a/Sounds/Custom/Codebreaker/DraedonTalk1.ogg b/Sounds/Custom/Codebreaker/DraedonTalk1.ogg new file mode 100644 index 0000000000..cf5752e201 Binary files /dev/null and b/Sounds/Custom/Codebreaker/DraedonTalk1.ogg differ diff --git a/Sounds/Custom/Codebreaker/DraedonTalk2.ogg b/Sounds/Custom/Codebreaker/DraedonTalk2.ogg new file mode 100644 index 0000000000..dfb4d221de Binary files /dev/null and b/Sounds/Custom/Codebreaker/DraedonTalk2.ogg differ diff --git a/Sounds/Custom/Codebreaker/DraedonTalk3.ogg b/Sounds/Custom/Codebreaker/DraedonTalk3.ogg new file mode 100644 index 0000000000..aee4ca6fe7 Binary files /dev/null and b/Sounds/Custom/Codebreaker/DraedonTalk3.ogg differ diff --git a/Sounds/Custom/CrateBreak1.ogg b/Sounds/Custom/CrateBreak1.ogg new file mode 100644 index 0000000000..62e58f14e1 Binary files /dev/null and b/Sounds/Custom/CrateBreak1.ogg differ diff --git a/Sounds/Custom/CrateBreak2.ogg b/Sounds/Custom/CrateBreak2.ogg new file mode 100644 index 0000000000..00d65f3ef4 Binary files /dev/null and b/Sounds/Custom/CrateBreak2.ogg differ diff --git a/Sounds/Custom/CrateBreak3.ogg b/Sounds/Custom/CrateBreak3.ogg new file mode 100644 index 0000000000..d2916e332c Binary files /dev/null and b/Sounds/Custom/CrateBreak3.ogg differ diff --git a/Sounds/Custom/CryogenShieldRegenerate.ogg b/Sounds/Custom/CryogenShieldRegenerate.ogg new file mode 100644 index 0000000000..d81587b741 Binary files /dev/null and b/Sounds/Custom/CryogenShieldRegenerate.ogg differ diff --git a/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection.ogg b/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection.ogg new file mode 100644 index 0000000000..29d6c30723 Binary files /dev/null and b/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection.ogg differ diff --git a/Sounds/Custom/ExoMechs/ApolloMissileLaunch.ogg b/Sounds/Custom/ExoMechs/ApolloMissileLaunch.ogg new file mode 100644 index 0000000000..52ebd1004b Binary files /dev/null and b/Sounds/Custom/ExoMechs/ApolloMissileLaunch.ogg differ diff --git a/Sounds/Custom/ExoMechs/AresCircleLaserEnd.ogg b/Sounds/Custom/ExoMechs/AresCircleLaserEnd.ogg new file mode 100644 index 0000000000..66a841b0ff Binary files /dev/null and b/Sounds/Custom/ExoMechs/AresCircleLaserEnd.ogg differ diff --git a/Sounds/Custom/ExoMechs/AresCircleLaserLoop.ogg b/Sounds/Custom/ExoMechs/AresCircleLaserLoop.ogg new file mode 100644 index 0000000000..d4a77e1a75 Binary files /dev/null and b/Sounds/Custom/ExoMechs/AresCircleLaserLoop.ogg differ diff --git a/Sounds/Custom/ExoMechs/AresCircleLaserStart.ogg b/Sounds/Custom/ExoMechs/AresCircleLaserStart.ogg new file mode 100644 index 0000000000..67ec793a7d Binary files /dev/null and b/Sounds/Custom/ExoMechs/AresCircleLaserStart.ogg differ diff --git a/Sounds/Custom/AresEnraged.ogg b/Sounds/Custom/ExoMechs/AresEnraged.ogg similarity index 100% rename from Sounds/Custom/AresEnraged.ogg rename to Sounds/Custom/ExoMechs/AresEnraged.ogg diff --git a/Sounds/Custom/AresGaussNukeArmCharge.ogg b/Sounds/Custom/ExoMechs/AresGaussNukeArmCharge.ogg similarity index 100% rename from Sounds/Custom/AresGaussNukeArmCharge.ogg rename to Sounds/Custom/ExoMechs/AresGaussNukeArmCharge.ogg diff --git a/Sounds/Custom/ExoMechs/AresGaussNukeExplosion.ogg b/Sounds/Custom/ExoMechs/AresGaussNukeExplosion.ogg new file mode 100644 index 0000000000..183c0a0dae Binary files /dev/null and b/Sounds/Custom/ExoMechs/AresGaussNukeExplosion.ogg differ diff --git a/Sounds/Custom/AresLaserArmCharge.ogg b/Sounds/Custom/ExoMechs/AresLaserArmCharge.ogg similarity index 100% rename from Sounds/Custom/AresLaserArmCharge.ogg rename to Sounds/Custom/ExoMechs/AresLaserArmCharge.ogg diff --git a/Sounds/Custom/ExoMechs/AresLaserArmShoot.ogg b/Sounds/Custom/ExoMechs/AresLaserArmShoot.ogg new file mode 100644 index 0000000000..e2a334587d Binary files /dev/null and b/Sounds/Custom/ExoMechs/AresLaserArmShoot.ogg differ diff --git a/Sounds/Custom/AresPlasmaArmCharge.ogg b/Sounds/Custom/ExoMechs/AresPlasmaArmCharge.ogg similarity index 100% rename from Sounds/Custom/AresPlasmaArmCharge.ogg rename to Sounds/Custom/ExoMechs/AresPlasmaArmCharge.ogg diff --git a/Sounds/Custom/AresTeslaArmCharge.ogg b/Sounds/Custom/ExoMechs/AresTeslaArmCharge.ogg similarity index 100% rename from Sounds/Custom/AresTeslaArmCharge.ogg rename to Sounds/Custom/ExoMechs/AresTeslaArmCharge.ogg diff --git a/Sounds/Custom/ExoMechs/ArtemisApolloDash.ogg b/Sounds/Custom/ExoMechs/ArtemisApolloDash.ogg new file mode 100644 index 0000000000..1fdf466f1e Binary files /dev/null and b/Sounds/Custom/ExoMechs/ArtemisApolloDash.ogg differ diff --git a/Sounds/Custom/ExoMechs/ArtemisApolloDashTelegraph.ogg b/Sounds/Custom/ExoMechs/ArtemisApolloDashTelegraph.ogg new file mode 100644 index 0000000000..a759684b17 Binary files /dev/null and b/Sounds/Custom/ExoMechs/ArtemisApolloDashTelegraph.ogg differ diff --git a/Sounds/Custom/ExoMechs/ArtemisShotgunLaser.ogg b/Sounds/Custom/ExoMechs/ArtemisShotgunLaser.ogg new file mode 100644 index 0000000000..0a6485720e Binary files /dev/null and b/Sounds/Custom/ExoMechs/ArtemisShotgunLaser.ogg differ diff --git a/Sounds/Custom/ExoMechs/ArtemisSpinLaserbeam.ogg b/Sounds/Custom/ExoMechs/ArtemisSpinLaserbeam.ogg new file mode 100644 index 0000000000..904ad40279 Binary files /dev/null and b/Sounds/Custom/ExoMechs/ArtemisSpinLaserbeam.ogg differ diff --git a/Sounds/Custom/ExoMechs/ExoLaserShoot.ogg b/Sounds/Custom/ExoMechs/ExoLaserShoot.ogg new file mode 100644 index 0000000000..e4b1099d6f Binary files /dev/null and b/Sounds/Custom/ExoMechs/ExoLaserShoot.ogg differ diff --git a/Sounds/Custom/ExoMechs/ExoPlasmaExplosion1.ogg b/Sounds/Custom/ExoMechs/ExoPlasmaExplosion1.ogg new file mode 100644 index 0000000000..cf7751c4a1 Binary files /dev/null and b/Sounds/Custom/ExoMechs/ExoPlasmaExplosion1.ogg differ diff --git a/Sounds/Custom/ExoMechs/ExoPlasmaExplosion2.ogg b/Sounds/Custom/ExoMechs/ExoPlasmaExplosion2.ogg new file mode 100644 index 0000000000..5896e4ec07 Binary files /dev/null and b/Sounds/Custom/ExoMechs/ExoPlasmaExplosion2.ogg differ diff --git a/Sounds/Custom/ExoMechs/ExoPlasmaShoot.ogg b/Sounds/Custom/ExoMechs/ExoPlasmaShoot.ogg new file mode 100644 index 0000000000..15848ac2e1 Binary files /dev/null and b/Sounds/Custom/ExoMechs/ExoPlasmaShoot.ogg differ diff --git a/Sounds/Custom/ExoTwinsEject.ogg b/Sounds/Custom/ExoMechs/ExoTwinsEject.ogg similarity index 100% rename from Sounds/Custom/ExoTwinsEject.ogg rename to Sounds/Custom/ExoMechs/ExoTwinsEject.ogg diff --git a/Sounds/Custom/THanosLaser.ogg b/Sounds/Custom/ExoMechs/THanosLaser.ogg similarity index 100% rename from Sounds/Custom/THanosLaser.ogg rename to Sounds/Custom/ExoMechs/THanosLaser.ogg diff --git a/Sounds/Custom/ExoMechs/TeslaShoot1.ogg b/Sounds/Custom/ExoMechs/TeslaShoot1.ogg new file mode 100644 index 0000000000..48280b5ddf Binary files /dev/null and b/Sounds/Custom/ExoMechs/TeslaShoot1.ogg differ diff --git a/Sounds/Custom/ExoMechs/TeslaShoot2.ogg b/Sounds/Custom/ExoMechs/TeslaShoot2.ogg new file mode 100644 index 0000000000..a22eaac897 Binary files /dev/null and b/Sounds/Custom/ExoMechs/TeslaShoot2.ogg differ diff --git a/Sounds/Custom/ThanatosVent.ogg b/Sounds/Custom/ExoMechs/ThanatosVent.ogg similarity index 100% rename from Sounds/Custom/ThanatosVent.ogg rename to Sounds/Custom/ExoMechs/ThanatosVent.ogg diff --git a/Sounds/Custom/MagicalRockMine1.ogg b/Sounds/Custom/MagicalRockMine1.ogg new file mode 100644 index 0000000000..f752a8eae8 Binary files /dev/null and b/Sounds/Custom/MagicalRockMine1.ogg differ diff --git a/Sounds/Custom/MagicalRockMine2.ogg b/Sounds/Custom/MagicalRockMine2.ogg new file mode 100644 index 0000000000..229d090178 Binary files /dev/null and b/Sounds/Custom/MagicalRockMine2.ogg differ diff --git a/Sounds/Custom/MagicalRockMine3.ogg b/Sounds/Custom/MagicalRockMine3.ogg new file mode 100644 index 0000000000..e0fe343c4f Binary files /dev/null and b/Sounds/Custom/MagicalRockMine3.ogg differ diff --git a/Sounds/Custom/NuclearTerrorSpawn.ogg b/Sounds/Custom/NuclearTerrorSpawn.ogg new file mode 100644 index 0000000000..b63418747a Binary files /dev/null and b/Sounds/Custom/NuclearTerrorSpawn.ogg differ diff --git a/Sounds/Custom/OrbHeal1.ogg b/Sounds/Custom/OrbHeal1.ogg new file mode 100644 index 0000000000..2fbbaef0ef Binary files /dev/null and b/Sounds/Custom/OrbHeal1.ogg differ diff --git a/Sounds/Custom/OrbHeal2.ogg b/Sounds/Custom/OrbHeal2.ogg new file mode 100644 index 0000000000..38e2c47254 Binary files /dev/null and b/Sounds/Custom/OrbHeal2.ogg differ diff --git a/Sounds/Custom/OrbHeal3.ogg b/Sounds/Custom/OrbHeal3.ogg new file mode 100644 index 0000000000..22fb17bcd4 Binary files /dev/null and b/Sounds/Custom/OrbHeal3.ogg differ diff --git a/Sounds/Custom/OrbHeal4.ogg b/Sounds/Custom/OrbHeal4.ogg new file mode 100644 index 0000000000..f83277e69d Binary files /dev/null and b/Sounds/Custom/OrbHeal4.ogg differ diff --git a/Sounds/Custom/OrbHeal5.ogg b/Sounds/Custom/OrbHeal5.ogg new file mode 100644 index 0000000000..be849e5083 Binary files /dev/null and b/Sounds/Custom/OrbHeal5.ogg differ diff --git a/Sounds/Custom/PlatingMine1.ogg b/Sounds/Custom/PlatingMine1.ogg new file mode 100644 index 0000000000..e61ad02f28 Binary files /dev/null and b/Sounds/Custom/PlatingMine1.ogg differ diff --git a/Sounds/Custom/PlatingMine2.ogg b/Sounds/Custom/PlatingMine2.ogg new file mode 100644 index 0000000000..1cd3df6fd4 Binary files /dev/null and b/Sounds/Custom/PlatingMine2.ogg differ diff --git a/Sounds/Custom/PlatingMine3.ogg b/Sounds/Custom/PlatingMine3.ogg new file mode 100644 index 0000000000..7046ba873f Binary files /dev/null and b/Sounds/Custom/PlatingMine3.ogg differ diff --git a/Sounds/Custom/ProfanedGuardians/GuardianDash.ogg b/Sounds/Custom/ProfanedGuardians/GuardianDash.ogg new file mode 100644 index 0000000000..1663f06409 Binary files /dev/null and b/Sounds/Custom/ProfanedGuardians/GuardianDash.ogg differ diff --git a/Sounds/Custom/ProfanedGuardians/GuardianRay.ogg b/Sounds/Custom/ProfanedGuardians/GuardianRay.ogg new file mode 100644 index 0000000000..a802062c43 Binary files /dev/null and b/Sounds/Custom/ProfanedGuardians/GuardianRay.ogg differ diff --git a/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate.ogg b/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate.ogg new file mode 100644 index 0000000000..9a2e9498ab Binary files /dev/null and b/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate.ogg differ diff --git a/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate.ogg b/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate.ogg new file mode 100644 index 0000000000..2b9afbdf45 Binary files /dev/null and b/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate.ogg differ diff --git a/Sounds/Custom/Providence/ProvidenceBurn.ogg b/Sounds/Custom/Providence/ProvidenceBurn.ogg new file mode 100644 index 0000000000..22d40b6229 Binary files /dev/null and b/Sounds/Custom/Providence/ProvidenceBurn.ogg differ diff --git a/Sounds/Custom/Providence/ProvidenceBurnLoop.ogg b/Sounds/Custom/Providence/ProvidenceBurnLoop.ogg new file mode 100644 index 0000000000..2d847cb80b Binary files /dev/null and b/Sounds/Custom/Providence/ProvidenceBurnLoop.ogg differ diff --git a/Sounds/Custom/ProvidenceDeathAnimation.ogg b/Sounds/Custom/Providence/ProvidenceDeathAnimation.ogg similarity index 100% rename from Sounds/Custom/ProvidenceDeathAnimation.ogg rename to Sounds/Custom/Providence/ProvidenceDeathAnimation.ogg diff --git a/Sounds/Custom/ProvidenceHolyBlastImpact.ogg b/Sounds/Custom/Providence/ProvidenceHolyBlastImpact.ogg similarity index 100% rename from Sounds/Custom/ProvidenceHolyBlastImpact.ogg rename to Sounds/Custom/Providence/ProvidenceHolyBlastImpact.ogg diff --git a/Sounds/Custom/ProvidenceHolyBlastShoot.ogg b/Sounds/Custom/Providence/ProvidenceHolyBlastShoot.ogg similarity index 100% rename from Sounds/Custom/ProvidenceHolyBlastShoot.ogg rename to Sounds/Custom/Providence/ProvidenceHolyBlastShoot.ogg diff --git a/Sounds/Custom/ProvidenceHolyRay.ogg b/Sounds/Custom/Providence/ProvidenceHolyRay.ogg similarity index 100% rename from Sounds/Custom/ProvidenceHolyRay.ogg rename to Sounds/Custom/Providence/ProvidenceHolyRay.ogg diff --git a/Sounds/Custom/Providence/ProvidenceSizzle.ogg b/Sounds/Custom/Providence/ProvidenceSizzle.ogg new file mode 100644 index 0000000000..eb5449ad10 Binary files /dev/null and b/Sounds/Custom/Providence/ProvidenceSizzle.ogg differ diff --git a/Sounds/Custom/ProvidenceSpawn.ogg b/Sounds/Custom/Providence/ProvidenceSpawn.ogg similarity index 100% rename from Sounds/Custom/ProvidenceSpawn.ogg rename to Sounds/Custom/Providence/ProvidenceSpawn.ogg diff --git a/Sounds/Custom/Stylish.ogg b/Sounds/Custom/Stylish.ogg new file mode 100644 index 0000000000..487ba584b9 Binary files /dev/null and b/Sounds/Custom/Stylish.ogg differ diff --git a/Sounds/Custom/TreeFalling.ogg b/Sounds/Custom/TreeFalling.ogg new file mode 100644 index 0000000000..e24c91da56 Binary files /dev/null and b/Sounds/Custom/TreeFalling.ogg differ diff --git a/Sounds/Custom/VoidstoneMine1.ogg b/Sounds/Custom/VoidstoneMine1.ogg new file mode 100644 index 0000000000..258b8b0595 Binary files /dev/null and b/Sounds/Custom/VoidstoneMine1.ogg differ diff --git a/Sounds/Custom/VoidstoneMine2.ogg b/Sounds/Custom/VoidstoneMine2.ogg new file mode 100644 index 0000000000..0b62e1ec61 Binary files /dev/null and b/Sounds/Custom/VoidstoneMine2.ogg differ diff --git a/Sounds/Custom/VoidstoneMine3.ogg b/Sounds/Custom/VoidstoneMine3.ogg new file mode 100644 index 0000000000..88ddca230b Binary files /dev/null and b/Sounds/Custom/VoidstoneMine3.ogg differ diff --git a/Sounds/Item/BazookaFull.ogg b/Sounds/Item/BazookaFull.ogg deleted file mode 100644 index 21c37c6416..0000000000 Binary files a/Sounds/Item/BazookaFull.ogg and /dev/null differ diff --git a/Sounds/Item/LightningAura.ogg b/Sounds/Item/LightningAura.ogg new file mode 100644 index 0000000000..58b01a3923 Binary files /dev/null and b/Sounds/Item/LightningAura.ogg differ diff --git a/Sounds/Item/Magnum.ogg b/Sounds/Item/Magnum.ogg deleted file mode 100644 index b5173f333e..0000000000 Binary files a/Sounds/Item/Magnum.ogg and /dev/null differ diff --git a/Sounds/Item/SarosDiskThrow1.ogg b/Sounds/Item/SarosDiskThrow1.ogg new file mode 100644 index 0000000000..3c46a42673 Binary files /dev/null and b/Sounds/Item/SarosDiskThrow1.ogg differ diff --git a/Sounds/Item/SarosDiskThrow2.ogg b/Sounds/Item/SarosDiskThrow2.ogg new file mode 100644 index 0000000000..0b57f6c768 Binary files /dev/null and b/Sounds/Item/SarosDiskThrow2.ogg differ diff --git a/Sounds/Item/SarosDiskThrow3.ogg b/Sounds/Item/SarosDiskThrow3.ogg new file mode 100644 index 0000000000..ed1dc535ab Binary files /dev/null and b/Sounds/Item/SarosDiskThrow3.ogg differ diff --git a/Sounds/Item/SoupConsumption.ogg b/Sounds/Item/SoupConsumption.ogg new file mode 100644 index 0000000000..4980e5960b Binary files /dev/null and b/Sounds/Item/SoupConsumption.ogg differ diff --git a/Sounds/Item/TerratomereSwing.ogg b/Sounds/Item/TerratomereSwing.ogg new file mode 100644 index 0000000000..e033e963a9 Binary files /dev/null and b/Sounds/Item/TerratomereSwing.ogg differ diff --git a/Sounds/Music/DraedonAmbience.ogg b/Sounds/Music/DraedonAmbience.ogg deleted file mode 100644 index 51e1ca952f..0000000000 Binary files a/Sounds/Music/DraedonAmbience.ogg and /dev/null differ diff --git a/Sounds/Music/DraedonsAmbience.ogg b/Sounds/Music/DraedonsAmbience.ogg new file mode 100644 index 0000000000..6985a18ac9 Binary files /dev/null and b/Sounds/Music/DraedonsAmbience.ogg differ diff --git a/Sounds/NPCHit/CryogenHit1.ogg b/Sounds/NPCHit/CryogenHit1.ogg new file mode 100644 index 0000000000..738365c1d0 Binary files /dev/null and b/Sounds/NPCHit/CryogenHit1.ogg differ diff --git a/Sounds/NPCHit/CryogenHit2.ogg b/Sounds/NPCHit/CryogenHit2.ogg new file mode 100644 index 0000000000..1b370382a0 Binary files /dev/null and b/Sounds/NPCHit/CryogenHit2.ogg differ diff --git a/Sounds/NPCHit/CryogenHit3.ogg b/Sounds/NPCHit/CryogenHit3.ogg new file mode 100644 index 0000000000..9d7e9702a8 Binary files /dev/null and b/Sounds/NPCHit/CryogenHit3.ogg differ diff --git a/Sounds/NPCHit/CryogenPhaseTransitionCrack.ogg b/Sounds/NPCHit/CryogenPhaseTransitionCrack.ogg new file mode 100644 index 0000000000..34b4acef8e Binary files /dev/null and b/Sounds/NPCHit/CryogenPhaseTransitionCrack.ogg differ diff --git a/Sounds/NPCHit/ExoHit1.ogg b/Sounds/NPCHit/ExoHit1.ogg index 7515790ed8..9332148524 100644 Binary files a/Sounds/NPCHit/ExoHit1.ogg and b/Sounds/NPCHit/ExoHit1.ogg differ diff --git a/Sounds/NPCHit/ExoHit2.ogg b/Sounds/NPCHit/ExoHit2.ogg index cd9c0cc133..93a2e7d171 100644 Binary files a/Sounds/NPCHit/ExoHit2.ogg and b/Sounds/NPCHit/ExoHit2.ogg differ diff --git a/Sounds/NPCHit/ExoHit3.ogg b/Sounds/NPCHit/ExoHit3.ogg index 482ab8fa44..33654d7e3e 100644 Binary files a/Sounds/NPCHit/ExoHit3.ogg and b/Sounds/NPCHit/ExoHit3.ogg differ diff --git a/Sounds/NPCHit/ExoHit4.ogg b/Sounds/NPCHit/ExoHit4.ogg index c049c5115f..7535536893 100644 Binary files a/Sounds/NPCHit/ExoHit4.ogg and b/Sounds/NPCHit/ExoHit4.ogg differ diff --git a/Sounds/NPCHit/NuclearTerrorHit.ogg b/Sounds/NPCHit/NuclearTerrorHit.ogg new file mode 100644 index 0000000000..5886be8931 Binary files /dev/null and b/Sounds/NPCHit/NuclearTerrorHit.ogg differ diff --git a/Sounds/NPCHit/ThanatosHitClosed1.ogg b/Sounds/NPCHit/ThanatosHitClosed1.ogg new file mode 100644 index 0000000000..95deb0a940 Binary files /dev/null and b/Sounds/NPCHit/ThanatosHitClosed1.ogg differ diff --git a/Sounds/NPCHit/ThanatosHitClosed2.ogg b/Sounds/NPCHit/ThanatosHitClosed2.ogg new file mode 100644 index 0000000000..bbb3e242ad Binary files /dev/null and b/Sounds/NPCHit/ThanatosHitClosed2.ogg differ diff --git a/Sounds/NPCHit/ThanatosHitClosed3.ogg b/Sounds/NPCHit/ThanatosHitClosed3.ogg new file mode 100644 index 0000000000..77198b2c14 Binary files /dev/null and b/Sounds/NPCHit/ThanatosHitClosed3.ogg differ diff --git a/Sounds/NPCHit/ThanatosHitOpen1.ogg b/Sounds/NPCHit/ThanatosHitOpen1.ogg new file mode 100644 index 0000000000..ec4ad919f1 Binary files /dev/null and b/Sounds/NPCHit/ThanatosHitOpen1.ogg differ diff --git a/Sounds/NPCHit/ThanatosHitOpen2.ogg b/Sounds/NPCHit/ThanatosHitOpen2.ogg new file mode 100644 index 0000000000..3b2179e19a Binary files /dev/null and b/Sounds/NPCHit/ThanatosHitOpen2.ogg differ diff --git a/Sounds/NPCKilled/CryogenDeath.ogg b/Sounds/NPCKilled/CryogenDeath.ogg new file mode 100644 index 0000000000..9e4214e862 Binary files /dev/null and b/Sounds/NPCKilled/CryogenDeath.ogg differ diff --git a/Sounds/NPCKilled/CryogenShieldBreak.ogg b/Sounds/NPCKilled/CryogenShieldBreak.ogg new file mode 100644 index 0000000000..a663b9f9fd Binary files /dev/null and b/Sounds/NPCKilled/CryogenShieldBreak.ogg differ diff --git a/Sounds/NPCKilled/DevourerDeath.ogg b/Sounds/NPCKilled/DevourerDeath.ogg new file mode 100644 index 0000000000..4e50feb3f4 Binary files /dev/null and b/Sounds/NPCKilled/DevourerDeath.ogg differ diff --git a/Sounds/NPCKilled/DevourerDeathImpact.ogg b/Sounds/NPCKilled/DevourerDeathImpact.ogg new file mode 100644 index 0000000000..d17f046845 Binary files /dev/null and b/Sounds/NPCKilled/DevourerDeathImpact.ogg differ diff --git a/Sounds/NPCKilled/DevourerSegmentBreak1.ogg b/Sounds/NPCKilled/DevourerSegmentBreak1.ogg new file mode 100644 index 0000000000..20c7becee0 Binary files /dev/null and b/Sounds/NPCKilled/DevourerSegmentBreak1.ogg differ diff --git a/Sounds/NPCKilled/DevourerSegmentBreak2.ogg b/Sounds/NPCKilled/DevourerSegmentBreak2.ogg new file mode 100644 index 0000000000..42f262bfec Binary files /dev/null and b/Sounds/NPCKilled/DevourerSegmentBreak2.ogg differ diff --git a/Sounds/NPCKilled/DevourerSegmentBreak3.ogg b/Sounds/NPCKilled/DevourerSegmentBreak3.ogg new file mode 100644 index 0000000000..4e15239f8c Binary files /dev/null and b/Sounds/NPCKilled/DevourerSegmentBreak3.ogg differ diff --git a/Sounds/NPCKilled/DevourerSegmentBreak4.ogg b/Sounds/NPCKilled/DevourerSegmentBreak4.ogg new file mode 100644 index 0000000000..40e358f526 Binary files /dev/null and b/Sounds/NPCKilled/DevourerSegmentBreak4.ogg differ diff --git a/Sounds/NPCKilled/NuclearTerrorDeath.ogg b/Sounds/NPCKilled/NuclearTerrorDeath.ogg new file mode 100644 index 0000000000..b6760eb771 Binary files /dev/null and b/Sounds/NPCKilled/NuclearTerrorDeath.ogg differ diff --git a/Systems/BiomeTileCounterSystem.cs b/Systems/BiomeTileCounterSystem.cs index 2014276dcf..887c86e5d2 100644 --- a/Systems/BiomeTileCounterSystem.cs +++ b/Systems/BiomeTileCounterSystem.cs @@ -4,6 +4,7 @@ using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using Terraria; @@ -18,6 +19,12 @@ namespace CalamityMod.Systems public static int AbyssTiles = 0; public static int AstralTiles = 0; public static int SunkenSeaTiles = 0; + public static int ArsenalLabTiles = 0; + + public static int Layer1Tiles = 0; + public static int Layer2Tiles = 0; + public static int Layer3Tiles = 0; + public static int Layer4Tiles = 0; public override void ResetNearbyTileEffects() { @@ -26,15 +33,27 @@ namespace CalamityMod.Systems SunkenSeaTiles = 0; SulphurTiles = 0; AbyssTiles = 0; + ArsenalLabTiles = 0; + + Layer1Tiles = 0; + Layer2Tiles = 0; + Layer3Tiles = 0; + Layer4Tiles = 0; } public override void TileCountsAvailable(ReadOnlySpan tileCounts) { - BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; AbyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + ArsenalLabTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + Layer1Tiles = tileCounts[ModContent.TileType()]; + Layer2Tiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + Layer3Tiles = tileCounts[ModContent.TileType()]; + Layer4Tiles = tileCounts[ModContent.TileType()]; + int astralDesertTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; int astralSnowTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; diff --git a/Systems/DifficultyModeSystem.cs b/Systems/DifficultyModeSystem.cs index fe6e3aea20..26c1f4afbd 100644 --- a/Systems/DifficultyModeSystem.cs +++ b/Systems/DifficultyModeSystem.cs @@ -213,7 +213,7 @@ namespace CalamityMod.Systems "[c/"+mainColor+": When Adrenaline is maxed, press] " + adrenKey + " [c/"+mainColor+":for a large damage boost] \n" + "[c/"+mainColor+":Enables the ][c/FF8B54:Rage][c/"+mainColor+": mechanic. You gain Rage when in proximity of enemies or by using certain items] \n" + "[c/"+mainColor+": When Rage is maxed, press] " + rageKey + " [c/"+mainColor+":for a temporary damage boost] \n" + - "[c/"+mainColor+":Most foes have higher stats and deal more damage] \n" + + "[c/"+mainColor+":Most foes have higher stats and more aggressive AIs] \n" + "[c/"+mainColor+":Bosses have new AI mechanics, new phases, and will drop Master Mode loot. Enemies spawn more frequently] \n" + "[c/F7342A:This mode is more difficult than Expert. Be sure to prepare for the challenge]"); @@ -255,7 +255,7 @@ namespace CalamityMod.Systems } } - public override string ExpandedDescription =>"[c/B834E0:All foes will pose a much larger threat with aggressive AI and increased damage] \n" + + public override string ExpandedDescription =>"[c/B834E0:All foes will pose a much larger threat with highly aggressive AIs and increased damage] \n" + "[c/B834E0:Bosses have substantially harder AI changes. Enemies are even more numerous and can easily overwhelm you] \n" + "[c/B834E0:Debuffs are especially lethal and the Abyss is significantly more dangerous] \n" + "[c/E945FF:Vigilance and tenacity are crucial to survival]"; diff --git a/Systems/DownedBossSystem.cs b/Systems/DownedBossSystem.cs index 1cd39cb6cb..9726581e88 100644 --- a/Systems/DownedBossSystem.cs +++ b/Systems/DownedBossSystem.cs @@ -19,7 +19,7 @@ namespace CalamityMod internal static bool _downedCryogen = false; internal static bool _downedAquaticScourge = false; internal static bool _downedBrimstoneElemental = false; - internal static bool _downedCalamitas = false; + internal static bool _downedCalamitasClone = false; internal static bool _downedLeviathan = false; internal static bool _downedAstrumAureus = false; internal static bool _downedPlaguebringer = false; @@ -31,7 +31,7 @@ namespace CalamityMod internal static bool _downedCeaselessVoid = false; internal static bool _downedStormWeaver = false; internal static bool _downedSignus = false; - internal static bool _downedSecondSentinels = false; + internal static bool _downedSecondSentinels = false; // TODO: UNUSED (DoG no longer has sentinels phase) internal static bool _downedPolterghast = false; internal static bool _downedBoomerDuke = false; internal static bool _downedDoG = false; @@ -40,20 +40,25 @@ namespace CalamityMod internal static bool _downedThanatos = false; // only used for loot drops internal static bool _downedArtemisAndApollo = false; // only used for loot drops internal static bool _downedExoMechs = false; - internal static bool _downedSCal = false; + internal static bool _downedCalamitas = false; internal static bool _downedAdultEidolonWyrm = false; // Minibosses internal static bool _downedGSS = false; internal static bool _downedCLAM = false; internal static bool _downedCLAMHardMode = false; + internal static bool _downedCragmawMire = false; + internal static bool _downedMauler = false; + internal static bool _downedNuclearTerror = false; // Events internal static bool _downedEoCAcidRain = false; internal static bool _downedAquaticScourgeAcidRain = false; + internal static bool _downedBossRush = false; - // Betsy, because vanilla doesn't track her + // Betsy and Dreadnautilus because vanilla doesn't track them internal static bool _downedBetsy = false; + internal static bool _downedDreadnautilus = false; #region Wrapper Properties for Lantern Nights public static bool downedDesertScourge @@ -111,6 +116,17 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedSlimeGod, -1); } } + public static bool downedDreadnautilus + { + get => _downedDreadnautilus; + set + { + if (!value) + _downedDreadnautilus = false; + else + NPC.SetEventFlagCleared(ref _downedDreadnautilus, -1); + } + } public static bool downedCryogen { get => _downedCryogen; @@ -144,15 +160,15 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedBrimstoneElemental, -1); } } - public static bool downedCalamitas + public static bool downedCalamitasClone { - get => _downedCalamitas; + get => _downedCalamitasClone; set { if (!value) - _downedCalamitas = false; + _downedCalamitasClone = false; else - NPC.SetEventFlagCleared(ref _downedCalamitas, -1); + NPC.SetEventFlagCleared(ref _downedCalamitasClone, -1); } } public static bool downedLeviathan @@ -177,6 +193,17 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedAstrumAureus, -1); } } + public static bool downedBetsy + { + get => _downedBetsy; + set + { + if (!value) + _downedBetsy = false; + else + NPC.SetEventFlagCleared(ref _downedBetsy, -1); + } + } public static bool downedPlaguebringer { get => _downedPlaguebringer; @@ -331,15 +358,15 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedExoMechs, -1); } } - public static bool downedSCal + public static bool downedCalamitas { - get => _downedSCal; + get => _downedCalamitas; set { if (!value) - _downedSCal = false; + _downedCalamitas = false; else - NPC.SetEventFlagCleared(ref _downedSCal, -1); + NPC.SetEventFlagCleared(ref _downedCalamitas, -1); } } public static bool downedAdultEidolonWyrm @@ -353,17 +380,6 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedAdultEidolonWyrm, -1); } } - public static bool downedGSS - { - get => _downedGSS; - set - { - if (!value) - _downedGSS = false; - else - NPC.SetEventFlagCleared(ref _downedGSS, -1); - } - } public static bool downedCLAM { get => _downedCLAM; @@ -386,15 +402,48 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedCLAMHardMode, -1); } } - public static bool downedBetsy + public static bool downedCragmawMire { - get => _downedBetsy; + get => _downedCragmawMire; set { if (!value) - _downedBetsy = false; + _downedCragmawMire = false; else - NPC.SetEventFlagCleared(ref _downedBetsy, -1); + NPC.SetEventFlagCleared(ref _downedCragmawMire, -1); + } + } + public static bool downedGSS + { + get => _downedGSS; + set + { + if (!value) + _downedGSS = false; + else + NPC.SetEventFlagCleared(ref _downedGSS, -1); + } + } + public static bool downedMauler + { + get => _downedMauler; + set + { + if (!value) + _downedMauler = false; + else + NPC.SetEventFlagCleared(ref _downedMauler, -1); + } + } + public static bool downedNuclearTerror + { + get => _downedNuclearTerror; + set + { + if (!value) + _downedNuclearTerror = false; + else + NPC.SetEventFlagCleared(ref _downedNuclearTerror, -1); } } #endregion @@ -444,6 +493,17 @@ namespace CalamityMod NPC.SetEventFlagCleared(ref _downedAquaticScourgeAcidRain, -1); } } + public static bool downedBossRush + { + get => _downedBossRush; + set + { + if (!value) + _downedBossRush = false; + else + NPC.SetEventFlagCleared(ref _downedBossRush, -1); + } + } internal static void ResetAllFlags() { @@ -452,12 +512,14 @@ namespace CalamityMod downedHiveMind = false; downedPerforator = false; downedSlimeGod = false; + downedDreadnautilus = false; downedCryogen = false; downedAquaticScourge = false; downedBrimstoneElemental = false; - downedCalamitas = false; + downedCalamitasClone = false; downedLeviathan = false; downedAstrumAureus = false; + downedBetsy = false; downedPlaguebringer = false; downedRavager = false; downedAstrumDeus = false; @@ -475,19 +537,22 @@ namespace CalamityMod downedThanatos = false; downedArtemisAndApollo = false; downedExoMechs = false; - downedSCal = false; + downedCalamitas = false; downedAdultEidolonWyrm = false; downedSecondSentinels = false; downedCLAM = false; + downedEoCAcidRain = false; + downedCLAMHardMode = false; + downedCragmawMire = false; + downedAquaticScourgeAcidRain = false; downedGSS = false; - downedEoCAcidRain = false; - downedAquaticScourgeAcidRain = false; - - downedBetsy = false; + downedMauler = false; + downedNuclearTerror = false; + downedBossRush = false; } public override void OnWorldLoad() => ResetAllFlags(); @@ -498,30 +563,47 @@ namespace CalamityMod { List downed = new List(); + // Pre-hardmode bosses (progression sorted) if (downedDesertScourge) downed.Add("desertScourge"); - if (downedAquaticScourge) - downed.Add("aquaticScourge"); + if (downedCrabulon) + downed.Add("crabulon"); if (downedHiveMind) downed.Add("hiveMind"); if (downedPerforator) downed.Add("perforator"); if (downedSlimeGod) downed.Add("slimeGod"); + + // Hardmode bosses (progression sorted) + if (downedDreadnautilus) + downed.Add("dreadnautilus"); if (downedCryogen) downed.Add("cryogen"); + if (downedAquaticScourge) + downed.Add("aquaticScourge"); if (downedBrimstoneElemental) downed.Add("brimstoneElemental"); - if (downedCalamitas) + if (downedCalamitasClone) downed.Add("calamitas"); if (downedLeviathan) downed.Add("leviathan"); - if (downedDoG) - downed.Add("devourerOfGods"); + if (downedAstrumAureus) + downed.Add("astrageldon"); + if (downedBetsy) + downed.Add("betsy"); if (downedPlaguebringer) downed.Add("plaguebringerGoliath"); + if (downedRavager) + downed.Add("scavenger"); + if (downedAstrumDeus) + downed.Add("starGod"); + + // Post-ML bosses (progression sorted) if (downedGuardians) downed.Add("guardians"); + if (downedDragonfolly) + downed.Add("bumblebirb"); if (downedProvidence) downed.Add("providence"); if (downedCeaselessVoid) @@ -532,46 +614,48 @@ namespace CalamityMod downed.Add("signus"); if (downedSecondSentinels) downed.Add("secondSentinels"); + if (downedPolterghast) + downed.Add("polterghast"); + if (downedBoomerDuke) + downed.Add("oldDuke"); + if (downedDoG) + downed.Add("devourerOfGods"); if (downedYharon) downed.Add("yharon"); - if (downedExoMechs) - downed.Add("exoMechs"); - if (downedAres) - downed.Add("ares"); if (downedThanatos) downed.Add("thanatos"); if (downedArtemisAndApollo) downed.Add("artemisAndApollo"); - if (downedSCal) + if (downedAres) + downed.Add("ares"); + if (downedExoMechs) + downed.Add("exoMechs"); + if (downedCalamitas) downed.Add("supremeCalamitas"); if (downedAdultEidolonWyrm) downed.Add("adultEidolonWyrm"); - if (downedDragonfolly) - downed.Add("bumblebirb"); - if (downedCrabulon) - downed.Add("crabulon"); - if (downedBetsy) - downed.Add("betsy"); - if (downedRavager) - downed.Add("scavenger"); - if (downedAstrumDeus) - downed.Add("starGod"); - if (downedAstrumAureus) - downed.Add("astrageldon"); - if (downedPolterghast) - downed.Add("polterghast"); - if (downedGSS) - downed.Add("greatSandShark"); - if (downedBoomerDuke) - downed.Add("oldDuke"); + + // Minibosses and events if (downedCLAM) downed.Add("clam"); - if (downedCLAMHardMode) - downed.Add("clamHardmode"); if (downedEoCAcidRain) downed.Add("eocRain"); + + if (downedCLAMHardMode) + downed.Add("clamHardmode"); + if (downedCragmawMire) + downed.Add("cragmawMire"); if (downedAquaticScourgeAcidRain) downed.Add("hmRain"); + if (downedGSS) + downed.Add("greatSandShark"); + + if (downedMauler) + downed.Add("mauler"); + if (downedNuclearTerror) + downed.Add("nuclearTerror"); + if (downedBossRush) + downed.Add("bossRush"); tag["downedFlags"] = downed; } @@ -579,43 +663,54 @@ namespace CalamityMod public override void LoadWorldData(TagCompound tag) { IList downed = tag.GetList("downedFlags"); + downedDesertScourge = downed.Contains("desertScourge"); downedAquaticScourge = downed.Contains("aquaticScourge"); + downedCrabulon = downed.Contains("crabulon"); downedHiveMind = downed.Contains("hiveMind"); downedPerforator = downed.Contains("perforator"); downedSlimeGod = downed.Contains("slimeGod"); + + downedDreadnautilus = downed.Contains("dreadnautilus"); downedCryogen = downed.Contains("cryogen"); downedBrimstoneElemental = downed.Contains("brimstoneElemental"); - downedCalamitas = downed.Contains("calamitas"); + downedCalamitasClone = downed.Contains("calamitas"); downedLeviathan = downed.Contains("leviathan"); - downedDoG = downed.Contains("devourerOfGods"); + downedAstrumAureus = downed.Contains("astrageldon"); + downedBetsy = downed.Contains("betsy"); downedPlaguebringer = downed.Contains("plaguebringerGoliath"); + downedRavager = downed.Contains("scavenger"); + downedAstrumDeus = downed.Contains("starGod"); + downedGuardians = downed.Contains("guardians"); + downedDragonfolly = downed.Contains("bumblebirb"); downedProvidence = downed.Contains("providence"); downedCeaselessVoid = downed.Contains("ceaselessVoid"); downedStormWeaver = downed.Contains("stormWeaver"); downedSignus = downed.Contains("signus"); + downedPolterghast = downed.Contains("polterghast"); + downedBoomerDuke = downed.Contains("oldDuke"); downedSecondSentinels = downed.Contains("secondSentinels"); + downedDoG = downed.Contains("devourerOfGods"); downedYharon = downed.Contains("yharon"); - downedExoMechs = downed.Contains("exoMechs"); - downedAres = downed.Contains("ares"); downedThanatos = downed.Contains("thanatos"); downedArtemisAndApollo = downed.Contains("artemisAndApollo"); - downedSCal = downed.Contains("supremeCalamitas"); + downedAres = downed.Contains("ares"); + downedExoMechs = downed.Contains("exoMechs"); + downedCalamitas = downed.Contains("supremeCalamitas"); downedAdultEidolonWyrm = downed.Contains("adultEidolonWyrm"); - downedDragonfolly = downed.Contains("bumblebirb"); - downedCrabulon = downed.Contains("crabulon"); - downedBetsy = downed.Contains("betsy"); - downedRavager = downed.Contains("scavenger"); - downedAstrumDeus = downed.Contains("starGod"); - downedAstrumAureus = downed.Contains("astrageldon"); - downedPolterghast = downed.Contains("polterghast"); - downedGSS = downed.Contains("greatSandShark"); - downedBoomerDuke = downed.Contains("oldDuke"); + downedCLAM = downed.Contains("clam"); - downedCLAMHardMode = downed.Contains("clamHardmode"); downedEoCAcidRain = downed.Contains("eocRain"); + + downedCLAMHardMode = downed.Contains("clamHardmode"); + downedCragmawMire = downed.Contains("cragmawMire"); downedAquaticScourgeAcidRain = downed.Contains("hmRain"); + downedGSS = downed.Contains("greatSandShark"); + + downedMauler = downed.Contains("mauler"); + downedNuclearTerror = downed.Contains("nuclearTerror"); + downedBossRush = downed.Contains("bossRush"); } } } diff --git a/Systems/HellBackgroundSystem.cs b/Systems/HellBackgroundSystem.cs new file mode 100644 index 0000000000..da2600efed --- /dev/null +++ b/Systems/HellBackgroundSystem.cs @@ -0,0 +1,239 @@ +/* +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Systems +{ + public interface HellBGLoad + { + void Load(); + void Unload(); + } + + //hell background system since it will probably be used in the future + //also example at the bottom + internal static class HellBGManager + { + public static int CurrentBGID = -1; + public static HellBGType[] HellBGs; + + public static void Load() + { + CurrentBGID = -1; + HellBGs = new HellBGType[0]; + + //super epic detour + On.Terraria.Main.DrawUnderworldBackground += DrawHellBG; + } + + public static void Unload() + { + HellBGs = null; + } + + private static void DrawHellBG(On.Terraria.Main.orig_DrawUnderworldBackground orig, Main self, bool flat) + { + int oldID = CurrentBGID; + CurrentBGID = -1; + + if (Main.gameMenu || Main.screenPosition.Y + Main.screenHeight < (Main.maxTilesY - 220) * 16f) + { + orig(self, flat); + return; + } + for (int i = 0; i < HellBGs.Length; i++) + { + if (HellBGs[i].IsActive()) + { + CurrentBGID = i; + break; + } + } + if (oldID != CurrentBGID && oldID != -1) + { + CurrentBGID = oldID; + oldID = -2; + HellBGs[CurrentBGID].Transparency -= HellBGs[CurrentBGID].TransitionSpeed; + } + else if (CurrentBGID == -1) + { + orig(self, flat); + return; + } + + var currentBG = HellBGs[CurrentBGID]; + float transparency = 1f; + + if (currentBG.Transparency < 1f) + { + orig(self, flat); + if (oldID != -2) + { + currentBG.Transparency += currentBG.TransitionSpeed; + + if (currentBG.Transparency > 1f) + { + currentBG.Transparency = 1f; + } + } + else + { + currentBG.Transparency -= currentBG.TransitionSpeed; + + if (currentBG.Transparency < 0f) + { + currentBG.Transparency = 0f; + } + } + + transparency = currentBG.Transparency; + } + + Vector2 vector = Main.screenPosition + new Vector2((Main.screenWidth >> 1), (Main.screenHeight >> 1)); + float num = (Main.GameViewMatrix.Zoom.Y - 1f) * 0.5f * 200f; + int bg0Height = ModContent.Request(currentBG.TexturePath + "0").Height(); + bg0Height += bg0Height >> 1; + float Scale = 1.4f; //how much the bg textures are scaled up in game + for (int Layers = 4; Layers >= 0; Layers--) + { + //get each background texture + Texture2D BGTexture = ModContent.Request(currentBG.TexturePath + Layers).Value; + //get each glowmask texture for the bg + Texture2D BGTextureGlow = ModContent.Request(currentBG.TexturePath + Layers + "_Glow").Value; + + Vector2 vector2 = new Vector2(BGTexture.Width, BGTexture.Height) * 0.5f; + float num2 = flat ? 1f : (Layers * 2 + 3f); + Vector2 vector3 = new Vector2(1f / num2); + Rectangle rectangle = new Rectangle(0, 0, BGTexture.Width, BGTexture.Height); + Vector2 zero = Vector2.Zero; + + switch (Layers) + { + //zero.Y is the y-offset for each bg, if it draws too high or too low then it can be changed to fix that + case 0: + { + zero.Y += 0f; + break; + } + case 1: + { + zero.Y += 0f; + break; + } + case 2: + { + zero.Y += 0f; + break; + } + case 3: + { + zero.Y += 0f; + break; + } + case 4: + { + zero.Y += 0f; + break; + } + } + + if (flat) + { + zero.Y += bg0Height * 1.3f - vector2.Y; + } + + vector2 *= Scale; + + zero.Y -= num; + float num5 = Scale * rectangle.Width; + int num6 = (int)((vector.X * vector3.X - vector2.X + zero.X - (Main.screenWidth >> 1)) / num5); + + for (int j = num6 - 2; j < num6 + 4 + (int)(Main.screenWidth / num5); j++) + { + Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), (Main.maxTilesY - 200) * 16f) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero; + var frame = rectangle; + var clr = currentBG.DrawColor * transparency; + + if (currentBG.PreDraw(BGTexture, ref drawPosition, ref frame, ref clr, Scale, Layers)) + { + //draw the bg textures themselves + Main.spriteBatch.Draw(BGTexture, drawPosition, frame, clr, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f); + + //draws the glowmask over each background + Main.spriteBatch.Draw(BGTextureGlow, drawPosition, frame, Color.White * transparency, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f); + } + } + } + } + + public static void AddHellBG(HellBGType hellBG) + { + int id = HellBGs.Length; + Array.Resize(ref HellBGs, id + 1); + hellBG.ID = id; + HellBGs[id] = hellBG; + } + } + + public abstract class HellBGType : HellBGLoad + { + public int ID; + public float Transparency; + void HellBGLoad.Load() + { + if (Main.dedServ) + { + return; + } + HellBGManager.AddHellBG(this); + OnLoad(); + } + + void HellBGLoad.Unload() + { + OnUnload(); + } + + public abstract bool IsActive(); + public abstract string TexturePath { get; } + + public virtual float TransitionSpeed => 0.02f; + public virtual Color DrawColor => new Color(255, 255, 255, 255); + + protected virtual void OnLoad() + { + } + + protected virtual void OnUnload() + { + } + + public virtual bool PreDraw(Texture2D texture, ref Vector2 drawPosition, ref Rectangle frame, ref Color drawColor, float Scale, int Layer) + { + return true; + } + + public virtual void PostDraw(Texture2D texture, Vector2 drawPosition, Rectangle frame, Color drawColor, float Scale, int Layer) + { + } + } + + //example hell background using the system + public class SpookyHellBG : HellBGType + { + //get the texture for each background + //you dont need to put any numbers at the end of the bg texture name since the hell bg system manages that + public override string TexturePath => "CalamityMod/Backgrounds/BgTextureName"; + + public override bool IsActive() + { + return whatever; //return the condition(s) required for this background to be drawn + } + + public override Color DrawColor => Color.Gray; //draw color of the bg + } +} +*/ \ No newline at end of file diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/MiscWorldStateSystem.cs index 84e7cadfb3..afc9a07ad7 100644 --- a/Systems/MiscWorldStateSystem.cs +++ b/Systems/MiscWorldStateSystem.cs @@ -26,6 +26,7 @@ namespace CalamityMod CalamityGlobalNPC.voidBoss = -1; CalamityGlobalNPC.energyFlame = -1; CalamityGlobalNPC.hiveMind = -1; + CalamityGlobalNPC.astrumAureus = -1; CalamityGlobalNPC.scavenger = -1; for (int i = 0; i < CalamityGlobalNPC.bobbitWormBottom.Length; i++) @@ -141,6 +142,7 @@ namespace CalamityMod tag["JungleLabCenter"] = JungleLabCenter; tag["HellLabCenter"] = HellLabCenter; tag["IceLabCenter"] = IceLabCenter; + tag["CavernLabCenter"] = CavernLabCenter; } public override void LoadWorldData(TagCompound tag) @@ -188,6 +190,7 @@ namespace CalamityMod JungleLabCenter = tag.Get("JungleLabCenter"); HellLabCenter = tag.Get("HellLabCenter"); IceLabCenter = tag.Get("IceLabCenter"); + CavernLabCenter = tag.Get("CavernLabCenter"); } #endregion Saving/Loading } diff --git a/Systems/MusicBoxRegistry.cs b/Systems/MusicBoxRegistry.cs index 6513e69a08..12fefd7b24 100644 --- a/Systems/MusicBoxRegistry.cs +++ b/Systems/MusicBoxRegistry.cs @@ -1,7 +1,4 @@ -using CalamityMod.Items.Placeables.MusicBoxes; -using CalamityMod.Tiles.MusicBoxes; -using Terraria; -using Terraria.Audio; +using Terraria; using Terraria.ModLoader; namespace CalamityMod @@ -19,7 +16,7 @@ namespace CalamityMod { if (!Main.dedServ) { - AddMusicBox("Sounds/Music/DraedonAmbience", ModContent.ItemType(), ModContent.TileType()); + AddMusicBox("Sounds/Music/DraedonsAmbience", ModContent.ItemType(), ModContent.TileType()); } } } diff --git a/Systems/TilePingerSystem.cs b/Systems/TilePingerSystem.cs index 8a958df51a..6908635ad4 100644 --- a/Systems/TilePingerSystem.cs +++ b/Systems/TilePingerSystem.cs @@ -261,7 +261,7 @@ namespace CalamityMod.Systems if (emptyFrame == null) emptyFrame = ModContent.Request("CalamityMod/Projectiles/InvisibleProj").Value; - Effect tileEffect = Filters.Scene["WulfrumTilePing"].GetShader().Shader; + Effect tileEffect = Filters.Scene["CalamityMod:WulfrumTilePing"].GetShader().Shader; tileEffect.Parameters["pingCenter"].SetValue(PingCenter); tileEffect.Parameters["pingRadius"].SetValue(MaxPingRadius); tileEffect.Parameters["pingWaveThickness"].SetValue(PingWaveThickness); diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index 780f28e764..e207bfb575 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.AdultEidolonWyrm; @@ -8,8 +9,8 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Events; @@ -67,7 +68,7 @@ namespace CalamityMod.Systems AcidRainEvent.HasStartedAcidicDownpour = false; } - // Lumenyl crystal, tenebris spread and sea prism crystal spawn rates + // Lumenyl crystal and sea prism crystal spawn rates HandleTileGrowth(); // Update Boss Rush. @@ -85,7 +86,7 @@ namespace CalamityMod.Systems // Very, very, very rarely display a Lorde joke text if the system clock is set to April Fools Day. if (Main.rand.NextBool(100000000) && DateTime.Now.Month == 4 && DateTime.Now.Day == 1) { - string key = "Mods.CalamityMod.AprilFools"; + string key = CalamityWorld.getFixedBoi ? "Mods.CalamityMod.AprilFoolsGFB" : "Mods.CalamityMod.AprilFools"; Color messageColor = Color.Crimson; CalamityUtils.DisplayLocalizedText(key, messageColor); } @@ -150,7 +151,7 @@ namespace CalamityMod.Systems if (y2 < 10) y2 = 10; - if (WorldGen.InWorld(x, y, 1) && Main.tile[x, y] != null) + if (WorldGen.InWorld(x, y, 1) && Main.tile[x, y].HasTile) { if (Main.tile[x, y].HasUnactuatedTile) { @@ -229,12 +230,11 @@ namespace CalamityMod.Systems } } - int tileType = Main.tile[x, y].TileType; - bool tenebris = tileType == ModContent.TileType() && DownedBossSystem.downedCalamitas; - - if (CalamityGlobalTile.GrowthTiles.Contains(tileType) || tenebris) + Tile growthTile = Main.tile[x, y]; + int tileType = growthTile.TileType; + if (CalamityGlobalTile.GrowthTiles.Contains(tileType) && growthTile.Slope == SlopeType.Solid && !growthTile.IsHalfBlock) { - int growthChance = tenebris ? 4 : 2; + int growthChance = 2; if (tileType == ModContent.TileType()) growthChance *= 5; @@ -261,9 +261,9 @@ namespace CalamityMod.Systems if (Main.tile[x, y] != null) { Tile tile = Main.tile[x, y]; - bool growTile = tenebris ? (tile.HasTile && tile.TileType == ModContent.TileType()) : (!tile.HasTile && tile.LiquidAmount >= 128); + bool growTile = !tile.HasTile && tile.LiquidAmount >= 128; bool isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType() || tileType == ModContent.TileType(); - bool meetsAdditionalGrowConditions = tile.Slope == 0 && !tile.IsHalfBlock && tile.LiquidType != LiquidID.Lava; + bool meetsAdditionalGrowConditions = tile.Slope == SlopeType.Solid && !tile.IsHalfBlock && tile.LiquidType != LiquidID.Lava; if (growTile && meetsAdditionalGrowConditions) { @@ -276,31 +276,28 @@ namespace CalamityMod.Systems if (tileType2 == ModContent.TileType() && !isSunkenSeaTile) canPlaceBasedOnAttached = false; - if (canPlaceBasedOnAttached && (CanPlaceBasedOnProximity(x, y, tileType2) || tenebris)) + if (canPlaceBasedOnAttached && CanPlaceBasedOnProximity(x, y, tileType2)) { - tile.TileType = tenebris ? (ushort)tileType : (ushort)tileType2; + tile.TileType = (ushort)tileType2; - if (!tenebris) + tile.HasTile = true; + if (Main.tile[x, y + 1].HasTile && Main.tileSolid[Main.tile[x, y + 1].TileType] && Main.tile[x, y + 1].Slope == 0 && !Main.tile[x, y + 1].IsHalfBlock) { - tile.HasTile = true; - if (Main.tile[x, y + 1].HasTile && Main.tileSolid[Main.tile[x, y + 1].TileType] && Main.tile[x, y + 1].Slope == 0 && !Main.tile[x, y + 1].IsHalfBlock) - { - tile.TileFrameY = 0; - } - else if (Main.tile[x, y - 1].HasTile && Main.tileSolid[Main.tile[x, y - 1].TileType] && Main.tile[x, y - 1].Slope == 0 && !Main.tile[x, y - 1].IsHalfBlock) - { - tile.TileFrameY = 18; - } - else if (Main.tile[x + 1, y].HasTile && Main.tileSolid[Main.tile[x + 1, y].TileType] && Main.tile[x + 1, y].Slope == 0 && !Main.tile[x + 1, y].IsHalfBlock) - { - tile.TileFrameY = 36; - } - else if (Main.tile[x - 1, y].HasTile && Main.tileSolid[Main.tile[x - 1, y].TileType] && Main.tile[x - 1, y].Slope == 0 && !Main.tile[x - 1, y].IsHalfBlock) - { - tile.TileFrameY = 54; - } - tile.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); + tile.TileFrameY = 0; } + else if (Main.tile[x, y - 1].HasTile && Main.tileSolid[Main.tile[x, y - 1].TileType] && Main.tile[x, y - 1].Slope == 0 && !Main.tile[x, y - 1].IsHalfBlock) + { + tile.TileFrameY = 18; + } + else if (Main.tile[x + 1, y].HasTile && Main.tileSolid[Main.tile[x + 1, y].TileType] && Main.tile[x + 1, y].Slope == 0 && !Main.tile[x + 1, y].IsHalfBlock) + { + tile.TileFrameY = 36; + } + else if (Main.tile[x - 1, y].HasTile && Main.tileSolid[Main.tile[x - 1, y].TileType] && Main.tile[x - 1, y].Slope == 0 && !Main.tile[x - 1, y].IsHalfBlock) + { + tile.TileFrameY = 54; + } + tile.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); WorldGen.SquareTileFrame(x, y); @@ -319,10 +316,10 @@ namespace CalamityMod.Systems public static bool CanPlaceBasedOnProximity(int x, int y, int tileType) { - if (tileType == ModContent.TileType() && !DownedBossSystem.downedCalamitas) + if (tileType == ModContent.TileType() && !DownedBossSystem.downedCalamitasClone) return false; - int minDistanceFromOtherTiles = 6; + int minDistanceFromOtherTiles = 10; int sameTilesNearby = 0; for (int i = x - minDistanceFromOtherTiles; i < x + minDistanceFromOtherTiles; i++) { @@ -344,7 +341,8 @@ namespace CalamityMod.Systems #region Handle Armored Digger Random Spawns public static void TrySpawnArmoredDigger(Player player, CalamityPlayer modPlayer) { - if (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneDungeon && !player.ZoneJungle && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses) + bool gfbCondition = CalamityWorld.getFixedBoi && (player.ZoneHallow || player.ZoneUnderworldHeight) && NPC.downedMoonlord; + if ((gfbCondition || (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneJungle)) && !player.ZoneDungeon && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses) { if (NPC.downedPlantBoss && player.townNPCs < 3f) { @@ -419,7 +417,7 @@ namespace CalamityMod.Systems #region Handle Adult Eidolon Wyrm Spawns public static void TrySpawnAEoW(Player player, CalamityPlayer modPlayer) { - if (Main.netMode == NetmodeID.MultiplayerClient || !modPlayer.ZoneAbyss || !player.chaosState || player.dead) + if (Main.netMode == NetmodeID.MultiplayerClient || !(modPlayer.ZoneAbyss || CalamityWorld.getFixedBoi) || !player.chaosState || player.dead) return; bool adultWyrmAlive = CalamityGlobalNPC.adultEidolonWyrmHead != -1 && Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active; diff --git a/Systems/WorldSyncingSystem.cs b/Systems/WorldSyncingSystem.cs index 19ab8a6f40..6143bbb4f8 100644 --- a/Systems/WorldSyncingSystem.cs +++ b/Systems/WorldSyncingSystem.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Systems flags[3] = downedSlimeGod; flags[4] = downedCryogen; flags[5] = downedBrimstoneElemental; - flags[6] = downedCalamitas; + flags[6] = downedCalamitasClone; flags[7] = downedLeviathan; BitsByte flags2 = new BitsByte(); @@ -36,7 +36,7 @@ namespace CalamityMod.Systems // Don't write meaningful values for the now-unused vanilla boss booleans BitsByte flags3 = new BitsByte(); - flags3[0] = downedSCal; + flags3[0] = downedCalamitas; flags3[1] = downedDragonfolly; flags3[2] = downedCrabulon; flags3[3] = downedBetsy; @@ -125,6 +125,12 @@ namespace CalamityMod.Systems flags11[6] = downedArtemisAndApollo; flags11[7] = TalkedToDraedon; + BitsByte flags12 = new BitsByte(); + flags12[0] = downedCragmawMire; + flags12[1] = downedMauler; + flags12[2] = downedNuclearTerror; + flags12[3] = downedBossRush; + writer.Write(flags); writer.Write(flags2); writer.Write(flags3); @@ -136,6 +142,7 @@ namespace CalamityMod.Systems writer.Write(flags9); writer.Write(flags10); writer.Write(flags11); + writer.Write(flags12); RecipeUnlockHandler.SendData(writer); @@ -152,6 +159,7 @@ namespace CalamityMod.Systems writer.WriteVector2(JungleLabCenter); writer.WriteVector2(HellLabCenter); writer.WriteVector2(IceLabCenter); + writer.WriteVector2(CavernLabCenter); } #endregion @@ -165,7 +173,7 @@ namespace CalamityMod.Systems downedSlimeGod = flags[3]; downedCryogen = flags[4]; downedBrimstoneElemental = flags[5]; - downedCalamitas = flags[6]; + downedCalamitasClone = flags[6]; downedLeviathan = flags[7]; BitsByte flags2 = reader.ReadByte(); @@ -180,7 +188,7 @@ namespace CalamityMod.Systems // Explicitly discard the now-unused vanilla boss booleans BitsByte flags3 = reader.ReadByte(); - downedSCal = flags3[0]; + downedCalamitas = flags3[0]; downedDragonfolly = flags3[1]; downedCrabulon = flags3[2]; downedBetsy = flags3[3]; @@ -269,6 +277,12 @@ namespace CalamityMod.Systems downedArtemisAndApollo = flags11[6]; TalkedToDraedon = flags11[7]; + BitsByte flags12 = reader.ReadByte(); + downedCragmawMire = flags12[0]; + downedMauler = flags12[1]; + downedNuclearTerror = flags12[2]; + downedBossRush = flags12[3]; + RecipeUnlockHandler.ReceiveData(reader); Abyss.AbyssChasmBottom = reader.ReadInt32(); @@ -284,6 +298,7 @@ namespace CalamityMod.Systems JungleLabCenter = reader.ReadVector2(); HellLabCenter = reader.ReadVector2(); IceLabCenter = reader.ReadVector2(); + CavernLabCenter = reader.ReadVector2(); } #endregion } diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 00f0d5bf64..ea305cf9f9 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -29,34 +29,25 @@ namespace CalamityMod.Systems #region ModifyWorldGenTasks public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) { + //Evil Floating Island int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); if (islandIndex != -1) { - tasks.Insert(islandIndex + 2, new PassLegacy("EvilIsland", (progress, config) => + tasks.Insert(islandIndex + 2, new PassLegacy("Evil Island", (progress, config) => { - progress.Message = "Corrupting a floating island"; + progress.Message = WorldGen.crimson ? "Adding a putrid floating island" : "Adding a grotesque floating island"; WorldEvilIsland.PlaceEvilIsland(); })); } + //Calamity's biome chests in the dungeon int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); if (DungeonChestIndex != -1) { tasks.Insert(DungeonChestIndex + 1, new PassLegacy("CalamityDungeonBiomeChests", MiscWorldgenRoutines.GenerateBiomeChests)); } - int WaterFromSandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Remove Water From Sand")); - if (WaterFromSandIndex != -1) - { - tasks.Insert(WaterFromSandIndex + 1, new PassLegacy("SunkenSea", (progress, config) => - { - progress.Message = "Partially flooding an overblown desert"; - int sunkenSeaX = WorldGen.UndergroundDesertLocation.Left; - int sunkenSeaY = WorldGen.UndergroundDesertLocation.Center.Y; - SunkenSea.Place(new Point(sunkenSeaX, sunkenSeaY)); - })); - } - + //Larger Jungle Temple int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) => { @@ -64,16 +55,18 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTemple(); }); + //Improved Golem arena int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => { - progress.Message = "Building a bigger jungle temple"; + progress.Message = "Building a better jungle temple"; Main.tileSolid[162] = false; Main.tileSolid[226] = true; CustomTemple.NewJungleTemplePart2(); Main.tileSolid[232] = false; }); + //Better Lihzahrd altar (consistency?) int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => { @@ -81,73 +74,148 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTempleLihzahrdAltar(); }); - // TODO -- Most of the below worldgen should be spaced out at better points of generation instead of all crammed at the end + //Giant beehive + int giantHiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives")); + if (giantHiveIndex != -1) + { + tasks.Insert(giantHiveIndex + 1, new PassLegacy("Giant Hive", (progress, config) => + { + progress.Message = "Building a giant beehive"; + int attempts = 0; + while (attempts < 1000) + { + attempts++; + Point origin = WorldGen.RandomWorldPoint((int)Main.worldSurface + 25, 20, Main.maxTilesY - (int)Main.worldSurface - 125, 20); + if (GiantHive.CanPlaceGiantHive(origin, WorldGen.structures)) + break; + } + })); + } + //mechanic shed + int mechanicIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Sunflowers")); + if (mechanicIndex != -1) + { + tasks.Insert(mechanicIndex + 1, new PassLegacy("Mechanic Shed", (progress, config) => + { + progress.Message = "Placing mechanic shed"; + MechanicShed.PlaceMechanicShed(WorldGen.structures); + })); + } + + //Vernal pass + int vernalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Muds Walls In Jungle")); + if (vernalIndex != -1) + { + tasks.Insert(vernalIndex + 1, new PassLegacy("Vernal Pass", (progress, config) => + { + progress.Message = "Blessing a flourishing jungle grove"; + VernalPass.PlaceVernalPass(WorldGen.structures); + })); + } + + //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) => + { + progress.Message = "Partially flooding an overblown desert"; + + int sunkenSeaX = WorldGen.UndergroundDesertLocation.Left; + int sunkenSeaY = Main.maxTilesY - 400; + + SunkenSea.Place(new Point(sunkenSeaX, sunkenSeaY)); + })); + } + + //All further tasks occur after vanilla worldgen is completed int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) { + //Reallocate gems so rarity corresponds to depth int currentFinalIndex = FinalIndex; - tasks.Insert(++currentFinalIndex, new PassLegacy("GemDepthAdjustment", (progress, config) => + tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => { - progress.Message = "Reallocating gem deposits to match cavern depth"; + progress.Message = "Sensibly shuffling gem depth"; MiscWorldgenRoutines.SmartGemGen(); })); + //Forsaken Archive structure in the Dungeon + tasks.Insert(++currentFinalIndex, new PassLegacy("Forsaken Archive", (progress, config) => + { + progress.Message = "Entombing occult literature"; + DungeonArchive.PlaceArchive(); + })); + + //Planetoids tasks.Insert(++currentFinalIndex, new PassLegacy("Planetoids", Planetoid.GenerateAllBasePlanetoids)); - //Not touching this yet because the Crags will be reworked in the future - #region BrimstoneCrag - tasks.Insert(++currentFinalIndex, new PassLegacy("BrimstoneCrag", (progress, config) => - { - progress.Message = "Uncovering the ruins of a fallen empire"; - - int x = Main.maxTilesX; - - int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); - int yUnderworldGen = Main.maxTilesY - 100; - - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); - - MiscWorldgenRoutines.ChasmGenerator(xUnderworldGen - 110, yUnderworldGen - 10, WorldGen.genRand.Next(150) + 150); - MiscWorldgenRoutines.ChasmGenerator(xUnderworldGen + 110, yUnderworldGen - 10, WorldGen.genRand.Next(150) + 150); - - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); - MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); - - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen, yUnderworldGen + 30, 1323); - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen - 22, yUnderworldGen + 15, 1322); - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen + 22, yUnderworldGen + 15, 535); - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen - 50, yUnderworldGen - 30, 112); - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen + 50, yUnderworldGen - 30, 906); - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen - 150, yUnderworldGen - 30, 218); - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen + 150, yUnderworldGen - 30, 3019); - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen - 180, yUnderworldGen - 20, 274); - MiscWorldgenRoutines.UnderworldIslandHouse(xUnderworldGen + 180, yUnderworldGen - 20, 220); - })); - #endregion - + //Sulphurous Sea (Step 1) int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); if (SulphurIndex != -1) { - tasks.Insert(SulphurIndex + 1, new PassLegacy("SulphurSea", (progress, config) => + tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur Sea", (progress, config) => { progress.Message = "Polluting one of the oceans"; SulphurousSea.PlaceSulphurSea(); })); } - tasks.Insert(++currentFinalIndex, new PassLegacy("SpecialShrines", (progress, config) => + //Brimstone Crags + tasks.Insert(++currentFinalIndex, new PassLegacy("Brimstone Crag", (progress, config) => { - progress.Message = "Placing hidden shrines"; - UndergroundShrines.PlaceShrines(); + progress.Message = "Incinerating Azafure"; + BrimstoneCrag.GenAllCragsStuff(); })); + //Biome shrines + tasks.Insert(++currentFinalIndex, new PassLegacy("Special Shrines", (progress, config) => + { + progress.Message = "Hiding forbidden shrines"; - tasks.Insert(++currentFinalIndex, new PassLegacy("DraedonStructures", (progress, config) => + //Cuts down on worldgen time to process the right one. + //TODO -- Possible Both Evils compat whenever + if (WorldGen.crimson) + { + progress.Message = "Slaying a vengeful god"; + UndergroundShrines.PlaceCrimsonShrine(WorldGen.structures); + } + else + { + progress.Message = "Rotting a god's grave"; + UndergroundShrines.PlaceCorruptionShrine(WorldGen.structures); + } + + progress.Message = "Burrowing an artifact from Osiris"; + UndergroundShrines.PlaceDesertShrine(WorldGen.structures); + + progress.Message = "Crystallizing a deep blue geode"; + UndergroundShrines.PlaceGraniteShrine(WorldGen.structures); + + progress.Message = "Hiding a beast tamer's igloo"; + UndergroundShrines.PlaceIceShrine(WorldGen.structures); + + progress.Message = "Recovering a piece of the Parthenon"; + UndergroundShrines.PlaceMarbleShrine(WorldGen.structures); + + progress.Message = "Planting a mushroom rich of hyphae"; + UndergroundShrines.PlaceMushroomShrine(WorldGen.structures); + + progress.Message = "Assembling a shinobi hideout"; + UndergroundShrines.PlaceSurfaceShrine(WorldGen.structures); + })); + + //aerialite + //this MUST generate after the evil island, otherwise the ores keep getting painted from the evil island gen + tasks.Insert(++currentFinalIndex, new PassLegacy("Aerialite", (progress, config) => + { + progress.Message = "Hiding wyvern's gold in plain sight"; + AerialiteOreGen.Generate(false); + })); + + //Draedon Labs + tasks.Insert(++currentFinalIndex, new PassLegacy("Draedon Structures", (progress, config) => { progress.Message = "Rust and Dust"; List workshopPositions = new List(); @@ -160,23 +228,33 @@ namespace CalamityMod.Systems // Tries to scale up reasonably for XL worlds int labCount = Main.maxTilesX / 1500; + progress.Message = "Forging with the fires of hell"; DraedonStructures.PlaceHellLab(out Point hellPlacementPosition, workshopPositions, WorldGen.structures); workshopPositions.Add(hellPlacementPosition); + progress.Message = "Studying marine biology"; DraedonStructures.PlaceSunkenSeaLab(out Point sunkenSeaPlacementPosition, workshopPositions, WorldGen.structures); workshopPositions.Add(sunkenSeaPlacementPosition); + progress.Message = "Prototyping quantum supercooling"; DraedonStructures.PlaceIceLab(out Point icePlacementPosition, workshopPositions, WorldGen.structures); workshopPositions.Add(icePlacementPosition); + progress.Message = "Developing abhorrent bioweaponry"; DraedonStructures.PlacePlagueLab(out Point plaguePlacementPosition, workshopPositions, WorldGen.structures); workshopPositions.Add(plaguePlacementPosition); + progress.Message = "Strip mining for minerals"; + DraedonStructures.PlaceCavernLab(out Point cavernPlacementPosition, workshopPositions, WorldGen.structures); + workshopPositions.Add(cavernPlacementPosition); + + progress.Message = "Abandoned engineering projects"; for (int i = 0; i < workshopCount; i++) { DraedonStructures.PlaceWorkshop(out Point placementPosition, workshopPositions, WorldGen.structures); workshopPositions.Add(placementPosition); } + progress.Message = "Other minor research projects"; for (int i = 0; i < labCount; i++) { DraedonStructures.PlaceResearchFacility(out Point placementPosition, workshopPositions, WorldGen.structures); @@ -184,27 +262,30 @@ namespace CalamityMod.Systems } })); + //Abyss tasks.Insert(++currentFinalIndex, new PassLegacy("Abyss", (progress, config) => { - progress.Message = "Discovering the new Challenger Deep"; + progress.Message = "Disposing of Silva's remains"; Abyss.PlaceAbyss(); })); - tasks.Insert(++currentFinalIndex, new PassLegacy("SulphurSea2", (progress, config) => + //Sulphurous Sea (Part 2, after Abyss) + tasks.Insert(++currentFinalIndex, new PassLegacy("Sulphur Sea 2", (progress, config) => { - progress.Message = "Further polluting one of the oceans"; + progress.Message = "Irradiating one of the oceans"; SulphurousSea.SulphurSeaGenerationAfterAbyss(); })); + //Roxcalibur tasks.Insert(++currentFinalIndex, new PassLegacy("Roxcalibur", (progress, config) => { - progress.Message = "I Wanna Rock"; + progress.Message = "I wanna rock"; MiscWorldgenRoutines.PlaceRoxShrine(); })); } } - // An Astral Meteor always falls at the beginning of Hardmode. + //An Astral Meteor always falls at the beginning of Hardmode. public override void ModifyHardmodeTasks(List tasks) { int announceIndex = tasks.FindIndex(match => match.Name == "Hardmode Announcement"); @@ -290,7 +371,6 @@ namespace CalamityMod.Systems } } } - } } diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs index 0a33850846..9a9f50d51a 100644 --- a/TileEntities/TEBaseTurret.cs +++ b/TileEntities/TEBaseTurret.cs @@ -124,7 +124,7 @@ namespace CalamityMod.TileEntities // If the turret is too far off its mark or hasn't been around for long enough, don't fire at all. float deltaAngle = MathHelper.WrapAngle(Angle - targetAngle); bool angleCloseEnough = Math.Abs(deltaAngle) <= MaxTargetAngleDeviance; - if (!angleCloseEnough || FiringTime < FiringStartupDelay) + if (!angleCloseEnough || FiringTime < FiringStartupDelay || !Collision.CanHitLine(turretPos, 1, 1, targetPos, 1, 1)) return; // Don't shoot every frame, but sync up the firing cadence to the startup delay. diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs index 4f8f8988e7..b47a5cd6e2 100644 --- a/TileEntities/TECodebreaker.cs +++ b/TileEntities/TECodebreaker.cs @@ -1,5 +1,6 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonSummoner; using Microsoft.Xna.Framework; using System.IO; @@ -63,6 +64,8 @@ namespace CalamityMod.TileEntities public bool ContainsVoltageRegulationSystem; public bool ContainsCoolingCell; + public bool ContainsBloodSample; + public bool CanDecryptHeldSchematic { get @@ -96,12 +99,12 @@ namespace CalamityMod.TileEntities int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; if (schematicType == ModContent.ItemType()) return "Within an army, as weapons do, the soldiers serve different purposes. That distinction is crucial, as the wrong tool in the wrong hands—no matter how potent—may as well be a wooden club.\n" + - "Addendum: Seek out my base of operations closest to the Lihzahrd’s home. I wish you the best of luck with all sincerity, for it has been a long time since I have had a worthy test subject. "; + "Addendum: Seek out my base of operations closest to the Lihzahrd's home. I wish you the best of luck with all sincerity, for it has been a long time since I have had a worthy test subject. "; if (schematicType == ModContent.ItemType()) return "As rank progresses, so often does the lethality of equipment. In the hands of competent soldiers, the weapons have the ability to make change. However, competent soldiers take no action but orders from above.\n" + "Addendum: If you read this, you have come far. Do not disappoint. Go now to Hell, for the next component stored in what were once my forges."; if (schematicType == ModContent.ItemType()) - return "Only the highest ranking in the battalions of Yharim’s army held these weapons. However these are still not my most potent tools. Those...characters could not be trusted with them.\n" + + return "Only the highest ranking in the battalions of Yharim's army held these weapons. However these are still not my most potent tools. Those...characters could not be trusted with them.\n" + "Addendum: The final piece remains. Travel now from the hottest fire this land has to offer, to the most frigid cold. I cannot deny having some sense of poetic symmetry."; if (schematicType == ModContent.ItemType()) return "I have since made progress to even greater weapons than these, but they remain creations to be proud of. No progress can be made without a desire that comes from dissatisfaction.\n" + @@ -167,7 +170,8 @@ namespace CalamityMod.TileEntities if (totalCellsToDrop > 999) totalCellsToDrop = 999; InputtedCellCount -= totalCellsToDrop; - Item.NewItem(new EntitySource_TileEntity(this), x * 16, y * 16, 32, 32, ModContent.ItemType(), totalCellsToDrop); + int itemType = ContainsBloodSample ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(new EntitySource_TileEntity(this), x * 16, y * 16, 32, 32, itemType, totalCellsToDrop); } } @@ -241,6 +245,7 @@ namespace CalamityMod.TileEntities packet.Write(InputtedCellCount); packet.Write(InitialCellCountBeforeDecrypting); packet.Write(HeldSchematicID); + packet.Write(ContainsBloodSample); packet.Send(); } @@ -380,6 +385,7 @@ namespace CalamityMod.TileEntities tag["HeldSchematicID"] = HeldSchematicID; tag["DecryptionCountdown"] = DecryptionCountdown; tag["InitialCellCountBeforeDecrypting"] = InitialCellCountBeforeDecrypting; + tag["ContainsBloodSample"] = ContainsBloodSample; } public override void LoadData(TagCompound tag) @@ -393,6 +399,7 @@ namespace CalamityMod.TileEntities HeldSchematicID = tag.GetInt("HeldSchematicID"); DecryptionCountdown = tag.GetInt("DecryptionCountdown"); InitialCellCountBeforeDecrypting = tag.GetInt("InitialCellCountBeforeDecrypting"); + ContainsBloodSample = tag.GetBool("ContainsBloodSample"); } public override void NetSend(BinaryWriter writer) @@ -406,6 +413,7 @@ namespace CalamityMod.TileEntities writer.Write(HeldSchematicID); writer.Write(DecryptionCountdown); writer.Write(InitialCellCountBeforeDecrypting); + writer.Write(ContainsBloodSample); } public override void NetReceive(BinaryReader reader) @@ -419,6 +427,7 @@ namespace CalamityMod.TileEntities HeldSchematicID = reader.ReadInt32(); DecryptionCountdown = reader.ReadInt32(); InitialCellCountBeforeDecrypting = reader.ReadInt32(); + ContainsBloodSample= reader.ReadBoolean(); } } } diff --git a/TileEntities/TEDraedonLabTurret.cs b/TileEntities/TEDraedonLabTurret.cs index 70d2c29c30..970961db54 100644 --- a/TileEntities/TEDraedonLabTurret.cs +++ b/TileEntities/TEDraedonLabTurret.cs @@ -16,11 +16,11 @@ namespace CalamityMod.TileEntities // Projectile variables public override int ProjectileType => ModContent.ProjectileType(); - public override int ProjectileDamage => Main.expertMode ? 14 : 20; + public override int ProjectileDamage => Main.expertMode ? 17 : 23; public override float ProjectileKnockback => 6.5f; public override float ShootSpeed => 5f; public override int FiringStartupDelay => 10; - public override int FiringUseTime => 20; + public override int FiringUseTime => 55; // Projectile spawn location variables public override Vector2 TurretCenterOffset => new Vector2(22f + 4f * Direction, -2f); diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs new file mode 100644 index 0000000000..a79927e6bc --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs @@ -0,0 +1,87 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssGiantKelp1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 4); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(92, 93, 42)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameY <= 36) + { + r = 184f / 255f; + g = 90f / 255f; + b = 20f / 255f; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + //just clone the first one its literally the same size + public class AbyssGiantKelp2 : AbyssGiantKelp1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.png new file mode 100644 index 0000000000..ee7a7eee5e Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow.png new file mode 100644 index 0000000000..fd9d167e72 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2.png new file mode 100644 index 0000000000..f77d5bf9da Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow.png new file mode 100644 index 0000000000..50f8d69f9b Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs new file mode 100644 index 0000000000..65ba072b9d --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs @@ -0,0 +1,74 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssGiantKelp3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(1, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(92, 93, 42)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameY <= 36) + { + r = 184f / 400f; + g = 90f / 400f; + b = 20f / 400f; + } + } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.png new file mode 100644 index 0000000000..d69f3d5445 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow.png new file mode 100644 index 0000000000..d3e69df07e Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs new file mode 100644 index 0000000000..9733af0e80 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs @@ -0,0 +1,74 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssGiantKelp4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(92, 93, 42)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameY <= 36) + { + r = 184f / 300f; + g = 90f / 300f; + b = 20f / 300f; + } + } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.png new file mode 100644 index 0000000000..fc436a8341 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow.png new file mode 100644 index 0000000000..e484deb6f4 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs new file mode 100644 index 0000000000..32bd993779 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs @@ -0,0 +1,63 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using System; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssKelp : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = true; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(92, 93, 42)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -16; + height = 32; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameX >= 146) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + r = 233f / 350f; + g = 144f / 350f; + b = 30f / 350f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssKelp.png b/Tiles/Abyss/AbyssAmbient/AbyssKelp.png new file mode 100644 index 0000000000..01d7e4fc89 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssKelp.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssVent.cs b/Tiles/Abyss/AbyssAmbient/AbyssVent.cs new file mode 100644 index 0000000000..8632fd4ec0 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssVent.cs @@ -0,0 +1,81 @@ +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; +using System; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssVent1 : ModTile + { + int steamTimer = 0; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Steam Vent"); + AddMapEntry(new Color(106, 80, 102), name); + DustType = 33; + + base.SetStaticDefaults(); + } + + public override bool IsTileDangerous(int i, int j, Player player) => true; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); + Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); + + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) + { + steamTimer += Main.rand.Next(0, 2); + + if (steamTimer >= 360) + { + steamTimer = 0; + } + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); + Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); + + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) + { + float positionInterpolant = (i + j) * 0.041f % 1f; + Vector2 smokeVelocity = -Vector2.UnitY.RotatedByRandom(0.11f) * MathHelper.Lerp(4.8f, 8.1f, positionInterpolant); + smokeVelocity.X += (float)Math.Cos(MathHelper.TwoPi * positionInterpolant) * 1.1f; + smokeVelocity.Y -= Main.rand.Next(3, 6); + + if (steamTimer >= 300 && Main.rand.NextBool(3)) + { + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 65 : 50, 0f); + } + } + } + } + + public class AbyssVent2 : AbyssVent1 + { + } + + public class AbyssVent3 : AbyssVent1 + { + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssVent1.png b/Tiles/Abyss/AbyssAmbient/AbyssVent1.png new file mode 100644 index 0000000000..2a078e8154 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssVent1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssVent2.png b/Tiles/Abyss/AbyssAmbient/AbyssVent2.png new file mode 100644 index 0000000000..76c7bd4132 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssVent2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssVent3.png b/Tiles/Abyss/AbyssAmbient/AbyssVent3.png new file mode 100644 index 0000000000..5cdb10fbdb Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssVent3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree.cs b/Tiles/Abyss/AbyssAmbient/BulbTree.cs new file mode 100644 index 0000000000..1a9a42f1e8 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/BulbTree.cs @@ -0,0 +1,81 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class BulbTree1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(52, 124, 153)); + DustType = 33; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 49f / 500f; + g = 159f / 500f; + b = 242f / 500f; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class BulbTree2 : BulbTree1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class BulbTree3 : BulbTree1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree1.png b/Tiles/Abyss/AbyssAmbient/BulbTree1.png new file mode 100644 index 0000000000..d2bd2967ca Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree1Glow.png b/Tiles/Abyss/AbyssAmbient/BulbTree1Glow.png new file mode 100644 index 0000000000..3b203f5be1 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree1Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree2.png b/Tiles/Abyss/AbyssAmbient/BulbTree2.png new file mode 100644 index 0000000000..04e4bb54f3 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree2Glow.png b/Tiles/Abyss/AbyssAmbient/BulbTree2Glow.png new file mode 100644 index 0000000000..692bb9a5c8 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree2Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree3.png b/Tiles/Abyss/AbyssAmbient/BulbTree3.png new file mode 100644 index 0000000000..d93e936775 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree3Glow.png b/Tiles/Abyss/AbyssAmbient/BulbTree3Glow.png new file mode 100644 index 0000000000..ebe3d5f087 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree3Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/GravelPile.cs b/Tiles/Abyss/AbyssAmbient/GravelPile.cs new file mode 100644 index 0000000000..7ea54e6b5f --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/GravelPile.cs @@ -0,0 +1,49 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class GravelPile1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(17, 19, 38)); + DustType = 33; + + base.SetStaticDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } + + public class GravelPile2 : GravelPile1 + { + } + + public class GravelPile3 : GravelPile1 + { + } +} diff --git a/Tiles/Abyss/AbyssAmbient/GravelPile1.png b/Tiles/Abyss/AbyssAmbient/GravelPile1.png new file mode 100644 index 0000000000..df67123707 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/GravelPile1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/GravelPile2.png b/Tiles/Abyss/AbyssAmbient/GravelPile2.png new file mode 100644 index 0000000000..a8cc09a959 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/GravelPile2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/GravelPile3.png b/Tiles/Abyss/AbyssAmbient/GravelPile3.png new file mode 100644 index 0000000000..c4a2d6c95d Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/GravelPile3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.cs b/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.cs new file mode 100644 index 0000000000..2346823176 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; +using System; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class MassiveRarePearl : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.addTile(Type); + AddMapEntry(new Color(106, 80, 102)); + DustType = 33; + + base.SetStaticDefaults(); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.PinkPearl); + } + else + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.WhitePearl); + } + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.png b/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.png new file mode 100644 index 0000000000..29e1516ea3 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/MassiveRarePearl.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs b/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs new file mode 100644 index 0000000000..eac6e06da5 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs @@ -0,0 +1,59 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using System; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class PhoviamareHalm : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = true; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(86, 33, 33)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -30; + height = 48; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + r = 191f / 350f; + g = 85f / 350f; + b = 28f / 350f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.png b/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.png new file mode 100644 index 0000000000..81ee7a6fe5 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs new file mode 100644 index 0000000000..ca667c9332 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs @@ -0,0 +1,127 @@ +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; +using System; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class PirateCrate1 : ModTile + { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/CrateBreak", 3) { Volume = 0.8f }; + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abandoned Crate"); + AddMapEntry(new Color(97, 69, 52), name); + DustType = DustID.WoodFurniture; + HitSound = MineSound; + + base.SetStaticDefaults(); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + //explode when broken (troll!) + //also instakill players in for the worthy + Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition.X, spawnPosition.Y, 0, 0, ProjectileID.Explosives, Main.getGoodWorld ? 99999 : 130, 0f); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class PirateCrate2 : PirateCrate1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class PirateCrate3 : PirateCrate1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class PirateCrate4 : ModTile + { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/CrateBreak", 3) { Volume = 0.8f }; + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Abandoned Crate"); + AddMapEntry(new Color(97, 69, 52), name); + DustType = DustID.WoodFurniture; + HitSound = MineSound; + + base.SetStaticDefaults(); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.GoldCoin, Main.rand.Next(1, 2)); + } + + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ItemID.SilverCoin, Main.rand.Next(45, 75)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } + + public class PirateCrate5 : PirateCrate4 + { + } + + public class PirateCrate6 : PirateCrate4 + { + } +} diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate1.png b/Tiles/Abyss/AbyssAmbient/PirateCrate1.png new file mode 100644 index 0000000000..7e1c5ce1f2 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow.png b/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow.png new file mode 100644 index 0000000000..e701c80b4f Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate2.png b/Tiles/Abyss/AbyssAmbient/PirateCrate2.png new file mode 100644 index 0000000000..c77f0a4369 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow.png b/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow.png new file mode 100644 index 0000000000..0b052970f5 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate3.png b/Tiles/Abyss/AbyssAmbient/PirateCrate3.png new file mode 100644 index 0000000000..0e4b89eeaa Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow.png b/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow.png new file mode 100644 index 0000000000..b025b1f2bb Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate4.png b/Tiles/Abyss/AbyssAmbient/PirateCrate4.png new file mode 100644 index 0000000000..c15d8e2cf8 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate4.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate5.png b/Tiles/Abyss/AbyssAmbient/PirateCrate5.png new file mode 100644 index 0000000000..4750e70108 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate5.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate6.png b/Tiles/Abyss/AbyssAmbient/PirateCrate6.png new file mode 100644 index 0000000000..f4b0f90a84 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PirateCrate6.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PlantyMushPile.cs b/Tiles/Abyss/AbyssAmbient/PlantyMushPile.cs new file mode 100644 index 0000000000..1ec4f65700 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/PlantyMushPile.cs @@ -0,0 +1,49 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class PlantyMushPile1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(84, 102, 39)); + DustType = 33; + + base.SetStaticDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } + + public class PlantyMushPile2 : PlantyMushPile1 + { + } + + public class PlantyMushPile3 : PlantyMushPile1 + { + } +} diff --git a/Tiles/Abyss/AbyssAmbient/PlantyMushPile1.png b/Tiles/Abyss/AbyssAmbient/PlantyMushPile1.png new file mode 100644 index 0000000000..4b87dee6ce Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PlantyMushPile1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PlantyMushPile2.png b/Tiles/Abyss/AbyssAmbient/PlantyMushPile2.png new file mode 100644 index 0000000000..ffbaa2f7bb Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PlantyMushPile2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/PlantyMushPile3.png b/Tiles/Abyss/AbyssAmbient/PlantyMushPile3.png new file mode 100644 index 0000000000..e148fec7e3 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/PlantyMushPile3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/ShalePile.cs b/Tiles/Abyss/AbyssAmbient/ShalePile.cs new file mode 100644 index 0000000000..4e1292cdfa --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/ShalePile.cs @@ -0,0 +1,49 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class ShalePile1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(47, 30, 63)); + DustType = 33; + + base.SetStaticDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } + + public class ShalePile2 : ShalePile1 + { + } + + public class ShalePile3 : ShalePile1 + { + } +} diff --git a/Tiles/Abyss/AbyssAmbient/ShalePile1.png b/Tiles/Abyss/AbyssAmbient/ShalePile1.png new file mode 100644 index 0000000000..551321a0ca Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/ShalePile1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/ShalePile2.png b/Tiles/Abyss/AbyssAmbient/ShalePile2.png new file mode 100644 index 0000000000..5b2c21132e Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/ShalePile2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/ShalePile3.png b/Tiles/Abyss/AbyssAmbient/ShalePile3.png new file mode 100644 index 0000000000..3a8af190f5 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/ShalePile3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs b/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs new file mode 100644 index 0000000000..aa5633cb10 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs @@ -0,0 +1,93 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using System; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class SpiderCoral1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(82, 49, 27)); + DustType = 32; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 190f / 400f; + g = 48f / 400f; + b = 30f / 400f; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class SpiderCoral2 : SpiderCoral1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class SpiderCoral3 : SpiderCoral1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class SpiderCoral4 : SpiderCoral1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class SpiderCoral5 : SpiderCoral1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral1.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral1.png new file mode 100644 index 0000000000..944a02508c Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow.png new file mode 100644 index 0000000000..d309c5766a Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral2.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral2.png new file mode 100644 index 0000000000..c7e3b06c6b Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow.png new file mode 100644 index 0000000000..e3dc319d03 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral3.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral3.png new file mode 100644 index 0000000000..a9d7220b27 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow.png new file mode 100644 index 0000000000..6eb96f76dd Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral4.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral4.png new file mode 100644 index 0000000000..da696f7999 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral4.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow.png new file mode 100644 index 0000000000..420aaf98dd Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral5.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral5.png new file mode 100644 index 0000000000..c046e35bdf Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral5.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow.png b/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow.png new file mode 100644 index 0000000000..3786515ae9 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs new file mode 100644 index 0000000000..ae229f93f8 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs @@ -0,0 +1,81 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class SulphurPireCoral1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(91, 128, 13)); + DustType = 32; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 230f / 500f; + g = 255f / 500f; + b = 0f; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class SulphurPireCoral2 : SulphurPireCoral1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } + + public class SulphurPireCoral3 : SulphurPireCoral1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1.png b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1.png new file mode 100644 index 0000000000..bf1e7e8b2c Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow.png b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow.png new file mode 100644 index 0000000000..310429534b Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2.png b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2.png new file mode 100644 index 0000000000..ecbe1509cf Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow.png b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow.png new file mode 100644 index 0000000000..ee7a27de0c Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3.png b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3.png new file mode 100644 index 0000000000..7810b4febb Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow.png b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow.png new file mode 100644 index 0000000000..f8fd2d287b Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs new file mode 100644 index 0000000000..1bc7933d12 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs @@ -0,0 +1,78 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using System; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class SulphurTentacleCorals : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(32, 65, 65)); + DustType = 32; + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -30; + height = 48; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameX <= 324) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.0025f; + brightness *= (float)MathF.Sin(-j / 2f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 2f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + r = 131f / 500f; + g = 198f / 500f; + b = 203f / 500f; + r *= brightness; + g *= brightness; + b *= brightness; + } + + if (tile.TileFrameX > 324) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.0025f; + brightness *= (float)MathF.Sin(-j / 2f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 2f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + r = 230f / 500f; + g = 255f / 500f; + b = 0f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.png b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.png new file mode 100644 index 0000000000..4527d201f5 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.png differ diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs b/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs new file mode 100644 index 0000000000..5d7111671a --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.cs @@ -0,0 +1,41 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class SulphurTubeCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(64, 36, 39)); + DustType = 32; + + base.SetStaticDefaults(); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.png b/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.png new file mode 100644 index 0000000000..4fb5879115 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/SulphurTubeCoral.png differ diff --git a/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs b/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs new file mode 100644 index 0000000000..3eea418a13 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.cs @@ -0,0 +1,44 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using System; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class TenebrisRemnant : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = true; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(46, 103, 96)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -30; + height = 48; + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.png b/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.png new file mode 100644 index 0000000000..f655ed8e0d Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/TenebrisRemnant.png differ diff --git a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs new file mode 100644 index 0000000000..4570c2033f --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs @@ -0,0 +1,98 @@ +using CalamityMod.Projectiles.Environment; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; +using System; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class ThermalVent1 : ModTile + { + int steamTimer = 0; + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Thermal Vent"); + AddMapEntry(new Color(132, 56, 42), name); + DustType = 162; + + base.SetStaticDefaults(); + } + + public override bool IsTileDangerous(int i, int j, Player player) => true; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 145f / 350f; + g = 75f / 350f; + b = 0f; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); + Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); + + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) + { + steamTimer += Main.rand.Next(0, 2); + + if (steamTimer >= 600) + { + steamTimer = 0; + } + } + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); + Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); + + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) + { + float positionInterpolant = (i + j) * 0.041f % 1f; + Vector2 smokeVelocity = -Vector2.UnitY.RotatedByRandom(0.11f) * MathHelper.Lerp(4.8f, 8.1f, positionInterpolant); + smokeVelocity.X += (float)Math.Cos(MathHelper.TwoPi * positionInterpolant) * 1.1f; + smokeVelocity.Y -= Main.rand.Next(3, 6); + + if (steamTimer >= 450 && Main.rand.NextBool(3)) + { + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 85 : 60, 0f); + } + } + } + } + + public class ThermalVent2 : ThermalVent1 + { + } + + public class ThermalVent3 : ThermalVent1 + { + } +} diff --git a/Tiles/Abyss/AbyssAmbient/ThermalVent1.png b/Tiles/Abyss/AbyssAmbient/ThermalVent1.png new file mode 100644 index 0000000000..81bc29cb5f Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/ThermalVent1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/ThermalVent2.png b/Tiles/Abyss/AbyssAmbient/ThermalVent2.png new file mode 100644 index 0000000000..3dc946a2fe Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/ThermalVent2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/ThermalVent3.png b/Tiles/Abyss/AbyssAmbient/ThermalVent3.png new file mode 100644 index 0000000000..2ce6201c14 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/ThermalVent3.png differ diff --git a/Tiles/Abyss/AbyssFossilTile.cs b/Tiles/Abyss/AbyssFossilTile.cs new file mode 100644 index 0000000000..d493dc9d62 --- /dev/null +++ b/Tiles/Abyss/AbyssFossilTile.cs @@ -0,0 +1,34 @@ +using CalamityMod.Items.Fishing.SulphurCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class AbyssFossilTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(29, 37, 58)); + DustType = 33; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Abyss/AbyssFossilTile.png b/Tiles/Abyss/AbyssFossilTile.png new file mode 100644 index 0000000000..a9ba92d6d7 Binary files /dev/null and b/Tiles/Abyss/AbyssFossilTile.png differ diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index 23ed514fdf..b50dcfd665 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -1,4 +1,4 @@ - +using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -9,7 +9,10 @@ namespace CalamityMod.Tiles.Abyss { public class AbyssGravel : ModTile { + int animationFrameWidth = 288; + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3); + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -36,10 +39,125 @@ namespace CalamityMod.Tiles.Abyss { num = fail ? 1 : 3; } + + public override void RandomUpdate(int i, int j) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + //place kelp + if (WorldGen.genRand.Next(8) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //16 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = 0; + int xPos = i % 4; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 2; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 3: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false); return false; } } diff --git a/Tiles/Abyss/AbyssGravel.png b/Tiles/Abyss/AbyssGravel.png index c51a8c09ea..05ffefa6d8 100644 Binary files a/Tiles/Abyss/AbyssGravel.png and b/Tiles/Abyss/AbyssGravel.png differ diff --git a/Tiles/Abyss/AbyssPiles.png b/Tiles/Abyss/AbyssPiles.png deleted file mode 100644 index 0995c09509..0000000000 Binary files a/Tiles/Abyss/AbyssPiles.png and /dev/null differ diff --git a/Tiles/Abyss/AbyssTreasureChest.cs b/Tiles/Abyss/AbyssTreasureChest.cs new file mode 100644 index 0000000000..a55aa8d9bd --- /dev/null +++ b/Tiles/Abyss/AbyssTreasureChest.cs @@ -0,0 +1,208 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Tiles.Abyss +{ + public class AbyssTreasureChest : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSpelunker[Type] = true; + Main.tileContainer[Type] = true; + Main.tileShine2[Type] = true; + Main.tileShine[Type] = 1200; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileOreFinderPriority[Type] = 500; + TileID.Sets.HasOutlines[Type] = true; + TileID.Sets.BasicChest[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Containers }; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 18 }; + TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(Chest.FindEmptyChest, -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(Chest.AfterPlacement_Hook, -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { TileID.MagicalIceBlock }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(Type); + ContainerName.SetDefault("Ancient Treasure Chest"); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Ancient Treasure Chest"); + AddMapEntry(new Color(71, 49, 41), name); + DustType = 33; + HitSound = SoundID.Dig; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return true; + } + + public override bool IsLockedChest(int i, int j) => Main.tile[i, j].TileFrameX / 36 == 1; + + public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) + { + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = 1; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 32, ModContent.ItemType()); + Chest.DestroyChest(i, j); + } + + public override bool RightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.TileFrameX % 36 != 0) + { + left--; + } + + if (tile.TileFrameY != 0) + { + top--; + } + + if (player.sign >= 0) + { + SoundEngine.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + + if (Main.editChest) + { + SoundEngine.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f); + player.editedChestName = false; + } + + bool isLocked = IsLockedChest(left, top); + if (Main.netMode == NetmodeID.MultiplayerClient && !isLocked) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + SoundEngine.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, top); + Main.stackSplit = 600; + } + } + else + { + /* + //perhaps a message can be put here, in case players try to open the chest too early + if (isLocked) + { + } + */ + + if (!isLocked) + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + SoundEngine.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + SoundEngine.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + + Recipe.FindRecipes(); + } + } + } + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.TileFrameX % 36 != 0) + { + left--; + } + + if (tile.TileFrameY != 0) + { + top--; + } + + int chest = Chest.FindChest(left, top); + if (chest < 0) + { + player.cursorItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.cursorItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : "Ancient Treasure Chest"; + if (player.cursorItemIconText == "Ancient Treasure Chest") + { + player.cursorItemIconID = ModContent.ItemType(); + + player.cursorItemIconText = ""; + } + } + + player.noThrow = 2; + player.cursorItemIconEnabled = true; + } + + public override void MouseOverFar(int i, int j) + { + MouseOver(i, j); + Player player = Main.LocalPlayer; + if (player.cursorItemIconText == "") + { + player.cursorItemIconEnabled = false; + player.cursorItemIconID = 0; + } + } + } +} diff --git a/Tiles/Abyss/AbyssTreasureChest.png b/Tiles/Abyss/AbyssTreasureChest.png new file mode 100644 index 0000000000..5a558541c4 Binary files /dev/null and b/Tiles/Abyss/AbyssTreasureChest.png differ diff --git a/Tiles/Abyss/AbyssTreasureChest_Highlight.png b/Tiles/Abyss/AbyssTreasureChest_Highlight.png new file mode 100644 index 0000000000..2d38a5cbe2 Binary files /dev/null and b/Tiles/Abyss/AbyssTreasureChest_Highlight.png differ diff --git a/Tiles/Abyss/AbyssalCrateTile.png b/Tiles/Abyss/AbyssalCrateTile.png deleted file mode 100644 index d5ddbe9f98..0000000000 Binary files a/Tiles/Abyss/AbyssalCrateTile.png and /dev/null differ diff --git a/Tiles/Abyss/AbyssalPots.cs b/Tiles/Abyss/AbyssalPots.cs index 2a8022a563..4dc7b3b5ba 100644 --- a/Tiles/Abyss/AbyssalPots.cs +++ b/Tiles/Abyss/AbyssalPots.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileSpelunker[Type] = true; Main.tileCut[Type] = true; + TileObjectData.newTile.DrawYOffset = 2; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/Abyss/AcidwoodTile.cs b/Tiles/Abyss/AcidwoodTile.cs index d116456dee..89bc2514e5 100644 --- a/Tiles/Abyss/AcidwoodTile.cs +++ b/Tiles/Abyss/AcidwoodTile.cs @@ -14,10 +14,11 @@ namespace CalamityMod.Tiles.Abyss Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; - TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]); + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Wood"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeDecorativeTiles(Type); + CalamityUtils.MergeWithAbyss(Type); ItemDrop = ModContent.ItemType(); HitSound = SoundID.Dig; diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.cs b/Tiles/Abyss/HardenedSulphurousSandstone.cs index fb6a4cd909..0332801a50 100644 --- a/Tiles/Abyss/HardenedSulphurousSandstone.cs +++ b/Tiles/Abyss/HardenedSulphurousSandstone.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.Abyss } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); return false; } public override void RandomUpdate(int i, int j) diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.png b/Tiles/Abyss/HardenedSulphurousSandstone.png index e771428125..32866338ad 100644 Binary files a/Tiles/Abyss/HardenedSulphurousSandstone.png and b/Tiles/Abyss/HardenedSulphurousSandstone.png differ diff --git a/Tiles/Abyss/LumenylCrystals.cs b/Tiles/Abyss/LumenylCrystals.cs index 9c074391c0..772947bc33 100644 --- a/Tiles/Abyss/LumenylCrystals.cs +++ b/Tiles/Abyss/LumenylCrystals.cs @@ -38,35 +38,44 @@ namespace CalamityMod.Tiles.Abyss public override bool CanPlace(int i, int j) { - if (Main.tile[i, j + 1].Slope == 0 && !Main.tile[i, j + 1].IsHalfBlock) - return true; - if (Main.tile[i, j - 1].Slope == 0 && !Main.tile[i, j - 1].IsHalfBlock) - return true; - if (Main.tile[i + 1, j].Slope == 0 && !Main.tile[i + 1, j].IsHalfBlock) - return true; - if (Main.tile[i - 1, j].Slope == 0 && !Main.tile[i - 1, j].IsHalfBlock) + Tile belowTile = Main.tile[i, j + 1]; + Tile aboveTile = Main.tile[i, j - 1]; + Tile rightTile = Main.tile[i + 1, j]; + Tile leftTile = Main.tile[i - 1, j]; + + if ((belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) || + (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) || + (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) || + (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid())) return true; + return false; } public override void PlaceInWorld(int i, int j, Item item) { - if (Main.tile[i, j + 1].HasTile && Main.tileSolid[Main.tile[i, j + 1].TileType] && Main.tile[i, j + 1].Slope == 0 && !Main.tile[i, j + 1].IsHalfBlock) + Tile belowTile = Main.tile[i, j + 1]; + Tile aboveTile = Main.tile[i, j - 1]; + Tile rightTile = Main.tile[i + 1, j]; + Tile leftTile = Main.tile[i - 1, j]; + + if (belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) { - Main.tile[i, j].TileFrameY = (short)(0 * 18); + Main.tile[i, j].TileFrameY = 0; } - else if (Main.tile[i, j - 1].HasTile && Main.tileSolid[Main.tile[i, j - 1].TileType] && Main.tile[i, j - 1].Slope == 0 && !Main.tile[i, j - 1].IsHalfBlock) + else if (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) { - Main.tile[i, j].TileFrameY = (short)(1 * 18); + Main.tile[i, j].TileFrameY = 18; } - else if (Main.tile[i + 1, j].HasTile && Main.tileSolid[Main.tile[i + 1, j].TileType] && Main.tile[i + 1, j].Slope == 0 && !Main.tile[i + 1, j].IsHalfBlock) + else if (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) { - Main.tile[i, j].TileFrameY = (short)(2 * 18); + Main.tile[i, j].TileFrameY = 36; } - else if (Main.tile[i - 1, j].HasTile && Main.tileSolid[Main.tile[i - 1, j].TileType] && Main.tile[i - 1, j].Slope == 0 && !Main.tile[i - 1, j].IsHalfBlock) + else if (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid()) { - Main.tile[i, j].TileFrameY = (short)(3 * 18); + Main.tile[i, j].TileFrameY = 54; } + Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); } } diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index d70ada41b0..c172432d98 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -1,4 +1,5 @@ -using CalamityMod.Walls; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Walls; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -7,6 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { + // Transforms any and all Tenebris in old worlds into planty mush. + [LegacyName("Tenebris")] public class PlantyMush : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); @@ -23,10 +26,17 @@ namespace CalamityMod.Tiles.Abyss ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Planty Mush"); - AddMapEntry(new Color(0, 120, 0), name); + AddMapEntry(new Color(84, 102, 39), name); MineResist = 1f; HitSound = MineSound; } + + int animationFrameWidth = 288; + + public override bool CanExplode(int i, int j) + { + return false; + } public override void NumDust(int i, int j, bool fail, ref int num) { @@ -44,9 +54,121 @@ namespace CalamityMod.Tiles.Abyss } } } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = 0; + int xPos = i % 4; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 1; + break; + default: + uniqueAnimationFrameX = 0; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 1; + break; + default: + uniqueAnimationFrameX = 0; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 1; + break; + default: + uniqueAnimationFrameX = 0; + break; + } + break; + case 3: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 1; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 1; + break; + default: + uniqueAnimationFrameX = 0; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + } public override void RandomUpdate(int i, int j) { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + //place kelp + if (WorldGen.genRand.Next(5) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //7 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(7) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); if (Main.tile[i, j + 1] != null) { diff --git a/Tiles/Abyss/PlantyMush.png b/Tiles/Abyss/PlantyMush.png index 4342ec2884..6cf0f42678 100644 Binary files a/Tiles/Abyss/PlantyMush.png and b/Tiles/Abyss/PlantyMush.png differ diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs new file mode 100644 index 0000000000..ad8ae03f42 --- /dev/null +++ b/Tiles/Abyss/PyreMantle.cs @@ -0,0 +1,74 @@ +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.Audio; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class PyreMantle : ModTile + { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithAbyss(Type); + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = MineSound; + MineResist = 10f; + MinPick = 180; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(19, 20, 32)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 162, 0f, 0f, 1, new Color(128, 128, 128), 1f); + return false; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + public override void RandomUpdate(int i, int j) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + //place Phoviamare Halm + if (WorldGen.genRand.Next(12) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //16 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); + return false; + } + } +} diff --git a/Tiles/Abyss/PyreMantle.png b/Tiles/Abyss/PyreMantle.png new file mode 100644 index 0000000000..4e195458c6 Binary files /dev/null and b/Tiles/Abyss/PyreMantle.png differ diff --git a/Tiles/Abyss/PyreMantleMolten.cs b/Tiles/Abyss/PyreMantleMolten.cs new file mode 100644 index 0000000000..c1ef70d8eb --- /dev/null +++ b/Tiles/Abyss/PyreMantleMolten.cs @@ -0,0 +1,133 @@ +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.Audio; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class PyreMantleMolten : ModTile + { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; + internal static Texture2D GlowTexture; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/Tiles/Abyss/PyreMantleMolten_Glowmask", AssetRequestMode.ImmediateLoad).Value; + + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithAbyss(Type); + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = MineSound; + MineResist = 10f; + MinPick = 180; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(113, 49, 16)); + } + + int animationFrameWidth = 288; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 162, 0f, 0f, 1, new Color(128, 128, 128), 1f); + return false; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void RandomUpdate(int i, int j) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + //place PhoviamareHalm + if (WorldGen.genRand.Next(12) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //16 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (GlowTexture is null) + return; + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(200, 200, 200, 200)); + Tile trackTile = Main.tile[i, j]; + float glowbrightness = 1f; + float glowspeed = Main.GameUpdateCount * 0.01f; + glowbrightness *= (float)MathF.Sin(i / 60f + glowspeed); + drawColour *= glowbrightness; + double num6 = Main.time * 0.08; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + { + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.IsHalfBlock) + { + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + glowbrightness += 0.3f; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float lightspeed = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(i / 60f + lightspeed); + brightness += 0.3f; + r = 255f / 255f; + g = 83f / 255f; + b = 0f; // 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); + return false; + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + } +} diff --git a/Tiles/Abyss/PyreMantleMolten.png b/Tiles/Abyss/PyreMantleMolten.png new file mode 100644 index 0000000000..6a6b60d515 Binary files /dev/null and b/Tiles/Abyss/PyreMantleMolten.png differ diff --git a/Tiles/Abyss/PyreMantleMolten_Glowmask.png b/Tiles/Abyss/PyreMantleMolten_Glowmask.png new file mode 100644 index 0000000000..9a9848fa7a Binary files /dev/null and b/Tiles/Abyss/PyreMantleMolten_Glowmask.png differ diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs index 43264f60d3..aacfd4a640 100644 --- a/Tiles/Abyss/RustyChestTile.cs +++ b/Tiles/Abyss/RustyChestTile.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.Abyss this.SetUpChest(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Rusty Chest"); - AddMapEntry(new Color(191, 142, 111), name, MapChestName); + AddMapEntry(new Color(113, 90, 71), name, MapChestName); TileID.Sets.DisableSmartCursor[Type] = true; AdjTiles = new int[] { TileID.Containers }; ContainerName.SetDefault("Rusty Chest"); diff --git a/Tiles/Abyss/ShaleColumns.cs b/Tiles/Abyss/ShaleColumns.cs new file mode 100644 index 0000000000..096807ca37 --- /dev/null +++ b/Tiles/Abyss/ShaleColumns.cs @@ -0,0 +1,63 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class ShaleColumns : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSolid[Type] = false; + Main.tileSolidTop[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16 + }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + AddMapEntry(new Color(37, 24, 63)); + DustType = 33; + + base.SetStaticDefaults(); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); + Tile left = CalamityUtils.ParanoidTileRetrieval(i - 1, j); + Tile right = CalamityUtils.ParanoidTileRetrieval(i + 1, j); + if (t.TileFrameX % 36 == 0 && !right.HasTile) + WorldGen.KillTile(i, j); + if (t.TileFrameX % 36 == 18 && !left.HasTile) + WorldGen.KillTile(i, j); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + if (Main.netMode == NetmodeID.Server) + return; + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + } +} diff --git a/Tiles/Abyss/ShaleColumns.png b/Tiles/Abyss/ShaleColumns.png new file mode 100644 index 0000000000..eff561644c Binary files /dev/null and b/Tiles/Abyss/ShaleColumns.png differ diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index e954255bc3..a2ff877140 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -9,17 +9,21 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss { - public class SteamGeyser : ModTile + [LegacyName("SteamGeyser")] + public class SteamGeyser1 : ModTile { + int steamTimer = 0; + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; + TileObjectData.newTile.DrawYOffset = 2; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Geyser"); - AddMapEntry(new Color(150, 100, 50), name); + AddMapEntry(new Color(103, 65, 64), name); DustType = (int)CalamityDusts.SulfurousSeaAcid; base.SetStaticDefaults(); @@ -31,18 +35,48 @@ namespace CalamityMod.Tiles.Abyss { num = fail ? 1 : 2; } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); + Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); + + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) + { + steamTimer += Main.rand.Next(0, 2); + + if (steamTimer >= 240) + { + steamTimer = 0; + } + } + } + public override void NearbyEffects(int i, int j, bool closer) { Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); - Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); + if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) { float positionInterpolant = (i + j) * 0.041f % 1f; Vector2 smokeVelocity = -Vector2.UnitY.RotatedByRandom(0.11f) * MathHelper.Lerp(4.8f, 8.1f, positionInterpolant); smokeVelocity.X += (float)Math.Cos(MathHelper.TwoPi * positionInterpolant) * 1.1f; - Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 12 : 15, 0f); + smokeVelocity.Y -= Main.rand.Next(3, 6); + + if (steamTimer >= 180 && Main.rand.NextBool(3)) + { + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 65 : 45, 0f); + } } } } + + public class SteamGeyser2 : SteamGeyser1 + { + } + + public class SteamGeyser3 : SteamGeyser1 + { + } } diff --git a/Tiles/Abyss/SteamGeyser.png b/Tiles/Abyss/SteamGeyser.png deleted file mode 100644 index 6d656dbcf9..0000000000 Binary files a/Tiles/Abyss/SteamGeyser.png and /dev/null differ diff --git a/Tiles/Abyss/SteamGeyser1.png b/Tiles/Abyss/SteamGeyser1.png new file mode 100644 index 0000000000..653e4e7bd5 Binary files /dev/null and b/Tiles/Abyss/SteamGeyser1.png differ diff --git a/Tiles/Abyss/SteamGeyser2.png b/Tiles/Abyss/SteamGeyser2.png new file mode 100644 index 0000000000..055bd73e68 Binary files /dev/null and b/Tiles/Abyss/SteamGeyser2.png differ diff --git a/Tiles/Abyss/SteamGeyser3.png b/Tiles/Abyss/SteamGeyser3.png new file mode 100644 index 0000000000..2a9708e159 Binary files /dev/null and b/Tiles/Abyss/SteamGeyser3.png differ diff --git a/Tiles/Abyss/SulphurousCactus.png b/Tiles/Abyss/SulphurousCactus.png index a19d1b55d2..a712b96121 100644 Binary files a/Tiles/Abyss/SulphurousCactus.png and b/Tiles/Abyss/SulphurousCactus.png differ diff --git a/Tiles/Abyss/AbyssalCrateTile.cs b/Tiles/Abyss/SulphurousCrateTile.cs similarity index 85% rename from Tiles/Abyss/AbyssalCrateTile.cs rename to Tiles/Abyss/SulphurousCrateTile.cs index beea5b05a1..da903eea48 100644 --- a/Tiles/Abyss/AbyssalCrateTile.cs +++ b/Tiles/Abyss/SulphurousCrateTile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Fishing.SulphurCatches; +using CalamityMod.Items.Fishing.SulphurCatches; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -7,7 +7,8 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss { - public class AbyssalCrateTile : ModTile + [LegacyName("AbyssalCrateTile")] + public class SulphurousCrateTile : ModTile { public override void SetStaticDefaults() { @@ -22,7 +23,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Abyssal Crate"); + name.SetDefault("Sulphurous Crate"); AddMapEntry(new Color(47, 79, 79), name); //dark slate gray DustType = 33; } @@ -47,7 +48,7 @@ namespace CalamityMod.Tiles.Abyss public override void KillMultiTile(int i, int j, int frameX, int frameY) { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); } } } diff --git a/Tiles/Abyss/SulphurousCrateTile.png b/Tiles/Abyss/SulphurousCrateTile.png new file mode 100644 index 0000000000..56dbd8ac67 Binary files /dev/null and b/Tiles/Abyss/SulphurousCrateTile.png differ diff --git a/Tiles/Abyss/SulphurousSand.png b/Tiles/Abyss/SulphurousSand.png index 180882767c..7a579b87f5 100644 Binary files a/Tiles/Abyss/SulphurousSand.png and b/Tiles/Abyss/SulphurousSand.png differ diff --git a/Tiles/Abyss/SulphurousSandstone.cs b/Tiles/Abyss/SulphurousSandstone.cs index ef03d8eda5..802816d88c 100644 --- a/Tiles/Abyss/SulphurousSandstone.cs +++ b/Tiles/Abyss/SulphurousSandstone.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.Abyss } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); return false; } public override void RandomUpdate(int i, int j) diff --git a/Tiles/Abyss/SulphurousSandstone.png b/Tiles/Abyss/SulphurousSandstone.png index 65eb36a150..bd3c43fa9d 100644 Binary files a/Tiles/Abyss/SulphurousSandstone.png and b/Tiles/Abyss/SulphurousSandstone.png differ diff --git a/Tiles/Abyss/SulphurousShale.cs b/Tiles/Abyss/SulphurousShale.cs new file mode 100644 index 0000000000..eb5c6c66d6 --- /dev/null +++ b/Tiles/Abyss/SulphurousShale.cs @@ -0,0 +1,223 @@ +//using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousShale : ModTile + { + int animationFrameWidth = 288; + + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine", 3); + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileMergeDirt[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithAbyss(Type); + + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(57, 44, 93)); + MineResist = 5f; + MinPick = 65; + HitSound = MineSound; + DustType = 33; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void RandomUpdate(int i, int j) + { + + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); + int nearbyVineCount = 0; + for (int x = i - 15; x <= i + 15; x++) + { + for (int y = j - 15; y <= j + 15; y++) + { + if (WorldGen.InWorld(x, y)) + { + if (CalamityUtils.ParanoidTileRetrieval(x, y).HasTile && + CalamityUtils.ParanoidTileRetrieval(x, y).TileType == (ushort)ModContent.TileType()) + { + nearbyVineCount++; + } + } + } + } + if (Main.tile[i, j + 1] != null && nearbyVineCount < 5 && j >= SulphurousSea.VineGrowTopLimit) + { + if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) + { + if (Main.tile[i, j + 1].LiquidAmount == 255 && + Main.tile[i, j + 1].LiquidType != LiquidID.Lava) + { + bool flag13 = false; + for (int num52 = num8; num52 > num8 - 10; num52--) + { + if (Main.tile[i, num52].BottomSlope) + { + flag13 = false; + break; + } + if (Main.tile[i, num52].HasTile && !Main.tile[i, num52].BottomSlope) + { + flag13 = true; + break; + } + } + if (flag13) + { + int num53 = i; + int num54 = j + 1; + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); + Main.tile[num53, num54].Get().HasTile = true; + WorldGen.SquareTileFrame(num53, num54, true); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); + } + } + Main.tile[i, j].Get().Slope = SlopeType.Solid; + Main.tile[i, j].Get().IsHalfBlock = false; + } + } + } + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + //place sulphur tentacle corals + if (WorldGen.genRand.Next(10) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //18 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(22) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = 0; + int xPos = i % 4; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 2; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 3: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); + return false; + } + } +} diff --git a/Tiles/Abyss/SulphurousShale.png b/Tiles/Abyss/SulphurousShale.png new file mode 100644 index 0000000000..e23324e5b9 Binary files /dev/null and b/Tiles/Abyss/SulphurousShale.png differ diff --git a/Tiles/Abyss/SulphurousTorch.cs b/Tiles/Abyss/SulphurousTorch.cs new file mode 100644 index 0000000000..56277373ee --- /dev/null +++ b/Tiles/Abyss/SulphurousTorch.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousTorch : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTorch(true, true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Torch"); + AddMapEntry(new Color(253, 221, 3), name); + TileID.Sets.DisableSmartCursor[Type] = true; + ItemDrop = ModContent.ItemType(); + AdjTiles = new int[] { TileID.Torches }; + TileID.Sets.Torch[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(190, 255, 60), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameX < 66) + { + r = 0.9f; + g = 1.2f; + b = 0.3f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Abyss/SulphurousTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(Main.rand.NextBool() ? 61 : 64, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneSulphur ? 1f : -1f; + } + } +} diff --git a/Tiles/Abyss/SulphurousTorch.png b/Tiles/Abyss/SulphurousTorch.png new file mode 100644 index 0000000000..c3c2b84088 Binary files /dev/null and b/Tiles/Abyss/SulphurousTorch.png differ diff --git a/Tiles/Abyss/SulphurousTorchFlame.png b/Tiles/Abyss/SulphurousTorchFlame.png new file mode 100644 index 0000000000..a62f876096 Binary files /dev/null and b/Tiles/Abyss/SulphurousTorchFlame.png differ diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index 1d774c15fe..70c79e3dc8 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Metadata; @@ -16,6 +17,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileBlockLight[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileNoFail[Type] = true; + Main.tileNoSunLight[Type] = false; ModTranslation name = CreateMapEntryName(); name.SetDefault("Sulphurous Vines"); AddMapEntry(new Color(0, 50, 0), name); @@ -33,6 +35,19 @@ namespace CalamityMod.Tiles.Abyss num = fail ? 1 : 3; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileAbove = Framing.GetTileSafely(i, j - 1); + + if (!tileAbove.HasTile) + { + WorldGen.KillTile(i, j); + return true; + } + + return true; + } + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { //GIVE VINE ROPE IF SPECIAL VINE BOOK @@ -55,6 +70,17 @@ namespace CalamityMod.Tiles.Abyss } } } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer && Main.rand.NextBool(200) && j > Main.worldSurface) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(22, 255, 0), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } // Ozzatron 01JUL2022: heavily refactored this code to not suck. also, sulphurous vines won't grow in honey anymore. private const int MaxVineHeight = 10; @@ -110,9 +136,16 @@ namespace CalamityMod.Tiles.Abyss } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { + float brightness = 0.7f; + brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.01f + i); + //brightness *= (float)MathF.Sin(-i / 50f + Main.GameUpdateCount * 0.01f); + brightness += 0.5f; r = 173f / 255f; g = 1f; b = 200f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; } } } diff --git a/Tiles/Abyss/Tenebris.cs b/Tiles/Abyss/Tenebris.cs deleted file mode 100644 index a1d6f50839..0000000000 --- a/Tiles/Abyss/Tenebris.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Abyss -{ - public class Tenebris : ModTile - { - public override void SetStaticDefaults() - { - Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; - - CalamityUtils.MergeWithGeneral(Type); - CalamityUtils.MergeWithAbyss(Type); - - DustType = 44; - ItemDrop = ModContent.ItemType(); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Tenebris"); - AddMapEntry(new Color(0, 100, 100), name); - MineResist = 3f; - MinPick = 200; - HitSound = SoundID.Tink; - } - - public override bool CanExplode(int i, int j) - { - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void NearbyEffects(int i, int j, bool closer) - { - if (!closer && j < Main.maxTilesY - 205) - { - Tile t = Main.tile[i, j]; - if (t.LiquidAmount <= 0) - { - t.LiquidAmount = 255; - t.Get().LiquidType = LiquidID.Water; - } - } - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - return false; - } - } -} diff --git a/Tiles/Abyss/Tenebris.png b/Tiles/Abyss/Tenebris.png deleted file mode 100644 index a5c43e1d84..0000000000 Binary files a/Tiles/Abyss/Tenebris.png and /dev/null differ diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index 31d0831016..ee623ff792 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -26,6 +26,19 @@ namespace CalamityMod.Tiles.Abyss num = fail ? 1 : 3; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileAbove = Framing.GetTileSafely(i, j - 1); + + if (!tileAbove.HasTile) + { + WorldGen.KillTile(i, j); + return true; + } + + return true; + } + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { //GIVE VINE ROPE IF SPECIAL VINE BOOK diff --git a/Tiles/Abyss/ViperVines.png b/Tiles/Abyss/ViperVines.png index b9fad1a574..10969a4380 100644 Binary files a/Tiles/Abyss/ViperVines.png and b/Tiles/Abyss/ViperVines.png differ diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index e77f71ff31..07e9e888ea 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -1,7 +1,9 @@ - +using CalamityMod.Tiles.Abyss.AbyssAmbient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using Terraria.Audio; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,7 @@ namespace CalamityMod.Tiles.Abyss { public class Voidstone : ModTile { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; internal static Texture2D GlowTexture; public override void SetStaticDefaults() { @@ -24,17 +27,18 @@ namespace CalamityMod.Tiles.Abyss CalamityUtils.MergeWithAbyss(Type); TileID.Sets.ChecksForMerge[Type] = true; - HitSound = SoundID.Tink; + HitSound = MineSound; MineResist = 10f; MinPick = 180; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(15, 15, 15)); } + int animationFrameWidth = 288; public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(128, 128, 128), 1f); return false; } @@ -43,6 +47,30 @@ namespace CalamityMod.Tiles.Abyss return false; } + public override void RandomUpdate(int i, int j) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + //place Tenebris + if (WorldGen.genRand.Next(12) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //6 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(6) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { int uniqueAnimationFrameX = 0; @@ -231,8 +259,15 @@ namespace CalamityMod.Tiles.Abyss xPos += xOffset; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); + Color drawColour = GetDrawColour(i, j, new Color(255, 255, 255, 255)); Tile trackTile = Main.tile[i, j]; + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawColour *= brightness; if (!trackTile.IsHalfBlock && trackTile.Slope == 0) { @@ -246,7 +281,7 @@ namespace CalamityMod.Tiles.Abyss public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); return false; } diff --git a/Tiles/Abyss/Voidstone.png b/Tiles/Abyss/Voidstone.png index 5f4f37b630..575da9a843 100644 Binary files a/Tiles/Abyss/Voidstone.png and b/Tiles/Abyss/Voidstone.png differ diff --git a/Tiles/Abyss/Voidstone_Glowmask.png b/Tiles/Abyss/Voidstone_Glowmask.png index b252e4f20b..37bdfa2c7e 100644 Binary files a/Tiles/Abyss/Voidstone_Glowmask.png and b/Tiles/Abyss/Voidstone_Glowmask.png differ diff --git a/Tiles/AerialiteBarTile.png b/Tiles/AerialiteBarTile.png index 8985bb2d66..cc3dce48f7 100644 Binary files a/Tiles/AerialiteBarTile.png and b/Tiles/AerialiteBarTile.png differ diff --git a/Tiles/ArenaTile.cs b/Tiles/ArenaTile.cs index cab04cb330..83b1fff6c3 100644 --- a/Tiles/ArenaTile.cs +++ b/Tiles/ArenaTile.cs @@ -1,9 +1,11 @@ -using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; using CalamityMod.Skies; +using CalamityMod.World; namespace CalamityMod.Tiles { @@ -34,7 +36,7 @@ namespace CalamityMod.Tiles { if (closer) { - if (!NPC.AnyNPCs(ModContent.NPCType()) && !SCalSky.RitualDramaProjectileIsPresent) + if (!NPC.AnyNPCs(ModContent.NPCType()) && !SCalSky.RitualDramaProjectileIsPresent && !(NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.getFixedBoi)) { WorldGen.KillTile(i, j, false, false, false); if (!Main.tile[i, j].HasTile && Main.netMode != NetmodeID.SinglePlayer) diff --git a/Tiles/Astral/AstralClay.cs b/Tiles/Astral/AstralClay.cs index 92e8eb708f..f1213d9f95 100644 --- a/Tiles/Astral/AstralClay.cs +++ b/Tiles/Astral/AstralClay.cs @@ -1,4 +1,4 @@ - + using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index 44c4c62156..1e957ab8ab 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.Astral DustType = ModContent.DustType(); ItemDrop = ModContent.ItemType(); - AddMapEntry(new Color(65, 56, 83)); + AddMapEntry(new Color(59, 50, 77)); TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false); return false; } @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.Astral Tile down = Main.tile[i, j + 1]; Tile left = Main.tile[i - 1, j]; Tile right = Main.tile[i + 1, j]; - if (WorldGen.genRand.Next(3) == 0 && (up.TileType == ModContent.TileType() || down.TileType == ModContent.TileType() || left.TileType == ModContent.TileType() || right.TileType == ModContent.TileType())) + if (WorldGen.genRand.NextBool(3) && (up.TileType == ModContent.TileType() || down.TileType == ModContent.TileType() || left.TileType == ModContent.TileType() || right.TileType == ModContent.TileType())) { WorldGen.SpreadGrass(i, j, Type, ModContent.TileType(), false); } diff --git a/Tiles/Astral/AstralDirt.png b/Tiles/Astral/AstralDirt.png index 5231ec13e2..65dd801350 100644 Binary files a/Tiles/Astral/AstralDirt.png and b/Tiles/Astral/AstralDirt.png differ diff --git a/Tiles/Astral/AstralGrass.png b/Tiles/Astral/AstralGrass.png index 184726e16c..18908d3796 100644 Binary files a/Tiles/Astral/AstralGrass.png and b/Tiles/Astral/AstralGrass.png differ diff --git a/Tiles/Astral/AstralShortPlants.cs b/Tiles/Astral/AstralShortPlants.cs index b8cd5e3c8d..942abad878 100644 --- a/Tiles/Astral/AstralShortPlants.cs +++ b/Tiles/Astral/AstralShortPlants.cs @@ -49,5 +49,13 @@ namespace CalamityMod.Tiles.Astral Main.npc[worm].netUpdate = true; } } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, ModContent.ItemType()); + } + } } } diff --git a/Tiles/Astral/AstralShortPlants.png b/Tiles/Astral/AstralShortPlants.png index 89d115934d..06c807d342 100644 Binary files a/Tiles/Astral/AstralShortPlants.png and b/Tiles/Astral/AstralShortPlants.png differ diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index 053282b916..6222d12fb4 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -1,4 +1,4 @@ - + using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.Astral HitSound = SoundID.Tink; - AddMapEntry(new Color(45, 36, 63)); + AddMapEntry(new Color(93, 78, 107)); TileID.Sets.Stone[Type] = true; TileID.Sets.Conversion.Stone[Type] = true; @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/Astral/AstralStone.png b/Tiles/Astral/AstralStone.png index 0dd03a3af6..d89fe8332c 100644 Binary files a/Tiles/Astral/AstralStone.png and b/Tiles/Astral/AstralStone.png differ diff --git a/Tiles/Astral/AstralTallPlants.cs b/Tiles/Astral/AstralTallPlants.cs index 801b244c8d..16a347b5a8 100644 --- a/Tiles/Astral/AstralTallPlants.cs +++ b/Tiles/Astral/AstralTallPlants.cs @@ -5,6 +5,7 @@ using Terraria.DataStructures; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.Astral { @@ -23,6 +24,9 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.SwaysInWindBasic[Type] = true; TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + DustType = ModContent.DustType(); HitSound = SoundID.Grass; @@ -44,5 +48,19 @@ namespace CalamityMod.Tiles.Astral Main.npc[worm].netUpdate = true; } } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -12; + height = 32; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, ModContent.ItemType()); + } + } } } diff --git a/Tiles/Astral/AstralTree.png b/Tiles/Astral/AstralTree.png index 80b0e3aa78..db95527f2f 100644 Binary files a/Tiles/Astral/AstralTree.png and b/Tiles/Astral/AstralTree.png differ diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index 6ad3b3e71b..3199f85196 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -12,13 +12,14 @@ namespace CalamityMod.Tiles.Astral { public override void SetStaticDefaults() { + Main.tileLighted[Type] = true; Main.tileCut[Type] = true; Main.tileBlockLight[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileNoFail[Type] = true; TileID.Sets.IsVine[Type] = true; TileID.Sets.ReplaceTileBreakDown[Type] = true; - TileID.Sets.VineThreads[Type] = true; + TileID.Sets.VineThreads[Type] = true; TileID.Sets.DrawFlipMode[Type] = 1; TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); @@ -26,16 +27,25 @@ namespace CalamityMod.Tiles.Astral HitSound = SoundID.Grass; - AddMapEntry(new Color(65, 56, 83)); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Astral Vines"); + AddMapEntry(new Color(65, 56, 83), name); } public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { //GIVE VINE ROPE IF SPECIAL VINE BOOK - if (WorldGen.genRand.Next(2) == 0 && Main.player[(int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16)].cordage) + if (WorldGen.genRand.NextBool() && Main.player[(int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16)].cordage) { Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope); } } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = Main.DiscoR / 255f * 0.5f; + g = 0.5f; + b = (255 - Main.DiscoR) / 255f * 0.5f; + } } } diff --git a/Tiles/Astral/NovaeSlag.cs b/Tiles/Astral/NovaeSlag.cs index f2cad769e7..dbcf9e730c 100644 --- a/Tiles/Astral/NovaeSlag.cs +++ b/Tiles/Astral/NovaeSlag.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/AstralBar.png b/Tiles/AstralBar.png index 0f33be340e..5d35fadbfd 100644 Binary files a/Tiles/AstralBar.png and b/Tiles/AstralBar.png differ diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index db773b22b1..7589a5532f 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -54,13 +54,13 @@ namespace CalamityMod.Tiles.AstralDesert } } // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } public override bool HasWalkDust() { - return Main.rand.Next(3) == 0; + return Main.rand.NextBool(3); } public override void WalkDust(ref int dustType, ref bool makeDust, ref Color color) diff --git a/Tiles/AstralDesert/AstralSand.png b/Tiles/AstralDesert/AstralSand.png index a535a94cce..5960e4585e 100644 Binary files a/Tiles/AstralDesert/AstralSand.png and b/Tiles/AstralDesert/AstralSand.png differ diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index 67a1a9ba3a..7872e56bae 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -1,4 +1,4 @@ - + using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.AstralDesert public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index 7b85530714..21926ac0bc 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -1,4 +1,4 @@ - + using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.AstralDesert public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index 4708b7110b..cb16c83920 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.AstralSnow public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } } diff --git a/Tiles/AuricTeslaBar.png b/Tiles/AuricTeslaBar.png index 489ba90d76..5ab79264e0 100644 Binary files a/Tiles/AuricTeslaBar.png and b/Tiles/AuricTeslaBar.png differ diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index c9f67922dd..a56cac3502 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -2,12 +2,14 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Tiles.Crags; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; @@ -15,8 +17,10 @@ using System.Linq; using System.Reflection; using Terraria; using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Tiles { @@ -44,7 +48,14 @@ namespace CalamityMod.Tiles TileID.HallowedPlants2, TileID.CrimsonPlants, (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(), + }; public static List GrowthTiles = new List() @@ -69,18 +80,18 @@ namespace CalamityMod.Tiles { // Custom plant framing for (int k = 0; k < PlantTypes.Length; k++) + { if (type == PlantTypes[k]) { TileFraming.PlantFrame(i, j); return false; } + } // Custom vine framing if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == ModContent.TileType()) - { TileFraming.VineFrame(i, j); - return false; - } + return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); } @@ -137,13 +148,129 @@ namespace CalamityMod.Tiles { Tile tile = Main.tile[i, j]; - // Helper function to shatter crystals attached to neighboring solid tiles. - static void CheckShatterCrystal(int xPos, int yPos) + // Fruit from trees upon tree destruction + if (!effectOnly && !fail && Main.netMode != NetmodeID.MultiplayerClient && TileID.Sets.IsShakeable[type]) { - if (xPos < 0 || xPos >= Main.maxTilesX || yPos < 0 || yPos >= Main.maxTilesY) + GetTreeBottom(i, j, out int treeX, out int treeY); + TreeTypes treeType = WorldGen.GetTreeType(Main.tile[treeX, treeY].TileType); + if (treeType != TreeTypes.None) + { + treeY--; + while (treeY > 10 && Main.tile[treeX, treeY].HasTile && TileID.Sets.IsShakeable[Main.tile[treeX, treeY].TileType]) + treeY--; + + treeY++; + + if (WorldGen.IsTileALeafyTreeTop(treeX, treeY) && !Collision.SolidTiles(treeX - 2, treeX + 2, treeY - 2, treeY + 2)) + { + int randomAmt = WorldGen.genRand.Next(1, 3); + for (int z = 0; z < randomAmt; z++) + { + int treeDropItemType = 0; + switch (treeType) + { + case TreeTypes.Forest: + + switch (WorldGen.genRand.Next(5)) + { + case 0: + treeDropItemType = ItemID.Apple; + break; + case 1: + treeDropItemType = ItemID.Apricot; + break; + case 2: + treeDropItemType = ItemID.Peach; + break; + case 3: + treeDropItemType = ItemID.Grapefruit; + break; + default: + treeDropItemType = ItemID.Lemon; + break; + } + + break; + + case TreeTypes.Snow: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Cherry : ItemID.Plum; + break; + + case TreeTypes.Jungle: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Mango : ItemID.Pineapple; + break; + + case TreeTypes.Palm: + + if (WorldGen.IsPalmOasisTree(treeX)) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; + + break; + + case TreeTypes.PalmCorrupt: + + if (WorldGen.genRand.NextBool()) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; + else if (WorldGen.IsPalmOasisTree(treeX)) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; + else + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; + + break; + + case TreeTypes.Corrupt: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BlackCurrant : ItemID.Elderberry; + break; + + case TreeTypes.PalmHallowed: + + if (WorldGen.genRand.NextBool()) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; + else if (WorldGen.IsPalmOasisTree(treeX)) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; + else + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; + + break; + + case TreeTypes.Hallowed: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Dragonfruit : ItemID.Starfruit; + break; + + case TreeTypes.PalmCrimson: + + if (WorldGen.genRand.NextBool()) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; + else if (WorldGen.IsPalmOasisTree(treeX)) + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.Banana : ItemID.Coconut; + else + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; + + break; + + case TreeTypes.Crimson: + treeDropItemType = WorldGen.genRand.NextBool() ? ItemID.BloodOrange : ItemID.Rambutan; + break; + + default: + break; + } + + if (treeDropItemType != 0) + Item.NewItem(new EntitySource_TileBreak(treeX, treeY), treeX * 16, treeY * 16, 16, 16, treeDropItemType); + } + } + } + } + + // Helper function to shatter crystals attached to neighboring solid tiles. + void CheckShatterCrystal(int xPos, int yPos, bool dontShatter) + { + if (xPos < 0 || xPos >= Main.maxTilesX || yPos < 0 || yPos >= Main.maxTilesY || dontShatter) return; + Tile t = Main.tile[xPos, yPos]; - if (t.HasTile && (t.TileType == ModContent.TileType() || (t.TileType == ModContent.TileType() && DownedBossSystem.downedDesertScourge))) + if (t.HasTile && (t.TileType == ModContent.TileType() || t.TileType == ModContent.TileType())) { WorldGen.KillTile(xPos, yPos, false, false, false); if (!Main.tile[xPos, yPos].HasTile && Main.netMode != NetmodeID.SinglePlayer) @@ -151,13 +278,14 @@ namespace CalamityMod.Tiles } } - // CONSIDER -- Lumenyl Crystals and Sea Prism Crystals aren't solid. They shouldn't need to be checked here. + // Check if crystals should be shattered, do not shatter crystals next to other crystals if a crystal is shattered. if (Main.tileSolid[tile.TileType] && tile.TileType != ModContent.TileType() && tile.TileType != ModContent.TileType()) { - CheckShatterCrystal(i + 1, j); - CheckShatterCrystal(i - 1, j); - CheckShatterCrystal(i, j + 1); - CheckShatterCrystal(i, j - 1); + bool dontShatter = fail || effectOnly; + CheckShatterCrystal(i + 1, j, dontShatter); + CheckShatterCrystal(i - 1, j, dontShatter); + CheckShatterCrystal(i, j + 1, dontShatter); + CheckShatterCrystal(i, j - 1, dontShatter); } // Cumbling Dungeon Bricks have a 100% chance to crumble. This causes an effect similar to the Vein Miner mod. @@ -232,6 +360,7 @@ namespace CalamityMod.Tiles if (player.breath > player.breathMax) player.breath = player.breathMax; } + // Mining set gives a chance for additional ore. This can be abused for infinite ore but it has a cooldown to prevent too much abuse if (player.Calamity().miningSet && player.Calamity().miningSetCooldown <= 0 && !fail) { @@ -266,7 +395,7 @@ namespace CalamityMod.Tiles Item.NewItem(new EntitySource_TileBreak(i, j), pos, ItemID.SoulofNight); } } - if (WorldGen.altarCount % 3 == 0 && WorldGen.altarCount > 1) + if (WorldGen.altarCount % 12 == 0 && WorldGen.altarCount > 1) Item.NewItem(new EntitySource_TileBreak(i, j), pos, ModContent.ItemType()); } } @@ -306,5 +435,45 @@ namespace CalamityMod.Tiles return base.CanKillTile(i, j, type, ref blockDamaged); } + + // "Private" my ass, fuck off + public static void GetTreeBottom(int i, int j, out int x, out int y) + { + x = i; + y = j; + Tile tileSafely = Framing.GetTileSafely(x, y); + if (tileSafely.TileType == TileID.PalmTree) + { + while (y < Main.maxTilesY - 50 && (!tileSafely.HasTile || tileSafely.TileType == TileID.PalmTree)) + { + y++; + tileSafely = Framing.GetTileSafely(x, y); + } + + return; + } + + int num = tileSafely.TileFrameX / 22; + int num2 = tileSafely.TileFrameY / 22; + if (num == 3 && num2 <= 2) + x++; + else if (num == 4 && num2 >= 3 && num2 <= 5) + x--; + else if (num == 1 && num2 >= 6 && num2 <= 8) + x--; + else if (num == 2 && num2 >= 6 && num2 <= 8) + x++; + else if (num == 2 && num2 >= 9) + x++; + else if (num == 3 && num2 >= 9) + x--; + + tileSafely = Framing.GetTileSafely(x, y); + while (y < Main.maxTilesY - 50 && (!tileSafely.HasTile || TileID.Sets.IsATreeTrunk[tileSafely.TileType] || tileSafely.TileType == TileID.MushroomTrees)) + { + y++; + tileSafely = Framing.GetTileSafely(x, y); + } + } } } diff --git a/Tiles/Crags/BrimstoneSlab.cs b/Tiles/Crags/BrimstoneSlab.cs new file mode 100644 index 0000000000..40cf6823dc --- /dev/null +++ b/Tiles/Crags/BrimstoneSlab.cs @@ -0,0 +1,53 @@ +using CalamityMod.Tiles.Crags; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Crags +{ + public class BrimstoneSlab : ModTile + { + private int sheetWidth = 450; + private int sheetHeight = 270; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithHell(Type); + + ItemDrop = ModContent.ItemType(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Brimstone Slab"); + AddMapEntry(new Color(79, 55, 70), name); + MineResist = 3f; + MinPick = 100; + HitSound = SoundID.Tink; + DustType = 235; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = i % 2 * sheetWidth; + frameYOffset = j % 2 * sheetHeight; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BrimstoneFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/Crags/BrimstoneSlab.png b/Tiles/Crags/BrimstoneSlab.png new file mode 100644 index 0000000000..976dccddc8 Binary files /dev/null and b/Tiles/Crags/BrimstoneSlab.png differ diff --git a/Tiles/Crags/BrimstoneSlag.cs b/Tiles/Crags/BrimstoneSlag.cs index 2dcb5fbfff..3e5945cb29 100644 --- a/Tiles/Crags/BrimstoneSlag.cs +++ b/Tiles/Crags/BrimstoneSlag.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.Crags CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithHell(Type); - CalamityUtils.SetMerge(Type, ModContent.TileType()); + CalamityUtils.SetMerge(Type, ModContent.TileType()); HitSound = SoundID.Tink; MineResist = 3f; diff --git a/Tiles/Crags/CinderBlossomGrassGrass.png b/Tiles/Crags/CinderBlossomGrassGrass.png new file mode 100644 index 0000000000..84455741a2 Binary files /dev/null and b/Tiles/Crags/CinderBlossomGrassGrass.png differ diff --git a/Tiles/Crags/CinderBlossomTallPlants.cs b/Tiles/Crags/CinderBlossomTallPlants.cs new file mode 100644 index 0000000000..8cc68dd2bf --- /dev/null +++ b/Tiles/Crags/CinderBlossomTallPlants.cs @@ -0,0 +1,51 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Crags +{ + public class CinderBlossomTallPlants : ModTile + { + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = true; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + + HitSound = SoundID.Grass; + + AddMapEntry(new Color(170, 50, 180)); + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -30; + height = 48; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, ModContent.ItemType()); + } + } + } +} diff --git a/Tiles/Crags/CinderBlossomTallPlants.png b/Tiles/Crags/CinderBlossomTallPlants.png new file mode 100644 index 0000000000..cf0526533b Binary files /dev/null and b/Tiles/Crags/CinderBlossomTallPlants.png differ diff --git a/Tiles/Crags/GloomTorch.cs b/Tiles/Crags/GloomTorch.cs new file mode 100644 index 0000000000..098285f352 --- /dev/null +++ b/Tiles/Crags/GloomTorch.cs @@ -0,0 +1,95 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; + +namespace CalamityMod.Tiles.Crags +{ + public class GloomTorch : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTorch(false, false); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Torch"); + AddMapEntry(new Color(253, 221, 3), name); + TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.Torch[Type] = true; + Main.tileWaterDeath[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + ItemDrop = ModContent.ItemType(); + AdjTiles = new int[] { TileID.Torches }; + + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(190, 255, 60), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameX < 66) + { + r = 0.5f; + g = 0.75f; + b = 1.2f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/Crags/GloomTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(Main.rand.NextBool() ? 61 : 64, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneCalamity ? 1f : -1f; + } + } +} diff --git a/Tiles/Crags/GloomTorch.png b/Tiles/Crags/GloomTorch.png new file mode 100644 index 0000000000..6ff4c4ab25 Binary files /dev/null and b/Tiles/Crags/GloomTorch.png differ diff --git a/Tiles/Crags/GloomTorchFlame.png b/Tiles/Crags/GloomTorchFlame.png new file mode 100644 index 0000000000..5f01acab9c Binary files /dev/null and b/Tiles/Crags/GloomTorchFlame.png differ diff --git a/Tiles/Crags/LavaPistil.cs b/Tiles/Crags/LavaPistil.cs new file mode 100644 index 0000000000..1bebbdc4bb --- /dev/null +++ b/Tiles/Crags/LavaPistil.cs @@ -0,0 +1,51 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Crags +{ + public class LavaPistil : ModTile + { + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLighted[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = false; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + + HitSound = SoundID.Grass; + + AddMapEntry(new Color(170, 50, 180)); + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -128; + height = 144; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 255f / 255f; + g = 206f / 255f; + b = 126f / 255f; + } + } +} diff --git a/Tiles/Crags/LavaPistil.png b/Tiles/Crags/LavaPistil.png new file mode 100644 index 0000000000..b3c5e0bee6 Binary files /dev/null and b/Tiles/Crags/LavaPistil.png differ diff --git a/Tiles/Crags/Lily/LavaLily1.cs b/Tiles/Crags/Lily/LavaLily1.cs new file mode 100644 index 0000000000..849b8aa9a4 --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily1.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(98, 191), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(98, 191), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily1.png b/Tiles/Crags/Lily/LavaLily1.png new file mode 100644 index 0000000000..577ffc6c9e Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily1.png differ diff --git a/Tiles/Crags/Lily/LavaLily1Glow.png b/Tiles/Crags/Lily/LavaLily1Glow.png new file mode 100644 index 0000000000..aa8417951c Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily1Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily1Top.png b/Tiles/Crags/Lily/LavaLily1Top.png new file mode 100644 index 0000000000..6073a6b920 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily1Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily1TopGlow.png b/Tiles/Crags/Lily/LavaLily1TopGlow.png new file mode 100644 index 0000000000..12aa31f3ec Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily1TopGlow.png differ diff --git a/Tiles/Crags/Lily/LavaLily2.cs b/Tiles/Crags/Lily/LavaLily2.cs new file mode 100644 index 0000000000..957816f3de --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily2.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(90, 209), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(90, 209), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily2.png b/Tiles/Crags/Lily/LavaLily2.png new file mode 100644 index 0000000000..cd908b4f64 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily2.png differ diff --git a/Tiles/Crags/Lily/LavaLily2Glow.png b/Tiles/Crags/Lily/LavaLily2Glow.png new file mode 100644 index 0000000000..50fbfbbc5a Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily2Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily2Top.png b/Tiles/Crags/Lily/LavaLily2Top.png new file mode 100644 index 0000000000..7ce6a66769 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily2Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily2TopGlow.png b/Tiles/Crags/Lily/LavaLily2TopGlow.png new file mode 100644 index 0000000000..ff3ca4083c Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily2TopGlow.png differ diff --git a/Tiles/Crags/Lily/LavaLily3.cs b/Tiles/Crags/Lily/LavaLily3.cs new file mode 100644 index 0000000000..64e7f004af --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily3.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(98, 199), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(98, 199), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily3.png b/Tiles/Crags/Lily/LavaLily3.png new file mode 100644 index 0000000000..2287eca150 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily3.png differ diff --git a/Tiles/Crags/Lily/LavaLily3Glow.png b/Tiles/Crags/Lily/LavaLily3Glow.png new file mode 100644 index 0000000000..964907ab5b Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily3Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily3Top.png b/Tiles/Crags/Lily/LavaLily3Top.png new file mode 100644 index 0000000000..11a199fa94 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily3Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily3TopGlow.png b/Tiles/Crags/Lily/LavaLily3TopGlow.png new file mode 100644 index 0000000000..d0c8fa7e3e Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily3TopGlow.png differ diff --git a/Tiles/Crags/Lily/LavaLily4.cs b/Tiles/Crags/Lily/LavaLily4.cs new file mode 100644 index 0000000000..656b9ee373 --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily4.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(96, 191), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(96, 191), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily4.png b/Tiles/Crags/Lily/LavaLily4.png new file mode 100644 index 0000000000..4b2ca5ac81 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily4.png differ diff --git a/Tiles/Crags/Lily/LavaLily4Glow.png b/Tiles/Crags/Lily/LavaLily4Glow.png new file mode 100644 index 0000000000..0d76ccdea0 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily4Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily4Top.png b/Tiles/Crags/Lily/LavaLily4Top.png new file mode 100644 index 0000000000..328eba3368 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily4Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily4TopGlow.png b/Tiles/Crags/Lily/LavaLily4TopGlow.png new file mode 100644 index 0000000000..38b92d2064 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily4TopGlow.png differ diff --git a/Tiles/Crags/Lily/LavaLily5.cs b/Tiles/Crags/Lily/LavaLily5.cs new file mode 100644 index 0000000000..036f0f7807 --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily5.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily5 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(118, 209), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(118, 209), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily5.png b/Tiles/Crags/Lily/LavaLily5.png new file mode 100644 index 0000000000..ece379c262 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily5.png differ diff --git a/Tiles/Crags/Lily/LavaLily5Glow.png b/Tiles/Crags/Lily/LavaLily5Glow.png new file mode 100644 index 0000000000..b51e6b0b1b Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily5Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily5Top.png b/Tiles/Crags/Lily/LavaLily5Top.png new file mode 100644 index 0000000000..d78dfda67b Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily5Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily5TopGlow.png b/Tiles/Crags/Lily/LavaLily5TopGlow.png new file mode 100644 index 0000000000..8d857ef0d9 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily5TopGlow.png differ diff --git a/Tiles/Crags/Lily/LavaLily6.cs b/Tiles/Crags/Lily/LavaLily6.cs new file mode 100644 index 0000000000..916f4bdd13 --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily6.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily6 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(96, 199), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(96, 199), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily6.png b/Tiles/Crags/Lily/LavaLily6.png new file mode 100644 index 0000000000..8c3eda7fea Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily6.png differ diff --git a/Tiles/Crags/Lily/LavaLily6Glow.png b/Tiles/Crags/Lily/LavaLily6Glow.png new file mode 100644 index 0000000000..03545208df Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily6Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily6Top.png b/Tiles/Crags/Lily/LavaLily6Top.png new file mode 100644 index 0000000000..10de73d614 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily6Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily6TopGlow.png b/Tiles/Crags/Lily/LavaLily6TopGlow.png new file mode 100644 index 0000000000..e7cacb0baf Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily6TopGlow.png differ diff --git a/Tiles/Crags/ScorchedBone.cs b/Tiles/Crags/ScorchedBone.cs new file mode 100644 index 0000000000..27eedbcb41 --- /dev/null +++ b/Tiles/Crags/ScorchedBone.cs @@ -0,0 +1,46 @@ +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Crags +{ + public class ScorchedBone : ModTile + { + private int sheetWidth = 450; + private int sheetHeight = 270; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithHell(Type); + CalamityUtils.SetMerge(Type, ModContent.TileType()); + + DustType = 155; + HitSound = SoundID.Dig; + MineResist = 1f; + MinPick = 100; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(87, 62, 67)); + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = i % 3 * sheetWidth; + frameYOffset = j % 3 * sheetHeight; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BrimstoneFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/Crags/ScorchedBone.png b/Tiles/Crags/ScorchedBone.png new file mode 100644 index 0000000000..d2965e7fe8 Binary files /dev/null and b/Tiles/Crags/ScorchedBone.png differ diff --git a/Tiles/Crags/ScorchedRemains.cs b/Tiles/Crags/ScorchedRemains.cs new file mode 100644 index 0000000000..d12acfb850 --- /dev/null +++ b/Tiles/Crags/ScorchedRemains.cs @@ -0,0 +1,66 @@ +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Crags +{ + public class ScorchedRemains : ModTile + { + private int sheetWidth = 288; + private int sheetHeight = 270; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithHell(Type); + CalamityUtils.SetMerge(Type, ModContent.TileType()); + + DustType = 155; + HitSound = SoundID.Dig; + MineResist = 1f; + MinPick = 100; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(57, 52, 72)); + } + + public override void RandomUpdate(int i, int j) + { + Tile up = Main.tile[i, j - 1]; + Tile left = Main.tile[i - 1, j]; + Tile right = Main.tile[i + 1, j]; + + if (WorldGen.genRand.Next(3) == 0 && !up.HasTile && (left.TileType == ModContent.TileType() || + right.TileType == ModContent.TileType())) + { + Main.tile[i, j].TileType = (ushort)ModContent.TileType(); + } + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = i % 3 * sheetWidth; + frameYOffset = j % 3 * sheetHeight; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); + return false; + } + } +} diff --git a/Tiles/Crags/ScorchedRemains.png b/Tiles/Crags/ScorchedRemains.png new file mode 100644 index 0000000000..3fe8139b3c Binary files /dev/null and b/Tiles/Crags/ScorchedRemains.png differ diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs new file mode 100644 index 0000000000..1b47d6509b --- /dev/null +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -0,0 +1,440 @@ +using CalamityMod.Tiles.Ores; +using CalamityMod.Dusts; +using CalamityMod.Tiles.Crags.Lily; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Crags +{ + public class ScorchedRemainsGrass : ModTile + { + private const short subsheetWidth = 450; + private const short subsheetHeight = 198; + private int extraFrameHeight = 36; + private int extraFrameWidth = 90; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithHell(Type); + CalamityUtils.SetMerge(Type, ModContent.TileType()); + + HitSound = SoundID.Dig; + MineResist = 1f; + MinPick = 100; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(212, 82, 227)); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 1.82f; + g = 0.56f; + b = 1.07f; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + if (fail && !effectOnly) + { + Main.tile[i, j].TileType = (ushort)ModContent.TileType(); + } + } + + public override void RandomUpdate(int i, int j) + { + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + //convert this tile back into scorched remains if any liquid is above it + //will change this to only check for lava if necessary + if (up.LiquidAmount > 0) + { + Main.tile[i, j].TileType = (ushort)ModContent.TileType(); + } + + if (WorldGen.genRand.Next(5) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount == 0) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + up.TileFrameX = (short)(WorldGen.genRand.Next(20) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + + if (WorldGen.genRand.NextBool(100)) + { + ushort[] Lillies = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(i, j - 1, WorldGen.genRand.Next(Lillies), true); + } + + //convert this tile back into scorched remains if any liquid is above it + //will change this to only check for lava if necessary + if (up.LiquidAmount > 0) + { + Main.tile[i, j].TileType = (ushort)ModContent.TileType(); + } + + if (WorldGen.genRand.Next(60) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount == 0) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + up.TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + Tile Above = Framing.GetTileSafely(i, j - 1); + + if (!Main.gamePaused && Main.instance.IsActive && !Above.HasTile && isPlayerNear) + { + if (Main.rand.Next(300) == 0) + { + int newDust = Dust.NewDust(new Vector2((i - 2) * 16, (j - 1) * 16), 5, 5, ModContent.DustType()); + Main.dust[newDust].velocity.Y += 0.09f; + } + } + + if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type || + Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type) + { + try + { + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + catch { } + } + } + + public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j); + Texture2D leaves = ModContent.Request("CalamityMod/Tiles/Crags/CinderBlossomGrassGrass").Value; + + DrawExtraTop(i, j, leaves, drawOffset, drawColour); + DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour); + DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); + } + + #region 'Extra Drapes' Drawing + private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface + */ + if ( + CheckTile(Type, false, 0, 1, i, j) || + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + DrawExtraOverhang(i, j, extras, drawOffset, drawColour); + } + } + + private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Ending the Extra when a wall is reached + */ + + //Left + if ( + CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right + if ( + CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached + */ + + //Left + if ( + CheckTile(Type, false, -1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right + if ( + CheckTile(Type, false, 1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Hanging 'drapes' of the extra element + */ + + //Base + if ( + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) || + (CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Left Wall + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right Wall + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Left Overhang + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + //Right Overhang + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + #endregion + + #region Tile Data + private bool CheckTile(int type, bool equal, int x, int y, int i, int j) + { + //Subtract y so that y is vertical for ease of readability + return Main.tile[i + x, j - y].TileType == type == equal; + } + + private Color GetDrawColour(int i, int j) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType < 13) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (colType == 29) + { + paintCol = Color.Black; + } + Color col = Lighting.GetColor(i, j); + col.R = (byte)(paintCol.R / 255f * col.R); + col.G = (byte)(paintCol.G / 255f * col.G); + col.B = (byte)(paintCol.B / 255f * col.B); + return col; + } + + private int GetExtraState(string type) + { + switch (type) + { + case "middle": + return 36; + case "overhangLeft": + return 18; + case "overhangRight": + return 54; + case "wallEndLeft": + return 0; + case "wallEndRight": + return 72; + default: + Main.NewText(type.ToString() + " is not a valid Extra sheet state"); + return 0; + } + } + + private int GetExtraPattern(int i) + { + return i % 3 * extraFrameHeight; + } + + private int GetExtraVariant(int i, int j) + { + return Main.tile[i, j].TileFrameNumber * extraFrameWidth; + } + + /* + private int GetTileVariant(int i, int j) + { + int variant = 0; //Default to using variant 1 + Tile sourceTile = Main.tile[i, j]; + //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using + int frameX = sourceTile.frameX / 18; + int frameY = sourceTile.frameY / 18; + if (frameY < 3 && !(frameX >= 6 && frameX < 9)) + { + int group = 0; + int[] group1XPos = new int[] { 1, 2, 3 }; + int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; + foreach (int k in group1XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 1; + } + } + foreach (int k in group2XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 2; + } + } + if (group == 1) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 3) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (group == 2) + { + if (frameY < 1) + { + variant = 0; + } + else if (frameY < 2) + { + variant = 1; + } + else + { + variant = 2; + } + } + } + else if (frameX < 6 && frameY >= 3) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 4) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 6 && frameX < 9) + { + if (frameX < 7) + { + variant = 0; + } + else if (frameX < 8) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 9 && frameY >= 3) + { + if (frameX < 10) + { + variant = 0; + } + else if (frameX < 11) + { + variant = 1; + } + else + { + variant = 2; + } + } + return (variant); + } + */ + #endregion + } +} + diff --git a/Tiles/Crags/ScorchedRemainsGrass.png b/Tiles/Crags/ScorchedRemainsGrass.png new file mode 100644 index 0000000000..540758b1f2 Binary files /dev/null and b/Tiles/Crags/ScorchedRemainsGrass.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteGiant.cs b/Tiles/Crags/Spike/CragStalactiteGiant.cs new file mode 100644 index 0000000000..d52cc6bbff --- /dev/null +++ b/Tiles/Crags/Spike/CragStalactiteGiant.cs @@ -0,0 +1,42 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalactiteGiant1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 8; + TileObjectData.newTile.Origin = new Point16(2, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } + + public class CragStalactiteGiant2 : CragStalactiteGiant1 + { + } + + public class CragStalactiteGiant3 : CragStalactiteGiant1 + { + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalactiteGiant1.png b/Tiles/Crags/Spike/CragStalactiteGiant1.png new file mode 100644 index 0000000000..224c971459 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteGiant1.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteGiant2.png b/Tiles/Crags/Spike/CragStalactiteGiant2.png new file mode 100644 index 0000000000..0c1392559a Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteGiant2.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteGiant3.png b/Tiles/Crags/Spike/CragStalactiteGiant3.png new file mode 100644 index 0000000000..2ef5c8ab41 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteGiant3.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteLarge1.png b/Tiles/Crags/Spike/CragStalactiteLarge1.png new file mode 100644 index 0000000000..6a7dbaa402 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteLarge1.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteLarge2.png b/Tiles/Crags/Spike/CragStalactiteLarge2.png new file mode 100644 index 0000000000..d1c7751849 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteLarge2.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteLarge2x4.cs b/Tiles/Crags/Spike/CragStalactiteLarge2x4.cs new file mode 100644 index 0000000000..91516d13e9 --- /dev/null +++ b/Tiles/Crags/Spike/CragStalactiteLarge2x4.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalactiteLarge3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalactiteLarge2x5.cs b/Tiles/Crags/Spike/CragStalactiteLarge2x5.cs new file mode 100644 index 0000000000..43a568b671 --- /dev/null +++ b/Tiles/Crags/Spike/CragStalactiteLarge2x5.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalactiteLarge1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } + + public class CragStalactiteLarge2 : CragStalactiteLarge1 + { + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalactiteLarge3.png b/Tiles/Crags/Spike/CragStalactiteLarge3.png new file mode 100644 index 0000000000..7fbaffa0be Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteLarge3.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteSmall1.png b/Tiles/Crags/Spike/CragStalactiteSmall1.png new file mode 100644 index 0000000000..50adb7fd52 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteSmall1.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteSmall2.png b/Tiles/Crags/Spike/CragStalactiteSmall2.png new file mode 100644 index 0000000000..d1603249a0 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteSmall2.png differ diff --git a/Tiles/Crags/Spike/CragStalactiteSmall2x2.cs b/Tiles/Crags/Spike/CragStalactiteSmall2x2.cs new file mode 100644 index 0000000000..b907a41a74 --- /dev/null +++ b/Tiles/Crags/Spike/CragStalactiteSmall2x2.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalactiteSmall3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalactiteSmall2x3.cs b/Tiles/Crags/Spike/CragStalactiteSmall2x3.cs new file mode 100644 index 0000000000..aa16d21c4a --- /dev/null +++ b/Tiles/Crags/Spike/CragStalactiteSmall2x3.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalactiteSmall1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = -3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } + + public class CragStalactiteSmall2 : CragStalactiteSmall1 + { + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalactiteSmall3.png b/Tiles/Crags/Spike/CragStalactiteSmall3.png new file mode 100644 index 0000000000..b5b7a56be1 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalactiteSmall3.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteGiant.cs b/Tiles/Crags/Spike/CragStalagmiteGiant.cs new file mode 100644 index 0000000000..96c7270acc --- /dev/null +++ b/Tiles/Crags/Spike/CragStalagmiteGiant.cs @@ -0,0 +1,41 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalagmiteGiant1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 8; + TileObjectData.newTile.Origin = new Point16(2, 7); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } + + public class CragStalagmiteGiant2 : CragStalagmiteGiant1 + { + } + + public class CragStalagmiteGiant3 : CragStalagmiteGiant1 + { + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalagmiteGiant1.png b/Tiles/Crags/Spike/CragStalagmiteGiant1.png new file mode 100644 index 0000000000..cd48c9a8a7 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteGiant1.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteGiant2.png b/Tiles/Crags/Spike/CragStalagmiteGiant2.png new file mode 100644 index 0000000000..72e22ca9bf Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteGiant2.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteGiant3.png b/Tiles/Crags/Spike/CragStalagmiteGiant3.png new file mode 100644 index 0000000000..045c46af0b Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteGiant3.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteLarge1.png b/Tiles/Crags/Spike/CragStalagmiteLarge1.png new file mode 100644 index 0000000000..a58093d4cf Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteLarge1.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteLarge2.png b/Tiles/Crags/Spike/CragStalagmiteLarge2.png new file mode 100644 index 0000000000..c40b894a76 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteLarge2.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteLarge2x4.cs b/Tiles/Crags/Spike/CragStalagmiteLarge2x4.cs new file mode 100644 index 0000000000..2d00e16c06 --- /dev/null +++ b/Tiles/Crags/Spike/CragStalagmiteLarge2x4.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalagmiteLarge3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(1, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalagmiteLarge2x5.cs b/Tiles/Crags/Spike/CragStalagmiteLarge2x5.cs new file mode 100644 index 0000000000..033f454fcb --- /dev/null +++ b/Tiles/Crags/Spike/CragStalagmiteLarge2x5.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalagmiteLarge1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 4); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } + + public class CragStalagmiteLarge2 : CragStalagmiteLarge1 + { + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalagmiteLarge3.png b/Tiles/Crags/Spike/CragStalagmiteLarge3.png new file mode 100644 index 0000000000..71ccd11aac Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteLarge3.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteSmall1.png b/Tiles/Crags/Spike/CragStalagmiteSmall1.png new file mode 100644 index 0000000000..2a016fc808 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteSmall1.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteSmall2.png b/Tiles/Crags/Spike/CragStalagmiteSmall2.png new file mode 100644 index 0000000000..858da12207 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteSmall2.png differ diff --git a/Tiles/Crags/Spike/CragStalagmiteSmall2x2.cs b/Tiles/Crags/Spike/CragStalagmiteSmall2x2.cs new file mode 100644 index 0000000000..051fa823a2 --- /dev/null +++ b/Tiles/Crags/Spike/CragStalagmiteSmall2x2.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalagmiteSmall3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalagmiteSmall2x3.cs b/Tiles/Crags/Spike/CragStalagmiteSmall2x3.cs new file mode 100644 index 0000000000..0ffa4e555d --- /dev/null +++ b/Tiles/Crags/Spike/CragStalagmiteSmall2x3.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Spike +{ + public class CragStalagmiteSmall1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(43, 23, 46)); + DustType = 155; + HitSound = SoundID.Tink; + } + } + + public class CragStalagmiteSmall2 : CragStalagmiteSmall1 + { + } +} \ No newline at end of file diff --git a/Tiles/Crags/Spike/CragStalagmiteSmall3.png b/Tiles/Crags/Spike/CragStalagmiteSmall3.png new file mode 100644 index 0000000000..6f59e304a9 Binary files /dev/null and b/Tiles/Crags/Spike/CragStalagmiteSmall3.png differ diff --git a/Tiles/Crags/Tree/SpineBottom.png b/Tiles/Crags/Tree/SpineBottom.png new file mode 100644 index 0000000000..282cb4a0bd Binary files /dev/null and b/Tiles/Crags/Tree/SpineBottom.png differ diff --git a/Tiles/Crags/Tree/SpineRib1Left.png b/Tiles/Crags/Tree/SpineRib1Left.png new file mode 100644 index 0000000000..92403cf0e7 Binary files /dev/null and b/Tiles/Crags/Tree/SpineRib1Left.png differ diff --git a/Tiles/Crags/Tree/SpineRib1Right.png b/Tiles/Crags/Tree/SpineRib1Right.png new file mode 100644 index 0000000000..af1b7d5f6a Binary files /dev/null and b/Tiles/Crags/Tree/SpineRib1Right.png differ diff --git a/Tiles/Crags/Tree/SpineRib2Left.png b/Tiles/Crags/Tree/SpineRib2Left.png new file mode 100644 index 0000000000..992ab812cb Binary files /dev/null and b/Tiles/Crags/Tree/SpineRib2Left.png differ diff --git a/Tiles/Crags/Tree/SpineRib2Right.png b/Tiles/Crags/Tree/SpineRib2Right.png new file mode 100644 index 0000000000..57ead12e2e Binary files /dev/null and b/Tiles/Crags/Tree/SpineRib2Right.png differ diff --git a/Tiles/Crags/Tree/SpineRib3Left.png b/Tiles/Crags/Tree/SpineRib3Left.png new file mode 100644 index 0000000000..4435bef84c Binary files /dev/null and b/Tiles/Crags/Tree/SpineRib3Left.png differ diff --git a/Tiles/Crags/Tree/SpineRib3Right.png b/Tiles/Crags/Tree/SpineRib3Right.png new file mode 100644 index 0000000000..182c9e0ee8 Binary files /dev/null and b/Tiles/Crags/Tree/SpineRib3Right.png differ diff --git a/Tiles/Crags/Tree/SpineSapling.cs b/Tiles/Crags/Tree/SpineSapling.cs new file mode 100644 index 0000000000..51c2b0b2aa --- /dev/null +++ b/Tiles/Crags/Tree/SpineSapling.cs @@ -0,0 +1,62 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Linq; + +namespace CalamityMod.Tiles.Crags.Tree +{ + public class SpineSapling : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + TileID.Sets.CommonSapling[Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.AnchorValidTiles = new[] { ModContent.TileType() }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.DrawFlipHorizontal = true; + TileObjectData.newTile.WaterPlacement = LiquidPlacement.NotAllowed; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.newTile.StyleMultiplier = 3; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Spine Sapling"); + AddMapEntry(new Color(38, 25, 27), name); + DustType = DustID.Blood; + AdjTiles = new int[] { TileID.Saplings }; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void RandomUpdate(int i, int j) + { + if (WorldGen.genRand.Next(20) == 0) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + + if (isPlayerNear && Main.tile[i, j + 1].TileType != ModContent.TileType()) + { + SpineTree.Spawn(i, j + 1, 22, 28, true); + } + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Tree/SpineSapling.png b/Tiles/Crags/Tree/SpineSapling.png new file mode 100644 index 0000000000..694feb66b0 Binary files /dev/null and b/Tiles/Crags/Tree/SpineSapling.png differ diff --git a/Tiles/Crags/Tree/SpineSegments.png b/Tiles/Crags/Tree/SpineSegments.png new file mode 100644 index 0000000000..d447eedca5 Binary files /dev/null and b/Tiles/Crags/Tree/SpineSegments.png differ diff --git a/Tiles/Crags/Tree/SpineTop.png b/Tiles/Crags/Tree/SpineTop.png new file mode 100644 index 0000000000..35c40ce235 Binary files /dev/null and b/Tiles/Crags/Tree/SpineTop.png differ diff --git a/Tiles/Crags/Tree/SpineTree.cs b/Tiles/Crags/Tree/SpineTree.cs new file mode 100644 index 0000000000..341ca298b1 --- /dev/null +++ b/Tiles/Crags/Tree/SpineTree.cs @@ -0,0 +1,448 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; +using Terraria.DataStructures; +using Terraria.Audio; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Placeables; +using CalamityMod.Tiles.Crags; +using System; +using System.Linq; + +namespace CalamityMod.Tiles.Crags.Tree +{ + internal class SpineTree : ModTile + { + /* + What each frame of the tree means + (refer to the sprite sheet for the colors) + X frame 0 (orange) = bottom segment + X frame 18 (dark purple) = main tree segment, each of the three y-frame variants draws a different tree segment variant + X frame 36 (light purple) = top of the tree + X frame 54 (teal) = small rib branch segments + X frame 72 (lime) = medium rib branch segments + X frame 90 (yellow) = large rib branch segments + + each of the branch frames have a pattern where + y-frame 1 = left branch + y-frame 2 = right branch + y-frame 3 = both left and right branch + */ + + public override void SetStaticDefaults() + { + TileID.Sets.IsATreeTrunk[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileAxe[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = false; + Main.tileBlockLight[Type] = false; + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Giant Spine"); + AddMapEntry(new Color(38, 25, 27), name); + DustType = 155; + HitSound = SoundID.DD2_SkeletonHurt; + ItemDrop = ModContent.ItemType(); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + resetFrame = false; + noBreak = true; + return false; + } + + public static bool SolidTile(int i, int j) + { + return Framing.GetTileSafely(i, j).HasTile && Main.tileSolid[Framing.GetTileSafely(i, j).TileType]; + } + + public static bool SolidTopTile(int i, int j) + { + return Framing.GetTileSafely(i, j).HasTile && (Main.tileSolidTop[Framing.GetTileSafely(i, j).TileType] || + Main.tileSolid[Framing.GetTileSafely(i, j).TileType]); + } + + public static bool Spawn(int i, int j, int minSize = 5, int maxSize = 18, bool saplingExists = false) + { + //if this tree grew from a sapling, then kill the sapling its growing from + if (saplingExists) + { + WorldGen.KillTile(i, j, false, false, true); + WorldGen.KillTile(i, j - 1, false, false, true); + } + + //set the minimum and maximum height the tree can grow to + int height = Main.rand.Next(minSize, maxSize); + for (int k = 1; k < height; ++k) + { + if (SolidTile(i, j - k)) + { + height = k - 2; + break; + } + } + + if (height < 4 || height < minSize) + { + return false; + } + + //this places the base, probably a bit weird looking here but it works + //problem is messing around with this completely broke the hell out of the tree so i refuse to modify it for now + //if someone else by some miracle can figure out how to change it, please let me know :) + bool[] extraPlaces = new bool[5]; + for (int k = -2; k <= 2; k++) + { + extraPlaces[k + 2] = false; + + if ((SolidTopTile(i + k, j + 1) || SolidTile(i + k, j + 1)) && !Framing.GetTileSafely(i + k, j).HasTile) + { + extraPlaces[k + 2] = true; + } + } + + if (!extraPlaces[1]) extraPlaces[0] = false; + if (!extraPlaces[3]) extraPlaces[4] = false; + + if (!extraPlaces[2]) + { + return false; + } + + extraPlaces = new bool[5] { false, false, true, false, false }; + + //place the actual base + for (int k = -2; k <= 2; k++) + { + if (extraPlaces[k + 2]) + { + WorldGen.PlaceTile(i + k, j, ModContent.TileType(), true); + + Framing.GetTileSafely(i + k, j).TileFrameX = 0; + Framing.GetTileSafely(i, j - k).TileFrameY = (short)(Main.rand.Next(3) * 18); + } + else + { + continue; + } + } + + int branchSegmentDelay = 0; + + for (int k = 1; k < height; k++) + { + WorldGen.PlaceTile(i, j - k, ModContent.TileType(), true); + + if (branchSegmentDelay > 0) + { + branchSegmentDelay--; + } + + //chance to place a branch segment + //also dont place branches below a certain threshold + if (Main.rand.Next(2) == 0 && branchSegmentDelay == 0 && k > 5) + { + float divide = 1.65f; + + if (k > 1 && k < 10) + { + Framing.GetTileSafely(i, j - k).TileFrameX = 3 * 18; + } + if (k >= 10 && k < 17) + { + Framing.GetTileSafely(i, j - k).TileFrameX = 4 * 18; + } + if (k >= 17) + { + Framing.GetTileSafely(i, j - k).TileFrameX = 5 * 18; + } + + Framing.GetTileSafely(i, j - k).TileFrameY = (short)(Main.rand.Next(3) * 18); + + branchSegmentDelay = 3; + } + //otherwise place a normal segment + else + { + Framing.GetTileSafely(i, j - k).TileFrameX = 18; + Framing.GetTileSafely(i, j - k).TileFrameY = (short)(Main.rand.Next(3) * 18); + } + + //once the top is reached, place the top segment + if (k == height - 1) + { + Framing.GetTileSafely(i, j - k).TileFrameX = 2 * 18; + Framing.GetTileSafely(i, j - k).TileFrameY = (short)(Main.rand.Next(3) * 18); + } + } + + return true; + } + + public override void NearbyEffects(int i, int j, bool closer) + { + //kill the tree tiles if there are no tiles below it + if (!Framing.GetTileSafely(i, j + 1).HasTile) + { + WorldGen.KillTile(i, j, false, false, false); + } + } + + public override bool Drop(int i, int j) + { + //drop seeds from the top of the tree + if (Framing.GetTileSafely(i, j).TileFrameX == 36) + { + int totalSeeds = Main.rand.Next(1, 3); + for (int numSeed = 0; numSeed < totalSeeds; numSeed++) + { + Item.NewItem(new EntitySource_TileBreak(i, j), (new Vector2(i, j) * 16) + new Vector2(Main.rand.Next(-46, 46), + Main.rand.Next(-40, 40) - 66), ModContent.ItemType(), Main.rand.Next(1, 5)); + } + } + + //chance to drop extra wood + if (Main.rand.NextBool()) + { + Item.NewItem(new EntitySource_TileBreak(i, j), (new Vector2(i, j) * 16) + new Vector2(Main.rand.Next(-46, 46), + Main.rand.Next(-40, 40) - 66), ModContent.ItemType(), Main.rand.Next(1, 2)); + } + + return true; + } + + //this checks the entire tree from bottom to top + private void CheckEntireTree(ref int x, ref int y) + { + while (Main.tile[x, y].TileType == Type) + { + y--; + } + + y++; + + if (Main.tile[x, y].TileFrameX == 16) + { + for (int k = 0; k < WorldGen.numTreeShakes; k++) + { + if (WorldGen.treeShakeX[k] == x && WorldGen.treeShakeY[k] == y) + { + return; + } + } + + WorldGen.treeShakeX[WorldGen.numTreeShakes] = x; + WorldGen.treeShakeY[WorldGen.numTreeShakes] = y; + WorldGen.numTreeShakes++; + + //this is where you can make stuff happen when the tree is shaken like in vanilla + //for example, when trees drop a fruit when you begin to break it + } + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile tile = Framing.GetTileSafely(i, j); + + if (fail && !effectOnly && !noItem) + { + (int x, int y) = (i, j); + CheckEntireTree(ref x, ref y); + } + + if (fail) + { + return; + } + + int belowFrame = Framing.GetTileSafely(i, j + 1).TileFrameX; + + SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt, (new Vector2(i, j) * 16)); + + //here is where you can make effects happen when the tree segments break, like adding dust, dropping gore, ect + + /* + //TODO: save this since this tree will also produce bone gores when broken (gores for this tree still need assets) + Gore.NewGore(new EntitySource_TileInteraction(Main.LocalPlayer, i, j), (new Vector2(i, j - 2) * 16), + new Vector2(Main.rand.Next(-3, 3), Main.rand.Next(-3, 3)), ModContent.Find("CalamityMod/WhateverGore").Type); + */ + + //TODO: spawn all the gores here + + //bottom segment + if (Framing.GetTileSafely(i, j).TileFrameX == 0) + { + } + + //regular segment + if (Framing.GetTileSafely(i, j).TileFrameX == 18) + { + } + + //small branch + if (Framing.GetTileSafely(i, j).TileFrameX == 54) + { + } + + //medium branch + if (Framing.GetTileSafely(i, j).TileFrameX == 72) + { + } + + //large branch + if (Framing.GetTileSafely(i, j).TileFrameX == 90) + { + } + + //top segment + if (Framing.GetTileSafely(i, j).TileFrameX == 36) + { + } + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public static Vector2 TileCustomPosition(int i, int j, Vector2? off = null) + { + return ((new Vector2(i, j) + TileOffset) * 16) - Main.screenPosition - (off ?? new Vector2(0, -2)); + } + + internal static void DrawTreeSegments(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Color col = Lighting.GetColor(i, j); + float xOff = (float)Math.Sin((j * 19) * 0.04f) * 1.2f; + + if (xOff == 1 && (j / 4f) == 0) + { + xOff = 0; + } + + int frameSizeX = 16; + int frameSizeY = 16; + int frameSize = 16; + int frameOff = 0; + + Vector2 offset = new((xOff * 2) - (frameOff / 2), 0); + Vector2 pos = TileCustomPosition(i, j) - offset; + + Vector2 baseSegmentOffset = new Vector2((xOff * 2) - (frameOff / 2) + 26, 14); + Vector2 treeSegmentOffset = new Vector2((xOff * 2) - (frameOff / 2) + 25, 14); + Vector2 topSegmentOffset = new Vector2((xOff * 2) - (frameOff / 2) + 20, 16); + + Texture2D baseTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineBottom").Value; + Texture2D segmentTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineSegments").Value; + + //draw the base of the tree + if (Framing.GetTileSafely(i, j).TileFrameX == 0) + { + int frame = tile.TileFrameY / 18; + + DrawTreeSegments(i, j, baseTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), baseSegmentOffset, false); + } + + //draw the different segments of the tree + if (Framing.GetTileSafely(i, j).TileFrameX == 18) + { + int frame = tile.TileFrameY / 18; + + DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false); + } + + //draw small branch segments + if (Framing.GetTileSafely(i, j).TileFrameX == 54) + { + int frame = tile.TileFrameY / 18; + + //branch drawing stuff + Texture2D leftBranchTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineRib1Left").Value; + Texture2D rightBranchTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineRib1Right").Value; + + Vector2 leftBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 50, 14); + Vector2 rightBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 4, 14); + + //ok so, terraria just does not want to cooperate when i draw a single branch texture on the side of the tree segments + //i changed them into a horitonzal sheet with blanks in it so it gives the illusion of branches being random + //not a good idea if branches are meant to be separate tiles, but here they are purely visual so it doesnt matter + DrawTreeSegments(i, j, leftBranchTex, new Rectangle(38 * frame, 0, 38, 40), TileOffset.ToWorldCoordinates(), leftBranchOffset, false); + DrawTreeSegments(i, j, rightBranchTex, new Rectangle(38 * frame, 0, 38, 40), TileOffset.ToWorldCoordinates(), rightBranchOffset, false); + + //draw segments + DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false); + } + + //draw medium branch segments + if (Framing.GetTileSafely(i, j).TileFrameX == 72) + { + int frame = tile.TileFrameY / 18; + + //branch drawing stuff + Texture2D leftBranchTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineRib2Left").Value; + Texture2D rightBranchTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineRib2Right").Value; + + Vector2 leftBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 60, 14); + Vector2 rightBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 4, 14); + + DrawTreeSegments(i, j, leftBranchTex, new Rectangle(50 * frame, 0, 50, 54), TileOffset.ToWorldCoordinates(), leftBranchOffset, false); + DrawTreeSegments(i, j, rightBranchTex, new Rectangle(50 * frame, 0, 50, 54), TileOffset.ToWorldCoordinates(), rightBranchOffset, false); + + //draw segments + DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false); + } + + //draw large branch segments + if (Framing.GetTileSafely(i, j).TileFrameX == 90) + { + int frame = tile.TileFrameY / 18; + + //branch drawing stuff + Texture2D leftBranchTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineRib3Left").Value; + Texture2D rightBranchTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineRib3Right").Value; + + Vector2 leftBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 75, 14); + Vector2 rightBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 4, 14); + + DrawTreeSegments(i, j, leftBranchTex, new Rectangle(62 * frame, 0, 62, 60), TileOffset.ToWorldCoordinates(), leftBranchOffset, false); + DrawTreeSegments(i, j, rightBranchTex, new Rectangle(62 * frame, 0, 62, 60), TileOffset.ToWorldCoordinates(), rightBranchOffset, false); + + //draw segments + DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false); + } + + //draw top segment + if (Framing.GetTileSafely(i, j).TileFrameX == 36) + { + Texture2D topTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineTop").Value; + int frame = tile.TileFrameY / 18; + + DrawTreeSegments(i, j - 1, topTex, new Rectangle(26 * frame, 0, 24, 24), TileOffset.ToWorldCoordinates(), topSegmentOffset, false); + + //draw segments + DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false); + } + + /* + //keep this here for debugging + Texture2D treeTex = ModContent.Request("CalamityMod/Tiles/Crags/Tree/SpineTree").Value; + + spriteBatch.Draw(treeTex, pos, new Rectangle(tile.TileFrameX + frameOff, tile.TileFrameY, frameSize, frameSizeY), + new Color(col.R, col.G, col.B, 255), 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); + */ + + return false; + } + } +} diff --git a/Tiles/Crags/Tree/SpineTree.png b/Tiles/Crags/Tree/SpineTree.png new file mode 100644 index 0000000000..d860812b5d Binary files /dev/null and b/Tiles/Crags/Tree/SpineTree.png differ diff --git a/Tiles/DraedonStructures/HazardChevronPanels.cs b/Tiles/DraedonStructures/HazardChevronPanels.cs index abfbed9581..39db8b9a6d 100644 --- a/Tiles/DraedonStructures/HazardChevronPanels.cs +++ b/Tiles/DraedonStructures/HazardChevronPanels.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; @@ -7,6 +8,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class HazardChevronPanels : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -19,7 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.SetMerge(Type, ModContent.TileType()); CalamityUtils.SetMerge(Type, ModContent.TileType()); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; DustType = 19; MinPick = 30; ItemDrop = ModContent.ItemType (); diff --git a/Tiles/DraedonStructures/LaboratoryPanels.cs b/Tiles/DraedonStructures/LaboratoryPanels.cs index 6c71829597..a7ea8499bc 100644 --- a/Tiles/DraedonStructures/LaboratoryPanels.cs +++ b/Tiles/DraedonStructures/LaboratoryPanels.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; @@ -7,6 +8,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPanels : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -16,7 +18,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.MergeWithGeneral(Type); CalamityUtils.SetMerge(Type, ModContent.TileType()); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; DustType = 109; MinPick = 30; ItemDrop = ModContent.ItemType(); diff --git a/Tiles/DraedonStructures/LaboratoryPipePlating.cs b/Tiles/DraedonStructures/LaboratoryPipePlating.cs index 4d96b8166b..c0d4c1052c 100644 --- a/Tiles/DraedonStructures/LaboratoryPipePlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPipePlating.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; @@ -7,6 +8,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPipePlating : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -14,7 +16,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.MergeWithGeneral(Type); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; DustType = 32; MinPick = 30; ItemDrop = ModContent.ItemType(); @@ -25,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } } diff --git a/Tiles/DraedonStructures/LaboratoryPlating.cs b/Tiles/DraedonStructures/LaboratoryPlating.cs index 590f64322b..c7c3067041 100644 --- a/Tiles/DraedonStructures/LaboratoryPlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPlating.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; @@ -7,6 +8,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class LaboratoryPlating : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -14,7 +16,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.MergeWithGeneral(Type); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; DustType = 30; MinPick = 30; ItemDrop = ModContent.ItemType (); diff --git a/Tiles/DraedonStructures/OnyxExcavatorTile.cs b/Tiles/DraedonStructures/OnyxExcavatorTile.cs new file mode 100644 index 0000000000..bffd6762b5 --- /dev/null +++ b/Tiles/DraedonStructures/OnyxExcavatorTile.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Mounts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class OnyxExcavatorTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.Width = 8; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Onyx Excavator"); + AddMapEntry(new Color(128, 0, 128), name); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 16, ModContent.ItemType()); + } + } +} diff --git a/Tiles/DraedonStructures/OnyxExcavatorTile.png b/Tiles/DraedonStructures/OnyxExcavatorTile.png new file mode 100644 index 0000000000..da19e9b9f3 Binary files /dev/null and b/Tiles/DraedonStructures/OnyxExcavatorTile.png differ diff --git a/Tiles/DraedonStructures/RustedPlating.cs b/Tiles/DraedonStructures/RustedPlating.cs index 7414893162..283ecee93d 100644 --- a/Tiles/DraedonStructures/RustedPlating.cs +++ b/Tiles/DraedonStructures/RustedPlating.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; @@ -7,6 +8,7 @@ namespace CalamityMod.Tiles.DraedonStructures { public class RustedPlating : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -14,7 +16,7 @@ namespace CalamityMod.Tiles.DraedonStructures CalamityUtils.MergeWithGeneral(Type); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; DustType = 32; MinPick = 30; ItemDrop = ModContent.ItemType(); diff --git a/Tiles/Furniture/BossRelics/ProfanedGuardiansRelic.png b/Tiles/Furniture/BossRelics/ProfanedGuardiansRelic.png index 079e4ed684..11b2fdcfbb 100644 Binary files a/Tiles/Furniture/BossRelics/ProfanedGuardiansRelic.png and b/Tiles/Furniture/BossRelics/ProfanedGuardiansRelic.png differ diff --git a/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.cs b/Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.cs similarity index 80% rename from Tiles/Furniture/BossTrophies/CalamitasTrophyTile.cs rename to Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.cs index 7796e9f8b5..4877271c1a 100644 --- a/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.cs +++ b/Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.cs @@ -2,14 +2,13 @@ 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.BossTrophies { - public class CalamitasTrophyTile : ModTile + [LegacyName("CalamitasTrophyTile")] + public class CalamitasCloneTrophyTile : ModTile { public override void SetStaticDefaults() { @@ -20,7 +19,7 @@ namespace CalamityMod.Tiles.Furniture.BossTrophies public override void KillMultiTile(int i, int j, int frameX, int frameY) { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); } } } diff --git a/Tiles/Furniture/BossTrophies/CalamitasTrophyTile.png b/Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.png similarity index 100% rename from Tiles/Furniture/BossTrophies/CalamitasTrophyTile.png rename to Tiles/Furniture/BossTrophies/CalamitasCloneTrophyTile.png diff --git a/Tiles/Furniture/BossTrophy.cs b/Tiles/Furniture/BossTrophy.cs index d6763d7079..903e013fd7 100644 --- a/Tiles/Furniture/BossTrophy.cs +++ b/Tiles/Furniture/BossTrophy.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.Furniture item = ModContent.ItemType(); break; case 7: - item = ModContent.ItemType(); + item = ModContent.ItemType(); break; case 8: item = ModContent.ItemType(); diff --git a/Tiles/Furniture/ChaosCandle.cs b/Tiles/Furniture/ChaosCandle.cs index 7e1b3053b3..6d59836a4d 100644 --- a/Tiles/Furniture/ChaosCandle.cs +++ b/Tiles/Furniture/ChaosCandle.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Furniture Player player = Main.LocalPlayer; if (player is null) return; - if (!player.dead && player.active) + if (!player.dead && player.active && Main.tile[i, j].TileFrameX < 18) player.AddBuff(ModContent.BuffType(), 20); } @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.Furniture public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + CalamityUtils.LightHitWire(Type, i, j, 1, 1); return true; } } diff --git a/Tiles/Furniture/CorruptionEffigy.cs b/Tiles/Furniture/CorruptionEffigy.cs index 3b788516c1..f242dc270b 100644 --- a/Tiles/Furniture/CorruptionEffigy.cs +++ b/Tiles/Furniture/CorruptionEffigy.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Corruption Effigy"); - AddMapEntry(new Color(238, 145, 105), name); + AddMapEntry(new Color(126, 156, 134), name); } public override void NearbyEffects(int i, int j, bool closer) diff --git a/Tiles/Furniture/CorruptionEffigy.png b/Tiles/Furniture/CorruptionEffigy.png index 2f10d31098..fef465f910 100644 Binary files a/Tiles/Furniture/CorruptionEffigy.png and b/Tiles/Furniture/CorruptionEffigy.png differ diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs new file mode 100644 index 0000000000..a9c0ffe7a8 --- /dev/null +++ b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Placeables.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.CraftingStations +{ + public class WulfrumLabstation : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Wulfrum Labstation"); + AddMapEntry(new Color(71, 95, 114), name); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow").Value; + Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + } +} diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstation.png b/Tiles/Furniture/CraftingStations/WulfrumLabstation.png new file mode 100644 index 0000000000..53eee229af Binary files /dev/null and b/Tiles/Furniture/CraftingStations/WulfrumLabstation.png differ diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow.png b/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow.png new file mode 100644 index 0000000000..a94be8cf67 Binary files /dev/null and b/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow.png differ diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.cs b/Tiles/Furniture/Fountains/AbyssFountainTile.cs index 7d49acf4ea..038e23921a 100644 --- a/Tiles/Furniture/Fountains/AbyssFountainTile.cs +++ b/Tiles/Furniture/Fountains/AbyssFountainTile.cs @@ -1,8 +1,10 @@ using CalamityMod.Items.Placeables.Furniture.Fountains; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -10,6 +12,8 @@ namespace CalamityMod.Tiles.Furniture.Fountains { public class AbyssFountainTile : ModTile { + int mode = 0; + public override void SetStaticDefaults() { this.SetUpFountain(); @@ -19,8 +23,8 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { - if (Main.tile[i, j].TileFrameX < 36) - CalamityGlobalTile.SetActiveFountainColor(ModContent.Find("CalamityMod/AbyssWater").Slot); + if (Main.tile[i, j].TileFrameX >= 36) + CalamityGlobalTile.SetActiveFountainColor(ModContent.Find("CalamityMod/VoidWater").Slot); } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; @@ -60,6 +64,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override bool RightClick(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 2, 4); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.png b/Tiles/Furniture/Fountains/AbyssFountainTile.png index 68927bab25..145dd37d5c 100644 Binary files a/Tiles/Furniture/Fountains/AbyssFountainTile.png and b/Tiles/Furniture/Fountains/AbyssFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png b/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png index 1d1e01fe1a..6288ffd19a 100644 Binary files a/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png and b/Tiles/Furniture/Fountains/AbyssFountainTile_Highlight.png differ diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.cs b/Tiles/Furniture/Fountains/AstralFountainTile.cs index 042d6ae760..8bcc5d495d 100644 --- a/Tiles/Furniture/Fountains/AstralFountainTile.cs +++ b/Tiles/Furniture/Fountains/AstralFountainTile.cs @@ -2,8 +2,10 @@ using CalamityMod.Items.Placeables.Furniture.Fountains; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -20,7 +22,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { - if (Main.tile[i, j].TileFrameX < 36) + if (Main.tile[i, j].TileFrameX >= 36) CalamityGlobalTile.SetActiveFountainColor(ModContent.Find("CalamityMod/AstralWater").Slot); } @@ -61,6 +63,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override bool RightClick(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 2, 4); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.png b/Tiles/Furniture/Fountains/AstralFountainTile.png index 126498ac4d..d727da44c5 100644 Binary files a/Tiles/Furniture/Fountains/AstralFountainTile.png and b/Tiles/Furniture/Fountains/AstralFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/AstralFountainTile_Highlight.png b/Tiles/Furniture/Fountains/AstralFountainTile_Highlight.png index 169f6ac0a3..b9b2a85f47 100644 Binary files a/Tiles/Furniture/Fountains/AstralFountainTile_Highlight.png and b/Tiles/Furniture/Fountains/AstralFountainTile_Highlight.png differ diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs index 597f60a3f1..eedbbeb654 100644 --- a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -1,8 +1,11 @@ using CalamityMod.Items.Placeables.Furniture.Fountains; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -19,8 +22,9 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { - if (Main.tile[i, j].TileFrameX < 36) - CalamityGlobalTile.SetActiveFountainColor(ModContent.Find("CalamityMod/SulphuricWater").Slot); + string waterColor = CalamityWorld.getFixedBoi ? "CalamityMod/PissWater" : "CalamityMod/SulphuricWater"; + if (Main.tile[i, j].TileFrameX >= 36) + CalamityGlobalTile.SetActiveFountainColor(ModContent.Find(waterColor).Slot); } public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; @@ -60,6 +64,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override bool RightClick(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 2, 4); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.png b/Tiles/Furniture/Fountains/SulphurousFountainTile.png index 9dfcecd6e6..ddbdeb2212 100644 Binary files a/Tiles/Furniture/Fountains/SulphurousFountainTile.png and b/Tiles/Furniture/Fountains/SulphurousFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile_Highlight.png b/Tiles/Furniture/Fountains/SulphurousFountainTile_Highlight.png index 31243c312d..92589b7b11 100644 Binary files a/Tiles/Furniture/Fountains/SulphurousFountainTile_Highlight.png and b/Tiles/Furniture/Fountains/SulphurousFountainTile_Highlight.png differ diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs index 4a8fb520f0..699f5f2202 100644 --- a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -1,8 +1,10 @@ using CalamityMod.Items.Placeables.Furniture.Fountains; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -19,7 +21,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void NearbyEffects(int i, int j, bool closer) { - if (Main.tile[i, j].TileFrameX < 36) + if (Main.tile[i, j].TileFrameX >= 36) CalamityGlobalTile.SetActiveFountainColor(ModContent.Find("CalamityMod/SunkenSeaWater").Slot); } @@ -60,6 +62,7 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override bool RightClick(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 2, 4); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png index e8ceb8d0a1..2e964dcf1a 100644 Binary files a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png and b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.png differ diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png b/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png index 5866fcb8b8..4364cf01ee 100644 Binary files a/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png and b/Tiles/Furniture/Fountains/SunkenSeaFountainTile_Highlight.png differ diff --git a/Tiles/Furniture/LanternCenterTile.cs b/Tiles/Furniture/LanternCenterTile.cs new file mode 100644 index 0000000000..7f4d74e248 --- /dev/null +++ b/Tiles/Furniture/LanternCenterTile.cs @@ -0,0 +1,75 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent.Events; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class LanternCenterTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 18 }; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Lantern Center"); + AddMapEntry(new Color(99, 99, 99), name); + TileID.Sets.HasOutlines[Type] = true; + + AnimationFrameHeight = 54; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool CreateDust(int i, int j, ref int type) => false; + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 6; + frameCounter = 0; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + LanternNight.ManualLanterns = false; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 3); + LanternNight.ToggleManualLanterns(); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 3); + LanternNight.ToggleManualLanterns(); + SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/Furniture/LanternCenterTile.png b/Tiles/Furniture/LanternCenterTile.png new file mode 100644 index 0000000000..1f8cc97ef3 Binary files /dev/null and b/Tiles/Furniture/LanternCenterTile.png differ diff --git a/Tiles/Furniture/LanternCenterTile_Highlight.png b/Tiles/Furniture/LanternCenterTile_Highlight.png new file mode 100644 index 0000000000..6e86215b5d Binary files /dev/null and b/Tiles/Furniture/LanternCenterTile_Highlight.png differ diff --git a/Tiles/Furniture/TranquilityCandle.cs b/Tiles/Furniture/TranquilityCandle.cs index 2f43040c90..67e621f03a 100644 --- a/Tiles/Furniture/TranquilityCandle.cs +++ b/Tiles/Furniture/TranquilityCandle.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Furniture Player player = Main.LocalPlayer; if (player is null) return; - if (!player.dead && player.active) + if (!player.dead && player.active && Main.tile[i, j].TileFrameX < 18) player.AddBuff(ModContent.BuffType(), 20); } @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.Furniture public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + CalamityUtils.LightHitWire(Type, i, j, 1, 1); return true; } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs b/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs index 0968556749..3fc4ee344c 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs @@ -35,9 +35,9 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { if (Main.tile[i, j].TileFrameX < 18) { - r = 0.8f; - g = 0.9f; - b = 1f; + r = 0.5f; + g = 1f; + b = 0.8f; } else { diff --git a/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs b/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs index 41db20e55f..a28a11838f 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs @@ -35,9 +35,9 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { if (Main.tile[i, j].TileFrameX < 18) { - r = 0.8f; - g = 0.9f; - b = 1f; + r = 0.5f; + g = 1f; + b = 0.8f; } else { diff --git a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs index f039620b07..3efb463b36 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs @@ -33,9 +33,9 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { if (Main.tile[i, j].TileFrameX < 18) { - r = 0.8f; - g = 0.9f; - b = 1f; + r = 0.5f; + g = 1f; + b = 0.8f; } else { diff --git a/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs index 8aadc3ee26..7afcba1300 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs @@ -40,9 +40,9 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { if (Main.tile[i, j].TileFrameX < 18) { - r = 0.8f; - g = 0.9f; - b = 1f; + r = 0.5f; + g = 1f; + b = 0.8f; } else { diff --git a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs index c064b518c0..100fa382f9 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs @@ -40,9 +40,9 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { if (Main.tile[i, j].TileFrameX < 18) { - r = 0.8f; - g = 0.9f; - b = 1f; + r = 0.5f; + g = 1f; + b = 0.8f; } else { diff --git a/Tiles/FurnitureAshen/AshenAccentSlab.cs b/Tiles/FurnitureAshen/AshenAccentSlab.cs new file mode 100644 index 0000000000..82dd833065 --- /dev/null +++ b/Tiles/FurnitureAshen/AshenAccentSlab.cs @@ -0,0 +1,659 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.FurnitureAshen +{ + public class AshenAccentSlab : ModTile + { + public override string Texture => "CalamityMod/Tiles/FurnitureAshen/AshenSlab"; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; + + ItemDrop = ModContent.ItemType(); + HitSound = SoundID.Tink; + MineResist = 5f; + MinPick = 180; + AddMapEntry(new Color(40, 24, 48)); + AnimationFrameHeight = 90; + } + int animationFrameWidth = 234; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = Main.tileFrame[Type] + i; + int uniqueAnimationFrameY = Main.tileFrame[Type] + j; + int xPos = i % 2; + int yPos = j % 3; + int xPattern = i % 20 / 2; + int yPattern = j % 30 / 3; + int xOffset; + switch (xPattern) + { + case 0: + switch (yPattern) + { + case 1: + xOffset = 1; + break; + case 5: + xOffset = 0; + break; + case 8: + xOffset = 2; + break; + case 9: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 1: + switch (yPattern) + { + case 0: + xOffset = 2; + break; + case 3: + xOffset = 0; + break; + case 8: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 2: + switch (yPattern) + { + case 2: + xOffset = 0; + break; + case 7: + xOffset = 1; + break; + case 8: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 3: + switch (yPattern) + { + case 2: + xOffset = 2; + break; + case 5: + xOffset = 2; + break; + case 7: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 4: + switch (yPattern) + { + case 1: + xOffset = 0; + break; + case 4: + xOffset = 0; + break; + case 9: + xOffset = 2; + break; + default: + xOffset = -1; + break; + } + break; + case 5: + switch (yPattern) + { + case 0: + xOffset = 1; + break; + case 7: + xOffset = 0; + break; + case 8: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 6: + switch (yPattern) + { + case 5: + xOffset = 2; + break; + case 8: + xOffset = 1; + break; + case 12: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 7: + switch (yPattern) + { + case 2: + xOffset = 0; + break; + case 6: + xOffset = 0; + break; + case 7: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 8: + switch (yPattern) + { + case 3: + xOffset = 0; + break; + case 4: + xOffset = 0; + break; + case 9: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 9: + switch (yPattern) + { + case 1: + xOffset = 0; + break; + case 7: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + default: + xOffset = -1; + break; + } + if (yPos < 2) + { + if (xOffset != -1) + { + if (j % 3 < 2) + { + uniqueAnimationFrameX = Main.tile[i - (i % 2), j - (j % 3)].TileFrameNumber; + } + if (uniqueAnimationFrameX != 0) + { + uniqueAnimationFrameX += xOffset; + } + } + else + { + uniqueAnimationFrameX = 0; + } + } + switch (yPos) + { + case 0: + switch (xPos) + { + case 0: + uniqueAnimationFrameY = 0; + break; + case 1: + uniqueAnimationFrameY = 2; + break; + } + break; + case 1: + switch (xPos) + { + case 0: + uniqueAnimationFrameY = 1; + break; + case 1: + uniqueAnimationFrameY = 3; + break; + } + break; + case 2: + uniqueAnimationFrameY = 4 + xPos; + uniqueAnimationFrameX = 0; + break; + default: + uniqueAnimationFrameY = 0; + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameYOffset = uniqueAnimationFrameY * AnimationFrameHeight; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int uniqueAnimationFrameX = 0; + int uniqueAnimationFrameY = 0; + int xPos = i % 2; + int yPos = j % 3; + int xPattern = i % 20 / 2; + int yPattern = j % 30 / 3; + int xOffset; + switch (xPattern) + { + case 0: + switch (yPattern) + { + case 1: + xOffset = 1; + break; + case 5: + xOffset = 0; + break; + case 8: + xOffset = 2; + break; + case 9: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 1: + switch (yPattern) + { + case 0: + xOffset = 2; + break; + case 3: + xOffset = 0; + break; + case 8: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 2: + switch (yPattern) + { + case 2: + xOffset = 0; + break; + case 7: + xOffset = 1; + break; + case 8: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 3: + switch (yPattern) + { + case 2: + xOffset = 2; + break; + case 5: + xOffset = 2; + break; + case 7: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 4: + switch (yPattern) + { + case 1: + xOffset = 0; + break; + case 4: + xOffset = 0; + break; + case 9: + xOffset = 2; + break; + default: + xOffset = -1; + break; + } + break; + case 5: + switch (yPattern) + { + case 0: + xOffset = 1; + break; + case 7: + xOffset = 0; + break; + case 8: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 6: + switch (yPattern) + { + case 5: + xOffset = 2; + break; + case 8: + xOffset = 1; + break; + case 12: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 7: + switch (yPattern) + { + case 2: + xOffset = 0; + break; + case 6: + xOffset = 0; + break; + case 7: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 8: + switch (yPattern) + { + case 3: + xOffset = 0; + break; + case 4: + xOffset = 0; + break; + case 9: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 9: + switch (yPattern) + { + case 1: + xOffset = 0; + break; + case 7: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + default: + xOffset = -1; + break; + } + if (yPos < 2) + { + if (xOffset != -1) + { + if (j % 3 < 2) + { + uniqueAnimationFrameX = Main.tile[i - (i % 2), j - (j % 3)].TileFrameNumber; + } + if (uniqueAnimationFrameX != 0) + { + uniqueAnimationFrameX += xOffset; + } + } + else + { + uniqueAnimationFrameX = 0; + } + } + switch (yPos) + { + case 0: + switch (xPos) + { + case 0: + uniqueAnimationFrameY = 0; + break; + case 1: + uniqueAnimationFrameY = 2; + break; + } + break; + case 1: + switch (xPos) + { + case 0: + uniqueAnimationFrameY = 1; + break; + case 1: + uniqueAnimationFrameY = 3; + break; + } + break; + case 2: + uniqueAnimationFrameY = 4 + xPos; + uniqueAnimationFrameX = 0; + break; + default: + uniqueAnimationFrameY = 0; + break; + } + int AnimationFrameHeight = 90; + int animationFrameWidth = 234; + int xDrawPos = Main.tile[i, j].TileFrameX + (uniqueAnimationFrameX * animationFrameWidth); + int yDrawPos = Main.tile[i, j].TileFrameY + (uniqueAnimationFrameY * AnimationFrameHeight); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenSlabGlow").Value; + Color drawColour = GetDrawColour(i, j, new Color(64, 64, 64, 64)); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xDrawPos, yDrawPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.IsHalfBlock) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xDrawPos, yDrawPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + + /* + /// + /// Gets the tile variant to use. Returns -1 by default + /// + /// + /// + /// + public int GetTileVariant(int i, int j) + { + int variant = 0; //Default to using variant 1 + if (j % 3 < 2) + { + //We need to get the particular tile to refer to. This is the top left tile in each iteration of the pattern (large slab above the small rune bricks + Tile sourceTile = Main.tile[i - (i % 2), j - (j % 3)]; //Gets the tile for this iteration by taking the current position of the tile minus this tile's position in the pattern + //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using + int frameX = sourceTile.frameX / 18; + int frameY = sourceTile.frameY / 18; + if (frameY < 3 && !(frameX >= 6 && frameX < 9)) + { + int group = 0; + int[] group1XPos = new int[] { 1, 2, 3 }; + int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; + foreach (int k in group1XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 1; + } + } + foreach (int k in group2XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 2; + } + } + if (group == 1) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 3) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (group == 2) + { + if (frameY < 1) + { + variant = 0; + } + else if (frameY < 2) + { + variant = 1; + } + else + { + variant = 2; + } + } + } + else if (frameX < 6 && frameY >= 3) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 4) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 6 && frameX < 9) + { + if (frameX < 7) + { + variant = 0; + } + else if (frameX < 8) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 9 && frameY >= 3) + { + if (frameX < 10) + { + variant = 0; + } + else if (frameX < 11) + { + variant = 1; + } + else + { + variant = 2; + } + } + } + return (variant); + } + */ + } +} diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 964429575e..0560687f6d 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.Tiles.Crags; namespace CalamityMod.Tiles.FurnitureAshen { @@ -13,6 +14,8 @@ namespace CalamityMod.Tiles.FurnitureAshen Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; + CalamityUtils.SetMerge(Type, ModContent.TileType()); + ItemDrop = ModContent.ItemType(); HitSound = SoundID.Tink; MineResist = 5f; diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.png b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.png index e6de2c0e0f..97892ef307 100644 Binary files a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.png and b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.png differ diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index 7d2f3af067..84e890aee7 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -1,6 +1,7 @@  using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; @@ -219,8 +220,15 @@ namespace CalamityMod.Tiles.FurnitureVoid Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureVoid/SmoothVoidstoneGlow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + Color drawColour = GetDrawColour(i, j, new Color(255, 255, 255, 255)); Tile trackTile = Main.tile[i, j]; + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawColour *= brightness; double num6 = Main.time * 0.08; if (!trackTile.IsHalfBlock && trackTile.Slope == 0) { diff --git a/Tiles/FurnitureWulfrum/WulfrumBathtub.cs b/Tiles/FurnitureWulfrum/WulfrumBathtub.cs new file mode 100644 index 0000000000..93168a8fc5 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumBathtub.cs @@ -0,0 +1,52 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumBathtub : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpBathtub(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Bathtub"); + AddMapEntry(new Color(71, 95, 114), name); + AnimationFrameHeight = 54; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBathtubGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumBathtub.png b/Tiles/FurnitureWulfrum/WulfrumBathtub.png new file mode 100644 index 0000000000..079b098d40 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumBathtub.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumBathtubGlow.png b/Tiles/FurnitureWulfrum/WulfrumBathtubGlow.png new file mode 100644 index 0000000000..e27d35519b Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumBathtubGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumBed.cs b/Tiles/FurnitureWulfrum/WulfrumBed.cs new file mode 100644 index 0000000000..fbbbb5b410 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumBed.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumBed : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpBed(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Bed"); + AddMapEntry(new Color(71, 95, 114), name); + AdjTiles = new int[] { TileID.Beds }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 64, 32, ModContent.ItemType()); + } + + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBedGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumBed.png b/Tiles/FurnitureWulfrum/WulfrumBed.png new file mode 100644 index 0000000000..f808e3dbf2 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumBed.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumBedGlow.png b/Tiles/FurnitureWulfrum/WulfrumBedGlow.png new file mode 100644 index 0000000000..673914427b Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumBedGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumBed_Highlight.png b/Tiles/FurnitureWulfrum/WulfrumBed_Highlight.png new file mode 100644 index 0000000000..2ca9e839b1 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumBed_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumBookcase.cs b/Tiles/FurnitureWulfrum/WulfrumBookcase.cs new file mode 100644 index 0000000000..1b28181573 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumBookcase.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumBookcase : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpBookcase(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Bookcase"); + AddMapEntry(new Color(71, 95, 114), name); + AnimationFrameHeight = 54; + AdjTiles = new int[] { TileID.Bookcases }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBookcaseGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumBookcase.png b/Tiles/FurnitureWulfrum/WulfrumBookcase.png new file mode 100644 index 0000000000..19f27d5ba9 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumBookcase.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumBookcaseGlow.png b/Tiles/FurnitureWulfrum/WulfrumBookcaseGlow.png new file mode 100644 index 0000000000..bae8e0be16 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumBookcaseGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs b/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs new file mode 100644 index 0000000000..5fa1f8837d --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumCandelabra : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpCandelabra(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Candelabra"); + AddMapEntry(new Color(253, 221, 3), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Candelabras }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumCandelabraFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumCandelabra.png b/Tiles/FurnitureWulfrum/WulfrumCandelabra.png new file mode 100644 index 0000000000..576f13cb72 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumCandelabra.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumCandelabraFlame.png b/Tiles/FurnitureWulfrum/WulfrumCandelabraFlame.png new file mode 100644 index 0000000000..5a8eefed93 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumCandelabraFlame.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumCandle.cs b/Tiles/FurnitureWulfrum/WulfrumCandle.cs new file mode 100644 index 0000000000..cf0b352af4 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumCandle.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumCandle : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpCandle(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Candle"); + AddMapEntry(new Color(253, 221, 3), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Candles }; + ItemDrop = ModContent.ItemType(); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 7, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumCandleFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumCandle.png b/Tiles/FurnitureWulfrum/WulfrumCandle.png new file mode 100644 index 0000000000..0613051f9b Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumCandle.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumCandleFlame.png b/Tiles/FurnitureWulfrum/WulfrumCandleFlame.png new file mode 100644 index 0000000000..192efba4f8 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumCandleFlame.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumChair.cs b/Tiles/FurnitureWulfrum/WulfrumChair.cs new file mode 100644 index 0000000000..1ca759c3a1 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumChair.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumChair : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + + AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Chair")); + TileID.Sets.CanBeSatOnForNPCs[Type] = true; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + AdjTiles = new int[] { TileID.Chairs }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumChairGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, 40, true, true); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumChair.png b/Tiles/FurnitureWulfrum/WulfrumChair.png new file mode 100644 index 0000000000..fb7b9a934a Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumChair.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumChairGlow.png b/Tiles/FurnitureWulfrum/WulfrumChairGlow.png new file mode 100644 index 0000000000..5e43422a79 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumChairGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumChair_Highlight.png b/Tiles/FurnitureWulfrum/WulfrumChair_Highlight.png new file mode 100644 index 0000000000..53d0d643ad Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumChair_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs new file mode 100644 index 0000000000..c20b62c2a1 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumChandelier : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Chandelier")); + AdjTiles = new int[] { TileID.Chandeliers }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 48, ModContent.ItemType()); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 2); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumChandelierFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumChandelier.png b/Tiles/FurnitureWulfrum/WulfrumChandelier.png new file mode 100644 index 0000000000..e7d6cfeceb Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumChandelier.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumChandelierFlame.png b/Tiles/FurnitureWulfrum/WulfrumChandelierFlame.png new file mode 100644 index 0000000000..867632c86c Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumChandelierFlame.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumClock.cs b/Tiles/FurnitureWulfrum/WulfrumClock.cs new file mode 100644 index 0000000000..7058db5e65 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumClock.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumClock : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpClock(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Grandfather Clock"); + AddMapEntry(new Color(71, 95, 114), name); + AdjTiles = new int[] { TileID.GrandfatherClocks }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool RightClick(int x, int y) => CalamityUtils.ClockRightClick(); + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.SceneMetrics.HasClock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, ModContent.ItemType()); + } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumClockGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumClock.png b/Tiles/FurnitureWulfrum/WulfrumClock.png new file mode 100644 index 0000000000..4eef418869 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumClock.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumClockGlow.png b/Tiles/FurnitureWulfrum/WulfrumClockGlow.png new file mode 100644 index 0000000000..e8fef450e2 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumClockGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumClock_Highlight.png b/Tiles/FurnitureWulfrum/WulfrumClock_Highlight.png new file mode 100644 index 0000000000..7e3086dcd2 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumClock_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumDresser.cs b/Tiles/FurnitureWulfrum/WulfrumDresser.cs new file mode 100644 index 0000000000..66e11f9ffb --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumDresser.cs @@ -0,0 +1,67 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumDresser : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDresser(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Wulfrum Dresser"); + AddMapEntry(new Color(71, 95, 114), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Dressers }; + ContainerName.SetDefault("Wulfrum Dresser"); + DresserDrop = ModContent.ItemType(); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + + public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(ContainerName.GetDefault()); + + public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(ContainerName.GetDefault()); + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 48, 32, DresserDrop); + Chest.DestroyChest(i, j); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumDresserGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumDresser.png b/Tiles/FurnitureWulfrum/WulfrumDresser.png new file mode 100644 index 0000000000..6acb73610f Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumDresser.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumDresserGlow.png b/Tiles/FurnitureWulfrum/WulfrumDresserGlow.png new file mode 100644 index 0000000000..2db29787c7 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumDresserGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumDresser_Highlight.png b/Tiles/FurnitureWulfrum/WulfrumDresser_Highlight.png new file mode 100644 index 0000000000..96cce9973d Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumDresser_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumLamp.cs b/Tiles/FurnitureWulfrum/WulfrumLamp.cs new file mode 100644 index 0000000000..c70b3b14a4 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumLamp.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumLamp : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpLamp(); + AddMapEntry(new Color(253, 221, 3), Language.GetText("MapObject.FloorLamp")); + + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.Lamps }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 3); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumLampFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumLamp.png b/Tiles/FurnitureWulfrum/WulfrumLamp.png new file mode 100644 index 0000000000..ffe8ffd5ff Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumLamp.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumLampFlame.png b/Tiles/FurnitureWulfrum/WulfrumLampFlame.png new file mode 100644 index 0000000000..4a11ae334f Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumLampFlame.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumLantern.cs b/Tiles/FurnitureWulfrum/WulfrumLantern.cs new file mode 100644 index 0000000000..75bacb76f8 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumLantern.cs @@ -0,0 +1,73 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumLantern : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.addTile(Type); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Lantern")); + + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.HangingLanterns }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.8f; + g = 0.9f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 3); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumLanternFlame").Value, i, j); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumLantern.png b/Tiles/FurnitureWulfrum/WulfrumLantern.png new file mode 100644 index 0000000000..4eda4d5984 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumLantern.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumLanternFlame.png b/Tiles/FurnitureWulfrum/WulfrumLanternFlame.png new file mode 100644 index 0000000000..8a4b6a04cb Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumLanternFlame.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumPiano.cs b/Tiles/FurnitureWulfrum/WulfrumPiano.cs new file mode 100644 index 0000000000..9c456d7fbd --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumPiano.cs @@ -0,0 +1,49 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumPiano : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpPiano(true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Piano"); + AddMapEntry(new Color(71, 95, 114), name); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumPianoGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumPiano.png b/Tiles/FurnitureWulfrum/WulfrumPiano.png new file mode 100644 index 0000000000..7c6350a441 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumPiano.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumPianoGlow.png b/Tiles/FurnitureWulfrum/WulfrumPianoGlow.png new file mode 100644 index 0000000000..a254032448 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumPianoGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumPlating.cs b/Tiles/FurnitureWulfrum/WulfrumPlating.cs new file mode 100644 index 0000000000..777f0645e5 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumPlating.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumPlating : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + private const short subsheetWidth = 324; + private const short subsheetHeight = 90; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + HitSound = MinePlatingSound; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(155, 171, 117)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 2; + int yPos = j % 2; + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumPlating.png b/Tiles/FurnitureWulfrum/WulfrumPlating.png new file mode 100644 index 0000000000..47559138c5 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumPlating.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumSink.cs b/Tiles/FurnitureWulfrum/WulfrumSink.cs new file mode 100644 index 0000000000..0135d54b7b --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumSink.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumSink : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpSink(); + AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Sink")); + AdjTiles = new int[] { TileID.Sinks }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumSinkGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumSink.png b/Tiles/FurnitureWulfrum/WulfrumSink.png new file mode 100644 index 0000000000..c4ec8b3120 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumSink.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumSinkGlow.png b/Tiles/FurnitureWulfrum/WulfrumSinkGlow.png new file mode 100644 index 0000000000..ff2ff022aa Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumSinkGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumSofa.cs b/Tiles/FurnitureWulfrum/WulfrumSofa.cs new file mode 100644 index 0000000000..e4629ea2a0 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumSofa.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumSofa : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpSofa(); + AddMapEntry(new Color(71, 95, 114), Language.GetText("Bench")); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumSofaGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumSofa.png b/Tiles/FurnitureWulfrum/WulfrumSofa.png new file mode 100644 index 0000000000..53027eb7c3 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumSofa.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumSofaGlow.png b/Tiles/FurnitureWulfrum/WulfrumSofaGlow.png new file mode 100644 index 0000000000..f8b2bd66d8 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumSofaGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumSofa_Highlight.png b/Tiles/FurnitureWulfrum/WulfrumSofa_Highlight.png new file mode 100644 index 0000000000..adc80ab781 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumSofa_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumTable.cs b/Tiles/FurnitureWulfrum/WulfrumTable.cs new file mode 100644 index 0000000000..c56497ee4a --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumTable.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumTable : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTable(); + AddMapEntry(new Color(71, 95, 114), Language.GetText("MapObject.Table")); + AdjTiles = new int[] { TileID.Tables }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumTableGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumTable.png b/Tiles/FurnitureWulfrum/WulfrumTable.png new file mode 100644 index 0000000000..f50c5cae48 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumTable.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumTableGlow.png b/Tiles/FurnitureWulfrum/WulfrumTableGlow.png new file mode 100644 index 0000000000..61958c441b Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumTableGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumToilet.cs b/Tiles/FurnitureWulfrum/WulfrumToilet.cs new file mode 100644 index 0000000000..0d6eff8d81 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumToilet.cs @@ -0,0 +1,110 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumToilet : ModTile + { + public const int NextStyleHeight = 40; + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + + // Toilets count as Chairs + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Wulfrum Toilet"); + AddMapEntry(new Color(71, 95, 114), name); + TileID.Sets.CanBeSatOnForNPCs[Type] = true; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + AdjTiles = new int[] { TileID.Chairs }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 32, ModContent.ItemType()); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumToiletGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, NextStyleHeight, true); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + + public override void HitWire(int i, int j) // I hate this please make it stop. - Merkalto + { + Tile tile = Main.tile[i, j]; + + int spawnX = i; + int spawnY = j - (tile.TileFrameY % NextStyleHeight) / 18; + + Wiring.SkipWire(spawnX, spawnY); + Wiring.SkipWire(spawnX, spawnY + 1); + + if (Wiring.CheckMech(spawnX, spawnY, 60)) + { + Projectile.NewProjectile(Wiring.GetProjectileSource(spawnX, spawnY), spawnX * 16 + 8, spawnY * 16 + 12, 0f, 0f, ProjectileID.ToiletEffect, 0, 0f, Main.myPlayer); + } + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumToilet.png b/Tiles/FurnitureWulfrum/WulfrumToilet.png new file mode 100644 index 0000000000..d1eece6a6d Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumToilet.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumToiletGlow.png b/Tiles/FurnitureWulfrum/WulfrumToiletGlow.png new file mode 100644 index 0000000000..86c93d0d65 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumToiletGlow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumToilet_Highlight.png b/Tiles/FurnitureWulfrum/WulfrumToilet_Highlight.png new file mode 100644 index 0000000000..3b60ee7afd Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumToilet_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumWorkbench.cs b/Tiles/FurnitureWulfrum/WulfrumWorkbench.cs new file mode 100644 index 0000000000..9251bb2f85 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumWorkbench.cs @@ -0,0 +1,65 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumWorkbench : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.addTile(Type); + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Work Bench"); + AddMapEntry(new Color(71, 95, 114), name); + TileID.Sets.DisableSmartCursor[Type] = true; + AdjTiles = new int[] { TileID.WorkBenches }; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 16, ModContent.ItemType()); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumWorkbenchGlow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumWorkbench.png b/Tiles/FurnitureWulfrum/WulfrumWorkbench.png new file mode 100644 index 0000000000..bc426b72c7 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumWorkbench.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumWorkbenchGlow.png b/Tiles/FurnitureWulfrum/WulfrumWorkbenchGlow.png new file mode 100644 index 0000000000..f7425e7835 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumWorkbenchGlow.png differ diff --git a/Tiles/GiantPlanteraBulb.cs b/Tiles/GiantPlanteraBulb.cs new file mode 100644 index 0000000000..a2959b5788 --- /dev/null +++ b/Tiles/GiantPlanteraBulb.cs @@ -0,0 +1,169 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; +using System; + +namespace CalamityMod.Tiles +{ + public class GiantPlanteraBulb : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(2, 4); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AnimationFrameHeight = 90; + MineResist = 3f; + AddMapEntry(Main.hardMode ? new Color(243, 82, 171) : new Color(107, 125, 33)); + DustType = DustID.PlanteraBulb; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + type = (!WorldGen.genRand.NextBool(3) && Main.hardMode) ? DustID.Plantera_Pink : DustID.Plantera_Green; + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override bool CanKillTile(int i, int j, ref bool blockDamaged) + { + return Main.hardMode; + } + + public override bool CanExplode(int i, int j) + { + return Main.hardMode; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + float x = i * 16; + float y = j * 16; + float distanceFromPlayer = -1f; + int player = 0; + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + float dist = Math.Abs(Main.player[playerIndex].position.X - x) + Math.Abs(Main.player[playerIndex].position.Y - y); + if (dist < distanceFromPlayer || distanceFromPlayer == -1f) + { + player = playerIndex; + distanceFromPlayer = dist; + } + } + + // Spawn Plantera if the bulb was broken within a distance of 50 tiles or less + if (distanceFromPlayer / 16f < 50f) + { + float projectileVelocity = 6f; + int projType = ProjectileID.SporeCloud; + int npcType = NPCID.Spore; + Vector2 spawn = new Vector2((i + 2) * 16 + 8, (j + 4) * 16 + 8); + Vector2 dustSpawn = new Vector2((i + 2) * 16, (j + 4) * 16); + SoundEngine.PlaySound(SoundID.Item74, spawn); + Vector2 destination = new Vector2((i + 2) * 16 + 8, j * 16 + 8) - spawn; + destination.Normalize(); + destination *= projectileVelocity; + int numProj = 30; + int numNPCs = 10; + float rotation = MathHelper.ToRadians(100); + + for (int projIndex = 0; projIndex < numProj; projIndex++) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, projIndex / (float)(numProj - 1))) * (Main.rand.NextFloat() + 0.25f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(new EntitySource_TileBreak(i, j), spawn, perturbedSpeed, projType, 0, 0f, Player.FindClosest(new Vector2(i * 16, j * 16), 16, 16)); + + perturbedSpeed *= 2f; + Dust dust = Dust.NewDustDirect(dustSpawn, 16, 16, DustID.JungleSpore, perturbedSpeed.X, perturbedSpeed.Y, 250); + dust.fadeIn = 0.7f; + Dust.NewDustDirect(dustSpawn, 16, 16, (!WorldGen.genRand.NextBool(3) && Main.hardMode) ? DustID.Plantera_Pink : DustID.Plantera_Green, perturbedSpeed.X, perturbedSpeed.Y); + } + + for (int npcIndex = 0; npcIndex < numNPCs; npcIndex++) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, npcIndex / (float)(numNPCs - 1))) * (Main.rand.NextFloat() + 0.5f) * 0.5f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spore = NPC.NewNPC(new EntitySource_TileBreak(i, j), (int)spawn.X, (int)spawn.Y, npcType, 0, -1f); + Main.npc[spore].velocity.X = perturbedSpeed.X; + Main.npc[spore].velocity.Y = perturbedSpeed.Y; + Main.npc[spore].netUpdate = true; + } + + perturbedSpeed *= 2f; + Dust dust = Dust.NewDustDirect(dustSpawn, 16, 16, DustID.JungleSpore, perturbedSpeed.X, perturbedSpeed.Y, 250); + dust.fadeIn = 0.7f; + Dust.NewDustDirect(dustSpawn, 16, 16, DustID.Plantera_Pink, perturbedSpeed.X, perturbedSpeed.Y); + } + + NPC.SpawnOnPlayer(player, NPCID.Plantera); + } + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + if (Main.hardMode) + { + frameCounter++; + if (frameCounter > 25) + { + frameCounter = 0; + frame++; + if (frame > 6) + { + frame = 1; + } + } + } + else + { + frame = 0; + } + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.hardMode) + { + r = 243f / 500f; + g = 82f / 500f; + b = 171f / 500f; + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/GiantPlanteraBulbGlow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.Yellow); + } + } +} diff --git a/Tiles/GiantPlanteraBulb.png b/Tiles/GiantPlanteraBulb.png new file mode 100644 index 0000000000..b8d61db2f9 Binary files /dev/null and b/Tiles/GiantPlanteraBulb.png differ diff --git a/Tiles/GiantPlanteraBulbGlow.png b/Tiles/GiantPlanteraBulbGlow.png new file mode 100644 index 0000000000..ee8617bad5 Binary files /dev/null and b/Tiles/GiantPlanteraBulbGlow.png differ diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index d0c4c374a9..c5b368c0d6 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/MusicBoxes/DraedonsAmbienceMusicBoxTile.cs b/Tiles/MusicBoxes/DraedonsAmbienceMusicBox.cs similarity index 80% rename from Tiles/MusicBoxes/DraedonsAmbienceMusicBoxTile.cs rename to Tiles/MusicBoxes/DraedonsAmbienceMusicBox.cs index 433537839d..d25cc53789 100644 --- a/Tiles/MusicBoxes/DraedonsAmbienceMusicBoxTile.cs +++ b/Tiles/MusicBoxes/DraedonsAmbienceMusicBox.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Placeables.MusicBoxes; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; @@ -9,7 +8,8 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.MusicBoxes { - public class DraedonsAmbienceMusicBoxTile : ModTile + [LegacyName("DraedonsAmbienceMusicBoxTile")] + public class DraedonsAmbienceMusicBox : ModTile { public override void SetStaticDefaults() { @@ -23,12 +23,12 @@ namespace CalamityMod.Tiles.MusicBoxes TileID.Sets.DisableSmartCursor[Type] = true; ModTranslation name = CreateMapEntryName(); name.SetDefault("Music Box"); - AddMapEntry(new Color(200, 200, 200), name); + AddMapEntry(new Color(191, 142, 111), name); } public override void KillMultiTile(int i, int j, int frameX, int frameY) { - Item.NewItem(new EntitySource_TileBreak(i * 16, j * 16), i * 16, j * 16, 16, 48, ModContent.ItemType()); + Item.NewItem(new EntitySource_TileBreak(i * 16, j * 16), i * 16, j * 16, 16, 48, ModContent.ItemType()); } public override void MouseOver(int i, int j) @@ -36,7 +36,12 @@ namespace CalamityMod.Tiles.MusicBoxes Player player = Main.LocalPlayer; player.noThrow = 2; player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + return false; } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/MusicBoxes/DraedonsAmbienceMusicBoxTile.png b/Tiles/MusicBoxes/DraedonsAmbienceMusicBox.png similarity index 100% rename from Tiles/MusicBoxes/DraedonsAmbienceMusicBoxTile.png rename to Tiles/MusicBoxes/DraedonsAmbienceMusicBox.png diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index b35e5024cd..e7cca19b3c 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -1,5 +1,8 @@  using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.Audio; using Terraria; using Terraria.ModLoader; using Terraria.ID; @@ -8,30 +11,273 @@ namespace CalamityMod.Tiles.Ores { public class AerialiteOre : ModTile { + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/MagicalRockMine", 3); + internal static Texture2D GlowTexture; public override void SetStaticDefaults() { + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AerialiteOreGlow", AssetRequestMode.ImmediateLoad).Value; Main.tileOreFinderPriority[Type] = 450; + Main.tileBlockLight[Type] = false; Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = true; + Main.tileNoSunLight[Type] = false; TileID.Sets.Ore[Type] = true; - TileID.Sets.OreMergesWithMud[Type] = true; - CalamityUtils.MergeWithGeneral(Type); + //CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.SetMerge(Type, TileID.Cloud); + CalamityUtils.SetMerge(Type, TileID.RainCloud); + CalamityUtils.SetMerge(Type, TileID.SnowCloud); + //Main.tileMerge[TileID.Cloud][ModContent.TileType()] = true; + + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = false; + + TileID.Sets.ChecksForMerge[Type] = true; + DustType = 33; ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Aerialite"); - AddMapEntry(new Color(0, 255, 255), name); + AddMapEntry(new Color(145, 255, 255), name); MineResist = 2f; MinPick = 65; - HitSound = SoundID.Tink; + HitSound = MineSound; Main.tileSpelunker[Type] = true; } + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + int animationFrameWidth = 288; public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud, false, false, false); + return false; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.14f; + g = 0.346f; + b = 0.42f; + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = 0; + int xPos = i % 4; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 2; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 3: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (GlowTexture is null) + return; + + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + int xOffset = 0; + int relativeXPos = i % 4; + int relativeYPos = j % 4; + switch (relativeXPos) + { + case 0: + switch (relativeYPos) + { + case 0: + xOffset = 0; + break; + case 1: + xOffset = 2; + break; + case 2: + xOffset = 1; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 1: + switch (relativeYPos) + { + case 0: + xOffset = 2; + break; + case 1: + xOffset = 0; + break; + case 2: + xOffset = 2; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 2: + switch (relativeYPos) + { + case 0: + xOffset = 2; + break; + case 1: + xOffset = 0; + break; + case 2: + xOffset = 1; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 3: + switch (relativeYPos) + { + case 0: + xOffset = 1; + break; + case 1: + xOffset = 2; + break; + case 2: + xOffset = 0; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + } + xOffset *= 288; + xPos += xOffset; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 50)); + Tile trackTile = Main.tile[i, j]; + + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + { + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.IsHalfBlock) + { + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } } } diff --git a/Tiles/Ores/AerialiteOre.png b/Tiles/Ores/AerialiteOre.png index 973ec03628..46e8cf4214 100644 Binary files a/Tiles/Ores/AerialiteOre.png and b/Tiles/Ores/AerialiteOre.png differ diff --git a/Tiles/Ores/AerialiteOreDisenchanted.cs b/Tiles/Ores/AerialiteOreDisenchanted.cs new file mode 100644 index 0000000000..b8436a156b --- /dev/null +++ b/Tiles/Ores/AerialiteOreDisenchanted.cs @@ -0,0 +1,164 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.Ores +{ + public class AerialiteOreDisenchanted : ModTile + { + public override void SetStaticDefaults() + { + Main.tileOreFinderPriority[Type] = 445; + Main.tileBlockLight[Type] = true; + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileLighted[Type] = true; + //Main.tileNoSunLight[Type] = false; + + TileID.Sets.Ore[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.SetMerge(Type, ModContent.TileType()); + CalamityUtils.SetMerge(Type, TileID.Cloud); + CalamityUtils.SetMerge(Type, TileID.RainCloud); + CalamityUtils.SetMerge(Type, TileID.SnowCloud); + //Main.tileMerge[TileID.Cloud][ModContent.TileType()] = true; + + //Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = false; + + TileID.Sets.ChecksForMerge[Type] = true; + DustType = 33; + ItemDrop = ModContent.ItemType(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Disenchanted Aerialite"); + AddMapEntry(new Color(204, 170, 81), name); + MineResist = 2f; + MinPick = 110; + HitSound = SoundID.Tink; + Main.tileSpelunker[Type] = true; + } + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + int animationFrameWidth = 288; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud, false, false, false); + return false; + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = 0; + int xPos = i % 4; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 2; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 3: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + } +} diff --git a/Tiles/Ores/AerialiteOreDisenchanted.png b/Tiles/Ores/AerialiteOreDisenchanted.png new file mode 100644 index 0000000000..e227f92d3b Binary files /dev/null and b/Tiles/Ores/AerialiteOreDisenchanted.png differ diff --git a/Tiles/Ores/AerialiteOreGlow.png b/Tiles/Ores/AerialiteOreGlow.png new file mode 100644 index 0000000000..be59ed0610 Binary files /dev/null and b/Tiles/Ores/AerialiteOreGlow.png differ diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 3237365afd..85642511f6 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -1,6 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,6 +41,22 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; } + public override void NearbyEffects(int i, int j, bool closer) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + if (closer && Main.rand.NextBool(60) && !up.HasTile && !up2.HasTile && j < Main.worldSurface) + { + //Cyan Cinders below + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, ModContent.DustType(), -0.4651165f, 0f, 17, new Color(0, 255, 244), 1.5f)]; + + //Orange Cinders below + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, ModContent.DustType(), -0.4651165f, 0f, 17, new Color(255, 255, 255), 1.5f)]; + + } + } public override bool CanKillTile(int i, int j, ref bool blockDamaged) { @@ -53,25 +73,20 @@ namespace CalamityMod.Tiles.Ores num = fail ? 1 : 3; } - public override void RandomUpdate(int i, int j) - { - if (Main.rand.Next(7) <= 2) - { - Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, 156, Main.rand.NextFloat(-0.05f, 0.05f), Main.rand.NextFloat(-0.05f, -0.001f)); - } - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.09f; - g = 0.03f; - b = 0.07f; - } - - public override void FloorVisuals(Player player) - { - player.AddBuff(ModContent.BuffType(), 2); - base.FloorVisuals(player); + float brightness = 0.7f; + brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.007f); + brightness *= (float)MathF.Sin(-i / 40f + Main.GameUpdateCount * 0.005f); + brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.006f); + brightness *= (float)MathF.Sin(-i / 40f + Main.GameUpdateCount * 0.009f); + brightness += 0.5f; + r = Main.DiscoR / 255f * 0.5f; + g = 0.5f; + b = (255 - Main.DiscoR) / 255f * 0.5f; + r *= brightness; + g *= brightness; + b *= brightness; } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/Ores/AstralOre.png b/Tiles/Ores/AstralOre.png index 0aca9d80b6..79bbef0832 100644 Binary files a/Tiles/Ores/AstralOre.png and b/Tiles/Ores/AstralOre.png differ diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index 31de72297d..44ff6b88e2 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -1,22 +1,35 @@ using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Tiles.Astral; using Terraria; using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; +using ReLogic.Content; +using Terraria.ObjectData; +using Microsoft.Xna.Framework.Graphics; +using Terraria.DataStructures; namespace CalamityMod.Tiles.Ores { public class AuricOre : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AuricMine", 3); + public static bool Animate; + internal static Texture2D GlowTexture; public override void SetStaticDefaults() { + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow", AssetRequestMode.ImmediateLoad).Value; + AnimationFrameHeight = 270; Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileSpelunker[Type] = true; Main.tileOreFinderPriority[Type] = 1000; + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = false; CalamityUtils.MergeWithGeneral(Type); @@ -26,7 +39,7 @@ namespace CalamityMod.Tiles.Ores DustType = 55; ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Auric Ore"); + name.SetDefault("Auric"); AddMapEntry(new Color(255, 200, 0), name); MineResist = 10f; MinPick = 250; @@ -45,9 +58,59 @@ namespace CalamityMod.Tiles.Ores public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.20f; - g = 0.16f; - b = 0.00f; + if (!Animate) + {return;} + r = 0.24f; + g = 0.40f; + b = 0.47f; + } + public override void AnimateTile(ref int frame, ref int frameCounter) + { + if (!Animate) + {return;} + frameCounter++; + if (frameCounter > 4) + { + frameCounter = 0; + frame++; + if (frame > 7) + { + Animate = false; + frame = 0; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY + AnimationFrameHeight * Main.tileFrame[Type]; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(225, 255, 255, 255)); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.IsHalfBlock) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; } } } diff --git a/Tiles/Ores/AuricOre.png b/Tiles/Ores/AuricOre.png index b61dcaafe6..15f0aa2a5e 100644 Binary files a/Tiles/Ores/AuricOre.png and b/Tiles/Ores/AuricOre.png differ diff --git a/Tiles/Ores/AuricOreGlow.png b/Tiles/Ores/AuricOreGlow.png new file mode 100644 index 0000000000..2b8417d30d Binary files /dev/null and b/Tiles/Ores/AuricOreGlow.png differ diff --git a/Tiles/Ores/CryonicOre.cs b/Tiles/Ores/CryonicOre.cs index 456e23b51e..6e2541c3f4 100644 --- a/Tiles/Ores/CryonicOre.cs +++ b/Tiles/Ores/CryonicOre.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.Ores public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.SnowBlock); + TileFraming.CustomMergeFrame(i, j, Type, TileID.SnowBlock, false, false, false); return false; } diff --git a/Tiles/Ores/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs index 889a46d151..02b2dee863 100644 --- a/Tiles/Ores/HallowedOre.cs +++ b/Tiles/Ores/HallowedOre.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +19,9 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.OreMergesWithMud[Type] = true; + Main.tileShine[Type] = 2000; + Main.tileShine2[Type] = true; + CalamityUtils.MergeWithGeneral(Type); ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); @@ -38,12 +42,17 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CustomMergeFrame(i, j, Type, TileID.Pearlstone, false, false, false); + return false; + } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.07f; - g = 0.07f; - b = 0.04f; + r = 224f / 600f; + g = 219f / 600f; + b = 124f / 600f; } } } diff --git a/Tiles/Ores/HallowedOre.png b/Tiles/Ores/HallowedOre.png index 35867adf23..221d242e9d 100644 Binary files a/Tiles/Ores/HallowedOre.png and b/Tiles/Ores/HallowedOre.png differ diff --git a/Tiles/Ores/CharredOre.cs b/Tiles/Ores/InfernalSuevite.cs similarity index 92% rename from Tiles/Ores/CharredOre.cs rename to Tiles/Ores/InfernalSuevite.cs index 532653c361..2a5e5840f6 100644 --- a/Tiles/Ores/CharredOre.cs +++ b/Tiles/Ores/InfernalSuevite.cs @@ -6,7 +6,8 @@ using Terraria.ID; namespace CalamityMod.Tiles.Ores { - public class CharredOre : ModTile + [LegacyName("CharredOre")] + public class InfernalSuevite : ModTile { private int sheetWidth = 288; private int sheetHeight = 270; @@ -23,9 +24,9 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; - ItemDrop = ModContent.ItemType(); + ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Charred Ore"); + name.SetDefault("Infernal Suevite"); AddMapEntry(new Color(17, 16, 26), name); MineResist = 6f; MinPick = 150; diff --git a/Tiles/Ores/CharredOre.png b/Tiles/Ores/InfernalSuevite.png similarity index 100% rename from Tiles/Ores/CharredOre.png rename to Tiles/Ores/InfernalSuevite.png diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index 20c7dec5ee..6ff54e7563 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -1,20 +1,28 @@  using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using System; namespace CalamityMod.Tiles.Ores { public class PerennialOre : ModTile { + internal static Texture2D GlowTexture; public override void SetStaticDefaults() { + if (!Main.dedServ) + GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/PerennialOreGlow", AssetRequestMode.ImmediateLoad).Value; Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileOreFinderPriority[Type] = 710; + Main.tileShine[Type] = 2500; + Main.tileShine2[Type] = true; CalamityUtils.MergeWithGeneral(Type); @@ -23,13 +31,14 @@ namespace CalamityMod.Tiles.Ores ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Perennial Ore"); + name.SetDefault("Perennial"); AddMapEntry(new Color(200, 250, 100), name); MineResist = 3f; MinPick = 200; HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; } + int animationFrameWidth = 288; public override bool CanExplode(int i, int j) { @@ -40,12 +49,327 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.04f; - g = 0.10f; - b = 0.02f; + //The base green color glow + r = 0.08f; + g = 0.2f; + b = 0.04f; + var tile = Main.tile[i, j]; + var pos = new Vector2(tile.TileFrameX, tile.TileFrameY); + + Vector2[] positionsFlower = new Vector2[] + { + //Top row (always y = 0 on tile sheets) + new Vector2(0, 0), + new Vector2(36, 0), + new Vector2(72, 0), + new Vector2(252, 0), + + //Second row (always y = 18 on tile sheets) + new Vector2(18, 18), + new Vector2(54, 18), + new Vector2(252, 18), + + //Third row (always y = 36 on tile sheets) + new Vector2(36, 36), + new Vector2(252, 36), + + //Forth row (always y = 54 on tile sheets) + new Vector2(250, 54), + + //Nothing on fifth row (always y = 72 on tile sheets) + + //Sixth row (always y = 90 on tile sheets) + new Vector2(72, 90), + new Vector2(90, 90), + new Vector2(144, 90), + new Vector2(180, 90), + new Vector2(198, 90), + new Vector2(216, 90), + + //Seventh row (always y = 108 on tile sheets) + new Vector2(72, 108), + new Vector2(144, 108), + new Vector2(180, 108), + + //Eighth row (always y = 126 on tile sheets) + new Vector2(0, 126), + new Vector2(18, 126), + new Vector2(36, 126), + new Vector2(54, 126), + new Vector2(144, 126), + new Vector2(162, 126), + new Vector2(180, 126), + new Vector2(198, 126), + new Vector2(216, 126), + + //Ninth row (always y = 144 on tile sheets) + new Vector2(0, 144), + new Vector2(18, 144), + new Vector2(36, 144), + new Vector2(54, 144), + new Vector2(72, 144), + new Vector2(90, 144), + new Vector2(198, 144), + new Vector2(216, 144), + //Tenth row (always y = 162 on tile sheets) + new Vector2(0, 162), + new Vector2(18, 162), + new Vector2(36, 162), + new Vector2(54, 162), + new Vector2(72, 162), + new Vector2(144, 162), + new Vector2(162, 162), + new Vector2(180, 162), + //Eleventh row (always y = 180 on tile sheets) + new Vector2(0, 180), + new Vector2(18, 180), + new Vector2(36, 180), + new Vector2(54, 180), + new Vector2(144, 180), + new Vector2(180, 180), + new Vector2(198, 180), + new Vector2(216, 180), + //Twelfth row (always y = 198 on tile sheets) + new Vector2(18, 198), + new Vector2(72, 198), + new Vector2(108, 198), + new Vector2(144, 198), + //Thirteenth row (always y = 216 on tile sheets) + new Vector2(18, 216), + new Vector2(72, 216), + //Nothing on fourteenth row (always y = 249 on tile sheets) + + //Nothing on fifteenth row (always y = 252 on tile sheets) + }; + foreach (var positionFlower in positionsFlower) + { + if (pos == positionFlower) + { + float brightness = 0.7f; + brightness *= (float)MathF.Sin(j / 14f + Main.GameUpdateCount * 0.017f); + brightness *= (float)MathF.Sin(i / 14f + Main.GameUpdateCount * 0.017f); + brightness += 0.3f; + r = 0.83f; + g = 0.16f; + b = 0.31f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = 0; + int xPos = i % 4; + int yPos = j % 4; + switch (xPos) + { + case 0: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 0; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 1: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 2; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 2: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 2; + break; + case 1: + uniqueAnimationFrameX = 0; + break; + case 2: + uniqueAnimationFrameX = 1; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + case 3: + switch (yPos) + { + case 0: + uniqueAnimationFrameX = 1; + break; + case 1: + uniqueAnimationFrameX = 2; + break; + case 2: + uniqueAnimationFrameX = 0; + break; + case 3: + uniqueAnimationFrameX = 2; + break; + default: + uniqueAnimationFrameX = 2; + break; + } + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (GlowTexture is null) + return; + + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + int xOffset = 0; + int relativeXPos = i % 4; + int relativeYPos = j % 4; + switch (relativeXPos) + { + case 0: + switch (relativeYPos) + { + case 0: + xOffset = 0; + break; + case 1: + xOffset = 2; + break; + case 2: + xOffset = 1; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 1: + switch (relativeYPos) + { + case 0: + xOffset = 2; + break; + case 1: + xOffset = 0; + break; + case 2: + xOffset = 2; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 2: + switch (relativeYPos) + { + case 0: + xOffset = 2; + break; + case 1: + xOffset = 0; + break; + case 2: + xOffset = 1; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + case 3: + switch (relativeYPos) + { + case 0: + xOffset = 1; + break; + case 1: + xOffset = 2; + break; + case 2: + xOffset = 0; + break; + case 3: + xOffset = 2; + break; + default: + xOffset = 2; + break; + } + break; + } + xOffset *= 288; + xPos += xOffset; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(175, 175, 175, 175)); + Tile trackTile = Main.tile[i, j]; + + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + { + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.IsHalfBlock) + { + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; } } } diff --git a/Tiles/Ores/PerennialOre.png b/Tiles/Ores/PerennialOre.png index 9e8f6cd3e5..799dc2347c 100644 Binary files a/Tiles/Ores/PerennialOre.png and b/Tiles/Ores/PerennialOre.png differ diff --git a/Tiles/Ores/PerennialOreGlow.png b/Tiles/Ores/PerennialOreGlow.png new file mode 100644 index 0000000000..7a768a55ad Binary files /dev/null and b/Tiles/Ores/PerennialOreGlow.png differ diff --git a/Tiles/Ores/ChaoticOre.cs b/Tiles/Ores/ScoriaOre.cs similarity index 83% rename from Tiles/Ores/ChaoticOre.cs rename to Tiles/Ores/ScoriaOre.cs index a78a100c17..2dc48d0d8a 100644 --- a/Tiles/Ores/ChaoticOre.cs +++ b/Tiles/Ores/ScoriaOre.cs @@ -6,9 +6,11 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Tiles.Ores { - public class ChaoticOre : ModTile + [LegacyName("ChaoticOre")] + public class ScoriaOre : ModTile { public override void SetStaticDefaults() { @@ -26,7 +28,7 @@ namespace CalamityMod.Tiles.Ores ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Scoria"); - AddMapEntry(new Color(255, 0, 0), name); + AddMapEntry(new Color(210, 101, 28), name); MineResist = 4f; MinPick = 210; HitSound = SoundID.Tink; @@ -34,6 +36,20 @@ namespace CalamityMod.Tiles.Ores public override void NearbyEffects(int i, int j, bool closer) { + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + if (closer && Main.rand.NextBool(30) && !up.HasTile && !up2.HasTile) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, 127, 0f, -10f, 47, new Color(255, 255, 255), 1.0465117f)]; + dust.noGravity = true; + dust.fadeIn = 1.2209302f; + + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, 31, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; + dust.noGravity = false; + dust.fadeIn = 1.4209302f; + + } if (!closer && j < Main.maxTilesY - 205) { if (Main.tile[i, j].LiquidAmount <= 0) @@ -46,7 +62,7 @@ namespace CalamityMod.Tiles.Ores { return; } - if (closer && Main.rand.NextBool(300)) + if (closer && Main.rand.NextBool(400)) { int tileLocationY = j + 1; if (Main.tile[i, tileLocationY] != null) @@ -71,7 +87,7 @@ namespace CalamityMod.Tiles.Ores { num = fail ? 1 : 3; } - + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.04f; @@ -89,7 +105,7 @@ namespace CalamityMod.Tiles.Ores { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/ChaoticOreGlow").Value; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/ScoriaOreGlow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); diff --git a/Tiles/Ores/ChaoticOre.png b/Tiles/Ores/ScoriaOre.png similarity index 100% rename from Tiles/Ores/ChaoticOre.png rename to Tiles/Ores/ScoriaOre.png diff --git a/Tiles/Ores/ChaoticOreGlow.png b/Tiles/Ores/ScoriaOreGlow.png similarity index 100% rename from Tiles/Ores/ChaoticOreGlow.png rename to Tiles/Ores/ScoriaOreGlow.png diff --git a/Tiles/Ores/UelibloomOre.png b/Tiles/Ores/UelibloomOre.png index 193f42016f..040a09a159 100644 Binary files a/Tiles/Ores/UelibloomOre.png and b/Tiles/Ores/UelibloomOre.png differ diff --git a/Tiles/PerennialBar.png b/Tiles/PerennialBar.png index 903a3943ff..5bdae4a3ea 100644 Binary files a/Tiles/PerennialBar.png and b/Tiles/PerennialBar.png differ diff --git a/Tiles/Plates/Cinderplate.cs b/Tiles/Plates/Cinderplate.cs index 0db0ff6f84..b6c5b63097 100644 --- a/Tiles/Plates/Cinderplate.cs +++ b/Tiles/Plates/Cinderplate.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; using ReLogic.Content; @@ -10,6 +11,7 @@ namespace CalamityMod.Tiles.Plates { public class Cinderplate : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; @@ -28,7 +30,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; MineResist = 1f; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(242, 216, 131)); @@ -58,7 +60,7 @@ namespace CalamityMod.Tiles.Plates Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; // Glowmask 'pulse' effect - int factor = (int)Main.time % PulseTexture.Width; + int factor = (int)Main.GameUpdateCount % PulseTexture.Width; float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); diff --git a/Tiles/Plates/Elumplate.cs b/Tiles/Plates/Elumplate.cs index 2f848778d2..c0c4d6bae2 100644 --- a/Tiles/Plates/Elumplate.cs +++ b/Tiles/Plates/Elumplate.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; using ReLogic.Content; @@ -10,6 +11,7 @@ namespace CalamityMod.Tiles.Plates { public class Elumplate : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; @@ -28,7 +30,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; MineResist = 1f; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(121, 180, 212)); @@ -58,7 +60,7 @@ namespace CalamityMod.Tiles.Plates Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; // Glowmask 'pulse' effect - int factor = (int)Main.time % PulseTexture.Width; + int factor = (int)Main.GameUpdateCount % PulseTexture.Width; float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); diff --git a/Tiles/Plates/Chaosplate.cs b/Tiles/Plates/Havocplate.cs similarity index 89% rename from Tiles/Plates/Chaosplate.cs rename to Tiles/Plates/Havocplate.cs index 1a09dca902..34dd626a97 100644 --- a/Tiles/Plates/Chaosplate.cs +++ b/Tiles/Plates/Havocplate.cs @@ -2,14 +2,17 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; using ReLogic.Content; namespace CalamityMod.Tiles.Plates { - public class Chaosplate : ModTile + [LegacyName("Chaosplate")] + public class Havocplate : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; @@ -18,10 +21,10 @@ namespace CalamityMod.Tiles.Plates { if (!Main.dedServ) { - PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/ChaosplatePulse", AssetRequestMode.ImmediateLoad).Value; + PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/HavocplatePulse", AssetRequestMode.ImmediateLoad).Value; PulseColors = new Color[PulseTexture.Width]; Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors)); - GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/ChaosplateGlow", AssetRequestMode.ImmediateLoad).Value; + GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/HavocplateGlow", AssetRequestMode.ImmediateLoad).Value; } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -29,9 +32,9 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; MineResist = 1f; - ItemDrop = ModContent.ItemType(); + ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(235, 108, 108)); } @@ -59,7 +62,7 @@ namespace CalamityMod.Tiles.Plates Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; // Glowmask 'pulse' effect - int factor = (int)Main.time % PulseTexture.Width; + int factor = (int)Main.GameUpdateCount % PulseTexture.Width; float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); diff --git a/Tiles/Plates/Chaosplate.png b/Tiles/Plates/Havocplate.png similarity index 100% rename from Tiles/Plates/Chaosplate.png rename to Tiles/Plates/Havocplate.png diff --git a/Tiles/Plates/ChaosplateGlow.png b/Tiles/Plates/HavocplateGlow.png similarity index 100% rename from Tiles/Plates/ChaosplateGlow.png rename to Tiles/Plates/HavocplateGlow.png diff --git a/Tiles/Plates/ChaosplatePulse.png b/Tiles/Plates/HavocplatePulse.png similarity index 100% rename from Tiles/Plates/ChaosplatePulse.png rename to Tiles/Plates/HavocplatePulse.png diff --git a/Tiles/Plates/Navyplate.cs b/Tiles/Plates/Navyplate.cs index 1d6cd3bb13..7f7a0356d6 100644 --- a/Tiles/Plates/Navyplate.cs +++ b/Tiles/Plates/Navyplate.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; using ReLogic.Content; @@ -10,6 +11,7 @@ namespace CalamityMod.Tiles.Plates { public class Navyplate : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; @@ -28,7 +30,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; MineResist = 1f; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(85, 151, 196)); @@ -58,7 +60,7 @@ namespace CalamityMod.Tiles.Plates Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; // Glowmask 'pulse' effect - int factor = (int)Main.time % PulseTexture.Width; + int factor = (int)Main.GameUpdateCount % PulseTexture.Width; float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); diff --git a/Tiles/Plates/Onyxplate.cs b/Tiles/Plates/Onyxplate.cs new file mode 100644 index 0000000000..c3d01c655d --- /dev/null +++ b/Tiles/Plates/Onyxplate.cs @@ -0,0 +1,83 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; +using Terraria.ID; +using ReLogic.Content; + +namespace CalamityMod.Tiles.Plates +{ + public class Onyxplate : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + internal static Texture2D GlowTexture; + internal static Texture2D PulseTexture; + internal static Color[] PulseColors; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + PulseTexture = ModContent.Request("CalamityMod/Tiles/Plates/OnyxplatePulse", AssetRequestMode.ImmediateLoad).Value; + PulseColors = new Color[PulseTexture.Width]; + Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors)); + GlowTexture = ModContent.Request("CalamityMod/Tiles/Plates/OnyxplateGlow", AssetRequestMode.ImmediateLoad).Value; + } + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + HitSound = MinePlatingSound; + MineResist = 1f; + DustType = 173; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(182, 28, 232)); + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null || PulseTexture is null) + return; + + int xPos = Main.tile[i, j].TileFrameX; + int yPos = Main.tile[i, j].TileFrameY; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + + // Glowmask 'pulse' effect + int factor = (int)Main.GameUpdateCount % PulseTexture.Width; + float brightness = PulseColors[factor].R / 255f; + int drawBrightness = (int)(80 * brightness) + 10; + Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); + + // If these tiles cause lag, comment out the pulse effect code and uncomment this: + //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + { + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.IsHalfBlock) + { + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + } +} diff --git a/Tiles/Plates/Onyxplate.png b/Tiles/Plates/Onyxplate.png new file mode 100644 index 0000000000..4498318a7e Binary files /dev/null and b/Tiles/Plates/Onyxplate.png differ diff --git a/Tiles/Plates/OnyxplateGlow.png b/Tiles/Plates/OnyxplateGlow.png new file mode 100644 index 0000000000..a5d343aca4 Binary files /dev/null and b/Tiles/Plates/OnyxplateGlow.png differ diff --git a/Tiles/Plates/OnyxplatePulse.png b/Tiles/Plates/OnyxplatePulse.png new file mode 100644 index 0000000000..2dfaed8013 Binary files /dev/null and b/Tiles/Plates/OnyxplatePulse.png differ diff --git a/Tiles/Plates/PlagueContainmentCells.cs b/Tiles/Plates/PlagueContainmentCells.cs index 3cd7c463b6..34976e9a09 100644 --- a/Tiles/Plates/PlagueContainmentCells.cs +++ b/Tiles/Plates/PlagueContainmentCells.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ModLoader; using Terraria.ID; using ReLogic.Content; @@ -9,6 +10,7 @@ namespace CalamityMod.Tiles.Plates { public class PlagueContainmentCells : ModTile { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); internal static Texture2D GlowTexture; internal static Texture2D PulseTexture; internal static Color[] PulseColors; @@ -27,7 +29,7 @@ namespace CalamityMod.Tiles.Plates CalamityUtils.MergeWithGeneral(Type); - HitSound = SoundID.Tink; + HitSound = MinePlatingSound; MineResist = 1f; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(128, 188, 67)); @@ -62,7 +64,7 @@ namespace CalamityMod.Tiles.Plates Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; // Glowmask 'pulse' effect - int factor = (int)Main.time % PulseTexture.Width; + int factor = (int)Main.GameUpdateCount % PulseTexture.Width; float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); diff --git a/Tiles/Pylons/SunkenPylonTile.png b/Tiles/Pylons/SunkenPylonTile.png index c655af00f3..bbdcf59df6 100644 Binary files a/Tiles/Pylons/SunkenPylonTile.png and b/Tiles/Pylons/SunkenPylonTile.png differ diff --git a/Tiles/Pylons/SunkenPylonTile_MapIcon.png b/Tiles/Pylons/SunkenPylonTile_MapIcon.png index 86c0da568a..9ed6162d23 100644 Binary files a/Tiles/Pylons/SunkenPylonTile_MapIcon.png and b/Tiles/Pylons/SunkenPylonTile_MapIcon.png differ diff --git a/Tiles/ScoriaBrick.cs b/Tiles/ScoriaBrick.cs index 4a5659aa1b..3fde2fc30b 100644 --- a/Tiles/ScoriaBrick.cs +++ b/Tiles/ScoriaBrick.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Tiles [LegacyName("ChaoticBrick")] public class ScoriaBrick : ModTile { + int subsheetHeight = 72; + int subsheetWidth = 216; internal static Texture2D GlowTexture; public override void SetStaticDefaults() { @@ -23,7 +25,7 @@ namespace CalamityMod.Tiles Main.tileBlockLight[Type] = true; DustType = 105; ItemDrop = ModContent.ItemType(); - AddMapEntry(new Color(255, 0, 0)); + AddMapEntry(new Color(85, 87, 101)); HitSound = SoundID.Tink; } @@ -41,8 +43,8 @@ namespace CalamityMod.Tiles public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - int frameOffset = (i + j) % 2; - frameYOffset = frameOffset * AnimationFrameHeight; + int yPos = j % 2; + frameYOffset = yPos * subsheetHeight; } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) @@ -59,7 +61,7 @@ namespace CalamityMod.Tiles Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); int xPos = tile.TileFrameX; - int frameOffset = (i + j) % 2 * AnimationFrameHeight; + int frameOffset = j % 2 * 72; int yPos = tile.TileFrameY + frameOffset; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; diff --git a/Tiles/SunkenSea/AlgalPrismTorch.cs b/Tiles/SunkenSea/AlgalPrismTorch.cs new file mode 100644 index 0000000000..e090cb3317 --- /dev/null +++ b/Tiles/SunkenSea/AlgalPrismTorch.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class AlgalPrismTorch : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTorch(true, true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Torch"); + AddMapEntry(new Color(253, 221, 3), name); + TileID.Sets.DisableSmartCursor[Type] = true; + ItemDrop = ModContent.ItemType(); + AdjTiles = new int[] { TileID.Torches }; + TileID.Sets.Torch[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(150, 255, 190), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameX < 66) + { + r = 0.7f; + g = 1.2f; + b = 0.9f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/SunkenSea/AlgalPrismTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(61, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneSunkenSea ? 1f : -1f; + } + } +} diff --git a/Tiles/SunkenSea/AlgalPrismTorch.png b/Tiles/SunkenSea/AlgalPrismTorch.png new file mode 100644 index 0000000000..c03ce1f3ca Binary files /dev/null and b/Tiles/SunkenSea/AlgalPrismTorch.png differ diff --git a/Tiles/SunkenSea/AlgalPrismTorchFlame.png b/Tiles/SunkenSea/AlgalPrismTorchFlame.png new file mode 100644 index 0000000000..9c3219e140 Binary files /dev/null and b/Tiles/SunkenSea/AlgalPrismTorchFlame.png differ diff --git a/Tiles/SunkenSea/BrainCoral.cs b/Tiles/SunkenSea/BrainCoral.cs index 62d79b213a..75c3c24c15 100644 --- a/Tiles/SunkenSea/BrainCoral.cs +++ b/Tiles/SunkenSea/BrainCoral.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 253; ModTranslation name = CreateMapEntryName(); name.SetDefault("Brain Coral"); - AddMapEntry(new Color(0, 0, 80)); + AddMapEntry(new Color(36, 61, 111)); MineResist = 3f; base.SetStaticDefaults(); @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.SunkenSea if (Main.tile[i, tileLocationY].LiquidAmount == 255 && Main.tile[i, tileLocationY - 1].LiquidAmount == 255 && Main.tile[i, tileLocationY - 2].LiquidAmount == 255) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(new EntitySource_WorldEvent(), (float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), i * 16 + 16, tileLocationY * 16 + 16, 0f, -0.1f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } } } diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 137ec91434..014107d667 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -15,6 +15,9 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); + Main.tileShine[Type] = 2000; + Main.tileShine2[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; @@ -22,20 +25,10 @@ namespace CalamityMod.Tiles.SunkenSea ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Eutrophic Sand"); - AddMapEntry(new Color(100, 100, 150), name); + AddMapEntry(new Color(92, 145, 167), name); MineResist = 2f; } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return DownedBossSystem.downedDesertScourge; - } - - public override bool CanExplode(int i, int j) - { - return DownedBossSystem.downedDesertScourge; - } - public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; @@ -43,8 +36,10 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Sandstone); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Sandstone, true, false, false); return false; + + //return TileFraming.BrimstoneFraming(i, j, resetFrame); } } } diff --git a/Tiles/SunkenSea/EutrophicSand.png b/Tiles/SunkenSea/EutrophicSand.png index 7743c95a6e..4dedca4989 100644 Binary files a/Tiles/SunkenSea/EutrophicSand.png and b/Tiles/SunkenSea/EutrophicSand.png differ diff --git a/Tiles/SunkenSea/FanCoral.cs b/Tiles/SunkenSea/FanCoral.cs index c15e036ea6..1a5fb65deb 100644 --- a/Tiles/SunkenSea/FanCoral.cs +++ b/Tiles/SunkenSea/FanCoral.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Enums; using Terraria.ModLoader; @@ -19,12 +19,17 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 253; ModTranslation name = CreateMapEntryName(); name.SetDefault("Fan Coral"); - AddMapEntry(new Color(0, 0, 80)); + AddMapEntry(new Color(54, 69, 72)); MineResist = 3f; base.SetStaticDefaults(); } + public override void NearbyEffects(int i, int j, bool closer) + { + CalamityGlobalTile.SetActiveFountainColor(ModContent.Find("CalamityMod/SunkenSeaWater").Slot); + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/SunkenSea/NavyPrismTorch.cs b/Tiles/SunkenSea/NavyPrismTorch.cs new file mode 100644 index 0000000000..bb60580fef --- /dev/null +++ b/Tiles/SunkenSea/NavyPrismTorch.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class NavyPrismTorch : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTorch(true, true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Torch"); + AddMapEntry(new Color(253, 221, 3), name); + TileID.Sets.DisableSmartCursor[Type] = true; + ItemDrop = ModContent.ItemType(); + AdjTiles = new int[] { TileID.Torches }; + TileID.Sets.Torch[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(170, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameX < 66) + { + r = 0.8f; + g = 1.2f; + b = 1.2f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/SunkenSea/NavyPrismTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(59, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneSunkenSea ? 1f : -1f; + } + } +} diff --git a/Tiles/SunkenSea/NavyPrismTorch.png b/Tiles/SunkenSea/NavyPrismTorch.png new file mode 100644 index 0000000000..28af9e2d85 Binary files /dev/null and b/Tiles/SunkenSea/NavyPrismTorch.png differ diff --git a/Tiles/SunkenSea/NavyPrismTorchFlame.png b/Tiles/SunkenSea/NavyPrismTorchFlame.png new file mode 100644 index 0000000000..3885816289 Binary files /dev/null and b/Tiles/SunkenSea/NavyPrismTorchFlame.png differ diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 87f79a3e6f..4767c2f632 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -14,27 +14,18 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); + //CalamityUtils.SetMerge(Type, ModContent.TileType()); TileID.Sets.ChecksForMerge[Type] = true; DustType = 96; ItemDrop = ModContent.ItemType(); ModTranslation name = CreateMapEntryName(); name.SetDefault("Navystone"); - AddMapEntry(new Color(0, 90, 90), name); + AddMapEntry(new Color(31, 92, 114), name); MineResist = 2f; HitSound = SoundID.Tink; } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return DownedBossSystem.downedDesertScourge; - } - - public override bool CanExplode(int i, int j) - { - return DownedBossSystem.downedDesertScourge; - } - public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; @@ -42,8 +33,10 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), true, true, false); return false; + + //return TileFraming.BrimstoneFraming(i, j, resetFrame); } } } diff --git a/Tiles/SunkenSea/Navystone.png b/Tiles/SunkenSea/Navystone.png index c8d67b12a2..e72385a27b 100644 Binary files a/Tiles/SunkenSea/Navystone.png and b/Tiles/SunkenSea/Navystone.png differ diff --git a/Tiles/SunkenSea/RefractivePrismTorch.cs b/Tiles/SunkenSea/RefractivePrismTorch.cs new file mode 100644 index 0000000000..0dab6c5ff0 --- /dev/null +++ b/Tiles/SunkenSea/RefractivePrismTorch.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class RefractivePrismTorch : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpTorch(true, true); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Torch"); + AddMapEntry(new Color(253, 221, 3), name); + TileID.Sets.DisableSmartCursor[Type] = true; + ItemDrop = ModContent.ItemType(); + AdjTiles = new int[] { TileID.Torches }; + TileID.Sets.Torch[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(210, 190, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Main.tile[i, j]; + if (tile.TileFrameX < 66) + { + r = 1f; + g = 0.9f; + b = 1.2f; + } + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = 0; + if (WorldGen.SolidTile(i, j - 1)) + { + offsetY = 2; + if (WorldGen.SolidTile(i - 1, j + 1) || WorldGen.SolidTile(i + 1, j + 1)) + { + offsetY = 4; + } + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/SunkenSea/RefractivePrismTorchFlame").Value, i, j, 2); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i, j].TileFrameX < 66) + CalamityUtils.DrawFlameSparks(62, 5, i, j); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + + public override float GetTorchLuck(Player player) + { + // Note: Total Torch luck never goes below zero + return player.Calamity().ZoneSunkenSea ? 1f : -1f; + } + } +} diff --git a/Tiles/SunkenSea/RefractivePrismTorch.png b/Tiles/SunkenSea/RefractivePrismTorch.png new file mode 100644 index 0000000000..d094f1d527 Binary files /dev/null and b/Tiles/SunkenSea/RefractivePrismTorch.png differ diff --git a/Tiles/SunkenSea/RefractivePrismTorchFlame.png b/Tiles/SunkenSea/RefractivePrismTorchFlame.png new file mode 100644 index 0000000000..936796c320 Binary files /dev/null and b/Tiles/SunkenSea/RefractivePrismTorchFlame.png differ diff --git a/Tiles/SunkenSea/SeaAnemone.cs b/Tiles/SunkenSea/SeaAnemone.cs index a54d426ec0..3506fe6c16 100644 --- a/Tiles/SunkenSea/SeaAnemone.cs +++ b/Tiles/SunkenSea/SeaAnemone.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 253; ModTranslation name = CreateMapEntryName(); name.SetDefault("Sea Anemone"); - AddMapEntry(new Color(0, 0, 80)); + AddMapEntry(new Color(54, 69, 72)); MineResist = 2f; base.SetStaticDefaults(); diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 3707ddcf61..5d1ce43dd2 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -5,8 +5,11 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { + public class SeaPrism : ModTile { + private const short subsheetWidth = 450; + private const short subsheetHeight = 270; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; @@ -15,6 +18,9 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; DustType = 33; ItemDrop = ModContent.ItemType(); @@ -24,27 +30,25 @@ namespace CalamityMod.Tiles.SunkenSea MineResist = 3f; HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; - } - - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return DownedBossSystem.downedDesertScourge; - } - - public override bool CanExplode(int i, int j) - { - return DownedBossSystem.downedDesertScourge; + MinPick = 55; } public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = i % 2 * subsheetWidth; + frameYOffset = j % 2 * subsheetHeight; + } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), true, true, false); return false; + + //return TileFraming.BrimstoneFraming(i, j, resetFrame); } } } diff --git a/Tiles/SunkenSea/SeaPrism.png b/Tiles/SunkenSea/SeaPrism.png index aea69ab4af..7eed62b890 100644 Binary files a/Tiles/SunkenSea/SeaPrism.png and b/Tiles/SunkenSea/SeaPrism.png differ diff --git a/Tiles/SunkenSea/SeaPrismBrick.cs b/Tiles/SunkenSea/SeaPrismBrick.cs new file mode 100644 index 0000000000..15d657a7a1 --- /dev/null +++ b/Tiles/SunkenSea/SeaPrismBrick.cs @@ -0,0 +1,51 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + + public class SeaPrismBrick : ModTile + { + private static int sheetWidth = 216; + private static int sheetHeight = 72; + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + CalamityUtils.MergeWithGeneral(Type); + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + DustType = 33; + ItemDrop = ModContent.ItemType(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Sea Prism Brick"); + AddMapEntry(new Color(47, 193, 236), name); + MineResist = 3f; + HitSound = SoundID.Tink; + Main.tileSpelunker[Type] = true; + MinPick = 55; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 3; + int yPos = j % 3; + frameXOffset = xPos * sheetWidth; + frameYOffset = yPos * sheetHeight; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.CompactFraming(i, j, resetFrame); + return false; + } + } +} diff --git a/Tiles/SunkenSea/SeaPrismBrick.png b/Tiles/SunkenSea/SeaPrismBrick.png new file mode 100644 index 0000000000..d3a1947126 Binary files /dev/null and b/Tiles/SunkenSea/SeaPrismBrick.png differ diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index 5800acbab9..466c3508bf 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -22,16 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 67; ItemDrop = ModContent.ItemType(); Main.tileSpelunker[Type] = true; - } - - public override bool CanKillTile(int i, int j, ref bool blockDamaged) - { - return DownedBossSystem.downedDesertScourge; - } - - public override bool CanExplode(int i, int j) - { - return DownedBossSystem.downedDesertScourge; + MinPick = 55; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -41,17 +32,48 @@ namespace CalamityMod.Tiles.SunkenSea public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.2f; - g = 0.5f; - b = 0.5f; + var tile = Main.tile[i, j]; + float brightness = 0.7f; + if (tile.LiquidAmount > 50 && tile.LiquidType == 0) + brightness = 1.0f; + + r = 0.6f; + g = 0.9f; + b = 0.9f; + + int xframe = tile.TileFrameX / 18; + if (xframe > 7 && xframe < 14) + { + + r = 0.8f; + g = 0.7f; + b = 0.9f; + } + + if (xframe >= 14) + { + r = 0.5f; + g = 0.9f; + b = 0.7f; + } + + r *= brightness; + g *= brightness; + b *= brightness; + } public override bool CanPlace(int i, int j) { - if ((Main.tile[i, j + 1].Slope == 0 && !Main.tile[i, j + 1].IsHalfBlock && Main.tile[i, j + 1].HasTile) || - (Main.tile[i, j - 1].Slope == 0 && !Main.tile[i, j - 1].IsHalfBlock && Main.tile[i, j - 1].HasTile) || - (Main.tile[i + 1, j].Slope == 0 && !Main.tile[i + 1, j].IsHalfBlock && Main.tile[i + 1, j].HasTile) || - (Main.tile[i - 1, j].Slope == 0 && !Main.tile[i - 1, j].IsHalfBlock && Main.tile[i - 1, j].HasTile)) + Tile belowTile = Main.tile[i, j + 1]; + Tile aboveTile = Main.tile[i, j - 1]; + Tile rightTile = Main.tile[i + 1, j]; + Tile leftTile = Main.tile[i - 1, j]; + + if ((belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) || + (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) || + (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) || + (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid())) return true; return false; @@ -59,21 +81,26 @@ namespace CalamityMod.Tiles.SunkenSea public override void PlaceInWorld(int i, int j, Item item) { - if (Main.tile[i, j + 1].HasTile && Main.tileSolid[Main.tile[i, j + 1].TileType] && Main.tile[i, j + 1].Slope == 0 && !Main.tile[i, j + 1].IsHalfBlock) + Tile belowTile = Main.tile[i, j + 1]; + Tile aboveTile = Main.tile[i, j - 1]; + Tile rightTile = Main.tile[i + 1, j]; + Tile leftTile = Main.tile[i - 1, j]; + + if (belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) { - Main.tile[i, j].TileFrameY = (short)(0 * 18); + Main.tile[i, j].TileFrameY = 0; } - else if (Main.tile[i, j - 1].HasTile && Main.tileSolid[Main.tile[i, j - 1].TileType] && Main.tile[i, j - 1].Slope == 0 && !Main.tile[i, j - 1].IsHalfBlock) + else if (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) { - Main.tile[i, j].TileFrameY = (short)(1 * 18); + Main.tile[i, j].TileFrameY = 18; } - else if (Main.tile[i + 1, j].HasTile && Main.tileSolid[Main.tile[i + 1, j].TileType] && Main.tile[i + 1, j].Slope == 0 && !Main.tile[i + 1, j].IsHalfBlock) + else if (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) { - Main.tile[i, j].TileFrameY = (short)(2 * 18); + Main.tile[i, j].TileFrameY = 36; } - else if (Main.tile[i - 1, j].HasTile && Main.tileSolid[Main.tile[i - 1, j].TileType] && Main.tile[i - 1, j].Slope == 0 && !Main.tile[i - 1, j].IsHalfBlock) + else if (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid()) { - Main.tile[i, j].TileFrameY = (short)(3 * 18); + Main.tile[i, j].TileFrameY = 54; } Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); } diff --git a/Tiles/SunkenSea/SeaPrismCrystals.png b/Tiles/SunkenSea/SeaPrismCrystals.png index f53ca4fade..5ba9ded01b 100644 Binary files a/Tiles/SunkenSea/SeaPrismCrystals.png and b/Tiles/SunkenSea/SeaPrismCrystals.png differ diff --git a/Tiles/SunkenSea/SmallBrainCoral.cs b/Tiles/SunkenSea/SmallBrainCoral.cs index e74dafe6d3..49ab406f7e 100644 --- a/Tiles/SunkenSea/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/SmallBrainCoral.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 253; ModTranslation name = CreateMapEntryName(); name.SetDefault("Small Brain Coral"); - AddMapEntry(new Color(0, 0, 80)); + AddMapEntry(new Color(36, 61, 111)); MineResist = 3f; base.SetStaticDefaults(); @@ -48,7 +48,7 @@ namespace CalamityMod.Tiles.SunkenSea if (Main.tile[i, tileLocationY].LiquidAmount == 255 && Main.tile[i, tileLocationY - 1].LiquidAmount == 255 && Main.tile[i, tileLocationY - 2].LiquidAmount == 255) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(new EntitySource_WorldEvent(), (float)(i * 16 + 16), (float)(tileLocationY * 16 + 16), 0f, -0.1f, ModContent.ProjectileType(), 0, 1f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), i * 16 + 16, tileLocationY * 16 + 16, 0f, -0.1f, ModContent.ProjectileType(), 0, 1f, Main.myPlayer); } } } diff --git a/Tiles/SunkenSea/SmallTubeCoral.cs b/Tiles/SunkenSea/SmallTubeCoral.cs index f471602d1f..c433c90852 100644 --- a/Tiles/SunkenSea/SmallTubeCoral.cs +++ b/Tiles/SunkenSea/SmallTubeCoral.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 253; ModTranslation name = CreateMapEntryName(); name.SetDefault("Small Tube Coral"); - AddMapEntry(new Color(0, 0, 80)); + AddMapEntry(new Color(36, 61, 111)); MineResist = 3f; base.SetStaticDefaults(); diff --git a/Tiles/SunkenSea/SunkenSeaStalactite.cs b/Tiles/SunkenSea/SunkenSeaStalactite.cs deleted file mode 100644 index 143e5cf61f..0000000000 --- a/Tiles/SunkenSea/SunkenSeaStalactite.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Tiles.SunkenSea -{ - public class SunkenSeaStalactite : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoFail[Type] = true; - Main.tileObsidianKill[Type] = true; - Main.tileBlockLight[Type] = true; - DustType = 96; - AddMapEntry(new Color(0, 50, 50)); - - base.SetStaticDefaults(); - } - - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) - { - Tile tile = Main.tile[i, j]; - if (tile.TileFrameY <= 18 || tile.TileFrameY == 72) - { - offsetY = -2; - } - else if ((tile.TileFrameY >= 36 && tile.TileFrameY <= 54) || tile.TileFrameY == 90) - { - offsetY = 2; - } - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - WorldGen.CheckTight(i, j); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 4; - } - } -} diff --git a/Tiles/SunkenSea/SunkenSeaStalactite.png b/Tiles/SunkenSea/SunkenSeaStalactite.png deleted file mode 100644 index 7ed7c07179..0000000000 Binary files a/Tiles/SunkenSea/SunkenSeaStalactite.png and /dev/null differ diff --git a/Tiles/SunkenSea/SunkenStalactite.cs b/Tiles/SunkenSea/SunkenStalactite.cs new file mode 100644 index 0000000000..711036a075 --- /dev/null +++ b/Tiles/SunkenSea/SunkenStalactite.cs @@ -0,0 +1,40 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Tiles.SunkenSea +{ + [LegacyName("SunkenStalactites")] + public class SunkenStalactite1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.addTile(Type); + DustType = 253; + ModTranslation name = CreateMapEntryName(); + AddMapEntry(new Color(31, 92, 114)); + MineResist = 3f; + + base.SetStaticDefaults(); + } + } + + public class SunkenStalactite2 : SunkenStalactite1 + { + } + + public class SunkenStalactite3 : SunkenStalactite1 + { + } +} \ No newline at end of file diff --git a/Tiles/SunkenSea/SunkenStalactite1.png b/Tiles/SunkenSea/SunkenStalactite1.png new file mode 100644 index 0000000000..3ee3027221 Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalactite1.png differ diff --git a/Tiles/SunkenSea/SunkenStalactite2.png b/Tiles/SunkenSea/SunkenStalactite2.png new file mode 100644 index 0000000000..9dfc38af8f Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalactite2.png differ diff --git a/Tiles/SunkenSea/SunkenStalactite3.png b/Tiles/SunkenSea/SunkenStalactite3.png new file mode 100644 index 0000000000..645ea59c1f Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalactite3.png differ diff --git a/Tiles/SunkenSea/SunkenStalactites.png b/Tiles/SunkenSea/SunkenStalactites.png new file mode 100644 index 0000000000..a620f4b89e Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalactites.png differ diff --git a/Tiles/SunkenSea/SunkenStalactitesSmall.cs b/Tiles/SunkenSea/SunkenStalactitesSmall.cs new file mode 100644 index 0000000000..388a45b9dc --- /dev/null +++ b/Tiles/SunkenSea/SunkenStalactitesSmall.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SunkenStalactitesSmall : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.addTile(Type); + DustType = 253; + ModTranslation name = CreateMapEntryName(); + AddMapEntry(new Color(31, 92, 114)); + MineResist = 3f; + + base.SetStaticDefaults(); + } + } +} \ No newline at end of file diff --git a/Tiles/SunkenSea/SunkenStalactitesSmall.png b/Tiles/SunkenSea/SunkenStalactitesSmall.png new file mode 100644 index 0000000000..4fd5dd587c Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalactitesSmall.png differ diff --git a/Tiles/SunkenSea/SunkenStalagmite.cs b/Tiles/SunkenSea/SunkenStalagmite.cs new file mode 100644 index 0000000000..6a109d4f2b --- /dev/null +++ b/Tiles/SunkenSea/SunkenStalagmite.cs @@ -0,0 +1,38 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Tiles.SunkenSea +{ + [LegacyName("SunkenStalagmites")] + public class SunkenStalagmite1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + DustType = 253; + ModTranslation name = CreateMapEntryName(); + AddMapEntry(new Color(31, 92, 114)); + MineResist = 3f; + + base.SetStaticDefaults(); + } + } + + public class SunkenStalagmite2 : SunkenStalagmite1 + { + } + + public class SunkenStalagmite3 : SunkenStalagmite1 + { + } +} \ No newline at end of file diff --git a/Tiles/SunkenSea/SunkenStalagmite1.png b/Tiles/SunkenSea/SunkenStalagmite1.png new file mode 100644 index 0000000000..aae38d97d3 Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalagmite1.png differ diff --git a/Tiles/SunkenSea/SunkenStalagmite2.png b/Tiles/SunkenSea/SunkenStalagmite2.png new file mode 100644 index 0000000000..5f17363111 Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalagmite2.png differ diff --git a/Tiles/SunkenSea/SunkenStalagmite3.png b/Tiles/SunkenSea/SunkenStalagmite3.png new file mode 100644 index 0000000000..532fe794b6 Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalagmite3.png differ diff --git a/Tiles/SunkenSea/SunkenStalagmitesSmall.cs b/Tiles/SunkenSea/SunkenStalagmitesSmall.cs new file mode 100644 index 0000000000..6aad893e52 --- /dev/null +++ b/Tiles/SunkenSea/SunkenStalagmitesSmall.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SunkenStalagmitesSmall : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.addTile(Type); + DustType = 253; + ModTranslation name = CreateMapEntryName(); + AddMapEntry(new Color(31, 92, 114)); + MineResist = 3f; + + base.SetStaticDefaults(); + } + } +} \ No newline at end of file diff --git a/Tiles/SunkenSea/SunkenStalagmitesSmall.png b/Tiles/SunkenSea/SunkenStalagmitesSmall.png new file mode 100644 index 0000000000..6a1d01c5c1 Binary files /dev/null and b/Tiles/SunkenSea/SunkenStalagmitesSmall.png differ diff --git a/Tiles/SunkenSea/TableCoral.cs b/Tiles/SunkenSea/TableCoral.cs index af7ba253db..0552d076b3 100644 --- a/Tiles/SunkenSea/TableCoral.cs +++ b/Tiles/SunkenSea/TableCoral.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Enums; @@ -9,6 +9,8 @@ namespace CalamityMod.Tiles.SunkenSea { public class TableCoral : ModTile { + int subsheetHeight = 34; + int subsheetWidth = 108; public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -24,7 +26,7 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 253; ModTranslation name = CreateMapEntryName(); name.SetDefault("Table Coral"); - AddMapEntry(new Color(0, 0, 80)); + AddMapEntry(new Color(54, 69, 72)); MineResist = 3f; base.SetStaticDefaults(); @@ -34,5 +36,12 @@ namespace CalamityMod.Tiles.SunkenSea { num = fail ? 1 : 3; } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int xPos = i % 1; + int yPos = j % 3; + frameXOffset = xPos * subsheetWidth; + frameYOffset = yPos * subsheetHeight; + } } } diff --git a/Tiles/SunkenSea/TableCoral.png b/Tiles/SunkenSea/TableCoral.png index 42d2201e27..68804bea84 100644 Binary files a/Tiles/SunkenSea/TableCoral.png and b/Tiles/SunkenSea/TableCoral.png differ diff --git a/Tiles/SunkenSea/TubeCoral.cs b/Tiles/SunkenSea/TubeCoral.cs index 397461e1aa..7811364e1b 100644 --- a/Tiles/SunkenSea/TubeCoral.cs +++ b/Tiles/SunkenSea/TubeCoral.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.SunkenSea DustType = 253; ModTranslation name = CreateMapEntryName(); name.SetDefault("Tube Coral"); - AddMapEntry(new Color(0, 0, 80)); + AddMapEntry(new Color(36, 61, 111)); MineResist = 3f; base.SetStaticDefaults(); diff --git a/Tiles/VernalSoil.cs b/Tiles/VernalSoil.cs new file mode 100644 index 0000000000..1a4807ee68 --- /dev/null +++ b/Tiles/VernalSoil.cs @@ -0,0 +1,150 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class VernalSoil : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.CanBeDugByShovel[Type] = true; + + DustType = 38; + ItemDrop = ModContent.ItemType(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Vernal Soil"); + AddMapEntry(new Color(80, 120, 0), name); + HitSound = SoundID.Dig; + } + + public override void RandomUpdate(int i, int j) + { + bool underground = j >= (int)Main.worldSurface - 1 && j < Main.maxTilesY - 20; + if (underground) + { + int j2 = j - 1; + if (j2 < 10) + j2 = 10; + + if (Main.tile[i, j2].LiquidAmount == 0) + { + if (WorldGen.genRand.NextBool(15)) + { + ushort tileTypeToPlace = (ushort)ModContent.TileType(); + int tileTypeToPlaceThickness = 5; + bool placeBulb = true; + int minDistanceFromOtherBulbs = 10; + for (int k = i - minDistanceFromOtherBulbs; k < i + minDistanceFromOtherBulbs; k += 2) + { + for (int l = j - minDistanceFromOtherBulbs; l < j + minDistanceFromOtherBulbs; l += 2) + { + if (k > tileTypeToPlaceThickness && k < Main.maxTilesX - tileTypeToPlaceThickness && l > tileTypeToPlaceThickness && l < Main.maxTilesY - tileTypeToPlaceThickness && Main.tile[k, l].HasTile && Main.tile[k, l].TileType == tileTypeToPlace) + { + placeBulb = false; + break; + } + } + } + + if (placeBulb) + { + if (i < tileTypeToPlaceThickness || i > Main.maxTilesX - tileTypeToPlaceThickness || j2 < tileTypeToPlaceThickness || j2 > Main.maxTilesY - tileTypeToPlaceThickness) + return; + + bool placeTile = true; + for (int i2 = i - 2; i2 < i + 3; i2++) + { + for (int j3 = j2 - 4; j3 < j2 + 1; j3++) + { + if (Main.tile[i2, j3] == null) + return; + + if (Main.tile[i2, j3].HasTile) + placeTile = false; + } + + if (Main.tile[i2, j2 + 1] == null) + return; + + if (!WorldGen.SolidTile2(i2, j2 + 1)) + placeTile = false; + } + + if (placeTile) + { + WorldGen.PlaceObject(i, j2, tileTypeToPlace, true); + NetMessage.SendObjectPlacment(-1, i, j2, tileTypeToPlace, 0, 0, -1, -1); + + // Spread of Chlorophyte Partisan clouds if the bulb spawns while a player is near + bool isPlayerNear = WorldGen.PlayerLOS(i, j2); + if (isPlayerNear) + { + float projectileVelocity = 6f; + int projType = ProjectileID.SporeCloud; + int npcType = NPCID.Spore; + Vector2 spawn = new Vector2(i * 16 + 8, j2 * 16 + 8); + Vector2 dustSpawn = new Vector2(i * 16, j2 * 16); + SoundEngine.PlaySound(SoundID.Item73, spawn); + Vector2 destination = new Vector2(i * 16 + 8, (j2 - 2) * 16 + 8) - spawn; + destination.Normalize(); + destination *= projectileVelocity; + int numProj = 15; + int numNPCs = 5; + float rotation = MathHelper.ToRadians(100); + + for (int projIndex = 0; projIndex < numProj; projIndex++) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, projIndex / (float)(numProj - 1))) * (Main.rand.NextFloat() + 0.25f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(new EntitySource_TileUpdate(i, j2), spawn, perturbedSpeed, projType, 0, 0f, Player.FindClosest(new Vector2(i * 16, j2 * 16), 16, 16)); + + perturbedSpeed *= 2f; + Dust dust = Dust.NewDustDirect(dustSpawn, 16, 16, DustID.JungleSpore, perturbedSpeed.X, perturbedSpeed.Y, 250); + dust.fadeIn = 0.7f; + Dust.NewDustDirect(dustSpawn, 16, 16, (!WorldGen.genRand.NextBool(3) && Main.hardMode) ? DustID.Plantera_Pink : DustID.Plantera_Green, perturbedSpeed.X, perturbedSpeed.Y); + } + + if (Main.hardMode) + { + for (int npcIndex = 0; npcIndex < numNPCs; npcIndex++) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, npcIndex / (float)(numNPCs - 1))) * (Main.rand.NextFloat() + 0.5f) * 0.5f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spore = NPC.NewNPC(new EntitySource_TileUpdate(i, j2), (int)spawn.X, (int)spawn.Y, npcType, 0, -1f); + Main.npc[spore].velocity.X = perturbedSpeed.X; + Main.npc[spore].velocity.Y = perturbedSpeed.Y; + Main.npc[spore].netUpdate = true; + } + + perturbedSpeed *= 2f; + Dust dust = Dust.NewDustDirect(dustSpawn, 16, 16, DustID.JungleSpore, perturbedSpeed.X, perturbedSpeed.Y, 250); + dust.fadeIn = 0.7f; + Dust.NewDustDirect(dustSpawn, 16, 16, DustID.Plantera_Pink, perturbedSpeed.X, perturbedSpeed.Y); + } + } + } + } + } + } + } + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/VernalSoil.png b/Tiles/VernalSoil.png new file mode 100644 index 0000000000..8c1e2f1c56 Binary files /dev/null and b/Tiles/VernalSoil.png differ diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 6a3d2f2cbe..8de0d225a0 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -1,7 +1,7 @@ using CalamityMod.Events; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; @@ -406,7 +406,7 @@ namespace CalamityMod.UI if (npc.type == NPCType()) canAddBar = false; if (npc.type == NPCType()) - overridingName = $"{Artemis.NameToDisplay} and {Apollo.NameToDisplay}"; + overridingName = npc.ModNPC().exoMechdusa ? "Eyes of XB-∞ Hekate" : "XS-01 Artemis and XS-03 Apollo"; if (canAddBar) Bars.Add(new BossHPUI(index, overridingName)); diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 14b475c09b..2fcfa7d72d 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; using CalamityMod.Projectiles.Melee; @@ -172,8 +173,8 @@ namespace CalamityMod.UI.CalamitasEnchants "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Oblatory", item => { - item.damage = (int)(item.damage * 1.5); - item.mana = (int)Math.Ceiling(item.mana * 0.6); + item.damage = (int)(item.damage * 1.25); + item.mana = (int)Math.Ceiling(item.mana * 0.7); }, player => player.Calamity().lifeManaEnchant = true, item => item.IsEnchantable() && item.damage > 0 && item.CountsAsClass() && item.mana > 0 && item.type != ModContent.ItemType()), @@ -183,21 +184,21 @@ namespace CalamityMod.UI.CalamitasEnchants "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Resentful", null, player => player.Calamity().farProximityRewardEnchant = true, - item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.IsTrueMelee()), + item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.IsTrueMelee() && item.type != ModContent.ItemType()), new Enchantment("Bloodthirsty", "Makes the damage of projectiles vary based on how far the hit target is from you. The closer, the more damage, and vice versa.", 500, "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Bloodthirsty", null, player => player.Calamity().closeProximityRewardEnchant = true, - item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.IsTrueMelee()), + item => item.IsEnchantable() && item.damage > 0 && item.shoot > ProjectileID.None && !item.IsTrueMelee() && item.type != ModContent.ItemType()), new Enchantment("Ephemeral", "Causes the damage output of this item to discharge from exhaustive use.\nIts damage returns naturally when not being used. It starts off with more damage than it normally would have.", 600, "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Ephemeral", null, player => player.Calamity().dischargingItemEnchant = true, - item => item.IsEnchantable() && item.damage > 0 && !item.CountsAsClass() && !item.CountsAsClass() && + item => item.IsEnchantable() && item.damage > 0 && !item.CountsAsClass() && !item.CountsAsClass() && !item.channel && item.type != ModContent.ItemType()), new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer.\nOnce it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.", @@ -245,7 +246,7 @@ namespace CalamityMod.UI.CalamitasEnchants }, item => item.IsEnchantable() && item.damage > 0 && item.CountsAsClass() && !item.noUseGraphic && item.shoot > ProjectileID.None), - new Enchantment("Traitorous", "Causes this item to sometimes release a monster that hurts both you and enemies when you have less than 50% mana.", + new Enchantment("Traitorous", "Using this item below 25% mana instantly consumes your remaining mana, unleashing a monster that harms both you and enemies.", 900, "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Traitorous", null, diff --git a/UI/DraedonLogs/DraedonLogHellGUI.cs b/UI/DraedonLogs/DraedonLogHellGUI.cs index 53ab8e63d6..5ebaba6e55 100644 --- a/UI/DraedonLogs/DraedonLogHellGUI.cs +++ b/UI/DraedonLogs/DraedonLogHellGUI.cs @@ -11,17 +11,11 @@ namespace CalamityMod.UI.DraedonLogs switch (Page) { case 0: - return "The entire landscape is a constant source of geothermal energy, and heat for a forge. If it was not entirely uninhabitable save for demons and spirits, I would conduct much more of my " + - "research in the bowels of the earth. Where I have actively chosen not to settle however, is in the crags of the underworld. There, the magma is... uncooperative and far more corrosive than " + - "should be possible, as it is saturated with cursed, twisted souls, courtesy of that Witch."; + return "The Underworld is a realm with history dating back more than a millenia when the Crags were first settled, and acts as a glance into both the modern and ancient world simultaneously. Prior to my joining of Yharim’s forces, Azafure was the center of scientific advancement in this world. Explosives, firearms, smithing techniques, and even entire schools of magic have roots in the city. It is doubtless that the city has been largely aided by the fact that forging is trivial in the Underworld, along with an abundance of food due to Silva’s essence dripping down from the Abyss above. Due to this, it has prospered even with the occasional attack from Demons."; case 1: - return "What a terrible abomination and yet an enticing subject. Not unlike the fusion of spirits which haunts the dungeons, this entity is formed not of one, but a multitude of sinners. " + - "What holds different for it however, is that the limitations caused by the artificiality of the dungeon's existence do not apply to it. It is the laws of hell which brought them together " + - "into a single overlord of the underworld. And when an innocent life is sacrificed... Their hunger, which appears to be in tune with the afterlife, surges."; + return "Azafure has not existed without consequence, of course. Any society on such a large scale leaves an ecological footprint behind. This can be seen most clearly in the sea far above the city, appropriately known as the Sulphurous Sea. Brimstone fumes became intense enough in the city that they began rising up through the Abyss via a process akin to osmosis, and eventually reached the sea. Reducing the pollution the city creates, particularly from forging, is a goal Yharim wishes for me to prioritize. I see little need in it, yet it is a field of study few in this world have delved into. I refuse to squander an opportunity for scientific breakthrough."; default: - return "A blade completely inundated with my surroundings during the time of its creation. It was tempered by the fires which are fueled by spirits, and formed in the magma I draw into my laboratories. " + - "Its cutting edge, unparalleled, though its reach is limited making general usage questionable. I would consider it my very first foray into work for the sake of craftsmanship and art. " + - "If I was born synthetically, any creation which leads one to question whether I was, is a creation I may be proud of. It shows that I can after all, be graced by a muse."; + return "A particular being here has been the subject of my interest: a massive wall created from biological material lies in this place created many years ago by the greatest mages Azafure has to offer. It is a living being, though only just. It lacks both pain and emotion, and brings terror to all who lay their eyes upon it. It is kept protected via high security by the city, and so few aside from the Godseeker’s closest allies have had the opportunity to observe it. For as long as Azafure continues to stand, it is unlikely to ever be truly released. Yet, I do not deny that I would be fascinated to see the effects its release would have on the world."; } } public override Texture2D GetTextureByPage() @@ -31,9 +25,9 @@ namespace CalamityMod.UI.DraedonLogs case 0: return ModContent.Request("CalamityMod/UI/DraedonLogs/DraedonsLogCragsBiome").Value; case 1: - return ModContent.Request("CalamityMod/UI/DraedonLogs/DraedonsLogWallOfFlesh").Value; + return null; default: - return ModContent.Request("CalamityMod/UI/DraedonLogs/DraedonsLogMurasamaPhaseslayer").Value; + return ModContent.Request("CalamityMod/UI/DraedonLogs/DraedonsLogWallOfFlesh").Value; } } } diff --git a/UI/DraedonLogs/DraedonLogJungleGUI.cs b/UI/DraedonLogs/DraedonLogJungleGUI.cs index 0c95f88e16..972cf0c63b 100644 --- a/UI/DraedonLogs/DraedonLogJungleGUI.cs +++ b/UI/DraedonLogs/DraedonLogJungleGUI.cs @@ -11,17 +11,11 @@ namespace CalamityMod.UI.DraedonLogs switch (Page) { case 0: - return "As I record this, it would not be a stretch to call the jungle the hub of this planet. All is centered around it, and none know not of it. It brings me no small amount of " + - "unease to see the uncomfortable, raw forms of the living beings who pass through on their journeys above. Fortunately these labs provide everything I need in my research and more. " + - "There is no need to ever visit the surface, save for summons on the Lord's orders."; + return "It would not be a stretch to call the jungle the hub of this planet. All is centered around it, and none know not of it. It brings me no small amount of unease to see the uncomfortable, raw forms of the living beings who pass through on their journeys above. Fortunately, these labs provide everything I need in my research and more. There is little need to visit the surface, save for Yharim’s summons."; case 1: - return "A virus, capable of devouring and converting almost anything. And nanotechnology, constructed painstakingly for the sake of control. Development was swift, and every piece fell into " + - "place almost eerily, forming an abhorrent existence. I struggle to think of practical applications which would be friendly to common life forms. However, it is not a major concern. Many " + - "were hesitant to continue its creation, but I granted them leave if they desired. I would have no need for any who were not entirely as dedicated as my machines."; + return "Few travel down here, with far fewer making the expedition to reach as far down as this research station. As such, I have taken to using this isolation to develop advanced nanotechnology for use in controlling the minds of biologicals. I yearn for it to be capable of spreading from organism to organism, a perfected blend of a virus and nanotechnology. Yet, it has been an arduous task even with my newly developed technologies. Further experimentation and research are required."; default: - return "Mechanically augmented, the Queen Bee which I had prior experimented on was theoretically a perfect host for the plague virus. When the first sign of the technology bonding with the creature " + - "began however, the problems also showed immediately. The mind of the insect fought the control of the nanotechnology, nothing like the simpler creatures I had used as test subjects. It grew " + - "increasingly violent, and only once subdued did it receive simple orders. However, if we were to utilize it at all, there is no other way than to let it roam free entirely. I will consider this further."; + return "Continued experiments have led to significant results. With a mechanically modified Queen Bee as a primary host, it may act as the core of a hive mind of those my plague has touched. However, Yharim was outraged upon learning of my experiments here and decried them as inhumane. After a brief verbal conflict, he wordlessly left and I have not heard from him since. Fortunately, I need not rely on the slayer of gods any longer, nor have I needed to for years."; } } public override Texture2D GetTextureByPage() diff --git a/UI/DraedonLogs/DraedonLogPlanetoidGUI.cs b/UI/DraedonLogs/DraedonLogPlanetoidGUI.cs index 059bc5ef1b..e29f910e96 100644 --- a/UI/DraedonLogs/DraedonLogPlanetoidGUI.cs +++ b/UI/DraedonLogs/DraedonLogPlanetoidGUI.cs @@ -11,17 +11,11 @@ namespace CalamityMod.UI.DraedonLogs switch (Page) { case 0: - return "Hung low in orbit, masses of ground and various parts of the world provide a secluded and distant point for research. Undeniably optimal for the science of astronomy and otherwise. " + - "In my labs here I grow many things, testing their limits against the cold and vacuum of the stratosphere. Though not many survive, the existence of certain creatures here, confirm the " + - "capabilities of life simply given more time."; + return "High above even the sky islands upheaved long ago lies a fascinating geological phenomenon. Though, unlike the islands, their airborne nature appears to have formed more naturally. I speculate that they formed long ago when the world was in its infancy judging by soil samples I have taken while testing high atmosphere plant growth. Perhaps these “planetoids”, as many refer to them as, formed via meteor strikes tossing matter high into the atmosphere. This would simultaneously explain many geological oddities I have found on the world’s surface."; case 1: - return "I do not care much for the interstellar, or the cosmos. Though I have traversed it, there is still plenty in my own world to manage and discover at this time. Even if I once inhabited a " + - "different planet, the Lord's wishes that I provide him machinery were the only condition that I needed to leave it and settle elsewhere. Once I have discovered and dissected every part of " + - "this place, perhaps then, I could look up towards the macroscopic."; + return "Travel between worlds is a fascination of mine. The planets within reasonable distance to this provide no use to me in terms of materials or study opportunities they could provide. And so, I wish to go further beyond this mere cluster of planets some day. It will likely take many more decades of technological progress, however, as travel between worlds would take years even at the maximum speed physical matter can currently go. Perhaps I will find a way to shatter this limit once this world holds my interest no longer."; default: - return "The bloated cosmic worm, though I understand why the Lord decides to employ it given he can control it, is a disgusting existence. However the idea of creating an armor suited to it in every " + - "way, was an offer I could not refuse. Forged from the cosmic steel of my own creation, it resists nearly any attack, yet allows the creature the same flexibility it would have without it, as well " + - "as augmenting its dimensional abilities. I remain pleased with the result."; + return "A request from Yharim has been delivered. An inquiry to create a suit of armor for the serpent that has joined his forces recently, the “Devourer of Gods” as the serpent calls himself. He is a bothersome yet fascinating being. And so, I have taken the opportunity so that I may learn more of his home dimension. Using materials from his place of origin, I have forged armor of immense size and durability yet extreme flexibility. It is certainly one of the most unique materials I have worked with and has advanced my knowledge greatly. Though, I have learned more than I expected to about the cosmic beast from this. Perhaps more than he wished for me to."; } } public override Texture2D GetTextureByPage() @@ -31,7 +25,7 @@ namespace CalamityMod.UI.DraedonLogs case 0: return ModContent.Request("CalamityMod/UI/DraedonLogs/DraedonsLogPlanetoid").Value; case 1: - return null; // The Draedon's backstory page does not have an image, and probably shouldn't. + return null; default: return ModContent.Request("CalamityMod/UI/DraedonLogs/DraedonsLogDoGArmor").Value; } diff --git a/UI/DraedonLogs/DraedonLogSnowBiomeGUI.cs b/UI/DraedonLogs/DraedonLogSnowBiomeGUI.cs index 7335dd2e88..0073da6a30 100644 --- a/UI/DraedonLogs/DraedonLogSnowBiomeGUI.cs +++ b/UI/DraedonLogs/DraedonLogSnowBiomeGUI.cs @@ -11,17 +11,11 @@ namespace CalamityMod.UI.DraedonLogs switch (Page) { case 0: - return "A freezing tundra, where only creatures entirely adapted to the subzero temperatures exist and thrive. It is a shocking transition from the forests of the purity and " + - "the sun baked desert. A climate like this should not exist naturally in this part of the world with ease. The weather patterns seem to shift unnaturally arounds the skies " + - "of these icy plains. There is likely a reason for this, which necessitates further research."; + return "A freezing tundra, where only creatures that have adapted to the subzero temperatures thrive. Few sapient beings have ever permanently resided here, save for miners and the Archmage. With this fact in mind, Yharim has requested I observe this place for oddities due to the armies largely having glossed over this location. Additionally, I have been requested by the Archmage to perform studies on his frigid metals. There is little else to do in this frozen wasteland, and so his request has been accepted."; case 1: - return "Intriguing. Though embedded deep into the caverns of ice and worn from centuries of frost and meltwater, I have uncovered several mechanisms which once filled the tunnels here. " + - "The ingenuity present is remarkable, and I have found parallels within my own work, as well as devices even I have something to learn from. From where do these come? Why machinery " + - "so complex in so sparse and dreary a habitat? Perhaps, they are related to the unnatural conditions."; + return "Cryonic Ore, as the Archmage simply calls it, is a material seemingly akin to iced over glass. One would assume it is a fragile material at a glance, yet upon testing it is clear that is not the case. Plating made out of it has been found to be more durable and resilient than mythril alloy via flexural and tensile testing, followed by destruction attempts. Yet, it is but a fraction of the weight. Perhaps mass amounts of this material could be used to forge armor for units who disdain for the usual burden of metal plating. I will likely inquire further about the creation methods of Cryonic Ore to achieve this."; default: - return "I am not the only singular being to inhabit this biome. Once before, the Archmage who opposed the Lord resided here, cloaked by constant artificial blizzards of his own creation, " + - "which no longer fall. He likely chose this place as a conduit for research into his ice spells, and extended the period of time that this place remained frozen. Deep underground my " + - "research and materials lay well protected, but above in the natural storms there are traces of the prison of ice he resides in, still haunting its place of creation."; + return "As described earlier, Cryonic Ore was developed by the Archmage, Permafrost. Despite his position as the mage of mages, he has little will to engage in combat. He instead acts as advisor to Yharim, assisting in much of the management of cities and towns taken by or sided with the Godkiller. In addition, he seems to have bonded with the girl who arrived seeking Yharim some months ago, acting as a fatherly figure to her. I myself have taken an interest in her immense natural power."; } } public override Texture2D GetTextureByPage() @@ -31,7 +25,7 @@ namespace CalamityMod.UI.DraedonLogs case 0: return ModContent.Request("CalamityMod/UI/DraedonLogs/DraedonsLogIceBiome").Value; case 1: - return null; // No image exists for Daedalus' ruins at the moment. + return null; default: return ModContent.Request("CalamityMod/UI/DraedonLogs/DraedonsLogPermafrost").Value; } diff --git a/UI/DraedonLogs/DraedonLogSunkenSeaGUI.cs b/UI/DraedonLogs/DraedonLogSunkenSeaGUI.cs index 5a2994c9e1..eb35a2e837 100644 --- a/UI/DraedonLogs/DraedonLogSunkenSeaGUI.cs +++ b/UI/DraedonLogs/DraedonLogSunkenSeaGUI.cs @@ -11,19 +11,11 @@ namespace CalamityMod.UI.DraedonLogs switch (Page) { case 0: - return "Preserved for millennia, a paradise for the living beings who sought shelter in prehistoric seas. They remain untouched by evolution, save for their adaptations " + - "to the oxygen starved waters and dim crystals, continuing to thrive. One mystery which continues to escape my understanding however, is how large some of the creatures " + - "have become. There is a blatant lack of nutrition and oxygen in the caves, and yet..."; + return "A hub of diverse ocean life, and all that remains of Ilmeris that is unscorched. Once its rural outskirts, it is now the final fragment of a once powerful kingdom. It is fortunate that the Witch only focused on attacking the cities proper, and spared some amount of the sea from the Incineration. I have long yearned to research these waters in great depth, yet was never able due to the ongoing conflict. Although many species went extinct in the devastation, many still thrive down here in its depths. It is in this lab that I may finally study the aquatic life properly and learn of their nature."; case 1: - return "The marine life in these caves do have eyes though they are barely functional, dulled by lack of use and milky white upon observation. On their tough, gnarled hides, " + - "crystals find an easy purchase, and grow in great numbers, providing the creatures protection. Perhaps another adaptation to the life they have adopted. The most striking " + - "wonder is within their bodies. In specimens dissected, I have noticed that the mineral is buried into their very digestive systems, and perhaps, through some chemical process, " + - "pass nutrients into their sluggish hosts. A peculiar yet entirely beneficial interaction."; + return "Although the marine life in these caves do have eyes, some of their eyes are weak and process few colors. All they are made to see is the light of the sea prisms that surround them, with many creatures relying on them to guide their way through the submerged caverns. Their tough, gnarled hides possess crystal growths that I had originally assumed were the prisms settling on their backs. However, dissection results reveal that they instead possess these crystals internally, and the growths are a result of internal sea prisms bursting out of their hides. The growth of these crystals reaches such an extent that some creatures are more geological than biological in certain areas."; default: - return "A specimen which has developed a grand size, and inexplicably, impressive psychic abilities. What is most curious is its strong connection to its " + - "lesser kin. Without any noticeable communication, when it comes under threat, other mollusks rally to its aggressor and begin attacking. Is this " + - "perhaps the very first signs of a higher life form, the evolutionary link hidden away in the sunken sea? Or a self sacrificial fluke, which would " + - "lead to their destruction if they inhabited any area other than these pacified caverns."; + return "Of the specimens here, the abnormally large clams capture my interest the most. Many times larger than the average person, their weight is so great that they lack the ability to move via the same methods as their smaller counterparts. Instead, they rely on teleportation to transport their hulking, heavily armored bodies. They seem to have once possessed further magical powers according to scouts. However, as they were seen only from afar, their reports could have easily been mistaken. Alternatively, their source of power simply could have faded after Ilmeris’ downfall. It is unwise to entirely discount the latter possibility."; } } public override Texture2D GetTextureByPage() diff --git a/UI/DraedonLogs/DraedonSchematicPlanetoidGUI.cs b/UI/DraedonLogs/DraedonSchematicPlanetoidGUI.cs index 74ce521179..ee02293a3b 100644 --- a/UI/DraedonLogs/DraedonSchematicPlanetoidGUI.cs +++ b/UI/DraedonLogs/DraedonSchematicPlanetoidGUI.cs @@ -10,7 +10,7 @@ namespace CalamityMod.UI.DraedonLogs { return "Within an army, as weapons do, the soldiers serve different purposes.\n" + "That distinction is crucial, as the wrong tool in the wrong hands—no matter how potent—may as well be a wooden club.\n" + - "Addendum: Seek out my base of operations closest to the Lihzahrd’s home.\n" + + "Addendum: Seek out my base of operations closest to the Lihzahrd's home.\n" + "I wish you the best of luck with all sincerity, for it has been a long time since I have had a worthy test subject."; } public override Texture2D GetTextureByPage() diff --git a/UI/DraedonLogs/DraedonSchematicSunkenSeaGUI.cs b/UI/DraedonLogs/DraedonSchematicSunkenSeaGUI.cs index 0213936203..8a85f4650a 100644 --- a/UI/DraedonLogs/DraedonSchematicSunkenSeaGUI.cs +++ b/UI/DraedonLogs/DraedonSchematicSunkenSeaGUI.cs @@ -10,7 +10,7 @@ namespace CalamityMod.UI.DraedonLogs { return "The weaponry I supply to the workers of the laboratories is weak. Hardly suited for battle.\n" + "However, they suffice for self defense against any lab mechanisms or creations which may have gone rogue.\n" + - "Addendum: For those who think themselves powerful, search the upper bounds of this planet’s atmosphere for a structure similar to that of the Sunken Seas.\n" + + "Addendum: For those who think themselves powerful, search the upper bounds of this planet's atmosphere for a structure similar to that of the Sunken Seas.\n" + "I will know by the end if you are worthy of battling my creations.\n"; } public override Texture2D GetTextureByPage() diff --git a/UI/DraedonSummoning/CodebreakerCommunicationUI.cs b/UI/DraedonSummoning/CodebreakerCommunicationUI.cs new file mode 100644 index 0000000000..6cd3e470ae --- /dev/null +++ b/UI/DraedonSummoning/CodebreakerCommunicationUI.cs @@ -0,0 +1,468 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.NPCs.ExoMechs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using static CalamityMod.UI.DraedonSummoning.DraedonDialogRegistry; + +namespace CalamityMod.UI.DraedonSummoning +{ + public partial class CodebreakerUI : ModSystem + { + public class DialogEntry + { + public bool FromDraedon; + + public string Dialog; + + public DialogEntry(string dialog, bool fromDraedon) + { + Dialog = dialog; + FromDraedon = fromDraedon; + } + } + + public static float CommunicationPanelScale + { + get; + set; + } = 0f; + + public static int DraedonTextCreationTimer + { + get; + set; + } + + public static string DraedonText + { + get; + set; + } = string.Empty; + + public static List DialogHistory + { + get; + set; + } = new(); + + public static int DraedonDialogDelayCountdown + { + get; + set; + } + + public static float DraedonScreenStaticInterpolant + { + get; + set; + } = 1f; + + public static float DraedonTextOptionsOpacity + { + get; + set; + } = 1f; + + // The text that Draedon should attempt to spell out. + public static string DraedonTextComplete + { + get; + set; + } = string.Empty; + + // This is used to give a one-frame buffer before dialog actually appears. The reason for this is to prevent dialog sometimes showing up for one frame + // in the case of dialog entries being pruned because of going past the natural box. + public static bool CanDisplayLatestDialogEntries + { + get; + set; + } = true; + + public static char PreviousTextCharacter => DraedonText.Length >= 1 ? DraedonTextComplete[DraedonText.Length - 1] : ' '; + + public static char NextTextCharacter => DraedonText.Length < DraedonTextComplete.Length ? DraedonTextComplete[DraedonText.Length] : ' '; + + public static int DraedonTextCreationRate + { + get + { + if (PreviousTextCharacter is '\n') + return 48; + + if (PreviousTextCharacter is '.' or '?') + return 9; + + return 1; + } + } + + public static string InquiryText => Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker ? "State your inquiry." : "..."; + + public static string HoverSoundDialogType + { + get; + set; + } = null; + + public static DynamicSpriteFont DialogFont + { + get; + internal set; + } + + public static readonly SoundStyle DialogOptionHoverSound = new("CalamityMod/Sounds/Custom/Codebreaker/DialogOptionHover"); + + public override void OnModLoad() + { + if (Main.dedServ) + return; + + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + DialogFont = CalamityMod.Instance.Assets.Request("Fonts/CodebreakerDialog", AssetRequestMode.ImmediateLoad).Value; + else + DialogFont = FontAssets.MouseText.Value; + } + + public static void DisplayCommunicationPanel() + { + // Draw the background panel. This pops up. + float panelWidthScale = Utils.Remap(CommunicationPanelScale, 0f, 0.5f, 0.085f, 1f); + float panelHeightScale = Utils.Remap(CommunicationPanelScale, 0.5f, 1f, 0.085f, 1f); + Vector2 panelScale = GeneralScale * new Vector2(panelWidthScale, panelHeightScale) * 1.4f; + Texture2D panelTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonContactPanel").Value; + float basePanelHeight = GeneralScale * panelTexture.Height * 1.4f; + Vector2 panelCenter = new Vector2(Main.screenWidth * 0.5f, Main.screenHeight * 0.5f + panelTexture.Height * panelScale.Y * 0.5f - basePanelHeight * 0.5f); + Rectangle panelArea = Utils.CenteredRectangle(panelCenter, panelTexture.Size() * panelScale); + + Main.spriteBatch.Draw(panelTexture, panelCenter, null, Color.White, 0f, panelTexture.Size() * 0.5f, panelScale, 0, 0f); + + // Draw static if the static interpolant is sufficiently high. + if (DraedonScreenStaticInterpolant > 0f) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + + // Apply a glitch shader. + GameShaders.Misc["CalamityMod:BlueStatic"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/SharpNoise")); + GameShaders.Misc["CalamityMod:BlueStatic"].Shader.Parameters["useStaticLine"].SetValue(false); + GameShaders.Misc["CalamityMod:BlueStatic"].Shader.Parameters["coordinateZoomFactor"].SetValue(0.5f); + GameShaders.Misc["CalamityMod:BlueStatic"].Shader.Parameters["useTrueNoise"].SetValue(true); + GameShaders.Misc["CalamityMod:BlueStatic"].Apply(); + + float readjustedInterpolant = Utils.GetLerpValue(0.42f, 1f, DraedonScreenStaticInterpolant, true); + Color staticColor = Color.White * (float)Math.Pow(CalamityUtils.AperiodicSin(readjustedInterpolant * 2.94f) * 0.5f + 0.5f, 0.54) * (float)Math.Pow(readjustedInterpolant, 0.51D); + Main.spriteBatch.Draw(panelTexture, panelCenter, null, staticColor, 0f, panelTexture.Size() * 0.5f, panelScale, 0, 0f); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity); + } + + // Disable clicks if hovering over the panel. + if (panelArea.Intersects(MouseScreenArea)) + Main.blockMouse = Main.LocalPlayer.mouseInterface = true; + + DisplayDraedonFacePanel(panelCenter, panelScale); + DisplayTextSelectionOptions(panelArea, panelScale); + DisplayDialogHistory(panelArea, panelScale); + } + + public static void DisplayDraedonFacePanel(Vector2 panelCenter, Vector2 panelScale) + { + // Draw a panel that has Draedon's face. + Texture2D iconTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonIconBorder").Value; + Texture2D iconTextureInner = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonIconBorderInner").Value; + float draedonIconDrawInterpolant = Utils.GetLerpValue(0.51f, 0.36f, DraedonScreenStaticInterpolant, true); + Vector2 draedonIconDrawTopRight = panelCenter + new Vector2(-218f, -130f) * panelScale; + draedonIconDrawTopRight += new Vector2(24f, 4f) * panelScale; + + Vector2 draedonIconScale = panelScale * 0.5f; + Vector2 draedonIconCenter = draedonIconDrawTopRight + iconTexture.Size() * new Vector2(0.5f, 0.5f) * draedonIconScale; + Rectangle draedonIconArea = Utils.CenteredRectangle(draedonIconCenter, iconTexture.Size() * draedonIconScale * 0.9f); + Main.spriteBatch.Draw(iconTexture, draedonIconDrawTopRight, null, Color.White * draedonIconDrawInterpolant, 0f, Vector2.Zero, draedonIconScale, 0, 0f); + + // Draw Draedon's face inside the panel. + // This involves restarting the sprite batch with a rasterizer state that can cut out Draedon's face if it exceeds the icon area. + Main.spriteBatch.EnforceCutoffRegion(draedonIconArea, Matrix.Identity, SpriteSortMode.Immediate); + + // Apply a glitch shader. + GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseOpacity(0.04f); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseSecondaryColor(Color.White * 0.75f); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].UseSaturation(0.75f); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].Shader.Parameters["frameCount"].SetValue(Vector2.One); + GameShaders.Misc["CalamityMod:TeleportDisplacement"].Apply(); + + Vector2 draedonScale = new Vector2(draedonIconDrawInterpolant, 1f) * 1.6f; + SpriteEffects draedonDirection = SpriteEffects.FlipHorizontally; + Texture2D draedonFaceTexture = ModContent.Request("CalamityMod/NPCs/ExoMechs/HologramDraedon").Value; + + Main.spriteBatch.Draw(draedonFaceTexture, draedonIconCenter, null, Color.White * draedonIconDrawInterpolant, 0f, draedonFaceTexture.Size() * 0.5f, draedonScale, draedonDirection, 0f); + Main.spriteBatch.ReleaseCutoffRegion(Matrix.Identity, SpriteSortMode.Immediate); + + // Draw a glitch effect over the panel and Draedon's icon. + GameShaders.Misc["CalamityMod:BlueStatic"].UseColor(Color.Cyan); + GameShaders.Misc["CalamityMod:BlueStatic"].UseImage1("Images/Misc/noise"); + GameShaders.Misc["CalamityMod:BlueStatic"].Shader.Parameters["useStaticLine"].SetValue(true); + GameShaders.Misc["CalamityMod:BlueStatic"].Shader.Parameters["coordinateZoomFactor"].SetValue(1f); + GameShaders.Misc["CalamityMod:BlueStatic"].Apply(); + Main.spriteBatch.Draw(iconTextureInner, draedonIconDrawTopRight, null, Color.White * draedonIconDrawInterpolant, 0f, Vector2.Zero, draedonIconScale, 0, 0f); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Matrix.Identity); + } + + public static void DisplayTextSelectionOptions(Rectangle panelArea, Vector2 panelScale) + { + // Draw the outline for the text selection options. + float selectionOptionsDrawInterpolant = Utils.GetLerpValue(0.3f, 0f, DraedonScreenStaticInterpolant, true); + Texture2D selectionOutline = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonSelectionOutline").Value; + Vector2 selectionCenter = panelArea.BottomLeft() - new Vector2(selectionOutline.Width * -0.5f - 24f, selectionOutline.Height * 0.5f + 24f) * panelScale; + Rectangle selectionArea = Utils.CenteredRectangle(selectionCenter, selectionOutline.Size() * panelScale); + Main.spriteBatch.Draw(selectionOutline, selectionCenter, null, Color.White * selectionOptionsDrawInterpolant, 0f, selectionOutline.Size() * 0.5f, panelScale, 0, 0f); + + // Update the options opacity. + bool canChooseQuery = DraedonText.Length == DraedonTextComplete.Length; + DraedonTextOptionsOpacity = MathHelper.Clamp(DraedonTextOptionsOpacity + canChooseQuery.ToDirectionInt() * 0.1f, 0f, 1f); + + // Display text options in the box. + bool hoveringOverAnyOption = false; + float opacity = DraedonTextOptionsOpacity * (1f - DraedonScreenStaticInterpolant); + Vector2 textTopLeft = selectionArea.TopLeft() + new Vector2(20f, 12f) * panelScale; + Texture2D markerTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonInquirySelector").Value; + + foreach (var dialog in DialogOptions.Where(d => d.Condition())) + { + // Skip/isolate the introduction text as needed. + string inquiry = dialog.Inquiry; + if (!Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker && !DialogHistory.Any(d => d.Dialog == DialogOptions[0].Response)) + { + if (inquiry != DialogOptions[0].Inquiry) + continue; + + while (DialogHistory.Count < 1) + DialogHistory.Add(new(string.Empty, true)); + } + else if (inquiry == DialogOptions[0].Inquiry) + continue; + + // Draw the text marker. + Vector2 markerScale = panelScale * 0.24f; + Vector2 markerDrawPosition = textTopLeft - Vector2.UnitX * markerTexture.Width * markerScale.X * 0.52f; + markerDrawPosition.Y += markerScale.Y * 22f; + + Color textColor = Color.Cyan; + Color markerColor = Color.White; + Vector2 textArea = DialogFont.MeasureString(inquiry) * GeneralScale; + Rectangle textAreaRect = new((int)textTopLeft.X, (int)textTopLeft.Y, (int)textArea.X, (int)textArea.Y); + Rectangle markerArea = Utils.CenteredRectangle(markerDrawPosition, markerTexture.Size() * markerScale); + textAreaRect.Y = markerArea.Y; + textAreaRect.Height = markerArea.Height; + + // Draw a bloom flare if the dialog hasn't been seen yet. + dialog.Update(); + if (dialog.BloomOpacity > 0f) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, Matrix.Identity); + + Texture2D bloomTex = ModContent.Request("CalamityMod/UI/ModeIndicator/BloomFlare").Value; + float scale = (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.05f + 0.26f; + float rot = Main.GlobalTimeWrappedHourly * 0.5f; + + Main.spriteBatch.Draw(bloomTex, markerDrawPosition, null, Color.SteelBlue * dialog.BloomOpacity * opacity, rot, new Vector2(123f, 124f), scale, 0, 0f); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Matrix.Identity); + } + + // Check if the player clicks on the text or hovers over it. + // If they're hovering over it, change the color to a yellow hover. + // If they clicked, have the player select that option as the dialog to ask Draedon about. + if ((MouseScreenArea.Intersects(textAreaRect) || MouseScreenArea.Intersects(markerArea)) && opacity >= 1f) + { + textColor = Color.Lerp(textColor, Color.Yellow, 0.5f); + markerColor = Color.Yellow; + + // Play the hover sound. + hoveringOverAnyOption = true; + if (HoverSoundDialogType != inquiry) + { + HoverSoundDialogType = inquiry; + SoundEngine.PlaySound(DialogOptionHoverSound); + } + + if (Main.mouseLeft && Main.mouseLeftRelease) + { + if (!Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker) + { + DialogHistory.Insert(0, new(string.Empty, true)); + DraedonTextOptionsOpacity = 0f; + } + + if (inquiry == DialogOptions[0].Inquiry) + DraedonTextCreationTimer = -72; + + if (DialogHistory.Count <= 0) + { + DialogHistory.Add(new(inquiry, false)); + DialogHistory.Add(new(string.Empty, true)); + } + else + { + DialogHistory[^1] = new(inquiry, false); + DialogHistory.Add(new(string.Empty, true)); + } + DraedonTextComplete = dialog.Response; + DraedonText = string.Empty; + if (!Main.LocalPlayer.Calamity().SeenDraedonDialogs.Contains(dialog.ID)) + Main.LocalPlayer.Calamity().SeenDraedonDialogs.Add(dialog.ID); + + CanDisplayLatestDialogEntries = false; + } + } + Main.spriteBatch.Draw(markerTexture, markerDrawPosition, null, markerColor * opacity, 0f, markerTexture.Size() * 0.5f, markerScale, 0, 0f); + + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, DialogFont, inquiry, textTopLeft, textColor * opacity, 0f, Vector2.Zero, Vector2.One * GeneralScale * 0.76f); + textTopLeft.Y += panelScale.Y * 12f; + } + + if (!hoveringOverAnyOption) + HoverSoundDialogType = null; + } + + public static void DisplayDialogHistory(Rectangle panelArea, Vector2 panelScale) + { + // Draw the outline for the dialog history. + float dialogHistoryDrawInterpolant = Utils.GetLerpValue(0.3f, 0f, DraedonScreenStaticInterpolant, true); + Texture2D dialogOutline = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonDialogOutline").Value; + Vector2 selectionCenter = panelArea.TopRight() - new Vector2(dialogOutline.Width * 0.5f + 16f, dialogOutline.Height * -0.5f - 6.5f) * panelScale; + Rectangle dialogArea = Utils.CenteredRectangle(selectionCenter, dialogOutline.Size() * panelScale); + Main.spriteBatch.Draw(dialogOutline, selectionCenter, null, Color.White * dialogHistoryDrawInterpolant, 0f, dialogOutline.Size() * 0.5f, panelScale, 0, 0f); + + // Intialize Draedon's dialog if necessary. + if (string.IsNullOrEmpty(DraedonTextComplete)) + DraedonTextComplete = InquiryText; + + // Type out Draedon text. + if (DraedonDialogDelayCountdown > 0) + DraedonDialogDelayCountdown--; + if (DraedonScreenStaticInterpolant <= 0f) + DraedonTextCreationTimer++; + if (DraedonTextCreationTimer >= DraedonTextCreationRate && DraedonText.Length < DraedonTextComplete.Length) + { + char nextLetter = DraedonTextComplete[DraedonText.Length]; + DraedonText += nextLetter; + DraedonTextCreationTimer = 0; + + // Initialize the dialog history if it's empty. + if (DialogHistory.Count <= 0) + DialogHistory.Add(new(string.Empty, true)); + + // Update the last dialog history entry as Draedon types. + DialogHistory[^1].Dialog = DraedonText; + + // Move to the next index in the dialog history once Draedon is finished speaking. + if (DraedonText.Length >= DraedonTextComplete.Length) + { + if (DraedonText == DialogOptions[0].Response) + Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker = true; + DialogHistory.Add(new(string.Empty, true)); + } + + // Play a small dialog sound, similar to that of Undertale. + if (DraedonDialogDelayCountdown <= 0 && nextLetter != ' ' && nextLetter != '\n') + { + SoundStyle[] DraedonTalks = { new("CalamityMod/Sounds/Custom/Codebreaker/DraedonTalk1"), + new("CalamityMod/Sounds/Custom/Codebreaker/DraedonTalk2"), + new("CalamityMod/Sounds/Custom/Codebreaker/DraedonTalk3")}; + + SoundStyle playThisSound = Main.rand.Next(DraedonTalks.ToArray()); + + SoundEngine.PlaySound(playThisSound with { Volume = 0.4f }, Main.LocalPlayer.Center); + DraedonDialogDelayCountdown = 4; + } + } + + // Display text in the box. + int textIndex = 0; + int entriesToPrune = 0; + bool showNewEntries = CanDisplayLatestDialogEntries; + var dialogEntries = DialogHistory.Where(d => !string.IsNullOrEmpty(d.Dialog)); + Vector2 textTopLeft = dialogArea.TopLeft() + new Vector2(20f, 14f) * panelScale; + Texture2D markerTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonInquirySelector").Value; + foreach (var entry in dialogEntries) + { + int lineIndex = 0; + foreach (string line in Utils.WordwrapString(entry.Dialog, DialogFont, 336, 100, out _)) + { + if (string.IsNullOrEmpty(line)) + continue; + + // Define a bunch of variables for text. These vary based on whether it's Draedon speaking or not. + bool textIsFromDraedon = entry.FromDraedon; + Color dialogColor = Draedon.TextColor; + Vector2 localTextTopLeft = textTopLeft; + Vector2 markerScale = panelScale * 0.24f; + Vector2 markerDrawPosition = textTopLeft - Vector2.UnitX * markerTexture.Width * markerScale.X * 0.6f; + markerDrawPosition.Y += markerScale.Y * 24f; + SpriteEffects markerDirection = SpriteEffects.None; + if (!textIsFromDraedon) + { + // Flip positions to the other side of the dialog outline if the text is being said by the player. + Vector2 anchorPoint = new(dialogArea.Center.X, markerDrawPosition.Y); + markerDrawPosition.X = anchorPoint.X + (anchorPoint.X - markerDrawPosition.X); + localTextTopLeft.X = anchorPoint.X + (anchorPoint.X - localTextTopLeft.X); + localTextTopLeft.X -= DialogFont.MeasureString(line).X * GeneralScale * 0.725f; + localTextTopLeft.Y -= markerScale.Y * 4f; + + // Use a neutral grey-ish color if text is being said by the player. + dialogColor = Color.LightGray; + + markerDirection = SpriteEffects.FlipHorizontally; + } + + if (entriesToPrune <= 0 && (textIndex < dialogEntries.Count() - 2 || showNewEntries)) + { + // Draw the text marker. + if (lineIndex <= 0) + Main.spriteBatch.Draw(markerTexture, markerDrawPosition, null, Color.White * dialogHistoryDrawInterpolant, 0f, markerTexture.Size() * 0.5f, markerScale, markerDirection, 0f); + + // Draw the text itself. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, DialogFont, line, localTextTopLeft, dialogColor * dialogHistoryDrawInterpolant, 0f, Vector2.Zero, Vector2.One * GeneralScale * 0.7f); + } + + textTopLeft.Y += panelScale.Y * 7.6f; + lineIndex++; + } + textTopLeft.Y += panelScale.Y * 16f; + if (textTopLeft.Y >= dialogArea.Bottom) + entriesToPrune++; + + textIndex++; + } + + // If the text entries went past the dialog box, prune the oldest ones. + while (entriesToPrune >= 1) + { + if (DialogHistory.Count <= 0) + break; + + string text = DialogHistory[0].Dialog; + if (text == DialogOptions[0].Inquiry) + Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker = true; + + DialogHistory.RemoveAt(0); + entriesToPrune--; + } + + CanDisplayLatestDialogEntries = true; + } + } +} diff --git a/UI/DraedonSummoning/CodebreakerUI.cs b/UI/DraedonSummoning/CodebreakerUI.cs index c5841d485d..3e3190c8ed 100644 --- a/UI/DraedonSummoning/CodebreakerUI.cs +++ b/UI/DraedonSummoning/CodebreakerUI.cs @@ -2,6 +2,8 @@ using System.Linq; using System.Text; using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.NPCs.ExoMechs; using CalamityMod.TileEntities; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -16,66 +18,162 @@ using Terraria.UI.Chat; namespace CalamityMod.UI.DraedonSummoning { - public static class CodebreakerUI + public partial class CodebreakerUI : ModSystem { - public static int ViewedTileEntityID = -1; - public static bool AwaitingCloseConfirmation = false; - public static bool AwaitingDecryptionTextClose = false; - public static float VerificationButtonScale = 1f; - public static float CancelButtonScale = 0.75f; - public static float ContactButtonScale = 1f; - public static float MechIconScale = 1f; - public static Vector2 BackgroundCenter => new Vector2(500f, Main.screenHeight * 0.5f + 115f); + public static int ViewedTileEntityID + { + get; + set; + } = -1; + + public static bool AwaitingCloseConfirmation + { + get; + set; + } = false; + + public static bool AwaitingDecryptionTextClose + { + get; + set; + } = false; + + public static bool DisplayingCommunicationText + { + get; + set; + } = false; + + public static float VerificationButtonScale + { + get; + set; + } = 1f; + + public static float CancelButtonScale + { + get; + set; + } = 0.75f; + + public static float ContactButtonScale + { + get; + set; + } = 1f; + + public static float CommunicateButtonScale + { + get; + set; + } = 1f; + + public static float MechIconScale + { + get; + set; + } = 1f; + + public static Vector2 BackgroundCenter => new(500f, Main.screenHeight * 0.5f + 115f); + public static float GeneralScale => MathHelper.Lerp(1f, 0.7f, Utils.GetLerpValue(1325f, 750f, Main.screenWidth, true)) * Main.UIScale; public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); public static readonly SoundStyle SummonSound = new("CalamityMod/Sounds/Custom/CodebreakerBeam"); + public static readonly SoundStyle BloodSound = new("CalamityMod/Sounds/Custom/Codebreaker/BloodForHekate"); + public static void Draw(SpriteBatch spriteBatch) { // If not viewing the specific tile entity's interface anymore, if the ID is for some reason invalid, or if the player is not equipped to continue viewing the UI // don't do anything other than resetting necessary data. - if (!TileEntity.ByID.ContainsKey(ViewedTileEntityID) || !(TileEntity.ByID[ViewedTileEntityID] is TECodebreaker codebreakerTileEntity) || !Main.LocalPlayer.WithinRange(codebreakerTileEntity.Center, 270f) || !Main.playerInventory) + if (!TileEntity.ByID.ContainsKey(ViewedTileEntityID) || TileEntity.ByID[ViewedTileEntityID] is not TECodebreaker codebreakerTileEntity || !Main.LocalPlayer.WithinRange(codebreakerTileEntity.Center, 270f) || !Main.playerInventory) { VerificationButtonScale = 1f; CancelButtonScale = 0.75f; ContactButtonScale = 1f; + CommunicateButtonScale = 1f; + CommunicationPanelScale = 0f; ViewedTileEntityID = -1; AwaitingCloseConfirmation = false; + DisplayingCommunicationText = false; MechIconScale = 1f; return; } // Draw the background. Texture2D backgroundTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonDecrypterBackground").Value; - spriteBatch.Draw(backgroundTexture, BackgroundCenter, null, Color.White, 0f, backgroundTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + spriteBatch.Draw(backgroundTexture, BackgroundCenter, null, Color.White, 0f, backgroundTexture.Size() * 0.5f, GeneralScale * (1f - CommunicationPanelScale), 0, 0f); Rectangle backgroundArea = Utils.CenteredRectangle(BackgroundCenter, backgroundTexture.Size() * GeneralScale); - if (MouseScreenArea.Intersects(backgroundArea)) + if (MouseScreenArea.Intersects(backgroundArea) && !DisplayingCommunicationText) Main.blockMouse = Main.LocalPlayer.mouseInterface = true; + // Display communication stuff as necessary. + if (DisplayingCommunicationText && CommunicationPanelScale == 0f) + { + CommunicationPanelScale = 1f; + DraedonScreenStaticInterpolant = 1f; + } + if (!DisplayingCommunicationText && CommunicationPanelScale != 0f) + { + CommunicationPanelScale = 0f; + DraedonScreenStaticInterpolant = 0f; + } + + if (DisplayingCommunicationText) + { + DisplayCommunicationPanel(); + DraedonScreenStaticInterpolant = MathHelper.Clamp(DraedonScreenStaticInterpolant - 0.01408f, 0f, 1f); + return; + } + + // Reset communication things. + DraedonTextCreationTimer = 0; + if (!string.IsNullOrEmpty(DraedonText) && DraedonTextComplete == DraedonDialogRegistry.DialogOptions[0].Inquiry) + Main.LocalPlayer.Calamity().HasTalkedAtCodebreaker = true; + + DraedonText = DraedonTextComplete = string.Empty; + DialogHistory.Clear(); + bool canSummonDraedon = codebreakerTileEntity.ReadyToSummonDraedon && CalamityWorld.AbleToSummonDraedon; + // canTalkToDraedon is currently permanently set to false due to being deemed unfinished and not fit for release. + // If there is a desire to re-enable it, replace the following line with the commented line beneath it. + bool canTalkToDraedon = false; + // bool canTalkToDraedon = codebreakerTileEntity.ReadyToSummonDraedon && DownedBossSystem.downedExoMechs; Vector2 backgroundTopLeft = BackgroundCenter - backgroundTexture.Size() * GeneralScale * 0.5f; // Draw the cell payment slot icon. Texture2D emptyCellIconTexture = ModContent.Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Empty").Value; Texture2D occupiedCellIconTexture = ModContent.Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Filled").Value; - Texture2D textPanelTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonDecrypterScreen").Value; - Texture2D cellTexture = codebreakerTileEntity.InputtedCellCount > 0 ? occupiedCellIconTexture : emptyCellIconTexture; + Texture2D bloodSampleIconTexture = ModContent.Request("CalamityMod/Items/Materials/BloodSample").Value; + Texture2D cellTexture = emptyCellIconTexture; + if (codebreakerTileEntity.InputtedCellCount > 0) + { + if (codebreakerTileEntity.ContainsBloodSample) + { + cellTexture = bloodSampleIconTexture; + } + else + { + cellTexture = occupiedCellIconTexture; + } + } Vector2 cellDrawCenter = backgroundTopLeft + Vector2.One * GeneralScale * 60f; Vector2 schematicSlotDrawCenter = cellDrawCenter + Vector2.UnitY * GeneralScale * 70f; Vector2 costDisplayLocation = schematicSlotDrawCenter + Vector2.UnitY * GeneralScale * 20f; Vector2 costVerificationLocation = costDisplayLocation + Vector2.UnitY * GeneralScale * 60f; Vector2 summonButtonCenter = backgroundTopLeft + new Vector2(58f, backgroundTexture.Height - 48f) * GeneralScale; + Vector2 talkButtonCenter = summonButtonCenter + Vector2.UnitX * GeneralScale * 172f; // Display some error text if the codebreaker isn't strong enough to decrypt the schematic. if (codebreakerTileEntity.HeldSchematicID != 0 && !codebreakerTileEntity.CanDecryptHeldSchematic) DisplayNotStrongEnoughErrorText(schematicSlotDrawCenter + new Vector2(-24f, 56f)); // Handle decryption costs. - else if (codebreakerTileEntity.HeldSchematicID != 0 && codebreakerTileEntity.DecryptionCountdown == 0) + else if (codebreakerTileEntity.HeldSchematicID != 0 && codebreakerTileEntity.DecryptionCountdown == 0 && !codebreakerTileEntity.ContainsBloodSample) { int cost = codebreakerTileEntity.DecryptionCellCost; DisplayCostText(costDisplayLocation, cost); @@ -95,6 +193,8 @@ namespace CalamityMod.UI.DraedonSummoning if (canSummonDraedon) HandleDraedonSummonButton(codebreakerTileEntity, summonButtonCenter); + if (canTalkToDraedon) + HandleDraedonTalkButton(talkButtonCenter); if (codebreakerTileEntity.DecryptionCountdown > 0 || AwaitingDecryptionTextClose) HandleDecryptionStuff(codebreakerTileEntity, backgroundTexture, backgroundTopLeft, schematicSlotDrawCenter + Vector2.UnitY * GeneralScale * 80f); @@ -118,15 +218,22 @@ namespace CalamityMod.UI.DraedonSummoning if (schematicType == ModContent.ItemType()) schematicIconTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/EncryptedSchematicIce").Value; - spriteBatch.Draw(schematicIconBG, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconBG.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + spriteBatch.Draw(schematicIconBG, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconBG.Size() * 0.5f, GeneralScale, 0, 0f); if (codebreakerTileEntity.HeldSchematicID != 0) - spriteBatch.Draw(schematicIconTexture, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + spriteBatch.Draw(schematicIconTexture, schematicSlotDrawCenter, null, Color.White, 0f, schematicIconTexture.Size() * 0.5f, GeneralScale, 0, 0f); HandleSchematicSlotInteractions(codebreakerTileEntity, schematicSlotDrawCenter, cellTexture.Size() * GeneralScale); // Create a temporary item for drawing purposes. // If cells are present, make the item reflect that. Item temporaryPowerCell = new Item(); - temporaryPowerCell.SetDefaults(ModContent.ItemType()); + if (codebreakerTileEntity.ContainsBloodSample) + { + temporaryPowerCell.SetDefaults(ModContent.ItemType()); + } + else + { + temporaryPowerCell.SetDefaults(ModContent.ItemType()); + } temporaryPowerCell.stack = codebreakerTileEntity.InputtedCellCount; Vector2 cellInteractionArea = ModContent.Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Empty").Value.Size() * GeneralScale; @@ -150,6 +257,7 @@ namespace CalamityMod.UI.DraedonSummoning if (Main.mouseLeft && Main.mouseLeftRelease && codebreakerTileEntity.DecryptionCountdown <= 0) { int powercellID = ModContent.ItemType(); + int sampleID = ModContent.ItemType(); short cellStackDiff = 0; bool shouldPlaySound = true; @@ -159,7 +267,7 @@ namespace CalamityMod.UI.DraedonSummoning cellStackDiff = (short)-Math.Min(temporaryItem.stack, temporaryItem.maxStack); Player p = Main.LocalPlayer; var source = p.GetSource_TileInteraction(codebreakerTileEntity.Position.X, codebreakerTileEntity.Position.Y); - p.QuickSpawnItem(source, powercellID, -cellStackDiff); + p.QuickSpawnItem(source, codebreakerTileEntity.ContainsBloodSample ? sampleID : powercellID, -cellStackDiff); // Do not play a sound in this situation. The player is going to pick up the dropped cells in a few frames, which will make sound. shouldPlaySound = false; @@ -168,20 +276,48 @@ namespace CalamityMod.UI.DraedonSummoning // If the slot is normally clicked, behavior depends on whether the player is holding power cells. else { - bool holdingPowercell = playerHandItem.type == powercellID; + bool holdingPowercell = playerHandItem.type == powercellID || (playerHandItem.type == sampleID && CalamityWorld.getFixedBoi); + bool powercellsinserted = !codebreakerTileEntity.ContainsBloodSample && temporaryItem.stack > 0; + bool cansummon = codebreakerTileEntity.ReadyToSummonDraedon && CalamityWorld.AbleToSummonDraedon; // If the player's held power cells can be stacked on top of what's already in the codeberaker, then stack them. if (holdingPowercell && temporaryItem.stack < TECodebreaker.MaxCellCapacity) { - int spaceLeft = TECodebreaker.MaxCellCapacity - temporaryItem.stack; + // If theres no power cells inside, it's GFB, and the player has a blood sample, it can be inserted + if (playerHandItem.type == sampleID && CalamityWorld.getFixedBoi && !powercellsinserted && cansummon) + { + // Play a gross sound if no samples are in yet + if (temporaryItem.stack == 0) + { + SoundEngine.PlaySound(BloodSound, codebreakerTileEntity.Center); + } + codebreakerTileEntity.ContainsBloodSample = true; - // If the player has more cells than there is space left, insert as many as possible. Otherwise insert all the cells. - int cellsToInsert = Math.Min(playerHandItem.stack, spaceLeft); - cellStackDiff = (short)cellsToInsert; - playerHandItem.stack -= cellsToInsert; - if (playerHandItem.stack == 0) - playerHandItem.TurnToAir(); - AwaitingDecryptionTextClose = false; + int spaceLeft = TECodebreaker.MaxCellCapacity - temporaryItem.stack; + + // If the player has more cells than there is space left, insert as many as possible. Otherwise insert all the cells. + int cellsToInsert = Math.Min(playerHandItem.stack, spaceLeft); + cellStackDiff = (short)cellsToInsert; + playerHandItem.stack -= cellsToInsert; + if (playerHandItem.stack == 0) + playerHandItem.TurnToAir(); + AwaitingDecryptionTextClose = false; + } + // If theres nothing inside or there are cells inside, cells can be inserted + if (playerHandItem.type == powercellID && (temporaryItem.stack == 0 || powercellsinserted)) + { + codebreakerTileEntity.ContainsBloodSample = false; + + int spaceLeft = TECodebreaker.MaxCellCapacity - temporaryItem.stack; + + // If the player has more cells than there is space left, insert as many as possible. Otherwise insert all the cells. + int cellsToInsert = Math.Min(playerHandItem.stack, spaceLeft); + cellStackDiff = (short)cellsToInsert; + playerHandItem.stack -= cellsToInsert; + if (playerHandItem.stack == 0) + playerHandItem.TurnToAir(); + AwaitingDecryptionTextClose = false; + } } // If the player is holding nothing, then pick up all the power cells (if any exist), up to the max-stack limit. @@ -195,6 +331,7 @@ namespace CalamityMod.UI.DraedonSummoning playerHandItem.stack = -cellStackDiff; temporaryItem.TurnToAir(); AwaitingDecryptionTextClose = false; + codebreakerTileEntity.ContainsBloodSample = false; } } @@ -279,8 +416,8 @@ namespace CalamityMod.UI.DraedonSummoning // And draw the cells to the right of the text. Texture2D cellTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/DraedonPowerCell").Value; Vector2 offsetDrawPosition = new Vector2(drawPosition.X + ChatManager.GetStringSize(FontAssets.MouseText.Value, text, Vector2.One, -1f).X * GeneralScale + GeneralScale * 15f, drawPosition.Y + GeneralScale * 30f); - Main.spriteBatch.Draw(cellTexture, offsetDrawPosition, null, Color.White, 0f, cellTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); - + Main.spriteBatch.Draw(cellTexture, offsetDrawPosition, null, Color.White, 0f, cellTexture.Size() * 0.5f, GeneralScale, 0, 0f); + // Display the cell quantity numerically below the drawn cells. Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.ItemStack.Value, totalCellsCost.ToString(), offsetDrawPosition.X - GeneralScale * 11f, offsetDrawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), GeneralScale * 0.75f); } @@ -315,7 +452,7 @@ namespace CalamityMod.UI.DraedonSummoning VerificationButtonScale = MathHelper.Clamp(VerificationButtonScale - 0.05f, 1f, 1.35f); // Draw the confirmation icon. - Main.spriteBatch.Draw(confirmationTexture, drawPosition, null, Color.White, 0f, confirmationTexture.Size() * 0.5f, VerificationButtonScale * GeneralScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(confirmationTexture, drawPosition, null, Color.White, 0f, confirmationTexture.Size() * 0.5f, VerificationButtonScale * GeneralScale, 0, 0f); } public static void DisplayDecryptCancelButton(TECodebreaker codebreakerTileEntity, Vector2 drawPosition) @@ -359,7 +496,7 @@ namespace CalamityMod.UI.DraedonSummoning } // Draw the cancel icon. - Main.spriteBatch.Draw(cancelTexture, drawPosition, null, Color.White, 0f, cancelTexture.Size() * 0.5f, CancelButtonScale * GeneralScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(cancelTexture, drawPosition, null, Color.White, 0f, cancelTexture.Size() * 0.5f, CancelButtonScale * GeneralScale, 0, 0f); } public static void DrawDecryptCancelConfirmationText(Vector2 drawPosition) @@ -368,7 +505,7 @@ namespace CalamityMod.UI.DraedonSummoning drawPosition.X += GeneralScale * 196f; Vector2 scale = new Vector2(1f, 0.3f) * GeneralScale; - Main.spriteBatch.Draw(textPanelTexture, drawPosition, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(textPanelTexture, drawPosition, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, scale, 0, 0); string confirmationText = "Are you sure?"; Vector2 confirmationTextPosition = drawPosition - FontAssets.MouseText.Value.MeasureString(confirmationText) * GeneralScale * 0.5f + Vector2.UnitY * GeneralScale * 4f; @@ -379,7 +516,7 @@ namespace CalamityMod.UI.DraedonSummoning { Texture2D textPanelTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/DraedonDecrypterScreen").Value; Vector2 textPanelCenter = backgroundTopLeft + Vector2.UnitX * backgroundTexture.Width * GeneralScale + textPanelTexture.Size() * new Vector2(-0.5f, 0.5f) * GeneralScale; - Main.spriteBatch.Draw(textPanelTexture, textPanelCenter, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(textPanelTexture, textPanelCenter, null, Color.White, 0f, textPanelTexture.Size() * 0.5f, GeneralScale, 0, 0f); // Generate gibberish and use slowly insert the real text. // When decryption is done the gibberish will go away and only the underlying text will remain. @@ -421,9 +558,9 @@ namespace CalamityMod.UI.DraedonSummoning // Draw a small bar at the bottom to indicate how much work is left. Texture2D borderTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/CodebreakerDecyptionBar").Value; Texture2D barTexture = ModContent.Request("CalamityMod/UI/DraedonSummoning/CodebreakerDecyptionBarCharge").Value; - Main.spriteBatch.Draw(borderTexture, barCenter, null, Color.White, 0f, borderTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(borderTexture, barCenter, null, Color.White, 0f, borderTexture.Size() * 0.5f, GeneralScale, 0, 0); Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * codebreakerTileEntity.DecryptionCompletion), barTexture.Width); - Main.spriteBatch.Draw(barTexture, barCenter, barRectangle, Color.White, 0f, barTexture.Size() * 0.5f, GeneralScale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(barTexture, barCenter, barRectangle, Color.White, 0f, barTexture.Size() * 0.5f, GeneralScale, 0, 0); // Display a completion percentage below the bar as a more precise indicator. string completionText = $"{codebreakerTileEntity.DecryptionCompletion * 100f:n2}%"; @@ -437,6 +574,8 @@ namespace CalamityMod.UI.DraedonSummoning Rectangle clickArea = Utils.CenteredRectangle(drawPosition, contactButton.Size() * VerificationButtonScale); + float iconrotation = codebreakerTileEntity.ContainsBloodSample ? Main.GlobalTimeWrappedHourly * 20f : 0f; + // Check if the mouse is hovering over the contact button area. if (MouseScreenArea.Intersects(clickArea)) { @@ -450,6 +589,10 @@ namespace CalamityMod.UI.DraedonSummoning { CalamityWorld.DraedonSummonCountdown = CalamityWorld.DraedonSummonCountdownMax; CalamityWorld.DraedonSummonPosition = codebreakerTileEntity.Center + new Vector2(-8f, -100f); + if (CalamityWorld.getFixedBoi && codebreakerTileEntity.ContainsBloodSample) + { + CalamityWorld.DraedonMechdusa = true; + } SoundEngine.PlaySound(SummonSound, CalamityWorld.DraedonSummonPosition); if (Main.netMode != NetmodeID.SinglePlayer) @@ -457,6 +600,7 @@ namespace CalamityMod.UI.DraedonSummoning var netMessage = CalamityMod.Instance.GetPacket(); netMessage.Write((byte)CalamityModMessageType.CodebreakerSummonStuff); netMessage.Write(CalamityWorld.DraedonSummonCountdown); + netMessage.Write(CalamityWorld.DraedonMechdusa); netMessage.WriteVector2(CalamityWorld.DraedonSummonPosition); netMessage.Send(); } @@ -468,11 +612,16 @@ namespace CalamityMod.UI.DraedonSummoning ContactButtonScale = MathHelper.Clamp(ContactButtonScale - 0.05f, 1f, 1.35f); // Draw the contact button. - Main.spriteBatch.Draw(contactButton, drawPosition, null, Color.White, 0f, contactButton.Size() * 0.5f, ContactButtonScale * GeneralScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(contactButton, drawPosition, null, Color.White, iconrotation, contactButton.Size() * 0.5f, ContactButtonScale * GeneralScale, 0, 0f); // And display a text indicator that describes the function of the button. // The color of the text cycles through the exo mech crystal palette. string contactText = "Contact"; + if (DownedBossSystem.downedExoMechs) + contactText = "Summon"; + if (codebreakerTileEntity.ContainsBloodSample) + contactText = "Evoke"; + Color contactTextColor = CalamityUtils.MulticolorLerp((float)Math.Cos(Main.GlobalTimeWrappedHourly * 0.7f) * 0.5f + 0.5f, CalamityUtils.ExoPalette); // Center the draw position. @@ -481,6 +630,40 @@ namespace CalamityMod.UI.DraedonSummoning Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, contactText, drawPosition.X, drawPosition.Y, contactTextColor, Color.Black, Vector2.Zero, GeneralScale); } + public static void HandleDraedonTalkButton(Vector2 drawPosition) + { + Texture2D communicateButton = ModContent.Request("CalamityMod/UI/DraedonSummoning/CommunicateIcon").Value; + + Rectangle clickArea = Utils.CenteredRectangle(drawPosition, communicateButton.Size() * VerificationButtonScale); + + // Check if the mouse is hovering over the communicate button area. + if (MouseScreenArea.Intersects(clickArea)) + { + // If so, cause the button to inflate a little bit. + CommunicateButtonScale = MathHelper.Clamp(CommunicateButtonScale + 0.035f, 1f, 1.35f); + + // If a click is done, do a check. This triggers the communicate panel opening animation. + if (Main.mouseLeft && Main.mouseLeftRelease) + DisplayingCommunicationText = true; + } + + // Otherwise, if not hovering, cause the button to deflate back to its normal size. + else + CommunicateButtonScale = MathHelper.Clamp(CommunicateButtonScale - 0.05f, 1f, 1.35f); + + // Draw the communication button. + Main.spriteBatch.Draw(communicateButton, drawPosition, null, Color.White, 0f, communicateButton.Size() * 0.5f, CommunicateButtonScale * GeneralScale, 0, 0f); + + // And display a text indicator that describes the function of the button. + // The color of the text is the same as Draedon's talk color. + string communicateText = "Communicate"; + + // Center the draw position. + drawPosition.X -= FontAssets.MouseText.Value.MeasureString(communicateText).X * GeneralScale * 0.5f; + drawPosition.Y += GeneralScale * 20f; + Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, communicateText, drawPosition.X, drawPosition.Y, Draedon.TextColor, Color.Black, Vector2.Zero, GeneralScale); + } + public static void DisplayNotStrongEnoughErrorText(Vector2 drawPosition) { string text = "Encryption unsolveable: Upgrades required."; diff --git a/UI/DraedonSummoning/CommunicateIcon.png b/UI/DraedonSummoning/CommunicateIcon.png new file mode 100644 index 0000000000..e11814717d Binary files /dev/null and b/UI/DraedonSummoning/CommunicateIcon.png differ diff --git a/UI/DraedonSummoning/DraedonContactPanel.png b/UI/DraedonSummoning/DraedonContactPanel.png new file mode 100644 index 0000000000..8a5e54519b Binary files /dev/null and b/UI/DraedonSummoning/DraedonContactPanel.png differ diff --git a/UI/DraedonSummoning/DraedonDialogEntry.cs b/UI/DraedonSummoning/DraedonDialogEntry.cs new file mode 100644 index 0000000000..4eab4ea4bb --- /dev/null +++ b/UI/DraedonSummoning/DraedonDialogEntry.cs @@ -0,0 +1,54 @@ +using System; +using System.Text; +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.UI.DraedonSummoning +{ + public class DraedonDialogEntry + { + public string Inquiry; + + public string Response; + + public float BloomOpacity; + + public Func Condition; + + // A bit of a scuffed way of identifying text based on a single neat number but it should be fine for all intents and purposes. + public ulong ID + { + get + { + ulong result = 0uL; + byte[] bytes = Encoding.UTF8.GetBytes(Response); + + unchecked + { + for (int i = 0; i < bytes.Length; i++) + result += (ulong)bytes[i] << (i * 8); + } + return result; + } + } + + public bool HasBeenSeen => Main.LocalPlayer.Calamity().SeenDraedonDialogs.Contains(ID); + + public DraedonDialogEntry(string inquiry, string response, Func condition = null) + { + // Initialize the condition as a simple "always show up" if nothing else is inputted. + Condition = condition ?? (() => true); + + Inquiry = inquiry; + Response = response; + } + + public void Update() + { + if (!HasBeenSeen) + BloomOpacity = 1f; + else + BloomOpacity = MathHelper.Clamp(BloomOpacity - 0.04f, 0f, 1f); + } + } +} diff --git a/UI/DraedonSummoning/DraedonDialogOutline.png b/UI/DraedonSummoning/DraedonDialogOutline.png new file mode 100644 index 0000000000..550c8b19cc Binary files /dev/null and b/UI/DraedonSummoning/DraedonDialogOutline.png differ diff --git a/UI/DraedonSummoning/DraedonDialogRegistry.cs b/UI/DraedonSummoning/DraedonDialogRegistry.cs new file mode 100644 index 0000000000..0763dc9197 --- /dev/null +++ b/UI/DraedonSummoning/DraedonDialogRegistry.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace CalamityMod.UI.DraedonSummoning +{ + public static class DraedonDialogRegistry + { + public static readonly DraedonDialogEntry WhoAreYou = new("Who are you?", "An ambitious question, if you are a philosopher. I will give only the facts.\n\n" + + "I am not of this planet. I was born from machines. Or rather, I was... created. It may be misleading to say I was born.\n\n" + + "The exact circumstances, I do not know. I do know that my first instance of awareness was that I was surrounded by a workshop.\n\n" + + "All I have known since then was the act of creation and destruction."); + + public static readonly DraedonDialogEntry CalamitasBeforeHerDefeat = new("Calamitas", "The witch? She is a walking weapon. Such powerful magic in a living being was destined to be so. Look at yourself now.", () => !DownedBossSystem.downedCalamitas); + + public static readonly DraedonDialogEntry CalamitasAfterHerDefeat = new("Calamitas", "She has mellowed, I've noticed. For you creatures so burdened by emotion and guilt, I wonder now, how she manages to live with herself.", () => + DownedBossSystem.downedCalamitas); + + public static readonly DraedonDialogEntry Plague = new("The Plague", "Fascinating, isn't it? I wasn't able to control it, unfortunately, but for science there is no such thing as failure as long as you record the results.\n\n" + + "I knew the Astral Infection was capable of converting even machinery, but for nanotechnology I'd given it to react in kind, and begin to use the virus as a building block itself...\n\n" + + "Marvelous.", () => DownedBossSystem.downedPlaguebringer); + + public static readonly DraedonDialogEntry SulphurousSea = new("The Sulphuric Sea", "Your concern for the utter destruction of the ecosystem is understandable, for you biological, and sentimental folk. However, " + + "nothing is irreparable or truly unrecreatable. Not even your sacred 'miracle of life'.\n\n" + + "The sea simply exists now in a different state than what it once was, one that resulted out of convenience for my work.\n\n" + + "Should I ever need to return to that sea? A pointless worry. I shall simply recreate it from the data I gathered, from the bedrock up. I would be a shame as a creator should I not be able to do that."); + + public static readonly DraedonDialogEntry TheTyrant = new("The Tyrant", "My patron...\n" + + "He is not someone I have spoken to in a very long time.\n\n" + + "Is that such a surprise? He no longer required my services and I no longer needed his patronage. Many years ago now he withdrew himself to some secret hideaway. I suspect, to the grave of dragons he spoke of...\n\n" + + "Should you locate him, I'll await the news of either his or your death. Perhaps I will collect the cadaver.", () => DownedBossSystem.downedCalamitas); + + internal static List DialogOptions = new() + { + // The first index is assumed to be the "who are you?" dialog by the UI. All other indices can be freely swapped around, however. + WhoAreYou, + + CalamitasBeforeHerDefeat, + CalamitasAfterHerDefeat, + Plague, + SulphurousSea, + TheTyrant + }; + } +} diff --git a/UI/DraedonSummoning/DraedonIconBorder.png b/UI/DraedonSummoning/DraedonIconBorder.png new file mode 100644 index 0000000000..27f6801dcd Binary files /dev/null and b/UI/DraedonSummoning/DraedonIconBorder.png differ diff --git a/UI/DraedonSummoning/DraedonIconBorderInner.png b/UI/DraedonSummoning/DraedonIconBorderInner.png new file mode 100644 index 0000000000..2aeab1848e Binary files /dev/null and b/UI/DraedonSummoning/DraedonIconBorderInner.png differ diff --git a/UI/DraedonSummoning/DraedonInquirySelector.png b/UI/DraedonSummoning/DraedonInquirySelector.png new file mode 100644 index 0000000000..05521d23a4 Binary files /dev/null and b/UI/DraedonSummoning/DraedonInquirySelector.png differ diff --git a/UI/DraedonSummoning/DraedonSelectionOutline.png b/UI/DraedonSummoning/DraedonSelectionOutline.png new file mode 100644 index 0000000000..bef2bd16c9 Binary files /dev/null and b/UI/DraedonSummoning/DraedonSelectionOutline.png differ diff --git a/UI/DraedonsArsenal/PowerCellSlot_Blood.png b/UI/DraedonsArsenal/PowerCellSlot_Blood.png new file mode 100644 index 0000000000..21ab14e734 Binary files /dev/null and b/UI/DraedonsArsenal/PowerCellSlot_Blood.png differ diff --git a/UI/InvasionProgressUI.cs b/UI/InvasionProgressUI.cs index 988daa4002..468a20bbbb 100644 --- a/UI/InvasionProgressUI.cs +++ b/UI/InvasionProgressUI.cs @@ -65,7 +65,7 @@ namespace CalamityMod.UI } public virtual void Draw(SpriteBatch spriteBatch) { - if (!IsActive) + if (!IsActive || Main.invasionProgressMode == 0) return; int barOffsetY = 0; diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index 4eae8f9e0f..2e8c74f53e 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -172,7 +172,7 @@ namespace CalamityMod.UI.ModeIndicator //Get a "regexed" size which matches the text properly. //Indeed, there is some scuffery in the code that makes it so that chat tags still get accounted as extra size, so we have to use 2 different values //One for the displacement, which is the improper size vanilla uses, and another for the actual visual size, which is the one the textbox will use - int numLines = Regex.Matches(textToDisplay, "\n").Count; //It's inconsistent. Adding one by default makes some textboxes too large, not adding one can make some too small + int numLines = 1 + Regex.Matches(textToDisplay, "\n").Count; //It's inconsistent. Adding one by default makes some textboxes too large, not adding one can make some too small string heightCalculator = string.Concat(Enumerable.Repeat("mis nuevos los gatos \n", numLines)); Vector2 regexedBoxSize = new Vector2(ChatManager.GetStringSize(MouseText.Value, textToDisplay, Vector2.One).X, ChatManager.GetStringSize(MouseText.Value, heightCalculator, Vector2.One).Y); diff --git a/UI/SpeedrunTimerUI.cs b/UI/SpeedrunTimerUI.cs index 8cd76263fb..cd8e75828f 100644 --- a/UI/SpeedrunTimerUI.cs +++ b/UI/SpeedrunTimerUI.cs @@ -6,7 +6,7 @@ using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; @@ -129,7 +129,7 @@ namespace CalamityMod.UI 35 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 36 => ModContent.Request("CalamityMod/NPCs/Polterghast/Necroplasm_Head_Boss").Value, 37 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, - 38 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, + 38 => ModContent.Request("CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss").Value, 39 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 40 => ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon").Value, 41 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, diff --git a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs index 29c9d91e4d..36c7756de2 100644 --- a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs +++ b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs @@ -53,7 +53,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter CalamityPlayer modPlayer = player.Calamity(); // If not drawing the water meter, save its latest position to config and leave. - if (modPlayer.SulphWaterUIOpacity > 0f) + if (modPlayer.SulphWaterUIOpacity > 0f && (modPlayer.ZoneSulphur || player.Calamity().ZoneAbyssLayer1)) DrawWaterBar(spriteBatch, modPlayer, screenPos); else { diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index fd20cf2cad..07ba89098e 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -539,9 +539,17 @@ namespace CalamityMod Register(); // Earlier Rocket Is for early rocket weapons - Recipe.Create(ItemID.RocketI, 20). - AddIngredient(ItemID.EmptyBullet, 20). - AddIngredient(ItemID.ExplosivePowder, 1). + Recipe.Create(ItemID.RocketI, 100). + AddRecipeGroup("IronBar"). + AddIngredient(ItemID.EmptyBullet, 100). + AddIngredient(ItemID.ExplosivePowder, 4). + AddTile(TileID.MythrilAnvil). + Register(); + // and Rocket IIs (requires slightly more explosive powder) + Recipe.Create(ItemID.RocketII, 100). + AddRecipeGroup("IronBar"). + AddIngredient(ItemID.EmptyBullet, 100). + AddIngredient(ItemID.ExplosivePowder, 5). AddTile(TileID.MythrilAnvil). Register(); @@ -573,7 +581,6 @@ namespace CalamityMod AddIngredient(ItemID.Feather, 2). AddIngredient(). AddIngredient(ItemID.GoldCoin, 15). - AddRecipeGroup(AnyGoldBar, 8). AddTile(TileID.Anvils). Register(); @@ -771,36 +778,40 @@ namespace CalamityMod r.requiredTile[idx] = newTileID; }; - var edits = new Dictionary, Action>(32) + var edits = new Dictionary, Action>(128) { { Vanilla(ItemID.EnchantedBoomerang), Disable }, // Calamity adds its own recipe - { Vanilla(ItemID.JestersArrow), JesterArrowRecipeEdit }, - { Vanilla(ItemID.NightsEdge), AddIngredient(ModContent.ItemType(), 5) }, + + // Make various things cheaper (sorted by progression) { Vanilla(ItemID.Leather), ChangeIngredientStack(ItemID.RottenChunk, 2) }, - { VanillaEach(ItemID.Flamarang, ItemID.PhoenixBlaster), SwapIngredients(0, 1) }, - { Vanilla(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType(), 3) }, - { Vanilla(ItemID.TrueNightsEdge), TrueNightsEdgeRecipeEdit }, - { Vanilla(ItemID.TrueExcalibur), ChangeIngredientStack(ItemID.ChlorophyteBar, 12) }, - { Vanilla(ItemID.TerraBlade), AddIngredient(ModContent.ItemType(), 12) }, - { Vanilla(ItemID.Zenith), AddIngredient(ModContent.ItemType(), 5) }, - { Vanilla(ItemID.FireGauntlet), AddIngredient(ModContent.ItemType(), 5) }, - { Vanilla(ItemID.SpiritFlame), AddGroup(AnyAdamantiteBar, 2) }, - { VanillaEach(ItemID.BeetleHelmet, ItemID.BeetleScaleMail, ItemID.BeetleShell, ItemID.BeetleLeggings), SwapIngredients(0, 1) }, - { Vanilla(ItemID.GoblinBattleStandard), ChangeIngredientStack(ItemID.TatteredCloth, 5) }, + { Vanilla(ItemID.JestersArrow), JesterArrowRecipeEdit }, { Vanilla(ItemID.WormFood), WormFoodRecipeEdit }, { Vanilla(ItemID.BloodySpine), BloodySpineRecipeEdit }, - { VanillaEach(ItemID.PumpkinMoonMedallion, ItemID.NaughtyPresent), Disable }, // Calamity adds its own recipes + { Vanilla(ItemID.GoblinBattleStandard), ChangeIngredientStack(ItemID.TatteredCloth, 5) }, { VanillaEach( ItemID.BluePhasesaber, ItemID.GreenPhasesaber, ItemID.OrangePhasesaber, ItemID.PurplePhasesaber, ItemID.RedPhasesaber, ItemID.WhitePhasesaber, ItemID.YellowPhasesaber), - ChangeIngredientStack(ItemID.CrystalShard, 20) + ChangeIngredientStack(ItemID.CrystalShard, 20) // TODO -- PORT: 1.4.4 reduces Phasesaber crystals to 25, remove this }, - { Vanilla(ItemID.OpticStaff), RemoveIngredient(ItemID.HallowedBar) }, - { Vanilla(ItemID.ShroomiteBar), ChangeIngredientStack(ItemID.GlowingMushroom, 5) }, { Vanilla(ItemID.ChlorophyteBar), ChangeIngredientStack(ItemID.ChlorophyteOre, 4) }, + + // TODO -- DELETE THIS LINE IN 1.4.4 PORT { Vanilla(ItemID.AnkhCharm), AddIngredient(ItemID.PocketMirror) }, - { Vanilla(ItemID.CelestialEmblem), ReplaceIngredient(ItemID.AvengerEmblem, ItemID.SorcererEmblem) }, - { Vanilla(ItemID.MechanicalGlove), ReplaceIngredient(ItemID.AvengerEmblem, ItemID.WarriorEmblem) }, + + { Vanilla(ItemID.ShroomiteBar), ChangeIngredientStack(ItemID.GlowingMushroom, 5) }, + { Vanilla(ItemID.TrueNightsEdge), TrueNightsEdgeRecipeEdit }, + { Vanilla(ItemID.TrueExcalibur), ChangeIngredientStack(ItemID.ChlorophyteBar, 12) }, + + // Tier lock various items to a higher tier (sorted by progression) + { Vanilla(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType(), 3) }, + { Vanilla(ItemID.NightsEdge), AddIngredient(ModContent.ItemType(), 5) }, + { Vanilla(ItemID.SpiritFlame), AddGroup(AnyAdamantiteBar, 2) }, + { Vanilla(ItemID.TerraBlade), AddIngredient(ModContent.ItemType(), 12) }, + { Vanilla(ItemID.FireGauntlet), AddIngredient(ModContent.ItemType(), 5) }, + { Vanilla(ItemID.Zenith), AddIngredient(ModContent.ItemType(), 5) }, + + // Tier unlock various items to a lower tier (sorted by progression) + // Move a bunch of mythril anvil locked stuff in early HM to regular anvils to fit progression changes { VanillaEach( ItemID.MechanicalEye, ItemID.MechanicalWorm, ItemID.MechanicalSkull, ItemID.DaoofPow, ItemID.Chik, ItemID.MeteorStaff, ItemID.CoolWhip, @@ -808,8 +819,22 @@ namespace CalamityMod ItemID.CursedArrow, ItemID.CursedBullet, ItemID.IchorArrow, ItemID.IchorBullet), ReplaceTile(TileID.MythrilAnvil, TileID.Anvils) }, + { Vanilla(ItemID.OpticStaff), RemoveIngredient(ItemID.HallowedBar) }, - // All PHM ore armors are 10/16/14 + // Swap hellstone recipe ordering (they have bars first and it's wrong and irritating) + { VanillaEach(ItemID.Flamarang, ItemID.PhoenixBlaster), SwapIngredients(0, 1) }, + + // Swap Beetle Armor recipe ordering (they have beetle husks first and it's wrong and irritating) + { VanillaEach(ItemID.BeetleHelmet, ItemID.BeetleScaleMail, ItemID.BeetleShell, ItemID.BeetleLeggings), SwapIngredients(0, 1) }, + + // Pumpkin & Frost Moon non linearity + { Vanilla(ItemID.PumpkinMoonMedallion), RemoveIngredient(ItemID.HallowedBar) }, + { Vanilla(ItemID.NaughtyPresent), RemoveIngredient(ItemID.SoulofFright) }, + + // Add 20 Souls of Flight to vanilla Luminite wings + { VanillaEach(ItemID.WingsSolar, ItemID.WingsVortex, ItemID.WingsNebula, ItemID.WingsStardust), AddIngredient(ItemID.SoulofFlight, 20) }, + + // Standardize the costs of all PHM ore armors to 10/16/14 head/chest/legs { Vanilla(ItemID.CopperHelmet), ChangeIngredientStack(ItemID.CopperBar, 10) }, { Vanilla(ItemID.CopperChainmail), ChangeIngredientStack(ItemID.CopperBar, 16) }, { Vanilla(ItemID.CopperGreaves), ChangeIngredientStack(ItemID.CopperBar, 14) }, @@ -835,57 +860,57 @@ namespace CalamityMod { Vanilla(ItemID.PlatinumChainmail), ChangeIngredientStack(ItemID.PlatinumBar, 16) }, { Vanilla(ItemID.PlatinumGreaves), ChangeIngredientStack(ItemID.PlatinumBar, 14) }, - // HM ores: - // 12 BARS : Melee Helm, Ranged Helm, Magic Helm, Pickaxe, Drill, Waraxe, Chainsaw, Sword, Spear, Repeater - // 24 BARS : Breastplate - // 18 BARS : Leggings + // Standardize the costs of all HM ore items to the following: + // 10 BARS : Melee Helm, Ranged Helm, Magic Helm, Pickaxe, Drill, Waraxe, Chainsaw, Sword, Spear, Repeater + // 20 BARS : Breastplate + // 15 BARS : Leggings { VanillaEach( ItemID.CobaltHelmet, ItemID.CobaltMask, ItemID.CobaltHat, ItemID.CobaltPickaxe, ItemID.CobaltDrill, ItemID.CobaltWaraxe, ItemID.CobaltChainsaw, ItemID.CobaltSword, ItemID.CobaltNaginata, ItemID.CobaltRepeater), - ChangeIngredientStack(ItemID.CobaltBar, 12) + ChangeIngredientStack(ItemID.CobaltBar, 10) }, - { Vanilla(ItemID.CobaltBreastplate), ChangeIngredientStack(ItemID.CobaltBar, 24) }, - { Vanilla(ItemID.CobaltLeggings), ChangeIngredientStack(ItemID.CobaltBar, 18) }, + { Vanilla(ItemID.CobaltBreastplate), ChangeIngredientStack(ItemID.CobaltBar, 20) }, + { Vanilla(ItemID.CobaltLeggings), ChangeIngredientStack(ItemID.CobaltBar, 15) }, { VanillaEach( ItemID.PalladiumHelmet, ItemID.PalladiumMask, ItemID.PalladiumHeadgear, ItemID.PalladiumPickaxe, ItemID.PalladiumDrill, ItemID.PalladiumWaraxe, ItemID.PalladiumChainsaw, ItemID.PalladiumSword, ItemID.PalladiumPike, ItemID.PalladiumRepeater), - ChangeIngredientStack(ItemID.PalladiumBar, 12) + ChangeIngredientStack(ItemID.PalladiumBar, 10) }, - { Vanilla(ItemID.PalladiumBreastplate), ChangeIngredientStack(ItemID.PalladiumBar, 24) }, - { Vanilla(ItemID.PalladiumLeggings), ChangeIngredientStack(ItemID.PalladiumBar, 18) }, + { Vanilla(ItemID.PalladiumBreastplate), ChangeIngredientStack(ItemID.PalladiumBar, 20) }, + { Vanilla(ItemID.PalladiumLeggings), ChangeIngredientStack(ItemID.PalladiumBar, 15) }, { VanillaEach( ItemID.MythrilHelmet, ItemID.MythrilHat, ItemID.MythrilHood, ItemID.MythrilPickaxe, ItemID.MythrilDrill, ItemID.MythrilWaraxe, ItemID.MythrilChainsaw, ItemID.MythrilSword, ItemID.MythrilHalberd, ItemID.MythrilRepeater), - ChangeIngredientStack(ItemID.MythrilBar, 12) + ChangeIngredientStack(ItemID.MythrilBar, 10) }, - { Vanilla(ItemID.MythrilChainmail), ChangeIngredientStack(ItemID.MythrilBar, 24) }, - { Vanilla(ItemID.MythrilGreaves), ChangeIngredientStack(ItemID.MythrilBar, 18) }, + { Vanilla(ItemID.MythrilChainmail), ChangeIngredientStack(ItemID.MythrilBar, 20) }, + { Vanilla(ItemID.MythrilGreaves), ChangeIngredientStack(ItemID.MythrilBar, 15) }, { VanillaEach( ItemID.OrichalcumHelmet, ItemID.OrichalcumMask, ItemID.OrichalcumHeadgear, ItemID.OrichalcumPickaxe, ItemID.OrichalcumDrill, ItemID.OrichalcumWaraxe, ItemID.OrichalcumChainsaw, ItemID.OrichalcumSword, ItemID.OrichalcumHalberd, ItemID.OrichalcumRepeater), - ChangeIngredientStack(ItemID.OrichalcumBar, 12) + ChangeIngredientStack(ItemID.OrichalcumBar, 10) }, - { Vanilla(ItemID.OrichalcumBreastplate), ChangeIngredientStack(ItemID.OrichalcumBar, 24) }, - { Vanilla(ItemID.OrichalcumLeggings), ChangeIngredientStack(ItemID.OrichalcumBar, 18) }, + { Vanilla(ItemID.OrichalcumBreastplate), ChangeIngredientStack(ItemID.OrichalcumBar, 20) }, + { Vanilla(ItemID.OrichalcumLeggings), ChangeIngredientStack(ItemID.OrichalcumBar, 15) }, { VanillaEach( ItemID.AdamantiteHelmet, ItemID.AdamantiteMask, ItemID.AdamantiteHeadgear, ItemID.AdamantitePickaxe, ItemID.AdamantiteDrill, ItemID.AdamantiteWaraxe, ItemID.AdamantiteChainsaw, ItemID.AdamantiteSword, ItemID.AdamantiteGlaive, ItemID.AdamantiteRepeater), - ChangeIngredientStack(ItemID.AdamantiteBar, 12) + ChangeIngredientStack(ItemID.AdamantiteBar, 10) }, - { Vanilla(ItemID.AdamantiteBreastplate), ChangeIngredientStack(ItemID.AdamantiteBar, 24) }, - { Vanilla(ItemID.AdamantiteLeggings), ChangeIngredientStack(ItemID.AdamantiteBar, 18) }, + { Vanilla(ItemID.AdamantiteBreastplate), ChangeIngredientStack(ItemID.AdamantiteBar, 20) }, + { Vanilla(ItemID.AdamantiteLeggings), ChangeIngredientStack(ItemID.AdamantiteBar, 15) }, { VanillaEach( ItemID.TitaniumHelmet, ItemID.TitaniumMask, ItemID.TitaniumHeadgear, ItemID.TitaniumPickaxe, ItemID.TitaniumDrill, ItemID.TitaniumWaraxe, ItemID.TitaniumChainsaw, ItemID.TitaniumSword, ItemID.TitaniumTrident, ItemID.TitaniumRepeater), - ChangeIngredientStack(ItemID.TitaniumBar, 12) + ChangeIngredientStack(ItemID.TitaniumBar, 10) }, - { Vanilla(ItemID.TitaniumBreastplate), ChangeIngredientStack(ItemID.TitaniumBar, 24) }, - { Vanilla(ItemID.TitaniumLeggings), ChangeIngredientStack(ItemID.TitaniumBar, 18) }, + { Vanilla(ItemID.TitaniumBreastplate), ChangeIngredientStack(ItemID.TitaniumBar, 20) }, + { Vanilla(ItemID.TitaniumLeggings), ChangeIngredientStack(ItemID.TitaniumBar, 15) }, }; // Apply all recipe changes. @@ -1111,7 +1136,7 @@ namespace CalamityMod r = Recipe.Create(ItemID.Bacon); r.AddIngredient(ModContent.ItemType()); - r.AddTile(TileID.CookingPots); + r.AddTile(TileID.Hellforge); r.Register(); r = Recipe.Create(ItemID.BowlofSoup); @@ -1119,6 +1144,36 @@ namespace CalamityMod r.AddIngredient(ModContent.ItemType()); r.AddTile(TileID.CookingPots); r.Register(); + + r = Recipe.Create(ItemID.ApplePie); + r.AddIngredient(ItemID.Apple, 3); + r.AddTile(TileID.Hellforge); + r.Register(); + + r = Recipe.Create(ItemID.BananaSplit); + r.AddIngredient(ItemID.Banana); + r.AddIngredient(ItemID.IceBlock); + r.AddIngredient(ItemID.MilkCarton); + r.AddTile(TileID.CookingPots); + r.Register(); + + r = Recipe.Create(ItemID.BBQRibs); + r.AddIngredient(ItemID.FleshBlock, 6); + r.AddIngredient(ItemID.Bone, 6); + r.AddTile(TileID.Hellforge); + r.Register(); + + r = Recipe.Create(ItemID.MilkCarton); + r.AddIngredient(ItemID.BottledWater); + r.AddIngredient(ItemID.Bone, 2); + r.AddTile(TileID.CookingPots); + r.Register(); + + r = Recipe.Create(ItemID.Nachos); + r.AddIngredient(ItemID.PotatoChips); + r.AddIngredient(ItemID.MilkCarton); + r.AddTile(TileID.CookingPots); + r.Register(); } #endregion @@ -1149,10 +1204,10 @@ namespace CalamityMod // Ice Mirror r = Recipe.Create(ItemID.IceMirror); + r.AddRecipeGroup("AnySilverBar", 5); r.AddRecipeGroup("AnyIceBlock", 20); r.AddIngredient(ItemID.Glass, 10); r.AddIngredient(ItemID.FallenStar, 10); - r.AddRecipeGroup("AnySilverBar", 5); r.AddTile(TileID.Anvils); r.Register(); @@ -1194,6 +1249,28 @@ namespace CalamityMod r.AddRecipeGroup("IronBar", 3); r.AddTile(TileID.Anvils); r.Register(); + + // Bast Statue + r = Recipe.Create(ItemID.CatBast); + r.AddRecipeGroup("IronBar", 7); + r.AddRecipeGroup("AnyGoldBar", 3); + r.AddIngredient(ItemID.Ruby); + r.AddTile(TileID.Anvils); + r.Register(); + + // Encumbering Stone + r = Recipe.Create(ItemID.EncumberingStone); + r.AddIngredient(ItemID.StoneBlock, 100); + r.AddTile(TileID.Anvils); + r.Register(); + + // Desert Minecart + r = Recipe.Create(ItemID.DesertMinecart); + r.AddIngredient(ItemID.SandstoneBrick, 20); + r.AddRecipeGroup("AnyGoldBar", 6); + r.AddRecipeGroup("IronBar", 3); + r.AddTile(TileID.Anvils); + r.Register(); } #endregion @@ -1228,24 +1305,8 @@ namespace CalamityMod r = Recipe.Create(ItemID.TempleKey); r.AddIngredient(ItemID.JungleSpores, 15); r.AddIngredient(ItemID.RichMahogany, 15); - r.AddIngredient(ItemID.SoulofNight, 15); r.AddIngredient(ItemID.SoulofLight, 15); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - - // Pumpkin Moon Medallion - r = Recipe.Create(ItemID.PumpkinMoonMedallion); - r.AddIngredient(ItemID.Pumpkin, 30); - r.AddIngredient(ItemID.Ectoplasm, 5); - r.AddRecipeGroup(AnyGoldBar, 5); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - - // Naughty Present - r = Recipe.Create(ItemID.NaughtyPresent); - r.AddIngredient(ItemID.Silk, 20); - r.AddIngredient(ItemID.Ectoplasm, 5); - r.AddRecipeGroup(AnySilverBar, 5); + r.AddIngredient(ItemID.SoulofNight, 15); r.AddTile(TileID.MythrilAnvil); r.Register(); @@ -1365,9 +1426,9 @@ namespace CalamityMod { // Cloud in a Bottle Recipe r = Recipe.Create(ItemID.CloudinaBottle); - r.AddIngredient(ItemID.Feather, 2); r.AddIngredient(ItemID.Bottle); r.AddIngredient(ItemID.Cloud, 25); + r.AddIngredient(ItemID.Feather, 2); r.AddTile(TileID.Anvils); r.Register(); @@ -1386,18 +1447,18 @@ namespace CalamityMod // Blizzard in a Bottle r = Recipe.Create(ItemID.BlizzardinaBottle); - r.AddIngredient(ItemID.Feather, 3); r.AddIngredient(ItemID.Bottle); r.AddRecipeGroup(AnySnowBlock, 50); + r.AddIngredient(ItemID.Feather, 3); r.AddTile(TileID.Anvils); r.Register(); // Sandstorm in a Bottle r = Recipe.Create(ItemID.SandstorminaBottle); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ItemID.Feather, 3); r.AddIngredient(ItemID.Bottle); r.AddIngredient(ItemID.SandBlock, 70); + r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(ItemID.Feather, 3); r.AddTile(TileID.Anvils); r.Register(); @@ -1583,79 +1644,6 @@ namespace CalamityMod r.AddTile(TileID.Loom); r.Register(); - // Alternative Turtle, Shroomite, and Spectre Armor set recipes - r = Recipe.Create(ItemID.TurtleHelmet); - r.AddIngredient(ItemID.ChlorophyteMask); - r.AddIngredient(ItemID.TurtleShell); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - - r = Recipe.Create(ItemID.TurtleScaleMail); - r.AddIngredient(ItemID.ChlorophytePlateMail); - r.AddIngredient(ItemID.TurtleShell); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - - r = Recipe.Create(ItemID.TurtleLeggings); - r.AddIngredient(ItemID.ChlorophyteGreaves); - r.AddIngredient(ItemID.TurtleShell); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - - r = Recipe.Create(ItemID.ShroomiteHelmet); - r.AddIngredient(ItemID.ChlorophyteHelmet); - r.AddIngredient(ItemID.GlowingMushroom, 60); - r.AddTile(TileID.Autohammer); - r.Register(); - - r = Recipe.Create(ItemID.ShroomiteHeadgear); - r.AddIngredient(ItemID.ChlorophyteHelmet); - r.AddIngredient(ItemID.GlowingMushroom, 60); - r.AddTile(TileID.Autohammer); - r.Register(); - - r = Recipe.Create(ItemID.ShroomiteMask); - r.AddIngredient(ItemID.ChlorophyteHelmet); - r.AddIngredient(ItemID.GlowingMushroom, 60); - r.AddTile(TileID.Autohammer); - r.Register(); - - r = Recipe.Create(ItemID.ShroomiteBreastplate); - r.AddIngredient(ItemID.ChlorophytePlateMail); - r.AddIngredient(ItemID.GlowingMushroom, 120); - r.AddTile(TileID.Autohammer); - r.Register(); - - r = Recipe.Create(ItemID.ShroomiteLeggings); - r.AddIngredient(ItemID.ChlorophyteGreaves); - r.AddIngredient(ItemID.GlowingMushroom, 80); - r.AddTile(TileID.Autohammer); - r.Register(); - - r = Recipe.Create(ItemID.SpectreHood); - r.AddIngredient(ItemID.ChlorophyteHeadgear); - r.AddIngredient(ItemID.Ectoplasm, 6); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - - r = Recipe.Create(ItemID.SpectreMask); - r.AddIngredient(ItemID.ChlorophyteHeadgear); - r.AddIngredient(ItemID.Ectoplasm, 6); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - - r = Recipe.Create(ItemID.SpectreRobe); - r.AddIngredient(ItemID.ChlorophytePlateMail); - r.AddIngredient(ItemID.Ectoplasm, 12); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - - r = Recipe.Create(ItemID.SpectrePants); - r.AddIngredient(ItemID.ChlorophyteGreaves); - r.AddIngredient(ItemID.Ectoplasm, 9); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - } #endregion @@ -1738,7 +1726,7 @@ namespace CalamityMod r.AddTile(TileID.Anvils); r.Register(); - // Pocket Mirror (petrification, added to Ankh charm+ in Calamity) + // Pocket Mirror (petrification) r = Recipe.Create(ItemID.PocketMirror); r.AddIngredient(ItemID.Glass, 10); r.AddRecipeGroup(AnyGoldBar, 4); @@ -1811,15 +1799,6 @@ namespace CalamityMod r.AddTile(TileID.CrystalBall); r.Register(); - // Terra Blade w/ True Bloody Edge - r = Recipe.Create(ItemID.TerraBlade); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ItemID.TrueExcalibur); - r.AddIngredient(ItemID.BrokenHeroSword); - r.AddIngredient(ModContent.ItemType(), 12); - r.AddTile(TileID.MythrilAnvil); - r.Register(); - // Turtle Shell with Giant Tortoise Shell r = Recipe.Create(ItemID.TurtleShell); r.AddIngredient(ModContent.ItemType()); @@ -1837,6 +1816,24 @@ namespace CalamityMod r.AddIngredient(ItemID.SoulofLight, 4); r.AddTile(TileID.Anvils); r.Register(); + + // Mechanical Glove directly from correct class emblem for cheaper (compromise) + r = Recipe.Create(ItemID.MechanicalGlove); + r.AddIngredient(ItemID.PowerGlove); + r.AddIngredient(ItemID.WarriorEmblem); + r.AddIngredient(ItemID.SoulofFright); + r.AddIngredient(ItemID.SoulofMight); + r.AddIngredient(ItemID.SoulofSight); + r.Register(); + + // Celestial Emblem directly from correct class emblem for cheaper (compromise) + r = Recipe.Create(ItemID.CelestialEmblem); + r.AddIngredient(ItemID.CelestialMagnet); + r.AddIngredient(ItemID.SorcererEmblem); + r.AddIngredient(ItemID.SoulofFright); + r.AddIngredient(ItemID.SoulofMight); + r.AddIngredient(ItemID.SoulofSight); + r.Register(); } #endregion } diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 5ccb7a4d08..1f81676b88 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -670,6 +670,42 @@ namespace CalamityMod spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } + /// + /// Restarts a given such that it enforces a rectangular area where pixels outside of said area are not drawn.

+ /// This is incredible convenient for UI sections where you need to ensure things only appear inside a box panel.

+ /// This method should be followed by a call to once you're ready to flush the contents drawn under these conditions. + ///
+ /// The sprite batch to enforce the cutoff region on. + /// The cutoff region. This should be in screen coordinates. + /// The perspective matrix that should be used across drawn contents. + /// The sort mode that should be used across drawn contents. Use if you additionally need to draw shaders. + /// The blend state that should be used across drawn contents. This defaults to . + public static void EnforceCutoffRegion(this SpriteBatch spriteBatch, Rectangle cutoffRegion, Matrix perspective, SpriteSortMode sortMode = SpriteSortMode.Deferred, BlendState newBlendState = null) + { + var rasterizer = Main.Rasterizer; + rasterizer.ScissorTestEnable = true; + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, newBlendState ?? BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, rasterizer, null, perspective); + spriteBatch.GraphicsDevice.ScissorRectangle = cutoffRegion; + } + + /// + /// Flushes contents drawn under restrictions enforced by the method and returns the to a more typical state. + /// + /// The sprite batch to flush the contents of. + /// The perspective matrix that was used before the cutoff region was enforced. Take care to ensure that this has the correct input. + /// The sort mode that should be used across drawn contents. Use if you additionally need to draw shaders. + public static void ReleaseCutoffRegion(this SpriteBatch spriteBatch, Matrix perspective, SpriteSortMode sortMode = SpriteSortMode.Deferred) + { + int width = spriteBatch.GraphicsDevice.Viewport.Width; + int height = spriteBatch.GraphicsDevice.Viewport.Height; + + spriteBatch.End(); + spriteBatch.Begin(sortMode, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, perspective); + spriteBatch.GraphicsDevice.ScissorRectangle = new(-1, -1, width + 2, height + 2); + } + public static IEnumerable DrawAuroras(Player player, float auroraCount, float opacity, Color color) { float time = Main.GlobalTimeWrappedHourly % 3f / 3f; diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 7dc03fdc21..9e5771752a 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -113,13 +113,14 @@ namespace CalamityMod #region Bestiary Text public static string FirstKillText = "Drops only on the first kill"; - public static string BloodMoonText = "Drops during the Blood Moon"; public static string MechBossText = "Drops on the first kill of the final Mechanical Boss"; - public static string SentinelText = "Drops on the first kill of the final Sentinel of the Devourer"; + public static string CynosureText = "Drops once you have defeated both Draedon and Calamitas"; + public static string ProvidenceHallowText = "Drops if Providence was summoned in the Hallow\nor if Providence is only attacked during nighttime"; public static string ProvidenceUnderworldText = "Drops if Providence was summoned in the Underworld\nor if Providence is only attacked during nighttime"; public static string ProvidenceNightText = "Drops if Providence is only attacked during nighttime"; public static string ProvidenceChallengeText = $"Drops if Providence was defeated only with the [i:{ModContent.ItemType()}] Profaned Soul Artifact\nThis is an Expert Mode drop rate"; + #endregion #region Block Drops @@ -538,46 +539,6 @@ namespace CalamityMod return p.Calamity().tarraSet; }); - private static bool CanDropBloodOrbs(DropAttemptInfo info) - { - // Blood Orbs do not drop unless it's a Blood Moon. - if (!Main.bloodMoon) - return false; - - // If the drop info has a player, then check whether the player is "on the surface". - bool onSurface = false; - Player p = info.player; - if (p != null && p.active) - onSurface = p.ZoneOverworldHeight || p.ZoneSkyHeight; - - // Also check whether the NPC is considered "on the surface". - NPC npc = info.npc; - if (npc.Center.Y <= Main.worldSurface) - onSurface = true; - - // Blood Orbs do not drop unless either the NPC killed or the player that killed the NPC are on the surface. - if (!onSurface) - return false; - - // Blood Orbs do not drop from the following: - // 1 - NPCs spawned from statues - // 2 - NPCs with no contact damage, unless they are bosses. - // 3 - NPCs that are not targeting a player. - return !npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && npc.HasPlayerTarget; - } - - public static IItemDropRuleCondition BloodOrbBaseCondition = If(CanDropBloodOrbs); - public static IItemDropRuleCondition BloodOrbBloodflareCondition = If((info) => - { - bool bloodOrbsAvailable = CanDropBloodOrbs(info); - if (!bloodOrbsAvailable) - return false; - - // To receive the extra orbs from Bloodflare Armor, you must be wearing Bloodflare Armor. - Player p = info.player; - return p != null && p.active && p.Calamity().bloodflareSet; - }); - internal const float TrasherEatDistance = 96f; public static IItemDropRuleCondition AnglerFedToTrasherCondition = If((info) => { @@ -627,9 +588,9 @@ namespace CalamityMod public static IItemDropRuleCondition PostSP(bool ui = true) => If(() => NPC.downedMechBoss3, ui, "Drops after defeating Skeletron Prime"); public static IItemDropRuleCondition Post1Mech(bool ui = true) => If(() => NPC.downedMechBossAny, ui, "Drops after defeating a Mechanical Boss"); public static IItemDropRuleCondition Post3Mechs(bool ui = true) => If(() => NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3, ui, "Drops after defeating all three Mechanical Bosses"); - public static IItemDropRuleCondition PostCal(bool ui = true) => If(() => DownedBossSystem.downedCalamitas, ui, "Drops after defeating Calamitas"); + public static IItemDropRuleCondition PostCal(bool ui = true) => If(() => DownedBossSystem.downedCalamitasClone, ui, "Drops after defeating Calamitas Clone"); public static IItemDropRuleCondition PostPlant(bool ui = true) => If(() => NPC.downedPlantBoss, ui, "Drops after defeating Plantera"); - public static IItemDropRuleCondition PostCalPlant(bool ui = true) => If(() => DownedBossSystem.downedCalamitas || NPC.downedPlantBoss, ui, "Drops after defeating Calamitas or Plantera"); + public static IItemDropRuleCondition PostCalPlant(bool ui = true) => If(() => DownedBossSystem.downedCalamitasClone || NPC.downedPlantBoss, ui, "Drops after defeating Calamitas or Plantera"); public static IItemDropRuleCondition PostLevi(bool ui = true) => If(() => DownedBossSystem.downedLeviathan, ui, "Drops after defeating the Leviathan and Anahita"); public static IItemDropRuleCondition PostAureus(bool ui = true) => If(() => DownedBossSystem.downedAstrumAureus, ui, "Drops after defeating Astrum Aureus"); public static IItemDropRuleCondition PostGolem(bool ui = true) => If(() => NPC.downedGolemBoss, ui, "Drops after defeating Golem"); @@ -651,7 +612,7 @@ namespace CalamityMod public static IItemDropRuleCondition PostDoG(bool ui = true) => If(() => DownedBossSystem.downedDoG, ui, "Drops after defeating the Devourer of Gods"); public static IItemDropRuleCondition PostYharon(bool ui = true) => If(() => DownedBossSystem.downedYharon, ui, "Drops after defeating Yharon"); public static IItemDropRuleCondition PostExos(bool ui = true) => If(() => DownedBossSystem.downedExoMechs, ui, "Drops after defeating the Exo Mechs"); - public static IItemDropRuleCondition PostSCal(bool ui = true) => If(() => DownedBossSystem.downedSCal, ui, "Drops after defeating Supreme Calamitas"); + public static IItemDropRuleCondition PostSCal(bool ui = true) => If(() => DownedBossSystem.downedCalamitas, ui, "Drops after defeating Calamitas"); public static IItemDropRuleCondition PostAEW(bool ui = true) => If(() => DownedBossSystem.downedAdultEidolonWyrm, ui, "Drops after defeating the Adult Eidolon Wyrm"); public static IItemDropRuleCondition PostClam(bool ui = true) => If(() => DownedBossSystem.downedCLAM, ui, "Drops after defeating the Giant Clam"); public static IItemDropRuleCondition PostClamHM(bool ui = true) => If(() => DownedBossSystem.downedCLAMHardMode, ui, "Drops after defeating the Giant Clam in Hardmode"); diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 39ea74d8c4..023ef1e13b 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -41,56 +41,49 @@ namespace CalamityMod default: return 0; + // Ironskin Potion + // This makes sense to be here but also not + case -1: + if (DownedBossSystem.downedDoG) + return 20; + else if (NPC.downedMoonlord) + return 16; + else if (Main.hardMode) + return 12; + return 8; + case PrefixID.Hard: - if (DownedBossSystem.downedYharon) + if (DownedBossSystem.downedDoG) return 4; - else if (DownedBossSystem.downedPolterghast || DownedBossSystem.downedDoG) + else if (NPC.downedMoonlord) return 3; - else if (Main.hardMode || NPC.downedGolemBoss || NPC.downedMoonlord || DownedBossSystem.downedProvidence) + else if (Main.hardMode) return 2; return 1; case PrefixID.Guarding: - if (DownedBossSystem.downedYharon) - return 7; - else if (DownedBossSystem.downedDoG) + if (DownedBossSystem.downedDoG) return 6; - else if (DownedBossSystem.downedProvidence || DownedBossSystem.downedPolterghast) - return 5; - else if (NPC.downedGolemBoss || NPC.downedMoonlord) + else if (NPC.downedMoonlord) return 4; else if (Main.hardMode) return 3; return 2; case PrefixID.Armored: - if (DownedBossSystem.downedYharon) - return 10; - else if (DownedBossSystem.downedDoG) - return 9; - else if (DownedBossSystem.downedPolterghast) + if (DownedBossSystem.downedDoG) return 8; - else if (DownedBossSystem.downedProvidence) - return 7; else if (NPC.downedMoonlord) return 6; - else if (Main.hardMode || NPC.downedGolemBoss) + else if (Main.hardMode) return 5; return 3; case PrefixID.Warding: - if (DownedBossSystem.downedYharon) - return 12; - else if (DownedBossSystem.downedDoG) - return 11; - else if (DownedBossSystem.downedPolterghast) + if (DownedBossSystem.downedDoG) return 10; - else if (DownedBossSystem.downedProvidence) - return 9; else if (NPC.downedMoonlord) return 8; - else if (NPC.downedGolemBoss) - return 7; else if (Main.hardMode) return 6; return 4; diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index d920f3e259..8fe2a9d988 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -192,7 +192,6 @@ namespace CalamityMod /// /// /// - /// public static float Modulo(this float dividend, float divisor) { return dividend - (float)Math.Floor(dividend / divisor) * divisor; @@ -215,6 +214,12 @@ namespace CalamityMod /// public static float AngleBetween(this float angle, float otherAngle) => ((otherAngle - angle) + MathHelper.Pi).Modulo(MathHelper.TwoPi) - MathHelper.Pi; + /// + /// Gets the sign of the number, but without the zero case. If 0 is inputted into this method, 1 is returned/ + /// + /// The input value. + public static int DirectionalSign(this float x) => (x > 0f).ToDirectionInt(); + #region Easings /// /// Gets a value from 0 to 1 and returns an eased value. @@ -281,6 +286,11 @@ namespace CalamityMod /// public int degree; + /// + /// The height of the segment after the elevation shift is taken into account. + /// + public float EndingHeight => startingHeight + elevationShift; + /// /// Legacy constructor /// @@ -350,7 +360,6 @@ namespace CalamityMod #endregion - // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function. // Due to its temporary state, this method will not receive an XML documentation comment. public static Rectangle ClampToWorld(Rectangle tileRectangle) diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 500fff2930..425c558295 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -8,6 +8,7 @@ using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.DraedonLabThings; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; @@ -379,8 +380,11 @@ namespace CalamityMod int item = -1; switch (style) { + case 0: + item = ModContent.ItemType(); + break; case 1: - item = ModContent.ItemType(); + item = ModContent.ItemType(); break; case 2: item = ModContent.ItemType(); @@ -389,7 +393,10 @@ namespace CalamityMod item = ModContent.ItemType(); break; case 4: - item = ModContent.ItemType(); + item = ModContent.ItemType(); + break; + case 6: + item = ModContent.ItemType(); break; case 7: item = ModContent.ItemType(); @@ -735,8 +742,11 @@ namespace CalamityMod int npc = -1; switch (style) { + case 0: + npc = ModContent.NPCType(); + break; case 1: - npc = ModContent.NPCType(); + npc = ModContent.NPCType(); break; case 2: npc = ModContent.NPCType(); @@ -745,7 +755,10 @@ namespace CalamityMod npc = ModContent.NPCType(); break; case 4: - npc = ModContent.NPCType(); + npc = ModContent.NPCType(); + break; + case 6: + npc = ModContent.NPCType(); break; case 7: npc = ModContent.NPCType(); diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 428e46b063..4b44480451 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -8,11 +8,12 @@ using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; @@ -150,6 +151,7 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, @@ -185,6 +187,15 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.OnFire }) }, + { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, + { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, + { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, + { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, + + // 20FEB2023: Ozzatron: made Ares immune to Miracle Blight, because otherwise he vanishes when affected by it + // The "correct" way to fix this involves a colossal amount of work and will be handled at a later date + { ModContent.NPCType(), new Tuple(false, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, @@ -195,11 +206,6 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, - { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, - { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, - { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, - { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, - { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, { ModContent.NPCType(), new Tuple(true, Array.Empty()) }, @@ -223,8 +229,8 @@ namespace CalamityMod { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, - { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, - { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index ff2c89b83e..8e0facbb62 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -13,8 +13,10 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Chat; +using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -385,19 +387,6 @@ namespace CalamityMod } } - /// Inflict typical exo weapon debuffs. Duration multiplier optional. - /// - /// The NPC attacked. - /// Debuff time multiplier if needed. - /// Inflicts debuffs if they can. - public static void ExoDebuffs(this NPC target, float multiplier = 1f) - { - target.AddBuff(BuffType(), (int)(30 * multiplier)); - target.AddBuff(BuffType(), (int)(120 * multiplier)); - target.AddBuff(BuffID.Frostburn, (int)(150 * multiplier)); - target.AddBuff(BuffID.OnFire, (int)(180 * multiplier)); - } - public static T ModNPC(this NPC npc) where T : ModNPC => npc.ModNPC as T; /// @@ -433,6 +422,19 @@ namespace CalamityMod return null; } + public static void DrawBackglow(this NPC npc, Color backglowColor, float backglowArea, SpriteEffects spriteEffects, Rectangle frame, Vector2 screenPos, Texture2D overrideTexture = null) + { + Texture2D texture = overrideTexture is null ? TextureAssets.Npc[npc.type].Value : overrideTexture; + Vector2 drawPosition = npc.Center - screenPos; + Vector2 origin = frame.Size() * 0.5f; + Color backAfterimageColor = backglowColor * npc.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } + } + /// /// Spawns Old Duke on a player. Only works server side, and only works if the player owns a fishing bobber.
/// Old Duke will spawn above the fishing bobber if one is found. diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 65e5489ab8..3e46bc041b 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -26,6 +26,50 @@ namespace CalamityMod public static float CalcDamage(this Player player, float baseDamage) where T : DamageClass => player.GetTotalDamage().ApplyTo(baseDamage); public static int CalcIntDamage(this Player player, float baseDamage) where T : DamageClass => (int)player.CalcDamage(baseDamage); + // Naively determines the player's chosen (aka "best") class by whichever has the highest damage boost. + public static DamageClass GetBestClass(this Player player) + { + // Check the five Calamity classes to see what the strongest one is, and use that for the typical damage stat. + float bestDamage = 1f; + DamageClass bestClass = DamageClass.Generic; + + float melee = player.GetTotalDamage().Additive; + if (melee > bestDamage) + { + bestDamage = melee; + bestClass = DamageClass.Melee; + } + float ranged = player.GetTotalDamage().Additive; + if (ranged > bestDamage) + { + bestDamage = ranged; + bestClass = DamageClass.Ranged; + } + float magic = player.GetTotalDamage().Additive; + if (magic > bestDamage) + { + bestDamage = magic; + bestClass = DamageClass.Magic; + } + + // Summoner intentionally has a reduction. As the only class with no crit, it tends to have higher raw damage than other classes. + float summon = player.GetTotalDamage().Additive * BalancingConstants.SummonAllClassScalingFactor; + if (summon > bestDamage) + { + bestDamage = summon; + bestClass = DamageClass.Summon; + } + // We intentionally don't check whip class, because it inherits 100% from Summon + + float rogue = player.GetTotalDamage().Additive; + if (rogue > bestDamage) + { + bestClass = RogueDamageClass.Instance; + } + + return bestClass; + } + public static StatModifier GetBestClassDamage(this Player player) { StatModifier ret = StatModifier.Default; @@ -123,6 +167,8 @@ namespace CalamityMod light += 1; if (mp.sparks) light += 1; + if (mp.thiefsDime) + light += 1; if (mp.fathomSwarmerVisage) light += 1; if (mp.aquaticHeart) @@ -502,20 +548,6 @@ namespace CalamityMod target.AddBuff(buff, SecondsToFrames(timeBase), false); } } - - /// - /// Inflict typical exo weapon debuffs in pvp. - /// - /// The Player attacked. - /// Debuff time multiplier if needed. - /// Inflicts debuffs if the target isn't immune. - public static void ExoDebuffs(this Player target, float multiplier = 1f) - { - target.AddBuff(BuffType(), (int)(30 * multiplier)); - target.AddBuff(BuffType(), (int)(120 * multiplier)); - target.AddBuff(BuffID.Frostburn, (int)(150 * multiplier)); - target.AddBuff(BuffID.OnFire, (int)(180 * multiplier)); - } #endregion #region Arms Control diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index fa02ddce21..67f52cf9ae 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -152,9 +152,11 @@ namespace CalamityMod /// The projectile that should home. /// The target. /// The inertia of the movement change. - public static Vector2 SuperhomeTowardsTarget(this Projectile projectile, NPC target, float homingSpeed, float inertia) + /// The ratio for how much the projectile aims ahead of the target. 1f is normal predictiveness. 0.01f is the lowest possible value, equating to no practical predictiveness. + public static Vector2 SuperhomeTowardsTarget(this Projectile projectile, NPC target, float homingSpeed, float inertia, float predictionStrength = 1f) { - Vector2 idealVelocity = CalculatePredictiveAimToTarget(projectile.Center, target, homingSpeed); + if (predictionStrength < 0.01f) { predictionStrength = 0.01f; } + Vector2 idealVelocity = CalculatePredictiveAimToTarget(projectile.Center, target, homingSpeed/predictionStrength) * predictionStrength; return (projectile.velocity * (inertia - 1f) + idealVelocity) / inertia; } #endregion @@ -237,10 +239,10 @@ namespace CalamityMod public static void MagnetSphereHitscan(Projectile projectile, float distanceRequired, float homingVelocity, float projectileTimer, int maxTargets, int spawnedProjectile, double damageMult = 1D, bool attackMultiple = false) { // Only shoot once every N frames. - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > projectileTimer) + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > projectileTimer) { - projectile.localAI[0] = 0f; + projectile.localAI[1] = 0f; // Only search for targets if projectiles could be fired. float maxDistance = distanceRequired; @@ -278,7 +280,7 @@ namespace CalamityMod int randomTarget = Main.rand.Next(targetArrayIndex); randomTarget = targetArray[randomTarget]; - projectile.localAI[0] = 0f; + projectile.localAI[1] = 0f; Vector2 spawnPos = projectile.Center + projectile.velocity * 4f; Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - spawnPos) * homingVelocity; @@ -505,6 +507,37 @@ namespace CalamityMod return false; } + public static void DrawBackglow(this Projectile projectile, Color backglowColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null) + { + texture ??= TextureAssets.Projectile[projectile.type].Value; + + // Use a fallback for the frame. + frame ??= texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + + Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 origin = frame.Value.Size() * 0.5f; + Color backAfterimageColor = backglowColor * projectile.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, projectile.rotation, origin, projectile.scale, 0, 0f); + } + } + + public static void DrawProjectileWithBackglow(this Projectile projectile, Color backglowColor, Color lightColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null) + { + texture ??= TextureAssets.Projectile[projectile.type].Value; + + // Use a fallback for the frame. + frame ??= texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + + Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 origin = frame.Value.Size() * 0.5f; + + projectile.DrawBackglow(backglowColor, backglowArea, texture, frame); + Main.spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, 0, 0f); + } + public static void ExplodeandDestroyTiles(Projectile projectile, int explosionRadius, bool checkExplosions, List tilesToCheck, List wallsToCheck) { int minTileX = (int)projectile.position.X / 16 - explosionRadius; diff --git a/Utilities/StringUtils.cs b/Utilities/StringUtils.cs index 5bb96f2528..503a80cc3d 100644 --- a/Utilities/StringUtils.cs +++ b/Utilities/StringUtils.cs @@ -1,4 +1,6 @@ -using System.Linq; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod @@ -7,5 +9,19 @@ namespace CalamityMod { internal static readonly string AlphanumericCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; public static string GenerateRandomAlphanumericString(int length) => new string(Enumerable.Repeat(AlphanumericCharacters, length).Select(s => s[Main.rand.Next(s.Length)]).ToArray()); + + public static string ColorMessage(this Color color, string text, bool newline = false) + { + int bufferSize = text.Length < 200 ? 256 : text.Length + 32; + StringBuilder sb = new(bufferSize); + sb.Append("[c/"); + sb.Append(color.Hex3()); + sb.Append(':'); + sb.Append(text); + sb.Append(']'); + if (newline) + sb.Append('\n'); + return sb.ToString(); + } } } diff --git a/Utilities/TileEntityUtils.cs b/Utilities/TileEntityUtils.cs index f3aef5f712..743204b84b 100644 --- a/Utilities/TileEntityUtils.cs +++ b/Utilities/TileEntityUtils.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; @@ -74,7 +76,16 @@ namespace CalamityMod // This check is done twice because the draw order matters. We want to draw the background icon before any text. if (item.stack > 0) - slotBackgroundTex = Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Filled").Value; + { + if (item.type == ModContent.ItemType()) + { + slotBackgroundTex = Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Blood").Value; + } + else + { + slotBackgroundTex = Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Filled").Value; + } + } spriteBatch.Draw(slotBackgroundTex, drawPosition, null, Color.White, 0f, slotBackgroundTex.Size() * 0.5f, iconScale, SpriteEffects.None, 0f); if (item.stack > 0) diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index 6ffeacb591..cb8e512be7 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -1,8 +1,10 @@ using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FurnitureAshen; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using System.Collections.Generic; @@ -60,6 +62,11 @@ namespace CalamityMod PlantCheckAgainst[TileID.CrimsonPlants] = new int[1] { TileID.CrimsonPlants }; PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantCheckAgainst[ModContent.TileType()] = new int[2] { ModContent.TileType(), ModContent.TileType() }; VineToGrass = new Dictionary { @@ -83,17 +90,16 @@ namespace CalamityMod tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; - tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; + tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; tileMergeTypes[TileID.Sandstone][ModContent.TileType()] = true; tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; - tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; + tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; - tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; tileMergeTypes[ModContent.TileType()][ModContent.TileType()] = true; } @@ -265,6 +271,7 @@ namespace CalamityMod return; if (y < 0 || y >= Main.maxTilesY) return; + Tile tile = Main.tile[x, y]; int myType = tile.TileType; @@ -284,25 +291,30 @@ namespace CalamityMod return; } } - + // If the tile above is an identical vine, nothing else needs to be done. if (northType == myType) return; // If the tile above isn't sloped correctly or otherwise isn't a valid anchor for this vine, check whether the vine must die. bool tileMustDie = northType == -1; - if(northType != -1) + if (northType != -1) { // Vanilla vines can hang from vanilla grass and vanilla leaf blocks. if (myType == TileID.Vines && northType != TileID.Grass && northType != TileID.LeafBlock) - tileMustDie = true; - else for (int i = 0; i < vines.Length; ++i) { - // Not matching grass? Die. - if (myType == vines[i] && northType != VineToGrass[vines[i]]) + tileMustDie = true; + } + else + { + for (int i = 0; i < vines.Length; ++i) { - tileMustDie = true; - break; + // Not matching grass? Die. + if (myType == vines[i] && northType != VineToGrass[vines[i]]) + { + tileMustDie = true; + break; + } } } } @@ -557,7 +569,16 @@ namespace CalamityMod return true; } + // BRIMSTONE COMPATIBILITY IMPLEMENTATION + // Added parameters to force a merge in a direction for use in the merge frame function internal static bool BrimstoneFraming(int x, int y, bool resetFrame) + { + return BrimstoneFraming(x, y, resetFrame, false, false, false, false, false, false, false, false); + } + + internal static bool BrimstoneFraming(int x, int y, bool resetFrame, + bool forceSameDown, bool forceSameUp, bool forceSameRight, bool forceSameLeft, + bool forceSameDR, bool forceSameDL, bool forceSameUR, bool forceSameUL) { if (x < 0 || x >= Main.maxTilesX) return false; @@ -572,6 +593,16 @@ namespace CalamityMod GetAdjacentTiles(x, y, out bool up, out bool down, out bool left, out bool right, out bool upLeft, out bool upRight, out bool downLeft, out bool downRight); + // Implement forced connections + up = forceSameUp || up; + down = forceSameDown || down; + left = forceSameLeft || left; + right = forceSameRight || right; + upLeft = forceSameUL || upLeft; + upRight = forceSameUR || upRight; + downLeft = forceSameDL || downLeft; + downRight = forceSameDR || downRight; + // Reset the tile's random frame style if the frame is being reset. int randomFrame; if (resetFrame) @@ -1038,7 +1069,7 @@ namespace CalamityMod if (up && down && left && right && !downLeft && !downRight && upLeft && upRight) { tile.TileFrameX = 198; - tile.TileFrameY = 18; + tile.TileFrameY = 0; return; } if (up && down && left && right && downLeft && downRight && !upLeft && !upRight) @@ -1157,9 +1188,14 @@ namespace CalamityMod #endregion #region Generic Custom Framing Code + + // New Variables (rename as fitting): + // myTypeBrimFrame - Whether the tile that this function is framing should use brimstone framing + // overrideBrimStates - Used in a situation where a brimstone state and a merge state could each be used, setting this to true will use the merge state, and setting this to false will use the brimstone state + internal static void CustomMergeFrameExplicit(int x, int y, int myType, int mergeType, out bool mergedUp, out bool mergedLeft, out bool mergedRight, out bool mergedDown, bool forceSameDown = false, - bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) + bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true, bool myTypeBrimFrame = false, bool overrideBrimStates = false) { if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY) { @@ -1170,7 +1206,7 @@ namespace CalamityMod // Disable vanilla trying to merge these tiles automtaically. Main.tileMerge[myType][mergeType] = false; - // these all get null checked in the GetSimilarity and GetMerge functions + // These all get null checked in the GetSimilarity and GetMerge functions Tile tileLeft = Main.tile[x - 1, y]; Tile tileRight = Main.tile[x + 1, y]; Tile tileUp = Main.tile[x, y - 1]; @@ -1207,6 +1243,51 @@ namespace CalamityMod // Initialize all merged variables to false. mergedDown = mergedLeft = mergedRight = mergedUp = false; + // BRIMSTONE COMPATIBILITY IMPLEMENTATION + // Used when set to prioritize brimstone states over blend states + // This will try to preserve the brimstone tile's own tiling, though it might produce some strange blending with the tile it merges with + // Moved since last implementation since I think that fixes some minor issues + if (myTypeBrimFrame && !overrideBrimStates) + { + // Diagonals + //bool forceDownRight = forceSameDown || forceSameRight; + //bool forceDownLeft = forceSameDown || forceSameLeft; + //bool forceUpRight = forceSameUp || forceSameRight; + //bool forceUpLeft = forceSameUp || forceSameLeft; + // BrimstoneFraming returns false if the tile uses a custom tile state, and true if it should use default tile framing + bool usedBrimstoneFrame = BrimstoneFraming(x, y, resetFrame, forceSameDown, forceSameUp, forceSameRight, forceSameLeft, false, false, false, false); + if (!usedBrimstoneFrame) + { + return; + } + } + + // BRIMSTONE COMPATIBILITY IMPLEMENTATION + // Moved the custom merge conditional tree to a separate procedure. This was done so that the returns could be left in place as they seem to be needed + // This should leave the functionality unchanged (I hope) while allowing code to be run after this + CustomMergeConditionalTree(x, y, randomFrame, leftSim, rightSim, upSim, downSim, topLeftSim, topRightSim, bottomLeftSim, bottomRightSim, ref mergedLeft, ref mergedRight, ref mergedUp, ref mergedDown); + + // BRIMSTONE COMPATIBILITY IMPLEMENTATION + // Used when set to prioritize blend states over brimstone states. + // This will create smoother blending with other tiles, though it will most likely result in unpleasant tiling between blend and non-blend states. Test to see if it looks good + // The tile frame checks are to see whether the tile that frame that has been picked out is a blend state (in which case a brimstone state isn't used) or a 'default' state (in which case a brimstone state might be used instead) + if (myTypeBrimFrame && overrideBrimStates && (Main.tile[x, y].TileFrameX < 234 && Main.tile[x, y].TileFrameY < 90)) + { + // Diagonals + //bool forceDownRight = forceSameDown || forceSameRight; + //bool forceDownLeft = forceSameDown || forceSameLeft; + //bool forceUpRight = forceSameUp || forceSameRight; + //bool forceUpLeft = forceSameUp || forceSameLeft; + // This will only override the frame if it uses a brimstone frame, otherwise the tile frame will remain unchanged + BrimstoneFraming(x, y, resetFrame, forceSameDown, forceSameUp, forceSameRight, forceSameLeft, false, false, false, false); + } + } + + private static void CustomMergeConditionalTree(int x, int y, int randomFrame, + Similarity leftSim, Similarity rightSim, Similarity upSim, Similarity downSim, + Similarity topLeftSim, Similarity topRightSim, Similarity bottomLeftSim, Similarity bottomRightSim, + ref bool mergedLeft, ref bool mergedRight, ref bool mergedUp, ref bool mergedDown) + { #region Custom Merge Conditional Tree if (leftSim == Similarity.None) { @@ -1709,14 +1790,17 @@ namespace CalamityMod bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) => CustomMergeFrameExplicit(x, y, myType, mergeType, out _, out _, out _, out _, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, resetFrame); - internal static void CustomMergeFrame(int x, int y, int myType, int mergeType) + // New Variables (rename as fitting): + // myTypeBrimFrame - Whether the tile that this function is framing uses brimstone framing + // mergeTypeBrimFrame - Whether the tile that this tile merges with uses brimstone framing + // overrideBrimStates - Used in a situation where a brimstone state and a merge state could each be used, setting this to true will use the merge state, and setting this to false will use the brimstone state + internal static void CustomMergeFrame(int x, int y, int myType, int mergeType, bool myTypeBrimFrame = false, bool mergeTypeBrimFrame = false, bool overrideBrimStates = false) { if (x < 0 || x >= Main.maxTilesX) return; if (y < 0 || y >= Main.maxTilesY) return; - Tile tile = Main.tile[x, y]; bool forceSameUp = false; bool forceSameDown = false; bool forceSameLeft = false; @@ -1727,14 +1811,16 @@ namespace CalamityMod Tile west = Main.tile[x - 1, y]; Tile east = Main.tile[x + 1, y]; + // Trying out what happens when setting the adjacent tiles to override brimstone states instead of overriding what happens with brimstone framing when forcing a merge in a given direction + if (north != null && north.HasTile && tileMergeTypes[myType][north.TileType]) { // Register this tile as not automatically merging with the tile above it. CalamityUtils.SetMerge(myType, north.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; - // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x, y - 1, north.TileType, myType, out _, out _, out _, out forceSameUp, false, false, false, false, false); + // Properly frame the adjacent tile given this constraint. + CustomMergeFrameExplicit(x, y - 1, north.TileType, myType, out _, out _, out _, out forceSameUp, false, false, false, false, false, mergeTypeBrimFrame, true); } if (west != null && west.HasTile && tileMergeTypes[myType][west.TileType]) { @@ -1742,8 +1828,8 @@ namespace CalamityMod CalamityUtils.SetMerge(myType, west.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; - // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x - 1, y, west.TileType, myType, out _, out _, out forceSameLeft, out _, false, false, false, false, false); + // Properly frame the adjacent tile given this constraint. + CustomMergeFrameExplicit(x - 1, y, west.TileType, myType, out _, out _, out forceSameLeft, out _, false, false, false, false, false, mergeTypeBrimFrame, true); } if (east != null && east.HasTile && tileMergeTypes[myType][east.TileType]) { @@ -1751,8 +1837,8 @@ namespace CalamityMod CalamityUtils.SetMerge(myType, east.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; - // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x + 1, y, east.TileType, myType, out _, out forceSameRight , out _, out _, false, false, false, false, false); + // Properly frame the adjacent tile given this constraint. + CustomMergeFrameExplicit(x + 1, y, east.TileType, myType, out _, out forceSameRight , out _, out _, false, false, false, false, false, mergeTypeBrimFrame, true); } if (south != null && south.HasTile && tileMergeTypes[myType][south.TileType]) { @@ -1760,12 +1846,12 @@ namespace CalamityMod CalamityUtils.SetMerge(myType, south.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; - // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x, y + 1, south.TileType, myType, out forceSameDown, out _, out _, out _, false, false, false, false, false); + // Properly frame the adjacent tile given this constraint. + CustomMergeFrameExplicit(x, y + 1, south.TileType, myType, out forceSameDown, out _, out _, out _, false, false, false, false, false, mergeTypeBrimFrame, false); } // With all constraints determined, properly frame the tile a final time. - CustomMergeFrameExplicit(x, y, myType, mergeType, out _, out _, out _, out _, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, true); + CustomMergeFrameExplicit(x, y, myType, mergeType, out _, out _, out _, out _, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, true, myTypeBrimFrame, overrideBrimStates); } #endregion } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index fdb6c541a3..a94f32786e 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -335,6 +335,7 @@ namespace CalamityMod TileType(), TileType(), TileType(), + TileType(), TileType(), TileType(), }); @@ -366,8 +367,8 @@ namespace CalamityMod TileType(), TileType(), TileType(), - TileType(), - TileType(), + TileType(), + TileType(), TileType(), TileType(), TileType(), @@ -426,7 +427,7 @@ namespace CalamityMod }); /// - /// Makes the specified tile merge with all tiles which generate in hell. Does not include Charred Ore. + /// Makes the specified tile merge with all tiles which generate in hell. Does not include Infernal Suevite. /// /// The tile whose merging properties will be set. public static void MergeWithHell(int type) => MergeWithSet(type, new int[] { @@ -435,6 +436,9 @@ namespace CalamityMod TileID.ObsidianBrick, TileID.HellstoneBrick, TileType(), + TileType(), + TileType(), + TileType(), }); /// @@ -445,12 +449,14 @@ namespace CalamityMod // Sulphurous Sea TileType(), TileType(), + TileType(), // Abyss TileType(), + TileType(), + TileType(), TileType(), TileType(), - TileType(), - TileType(), + TileType(), }); /// @@ -594,11 +600,12 @@ namespace CalamityMod case TileID.Ebonstone: case TileID.Crimstone: case TileID.Pearlstone: - case TileID.DesertFossil: - case TileID.Obsidian: case TileID.Hellstone: pickReq = 65; break; + case TileID.Obsidian: + pickReq = 55; + break; case TileID.Meteorite: pickReq = 50; break; @@ -628,11 +635,8 @@ namespace CalamityMod } } - if (Main.tileDungeon[tile.TileType]) - { - if (i < Main.maxTilesX * 0.35 || i > Main.maxTilesX * 0.65) - pickReq = 65; - } + if (Main.tileDungeon[tile.TileType] && j > Main.worldSurface) + pickReq = 100; return pickReq; } diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs index e5ea6c2ca1..17e38c44b7 100644 --- a/Utilities/WorldgenUtils.cs +++ b/Utilities/WorldgenUtils.cs @@ -1,5 +1,9 @@ -using System.Linq; +using System; +using System.Linq; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; namespace CalamityMod @@ -32,6 +36,28 @@ namespace CalamityMod } } + public static void GrowVines(int VineX, int VineY, int numVines, ushort vineType, bool finished = false) + { + for (int Y = VineY; Y <= VineY + numVines && !finished; Y++) + { + Tile tileBelow = Framing.GetTileSafely(VineX, Y + 1); + + if ((!tileBelow.HasTile || tileBelow.TileType == TileID.Cobweb) && WorldGen.InWorld(VineX, Y)) + { + WorldGen.PlaceTile(VineX, Y, vineType); + } + else + { + finished = true; + } + + if (numVines <= 1) + { + finished = true; + } + } + } + /// /// Settles all liquids in the world. /// @@ -68,5 +94,173 @@ namespace CalamityMod Liquid.quickSettle = false; Liquid.worldGenTilesIgnoreWater(false); } + + // Code more or less directly copied from SchematicManager.PlaceSchematic + public static Rectangle GetSchematicProtectionArea(SchematicMetaTile[,] schematic, Point placementPoint, SchematicAnchor anchorType) + { + int width = schematic.GetLength(0); + int height = schematic.GetLength(1); + + // Calculate the appropriate location to start laying down schematic tiles. + int cornerX = placementPoint.X; + int cornerY = placementPoint.Y; + switch (anchorType) + { + case SchematicAnchor.TopLeft: // Provided point is top-left corner = No change + case SchematicAnchor.Default: // This is also default behavior + default: + break; + case SchematicAnchor.TopCenter: // Provided point is top center = Top-left corner is 1/2 width to the left + cornerX -= width / 2; + break; + case SchematicAnchor.TopRight: // Provided point is top-right corner = Top-left corner is 1 width to the left + cornerX -= width; + break; + case SchematicAnchor.CenterLeft: // Provided point is left center: Top-left corner is 1/2 height above + cornerY -= height / 2; + break; + case SchematicAnchor.Center: // Provided point is center = Top-left corner is 1/2 width and 1/2 height up-left + cornerX -= width / 2; + cornerY -= height / 2; + break; + case SchematicAnchor.CenterRight: // Provided point is right center: Top-left corner is 1 width and 1/2 height up-left + cornerX -= width; + cornerY -= height / 2; + break; + case SchematicAnchor.BottomLeft: // Provided point is bottom-left corner = Top-left corner is 1 height above + cornerY -= height; + break; + case SchematicAnchor.BottomCenter: // Provided point is bottom center: Top-left corner is 1/2 width and 1 height up-left + cornerX -= width / 2; + cornerY -= height; + break; + case SchematicAnchor.BottomRight: // Provided point is bottom-right corner = Top-left corner is 1 width to the left and 1 height above + cornerX -= width; + cornerY -= height; + break; + } + + return new Rectangle(cornerX, cornerY, width, height); + } + } + + //tile runner, useful for caves and other stuff + public class TileRunner + { + public Vector2 pos; + public Vector2 speed; + public Point16 hRange; + public Point16 vRange; + public double strength; + public double str; + public int steps; + public int stepsLeft; + public ushort type; + public bool addTile; + public bool overRide; + + public TileRunner(Vector2 pos, Vector2 speed, Point16 hRange, Point16 vRange, double strength, int steps, ushort type, bool addTile, bool overRide) + { + this.pos = pos; + if (speed.X == 0 && speed.Y == 0) + { + this.speed = new Vector2(WorldGen.genRand.Next(hRange.X, hRange.Y + 1) * 0.1f, WorldGen.genRand.Next(vRange.X, vRange.Y + 1) * 0.1f); + } + else + { + this.speed = speed; + } + this.hRange = hRange; + this.vRange = vRange; + this.strength = strength; + str = strength; + this.steps = steps; + stepsLeft = steps; + this.type = type; + this.addTile = addTile; + this.overRide = overRide; + } + + public void Start() + { + while (str > 0 && stepsLeft > 0) + { + str = strength * (double)stepsLeft / steps; + + int a = (int)Math.Max(pos.X - str * 0.5, 1); + int b = (int)Math.Min(pos.X + str * 0.5, Main.maxTilesX - 1); + int c = (int)Math.Max(pos.Y - str * 0.5, 1); + int d = (int)Math.Min(pos.Y + str * 0.5, Main.maxTilesY - 1); + + for (int i = a; i < b; i++) + { + for (int j = c; j < d; j++) + { + if (Math.Abs(i - pos.X) + Math.Abs(j - pos.Y) >= strength * StrengthRange()) + { + continue; + } + + ChangeTile(Main.tile[i, j]); + } + } + + str += 50; + while (str > 50) + { + pos += speed; + stepsLeft--; + str -= 50; + speed.X += WorldGen.genRand.Next(hRange.X, hRange.Y + 1) * 0.05f; + speed.Y += WorldGen.genRand.Next(vRange.X, vRange.Y + 1) * 0.05f; + } + + speed = Vector2.Clamp(speed, new Vector2(-1, -1), new Vector2(1, 1)); + } + } + + public virtual void ChangeTile(Tile tile) + { + if (!addTile) + { + tile.HasTile = false; + } + else + { + tile.TileType = type; + } + } + + public virtual double StrengthRange() + { + return 0.5 + WorldGen.genRand.Next(-10, 11) * 0.0075; + } + } + + //probably might be useful to have for later, just places clumps of water + public class WaterTileRunner : TileRunner + { + public WaterTileRunner(Vector2 pos, Vector2 speed, Point16 hRange, Point16 vRange, double strength, int steps, ushort type, bool addTile, bool overRide) : base(pos, speed, hRange, vRange, strength, steps, type, addTile, overRide) + { + } + public override void ChangeTile(Tile tile) + { + tile.HasTile = false; + tile.LiquidType = LiquidID.Water; + tile.LiquidAmount = 255; + } + } + + public class LavaTileRunner : TileRunner + { + public LavaTileRunner(Vector2 pos, Vector2 speed, Point16 hRange, Point16 vRange, double strength, int steps, ushort type, bool addTile, bool overRide) : base(pos, speed, hRange, vRange, strength, steps, type, addTile, overRide) + { + } + public override void ChangeTile(Tile tile) + { + tile.HasTile = false; + tile.LiquidType = LiquidID.Lava; + tile.LiquidAmount = 255; + } } } diff --git a/Walls/AbyssGravelWall.png b/Walls/AbyssGravelWall.png index 90a8303f16..663bfa049a 100644 Binary files a/Walls/AbyssGravelWall.png and b/Walls/AbyssGravelWall.png differ diff --git a/Walls/AbyssGravelWallSafe.png b/Walls/AbyssGravelWallSafe.png index b486909ee3..b01e323001 100644 Binary files a/Walls/AbyssGravelWallSafe.png and b/Walls/AbyssGravelWallSafe.png differ diff --git a/Walls/AstralDirtWall.png b/Walls/AstralDirtWall.png index 0a8932ccc9..efaa5a75e8 100644 Binary files a/Walls/AstralDirtWall.png and b/Walls/AstralDirtWall.png differ diff --git a/Walls/AstralDirtWallSafe.png b/Walls/AstralDirtWallSafe.png index 0a8932ccc9..efaa5a75e8 100644 Binary files a/Walls/AstralDirtWallSafe.png and b/Walls/AstralDirtWallSafe.png differ diff --git a/Walls/BrimstoneSlabWall.cs b/Walls/BrimstoneSlabWall.cs new file mode 100644 index 0000000000..844705176b --- /dev/null +++ b/Walls/BrimstoneSlabWall.cs @@ -0,0 +1,83 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class BrimstoneSlabWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(41, 34, 43)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Texture2D sprite = ModContent.Request("CalamityMod/Walls/BrimstoneSlabWall").Value; + Color lightColor = GetWallColour(i, j); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + zero -= new Vector2(8, 8); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + return false; + } + + private int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { i % 2, j % 2 }; + sheetOffset[0] = sheetOffset[0] * 468; + sheetOffset[1] = sheetOffset[1] * 180; + return sheetOffset; + } + + private Color GetWallColour(int i, int j) + { + int colType = Main.tile[i, j].WallColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType < 13) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (colType == 29) + { + paintCol = Color.Black; + } + Color col = Lighting.GetColor(i, j); + col.R = (byte)(paintCol.R / 255f * col.R); + col.G = (byte)(paintCol.G / 255f * col.G); + col.B = (byte)(paintCol.B / 255f * col.B); + return col; + } + } +} diff --git a/Walls/BrimstoneSlabWall.png b/Walls/BrimstoneSlabWall.png new file mode 100644 index 0000000000..b98efa2860 Binary files /dev/null and b/Walls/BrimstoneSlabWall.png differ diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs index 328f789db0..05c00cc437 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/EutrophicSandWall.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { DustType = 108; - AddMapEntry(new Color(80, 80, 120)); + AddMapEntry(new Color(11, 56, 81)); } public override void RandomUpdate(int i, int j) diff --git a/Walls/EutrophicSandWall.png b/Walls/EutrophicSandWall.png index 2f53060752..a396b99d3d 100644 Binary files a/Walls/EutrophicSandWall.png and b/Walls/EutrophicSandWall.png differ diff --git a/Walls/EutrophicSandWallSafe.cs b/Walls/EutrophicSandWallSafe.cs index fd929e1d47..dffab21a64 100644 --- a/Walls/EutrophicSandWallSafe.cs +++ b/Walls/EutrophicSandWallSafe.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Walls Main.wallHouse[Type] = true; DustType = 108; ItemDrop = ModContent.ItemType(); - AddMapEntry(new Color(80, 80, 120)); + AddMapEntry(new Color(11, 56, 81)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/EutrophicSandWallSafe.png b/Walls/EutrophicSandWallSafe.png index 2f53060752..a396b99d3d 100644 Binary files a/Walls/EutrophicSandWallSafe.png and b/Walls/EutrophicSandWallSafe.png differ diff --git a/Walls/ChaosplateWall.cs b/Walls/HavocplateWall.cs similarity index 84% rename from Walls/ChaosplateWall.cs rename to Walls/HavocplateWall.cs index 53fe96b62b..0e23c6e88a 100644 --- a/Walls/ChaosplateWall.cs +++ b/Walls/HavocplateWall.cs @@ -1,16 +1,17 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Walls { - public class ChaosplateWall : ModWall + [LegacyName("ChaosplateWall")] + public class HavocplateWall : ModWall { public override void SetStaticDefaults() { Main.wallHouse[Type] = true; - ItemDrop = ModContent.ItemType(); + ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(123, 50, 66)); } diff --git a/Walls/ChaosplateWall.png b/Walls/HavocplateWall.png similarity index 100% rename from Walls/ChaosplateWall.png rename to Walls/HavocplateWall.png diff --git a/Walls/NavyplateWall.cs b/Walls/NavyplateWall.cs index 6add8b2569..bf00efd2be 100644 --- a/Walls/NavyplateWall.cs +++ b/Walls/NavyplateWall.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -11,7 +11,7 @@ namespace CalamityMod.Walls Main.wallHouse[Type] = true; ItemDrop = ModContent.ItemType(); - AddMapEntry(new Color(55, 98, 127)); + AddMapEntry(new Color(16, 45, 48)); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Walls/NavystoneWall.cs b/Walls/NavystoneWall.cs index bea6818f0b..80c3b49708 100644 --- a/Walls/NavystoneWall.cs +++ b/Walls/NavystoneWall.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { DustType = 96; - AddMapEntry(new Color(0, 50, 50)); + AddMapEntry(new Color(16, 45, 48)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/NavystoneWall.png b/Walls/NavystoneWall.png index 83238b1b57..4d7669028b 100644 Binary files a/Walls/NavystoneWall.png and b/Walls/NavystoneWall.png differ diff --git a/Walls/NavystoneWallSafe.png b/Walls/NavystoneWallSafe.png index 83238b1b57..4d7669028b 100644 Binary files a/Walls/NavystoneWallSafe.png and b/Walls/NavystoneWallSafe.png differ diff --git a/Walls/OnyxplateWall.cs b/Walls/OnyxplateWall.cs new file mode 100644 index 0000000000..1afbc3e1fd --- /dev/null +++ b/Walls/OnyxplateWall.cs @@ -0,0 +1,26 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class OnyxplateWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(92, 7, 92)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/OnyxplateWall.png b/Walls/OnyxplateWall.png new file mode 100644 index 0000000000..65a52bcfb4 Binary files /dev/null and b/Walls/OnyxplateWall.png differ diff --git a/Walls/PyreMantleWall.cs b/Walls/PyreMantleWall.cs new file mode 100644 index 0000000000..151de556ec --- /dev/null +++ b/Walls/PyreMantleWall.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class PyreMantleWall : ModWall + { + public override void SetStaticDefaults() + { + DustType = 33; + AddMapEntry(new Color(6, 10, 54)); + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].LiquidAmount <= 0 && j < Main.maxTilesY - 205) + { + Main.tile[i, j].LiquidAmount = 255; + Main.tile[i, j].Get().LiquidType = LiquidID.Water; + } + } + + public override void KillWall(int i, int j, ref bool fail) => fail = true; + + public override bool CanExplode(int i, int j) => false; + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/PyreMantleWall.png b/Walls/PyreMantleWall.png new file mode 100644 index 0000000000..c1dfd18dfb Binary files /dev/null and b/Walls/PyreMantleWall.png differ diff --git a/Walls/ScorchedBoneWall.cs b/Walls/ScorchedBoneWall.cs new file mode 100644 index 0000000000..49996cd155 --- /dev/null +++ b/Walls/ScorchedBoneWall.cs @@ -0,0 +1,73 @@ +using CalamityMod.Dusts.Furniture; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ScorchedBoneWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(49, 33, 35)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Texture2D sprite = ModContent.Request("CalamityMod/Walls/ScorchedBoneWall").Value; + Color lightColor = GetWallColour(i, j); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + zero -= new Vector2(8, 8); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + return false; + } + + private int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { i % 3, j % 3 }; + sheetOffset[0] = sheetOffset[0] * 468; + sheetOffset[1] = sheetOffset[1] * 180; + return sheetOffset; + } + + private Color GetWallColour(int i, int j) + { + int colType = Main.tile[i, j].WallColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType < 13) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (colType == 29) + { + paintCol = Color.Black; + } + Color col = Lighting.GetColor(i, j); + col.R = (byte)(paintCol.R / 255f * col.R); + col.G = (byte)(paintCol.G / 255f * col.G); + col.B = (byte)(paintCol.B / 255f * col.B); + return col; + } + } +} diff --git a/Walls/ScorchedBoneWall.png b/Walls/ScorchedBoneWall.png new file mode 100644 index 0000000000..f357905078 Binary files /dev/null and b/Walls/ScorchedBoneWall.png differ diff --git a/Walls/SulphurousSandWall.png b/Walls/SulphurousSandWall.png index 026db27ffb..8f7a554dc5 100644 Binary files a/Walls/SulphurousSandWall.png and b/Walls/SulphurousSandWall.png differ diff --git a/Walls/SulphurousSandWallSafe.png b/Walls/SulphurousSandWallSafe.png index 026db27ffb..8f7a554dc5 100644 Binary files a/Walls/SulphurousSandWallSafe.png and b/Walls/SulphurousSandWallSafe.png differ diff --git a/Walls/SulphurousShaleWall.cs b/Walls/SulphurousShaleWall.cs new file mode 100644 index 0000000000..a7a9c9e46d --- /dev/null +++ b/Walls/SulphurousShaleWall.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class SulphurousShaleWall : ModWall + { + public override void SetStaticDefaults() + { + DustType = 32; + AddMapEntry(new Color(59, 40, 63)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/SulphurousShaleWall.png b/Walls/SulphurousShaleWall.png new file mode 100644 index 0000000000..31dfbfc2b5 Binary files /dev/null and b/Walls/SulphurousShaleWall.png differ diff --git a/Walls/SulphurousShaleWallSafe.cs b/Walls/SulphurousShaleWallSafe.cs new file mode 100644 index 0000000000..9a28123226 --- /dev/null +++ b/Walls/SulphurousShaleWallSafe.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class SulphurousShaleWallSafe : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + DustType = 32; + ItemDrop = ModContent.ItemType(); + AddMapEntry(new Color(59, 40, 63)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/SulphurousShaleWallSafe.png b/Walls/SulphurousShaleWallSafe.png new file mode 100644 index 0000000000..31dfbfc2b5 Binary files /dev/null and b/Walls/SulphurousShaleWallSafe.png differ diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 357d70510a..9deae6852f 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -1,14 +1,21 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria.GameContent; using Terraria; using Terraria.ModLoader; +using ReLogic.Content; namespace CalamityMod.Walls { public class VoidstoneWall : ModWall { + internal static Texture2D GlowTexture; + public override void SetStaticDefaults() { Main.wallHouse[Type] = true; + GlowTexture = ModContent.Request("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value; ItemDrop = ModContent.ItemType(); AddMapEntry(new Color(0, 0, 0)); @@ -20,6 +27,47 @@ namespace CalamityMod.Walls return false; } + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + if (GlowTexture is null) + return; + + Tile tile = Main.tile[i, j]; + int xLength = 32; + int xOff = 0; + + Rectangle frame = new Rectangle(tile.WallFrameX + xOff, tile.WallFrameY, xLength, 32); + Color drawcolor; + drawcolor = WorldGen.paintColor(tile.WallColor) * (255f / 255f); + drawcolor.A = 255; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawcolor *= brightness; + + if (Main.drawToScreen) + zero = Vector2.Zero; + + Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; + Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + for (int k = 0; k < 3; k++) + { + Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, drawcolor * 0.4f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; } } diff --git a/Walls/VoidstoneWall.png b/Walls/VoidstoneWall.png index 59e8662408..8531cf0ef5 100644 Binary files a/Walls/VoidstoneWall.png and b/Walls/VoidstoneWall.png differ diff --git a/Walls/VoidstoneWallUnsafe _Glowmask.png b/Walls/VoidstoneWallUnsafe _Glowmask.png new file mode 100644 index 0000000000..a3f5c24d2b Binary files /dev/null and b/Walls/VoidstoneWallUnsafe _Glowmask.png differ diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index 1b6704ec1f..4ea5f82223 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -1,4 +1,8 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria.GameContent; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,8 +11,11 @@ namespace CalamityMod.Walls { public class VoidstoneWallUnsafe : ModWall { + internal static Texture2D GlowTexture; + public override void SetStaticDefaults() { + GlowTexture = ModContent.Request("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value; DustType = 187; AddMapEntry(new Color(0, 0, 0)); } @@ -22,6 +29,47 @@ namespace CalamityMod.Walls } } + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + if (GlowTexture is null) + return; + + Tile tile = Main.tile[i, j]; + int xLength = 32; + int xOff = 0; + + Rectangle frame = new Rectangle(tile.WallFrameX + xOff, tile.WallFrameY, xLength, 32); + Color drawcolor; + drawcolor = WorldGen.paintColor(tile.WallColor) * (255f / 255f); + drawcolor.A = 255; + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawcolor *= brightness; + + if (Main.drawToScreen) + zero = Vector2.Zero; + + Vector2 pos = new Vector2((i * 16 - (int)Main.screenPosition.X), (j * 16 - (int)Main.screenPosition.Y)) + zero; + Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + for (int k = 0; k < 3; k++) + { + Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, drawcolor * 0.4f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } + public override void KillWall(int i, int j, ref bool fail) => fail = true; public override bool CanExplode(int i, int j) => false; diff --git a/Walls/VoidstoneWallUnsafe.png b/Walls/VoidstoneWallUnsafe.png index 59e8662408..721e7e72f1 100644 Binary files a/Walls/VoidstoneWallUnsafe.png and b/Walls/VoidstoneWallUnsafe.png differ diff --git a/Walls/VoidstoneWall_Glowmask.png b/Walls/VoidstoneWall_Glowmask.png new file mode 100644 index 0000000000..f8a69e96e1 Binary files /dev/null and b/Walls/VoidstoneWall_Glowmask.png differ diff --git a/Waters/AbyssWater.png b/Waters/AbyssWater.png deleted file mode 100644 index 34877ba767..0000000000 Binary files a/Waters/AbyssWater.png and /dev/null differ diff --git a/Waters/AbyssWater_Block.png b/Waters/AbyssWater_Block.png deleted file mode 100644 index e67fa261a9..0000000000 Binary files a/Waters/AbyssWater_Block.png and /dev/null differ diff --git a/Waters/AbyssWaterflow.png b/Waters/AbyssWaterflow.png deleted file mode 100644 index a397ea2ebc..0000000000 Binary files a/Waters/AbyssWaterflow.png and /dev/null differ diff --git a/Waters/AstralWater.cs b/Waters/AstralWater.cs index 75ef019ee3..98aaa8d93a 100644 --- a/Waters/AstralWater.cs +++ b/Waters/AstralWater.cs @@ -1,5 +1,8 @@ -using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; +using ReLogic.Content; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Waters { @@ -20,6 +23,16 @@ namespace CalamityMod.Waters return ModContent.Find("CalamityMod/AstralWaterDroplet").Type; } + public override Asset GetRainTexture() + { + return ModContent.Request("CalamityMod/ExtraTextures/VanillaReplacements/RainAstral"); + } + + public override byte GetRainVariant() + { + return (byte)Main.rand.Next(3); + } + public override Color BiomeHairColor() { return Color.MediumPurple; diff --git a/Waters/AstralWater.png b/Waters/AstralWater.png index 10d8bab903..568313be7c 100644 Binary files a/Waters/AstralWater.png and b/Waters/AstralWater.png differ diff --git a/Waters/AstralWater_Block.png b/Waters/AstralWater_Block.png index 4d7ec4aa9a..259db2b823 100644 Binary files a/Waters/AstralWater_Block.png and b/Waters/AstralWater_Block.png differ diff --git a/Waters/AstralWaterflow.png b/Waters/AstralWaterflow.png index 4cc35417cb..03f3ef1a40 100644 Binary files a/Waters/AstralWaterflow.png and b/Waters/AstralWaterflow.png differ diff --git a/Waters/CragsLava.png b/Waters/CragsLava.png index 8039047658..2fab253577 100644 Binary files a/Waters/CragsLava.png and b/Waters/CragsLava.png differ diff --git a/Waters/CragsLavaStyle.cs b/Waters/CragsLavaStyle.cs index 999ffd7d12..86c150e699 100644 --- a/Waters/CragsLavaStyle.cs +++ b/Waters/CragsLavaStyle.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Waters public override void SelectLightColor(ref Color initialLightColor) { initialLightColor = Color.Lerp(initialLightColor, Color.White, 0.5f); - initialLightColor = Color.Lerp(initialLightColor, Color.DarkRed, 0.45f); initialLightColor.A = 255; } } diff --git a/Waters/CragsLava_Block.png b/Waters/CragsLava_Block.png index 530bc3d0d6..2c36f5a88a 100644 Binary files a/Waters/CragsLava_Block.png and b/Waters/CragsLava_Block.png differ diff --git a/Waters/CragsLava_Slope.png b/Waters/CragsLava_Slope.png index 18e07be5d7..10d6495401 100644 Binary files a/Waters/CragsLava_Slope.png and b/Waters/CragsLava_Slope.png differ diff --git a/Waters/CragsLavaflow.png b/Waters/CragsLavaflow.png index 0df9555c05..9e41d7e668 100644 Binary files a/Waters/CragsLavaflow.png and b/Waters/CragsLavaflow.png differ diff --git a/Waters/MiddleAbyssWater.cs b/Waters/MiddleAbyssWater.cs new file mode 100644 index 0000000000..1c7f8250f8 --- /dev/null +++ b/Waters/MiddleAbyssWater.cs @@ -0,0 +1,28 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class MiddleAbyssWater : ModWaterStyle + { + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/MiddleAbyssWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.Blue; + } + } +} diff --git a/Waters/MiddleAbyssWater.png b/Waters/MiddleAbyssWater.png new file mode 100644 index 0000000000..7473f10efc Binary files /dev/null and b/Waters/MiddleAbyssWater.png differ diff --git a/Waters/MiddleAbyssWater_Block.png b/Waters/MiddleAbyssWater_Block.png new file mode 100644 index 0000000000..053dbf0207 Binary files /dev/null and b/Waters/MiddleAbyssWater_Block.png differ diff --git a/Waters/MiddleAbyssWaterflow.cs b/Waters/MiddleAbyssWaterflow.cs new file mode 100644 index 0000000000..6d7deb015d --- /dev/null +++ b/Waters/MiddleAbyssWaterflow.cs @@ -0,0 +1,8 @@ +using Terraria.ModLoader; +namespace CalamityMod.Waters +{ + public class MiddleAbyssWaterflow : ModWaterfallStyle + { + + } +} diff --git a/Waters/MiddleAbyssWaterflow.png b/Waters/MiddleAbyssWaterflow.png new file mode 100644 index 0000000000..05053f61ad Binary files /dev/null and b/Waters/MiddleAbyssWaterflow.png differ diff --git a/Waters/PissWater.cs b/Waters/PissWater.cs new file mode 100644 index 0000000000..0b315df535 --- /dev/null +++ b/Waters/PissWater.cs @@ -0,0 +1,28 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class PissWater : ModWaterStyle + { + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/PissWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 102; + } + + public override int GetDropletGore() + { + return 711; + } + + public override Color BiomeHairColor() + { + return Color.Yellow; + } + } +} diff --git a/Waters/PissWater.png b/Waters/PissWater.png new file mode 100644 index 0000000000..c585c0b749 Binary files /dev/null and b/Waters/PissWater.png differ diff --git a/Waters/PissWater_Block.png b/Waters/PissWater_Block.png new file mode 100644 index 0000000000..b6b92ada7c Binary files /dev/null and b/Waters/PissWater_Block.png differ diff --git a/Waters/AbyssWaterflow.cs b/Waters/PissWaterflow.cs similarity index 58% rename from Waters/AbyssWaterflow.cs rename to Waters/PissWaterflow.cs index 9284d28dd3..df91b07b1b 100644 --- a/Waters/AbyssWaterflow.cs +++ b/Waters/PissWaterflow.cs @@ -1,7 +1,7 @@ using Terraria.ModLoader; namespace CalamityMod.Waters { - public class AbyssWaterflow : ModWaterfallStyle + public class PissWaterflow : ModWaterfallStyle { } diff --git a/Waters/PissWaterflow.png b/Waters/PissWaterflow.png new file mode 100644 index 0000000000..181d858ffb Binary files /dev/null and b/Waters/PissWaterflow.png differ diff --git a/Waters/SulphuricDepthsWater.cs b/Waters/SulphuricDepthsWater.cs new file mode 100644 index 0000000000..64aa588c33 --- /dev/null +++ b/Waters/SulphuricDepthsWater.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class SulphuricDepthsWater : ModWaterStyle + { + public static int Type; + public override void SetStaticDefaults() + { + Type = Slot; + } + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/SulphuricDepthsWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.Teal; + } + } +} diff --git a/Waters/SulphuricDepthsWater.png b/Waters/SulphuricDepthsWater.png new file mode 100644 index 0000000000..db1e320f60 Binary files /dev/null and b/Waters/SulphuricDepthsWater.png differ diff --git a/Waters/SulphuricDepthsWater_Block.png b/Waters/SulphuricDepthsWater_Block.png new file mode 100644 index 0000000000..f833897963 Binary files /dev/null and b/Waters/SulphuricDepthsWater_Block.png differ diff --git a/Waters/SulphuricDepthsWaterflow.cs b/Waters/SulphuricDepthsWaterflow.cs new file mode 100644 index 0000000000..0b0e76017e --- /dev/null +++ b/Waters/SulphuricDepthsWaterflow.cs @@ -0,0 +1,8 @@ +using Terraria.ModLoader; +namespace CalamityMod.Waters +{ + public class SulphuricDepthsWaterflow : ModWaterfallStyle + { + + } +} diff --git a/Waters/SulphuricDepthsWaterflow.png b/Waters/SulphuricDepthsWaterflow.png new file mode 100644 index 0000000000..12e11d8708 Binary files /dev/null and b/Waters/SulphuricDepthsWaterflow.png differ diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 2e3de550c8..16ba5f2725 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -1,10 +1,18 @@ -using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; +using ReLogic.Content; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Waters { public class SulphuricWater : ModWaterStyle { + public static int Type; + public override void SetStaticDefaults() + { + Type = Slot; + } public override int ChooseWaterfallStyle() { return ModContent.Find("CalamityMod/SulphuricWaterflow").Slot; @@ -20,6 +28,16 @@ namespace CalamityMod.Waters return 708; } + public override Asset GetRainTexture() + { + return ModContent.Request("CalamityMod/ExtraTextures/VanillaReplacements/RainSulphSea"); + } + + public override byte GetRainVariant() + { + return (byte)Main.rand.Next(3); + } + public override Color BiomeHairColor() { return Color.Turquoise; diff --git a/Waters/SulphuricWater.png b/Waters/SulphuricWater.png index 84a9e6e7a2..5be6a7c5a9 100644 Binary files a/Waters/SulphuricWater.png and b/Waters/SulphuricWater.png differ diff --git a/Waters/SulphuricWater_Block.png b/Waters/SulphuricWater_Block.png index b02541e8ed..5bc2c8ac0a 100644 Binary files a/Waters/SulphuricWater_Block.png and b/Waters/SulphuricWater_Block.png differ diff --git a/Waters/SulphuricWaterflow.png b/Waters/SulphuricWaterflow.png index eec550a78c..cd519bf721 100644 Binary files a/Waters/SulphuricWaterflow.png and b/Waters/SulphuricWaterflow.png differ diff --git a/Waters/SunkenSeaWater.cs b/Waters/SunkenSeaWater.cs index 6d37df53a9..62c32fbd4c 100644 --- a/Waters/SunkenSeaWater.cs +++ b/Waters/SunkenSeaWater.cs @@ -5,6 +5,11 @@ namespace CalamityMod.Waters { public class SunkenSeaWater : ModWaterStyle { + public static int Type; + public override void SetStaticDefaults() + { + Type = Slot; + } public override int ChooseWaterfallStyle() { return ModContent.Find("CalamityMod/SunkenSeaWaterflow").Slot; diff --git a/Waters/SunkenSeaWater.png b/Waters/SunkenSeaWater.png index 45af5a5c94..cae58da0f0 100644 Binary files a/Waters/SunkenSeaWater.png and b/Waters/SunkenSeaWater.png differ diff --git a/Waters/SunkenSeaWater_Block.png b/Waters/SunkenSeaWater_Block.png index 87a5f07a83..3d86838967 100644 Binary files a/Waters/SunkenSeaWater_Block.png and b/Waters/SunkenSeaWater_Block.png differ diff --git a/Waters/SunkenSeaWaterflow.png b/Waters/SunkenSeaWaterflow.png index 17626db60c..c063dddf79 100644 Binary files a/Waters/SunkenSeaWaterflow.png and b/Waters/SunkenSeaWaterflow.png differ diff --git a/Waters/UpperAbyssWater.cs b/Waters/UpperAbyssWater.cs new file mode 100644 index 0000000000..965861fdf7 --- /dev/null +++ b/Waters/UpperAbyssWater.cs @@ -0,0 +1,28 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class UpperAbyssWater : ModWaterStyle + { + public override int ChooseWaterfallStyle() + { + return ModContent.Find("CalamityMod/UpperAbyssWaterflow").Slot; + } + + public override int GetSplashDust() + { + return 33; + } + + public override int GetDropletGore() + { + return 713; + } + + public override Color BiomeHairColor() + { + return Color.Blue; + } + } +} diff --git a/Waters/UpperAbyssWater.png b/Waters/UpperAbyssWater.png new file mode 100644 index 0000000000..a338ce5e37 Binary files /dev/null and b/Waters/UpperAbyssWater.png differ diff --git a/Waters/UpperAbyssWater_Block.png b/Waters/UpperAbyssWater_Block.png new file mode 100644 index 0000000000..d6e381342a Binary files /dev/null and b/Waters/UpperAbyssWater_Block.png differ diff --git a/Waters/UpperAbyssWaterflow.cs b/Waters/UpperAbyssWaterflow.cs new file mode 100644 index 0000000000..855d4f319d --- /dev/null +++ b/Waters/UpperAbyssWaterflow.cs @@ -0,0 +1,8 @@ +using Terraria.ModLoader; +namespace CalamityMod.Waters +{ + public class UpperAbyssWaterflow : ModWaterfallStyle + { + + } +} diff --git a/Waters/UpperAbyssWaterflow.png b/Waters/UpperAbyssWaterflow.png new file mode 100644 index 0000000000..9c518906fd Binary files /dev/null and b/Waters/UpperAbyssWaterflow.png differ diff --git a/Waters/AbyssWater.cs b/Waters/VoidWater.cs similarity index 88% rename from Waters/AbyssWater.cs rename to Waters/VoidWater.cs index a6d848a409..bff3e0bf78 100644 --- a/Waters/AbyssWater.cs +++ b/Waters/VoidWater.cs @@ -3,11 +3,11 @@ using Terraria.ModLoader; namespace CalamityMod.Waters { - public class AbyssWater : ModWaterStyle + public class VoidWater : ModWaterStyle { public override int ChooseWaterfallStyle() { - return ModContent.Find("CalamityMod/AbyssWaterflow").Slot; + return ModContent.Find("CalamityMod/VoidWaterflow").Slot; } public override int GetSplashDust() diff --git a/Waters/VoidWater.png b/Waters/VoidWater.png new file mode 100644 index 0000000000..6fee1edade Binary files /dev/null and b/Waters/VoidWater.png differ diff --git a/Waters/VoidWater_Block.png b/Waters/VoidWater_Block.png new file mode 100644 index 0000000000..10d2c41046 Binary files /dev/null and b/Waters/VoidWater_Block.png differ diff --git a/Waters/VoidWaterflow.cs b/Waters/VoidWaterflow.cs new file mode 100644 index 0000000000..3224a16282 --- /dev/null +++ b/Waters/VoidWaterflow.cs @@ -0,0 +1,8 @@ +using Terraria.ModLoader; +namespace CalamityMod.Waters +{ + public class VoidWaterflow : ModWaterfallStyle + { + + } +} diff --git a/Waters/VoidWaterflow.png b/Waters/VoidWaterflow.png new file mode 100644 index 0000000000..a3df99b4a1 Binary files /dev/null and b/Waters/VoidWaterflow.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index da590c6cdb..4003ed7560 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -7,14 +7,23 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using System; +using System.Linq; +using System.Collections.Generic; using Terraria; using Terraria.ID; +using Terraria.IO; using Terraria.ModLoader; +using Terraria.GameContent.Generation; +using Terraria.DataStructures; +using Terraria.WorldBuilding; +using System.Diagnostics; namespace CalamityMod.World { @@ -36,256 +45,262 @@ namespace CalamityMod.World int abyssChasmY = y - 250; //Underworld = y - 200 AbyssChasmBottom = abyssChasmY - 100; //850 small 1450 medium 2050 large - int abyssChasmX = AtLeftSideOfWorld ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135); //2100 - 1965 = 135 : 2100 + 1965 = 4065 + int abyssChasmX = AtLeftSideOfWorld ? genLimit - (genLimit - 135) + 35 : genLimit + (genLimit - 135) - 35; //2100 - 1965 = 135 : 2100 + 1965 = 4065 - bool tenebrisSide = true; - if (abyssChasmX < genLimit) - tenebrisSide = false; + int abyssMinX = AtLeftSideOfWorld ? 0 : abyssChasmX - 160; + int abyssMaxX = AtLeftSideOfWorld ? abyssChasmX + 160 : x; - if (AtLeftSideOfWorld) + for (int abyssIndex = abyssMinX; abyssIndex < abyssMaxX; abyssIndex++) { - for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY + 50; abyssIndex2++) { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + + if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) { - Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); - bool canConvert = tile.HasTile && - tile.TileType < TileID.Count && - tile.TileType != TileID.DyePlants && - tile.TileType != TileID.Trees && - tile.TileType != TileID.PalmTree && - tile.TileType != TileID.Sand && - tile.TileType != TileID.Containers && - tile.TileType != TileID.Coral && - tile.TileType != TileID.BeachPiles && - tile.TileType != ModContent.TileType() && - tile.TileType != ModContent.TileType(); - if (abyssIndex2 > rockLayer - WorldGen.genRand.Next(30)) + tile.Get().LiquidType = LiquidID.Water; + tile.LiquidAmount = byte.MaxValue; + } + + bool canConvert = tile.HasTile && tile.TileType < TileID.Count && tile.TileType != ModContent.TileType(); + + //normally i would organize each layer of blocks by the order of how they are placed in the abyss + //but i cannot be bothered, and when i do it, it keeps messing up or making certain parts like transitions not gen right + //i have at least left comments so people reading will know what does what + if (abyssIndex2 > (rockLayer - Main.maxTilesY / 15) + 35) + { + //replaces blocks wand walls that can be converted + if (canConvert) { - if (abyssIndex > abyssChasmX + 75 - WorldGen.genRand.Next(30)) + //layer 4 + if (abyssIndex2 > (rockLayer + y * 0.270)) { - if (WorldGen.genRand.NextBool(4)) - { - if (canConvert) - { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - else if (!tile.HasTile) - { - tile.Get().HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - } + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } - else if (abyssIndex > abyssChasmX + 70) + //layer 3-4 dithering transition + else if (abyssIndex2 > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + //layer 3 + else if (abyssIndex2 > (rockLayer + y * 0.145)) + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + //layer 2-3 dithering transition + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + //layer 1-2 dithering transition + else if (abyssIndex2 >= rockLayer - 10 && abyssIndex2 <= rockLayer) { if (WorldGen.genRand.NextBool(2)) { - if (canConvert) - { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - else if (!tile.HasTile) - { - tile.Get().HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + else + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } } + //layer 1 + else if (abyssIndex2 <= rockLayer - 10) + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + //layer 2 (default block for the abyss) else { - if (canConvert) - { - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(3)) - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - else - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - } - else if (!tile.HasTile) - { - tile.Get().HasTile = true; - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(3)) - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - else - { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - } + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } } - } - } - } - else - { - for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 - { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) - { - Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); - bool canConvert = tile.HasTile && - tile.TileType < TileID.Count && - tile.TileType != TileID.DyePlants && - tile.TileType != TileID.Trees && - tile.TileType != TileID.PalmTree && - tile.TileType != TileID.Sand && - tile.TileType != TileID.Containers && - tile.TileType != TileID.Coral && - tile.TileType != TileID.BeachPiles; - if (abyssIndex2 > rockLayer - WorldGen.genRand.Next(30)) + //basically places smaller clusters everywhere else? + else if (!tile.HasTile) { - if (abyssIndex < abyssChasmX - 75) + tile.Get().HasTile = true; + + //layer 4 + if (abyssIndex2 > (rockLayer + y * 0.270)) { - if (WorldGen.genRand.NextBool(4)) - { - if (canConvert) - { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - else if (!tile.HasTile) - { - tile.Get().HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - } + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } - else if (abyssIndex < abyssChasmX - 70) + //layer 3-4 dithering transition + else if (abyssIndex2 > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + //layer 3 + else if (abyssIndex2 > (rockLayer + y * 0.145)) + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + //layer 2-3 dithering transition + else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + //layer 1-2 dithering transition + else if (abyssIndex2 >= rockLayer - 10 && abyssIndex2 <= rockLayer) { if (WorldGen.genRand.NextBool(2)) { - if (canConvert) - { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - else if (!tile.HasTile) - { - tile.Get().HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + else + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } } + //layer 1 + else if (abyssIndex2 <= rockLayer - 10) + { + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); + } + //layer 2 (default block for the abyss) else { - if (canConvert) - { - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(3)) - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - else - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - } - else if (!tile.HasTile) - { - tile.Get().HasTile = true; - if (abyssIndex2 > (rockLayer + y * 0.262)) - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(3)) - { - tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); - } - else - { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - } + tile.TileType = (ushort)ModContent.TileType(); + tile.WallType = (ushort)ModContent.WallType(); } } } } } - MiscWorldgenRoutines.ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, AbyssChasmBottom, true); + //initial hole + MiscWorldgenRoutines.ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow + 65, AbyssChasmBottom, true); + MiscWorldgenRoutines.ChasmGenerator(abyssChasmX - 22, (int)WorldGen.worldSurfaceLow, AbyssChasmBottom, true); + MiscWorldgenRoutines.ChasmGenerator(abyssChasmX + 22, (int)WorldGen.worldSurfaceLow, AbyssChasmBottom, true); int maxAbyssIslands = 11; //Small World + if (y > 2100) + { maxAbyssIslands = 20; //Large World + } else if (y > 1500) + { maxAbyssIslands = 16; //Medium World + } - // Place the Terminus shrine. + PlaceSnailFossil(abyssChasmX, AbyssChasmBottom + 45); + + //place a single abyss island under the terminus shrine + AbyssIsland(abyssChasmX, AbyssChasmBottom + 5, 65, 75, 40, 45, ModContent.TileType(), false, false, false); + + //place terminus shrine UndergroundShrines.SpecialHut((ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.WallType(), UndergroundShrines.UndergroundShrineType.Abyss, abyssChasmX, AbyssChasmBottom); + (ushort)ModContent.WallType(), UndergroundShrines.UndergroundShrineType.Abyss, abyssChasmX, AbyssChasmBottom); - int islandLocationOffset = 30; - int islandLocationY = rockLayer; - for (int islands = 0; islands < maxAbyssIslands; islands++) + //place islands in the sulphuric depths layer + //start placing islands at the world surface so the abyss hole isnt completely empty + int abyssStartHeight = (SulphurousSea.YStart + (int)Main.worldSurface) / 2 + 90; + for (int sulphurIslandY = abyssStartHeight; sulphurIslandY <= rockLayer - 25; sulphurIslandY++) { int islandLocationX = abyssChasmX; - int randomIsland = WorldGen.genRand.Next(5); //0 1 2 3 4 - bool hasVoidstone = islandLocationY > (rockLayer + y * 0.143); - AbyssIslandPositions[TotalPlacedIslandsSoFar].Y = islandLocationY; + int islandLocationOffset = WorldGen.genRand.Next(15, 22); + int randomPositon = WorldGen.genRand.Next(35, 80); + int randomIsland = WorldGen.genRand.Next(5); switch (randomIsland) { case 0: - AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + //3 islands, middle one with chest + AbyssIsland(islandLocationX - randomPositon - 10, sulphurIslandY + 15, 60, 65, 45, 55, ModContent.TileType(), false, false, false); + AbyssIsland(islandLocationX, sulphurIslandY, 60, 65, 45, 55, ModContent.TileType(), false, false, false); + AbyssIsland(islandLocationX + randomPositon + 10, sulphurIslandY + 15, 60, 65, 45, 55, ModContent.TileType(), false, false, false); break; case 1: - AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX += 30; + //3 islands, left, middle one with chest, and right + AbyssIsland(islandLocationX - randomPositon, sulphurIslandY + 10, 60, 85, 30, 35, ModContent.TileType(), false, false, false); + AbyssIsland(islandLocationX, sulphurIslandY + 15, 60, 85, 30, 35, ModContent.TileType(), false, false, false); + AbyssIsland(islandLocationX + randomPositon, sulphurIslandY, 60, 85, 30, 35, ModContent.TileType(), false, false, false); + islandLocationX += 15; break; case 2: - AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); - islandLocationX -= 30; + //2 islands, left, and slightly right + AbyssIsland(islandLocationX - randomPositon, sulphurIslandY + 15, 55, 65, 30, 35, ModContent.TileType(), false, false, false); + AbyssIsland(islandLocationX + WorldGen.genRand.Next(15, 30), sulphurIslandY + 15, 60, 85, 30, 35, ModContent.TileType(), false, false, false); + islandLocationX -= 15; break; case 3: - AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + //2 islands, slightly left, and right + AbyssIsland(islandLocationX - WorldGen.genRand.Next(15, 30), sulphurIslandY + 10, 55, 65, 30, 35, ModContent.TileType(), false, false, false); + AbyssIsland(islandLocationX + randomPositon, sulphurIslandY + 15, 60, 85, 30, 35, ModContent.TileType(), false, false, false); islandLocationX += 25; break; case 4: - AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + //2 islands, left and right + AbyssIsland(islandLocationX - randomPositon, sulphurIslandY, 60, 75, 30, 40, ModContent.TileType(), false, false, false); + AbyssIsland(islandLocationX + randomPositon, sulphurIslandY + 5, 60, 75, 30, 40, ModContent.TileType(), false, false, false); + islandLocationX -= 25; + break; + } + + //increase y value so islands cant be spammed on top of each other + sulphurIslandY += islandLocationOffset; + } + + //islands for layer 2 + int islandLocationY = rockLayer; + + for (int islands = 0; islands < maxAbyssIslands; islands++) + { + int islandLocationX = abyssChasmX; + int islandLocationOffset = WorldGen.genRand.Next(18, 25); + int randomPositon = WorldGen.genRand.Next(45, 80); + AbyssIslandPositions[TotalPlacedIslandsSoFar].Y = islandLocationY; + + int randomIsland = WorldGen.genRand.Next(5); + switch (randomIsland) + { + case 0: + //3 islands, middle one with chest + AbyssIsland(islandLocationX - randomPositon - 10, islandLocationY + 15, 60, 65, 30, 35, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX, islandLocationY, 60, 65, 30, 35, ModContent.TileType(), true, true, true); + AbyssIsland(islandLocationX + randomPositon + 10, islandLocationY + 15, 60, 65, 30, 35, ModContent.TileType(), false, true, false); + break; + case 1: + //3 islands, left, middle one with chest, and right + AbyssIsland(islandLocationX - randomPositon, islandLocationY + 10, 60, 65, 30, 35, ModContent.TileType(), false, true, true); + AbyssIsland(islandLocationX, islandLocationY + 15, 60, 65, 30, 35, ModContent.TileType(), true, true, false); + AbyssIsland(islandLocationX + randomPositon, islandLocationY, 60, 65, 30, 35, ModContent.TileType(), false, true, false); + islandLocationX += 30; + break; + case 2: + //3 islands, none with chest + AbyssIsland(islandLocationX - randomPositon - 20, islandLocationY, 55, 65, 30, 35, ModContent.TileType(), false, true, true); + AbyssIsland(islandLocationX + 15, islandLocationY + 15, 55, 65, 30, 35, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX + randomPositon + 20, islandLocationY + 10, 55, 65, 30, 35, ModContent.TileType(), false, true, false); + islandLocationX -= 30; + break; + case 3: + //3 islands, left, middle, and right one with chest + AbyssIsland(islandLocationX - randomPositon, islandLocationY + 15, 60, 65, 30, 45, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX - 15, islandLocationY + 5, 60, 65, 30, 45, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX + randomPositon, islandLocationY, 60, 65, 30, 45, ModContent.TileType(), true, true, true); + islandLocationX += 25; + break; + case 4: + //3 islands, left one with chest, middle, and right + AbyssIsland(islandLocationX - randomPositon, islandLocationY, 60, 75, 30, 40, ModContent.TileType(), true, true, false); + AbyssIsland(islandLocationX, islandLocationY + 15, 60, 75, 30, 40, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX + randomPositon, islandLocationY + 5, 60, 75, 30, 40, ModContent.TileType(), false, true, false); islandLocationX -= 25; break; } @@ -294,86 +309,364 @@ namespace CalamityMod.World TotalPlacedIslandsSoFar++; islandLocationY += islandLocationOffset; - if (islandLocationY >= AbyssChasmBottom - 50) + + //do not place anymore islands when the third layer is reached + if (islandLocationY >= (rockLayer + y * 0.145) - 10) + { break; + } } + //islands for layer 3 + for (int thermalIslandY = (int)(rockLayer + y * 0.145); thermalIslandY <= (int)(rockLayer + y * 0.270); thermalIslandY++) + { + int islandLocationX = abyssChasmX; + int islandLocationOffset = WorldGen.genRand.Next(18, 30); + int randomPositon = WorldGen.genRand.Next(40, 75); + bool hasScoria = WorldGen.genRand.NextBool(2); //50% chance to place scoria in each island instead of planty mush + + int randomIsland = WorldGen.genRand.Next(4); + switch (randomIsland) + { + case 0: + //3 islands, left, middle, and right + AbyssIsland(islandLocationX - randomPositon - 10, thermalIslandY + 15, 55, 65, 45, 55, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX, thermalIslandY, 60, 65, 45, 55, ModContent.TileType(), false, true, true); + AbyssIsland(islandLocationX + randomPositon + 10, thermalIslandY + 15, 60, 65, 45, 55, ModContent.TileType(), false, true, true); + islandLocationX -= 30; + break; + case 1: + //3 islands, left, middle (slightly lower), and right + AbyssIsland(islandLocationX - randomPositon, thermalIslandY + 10, 60, 75, 30, 35, ModContent.TileType(), false, true, true); + AbyssIsland(islandLocationX, thermalIslandY + 15, 75, 85, 30, 35, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX + randomPositon, thermalIslandY, 55, 85, 30, 35, ModContent.TileType(), false, true, false); + islandLocationX += 30; + break; + case 2: + //3 islands, left, middle (slightly left), and right + AbyssIsland(islandLocationX - randomPositon - 20, thermalIslandY, 55, 65, 30, 35, ModContent.TileType(), false, true, true); + AbyssIsland(islandLocationX - 20, thermalIslandY + 15, 60, 70, 30, 35, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX + randomPositon + 20, thermalIslandY + 10, 65, 70, 30, 35, ModContent.TileType(), false, true, true); + islandLocationX -= 25; + break; + case 3: + //3 islands, left, middle (slightly right), and right + AbyssIsland(islandLocationX - randomPositon, thermalIslandY + 15, 60, 75, 30, 55, ModContent.TileType(), false, true, true); + AbyssIsland(islandLocationX + 20, thermalIslandY + 5, 60, 75, 30, 55, ModContent.TileType(), false, true, false); + AbyssIsland(islandLocationX + randomPositon, thermalIslandY, 60, 75, 30, 55, ModContent.TileType(), false, true, true); + islandLocationX += 25; + break; + } + + thermalIslandY += islandLocationOffset; + + //do not place anymore islands when the fourth layer is reached + if (thermalIslandY >= (rockLayer + y * 0.270) - 10) + { + break; + } + } + + //place some islands lining the walls in layer 4 + for (int voidIslandY = (int)(rockLayer + y * 0.275); voidIslandY <= AbyssChasmBottom - 20; voidIslandY++) + { + if (WorldGen.genRand.NextBool(8)) + { + int randomIsland = WorldGen.genRand.Next(3); + switch (randomIsland) + { + case 0: + //1 island, to the left + AbyssIsland(abyssChasmX - WorldGen.genRand.Next(70, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, false, false); + break; + case 1: + //1 island, to the right + AbyssIsland(abyssChasmX + WorldGen.genRand.Next(70, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, false, false); + break; + case 2: + //2 islands, left and right + AbyssIsland(abyssChasmX - WorldGen.genRand.Next(70, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, false, false); + AbyssIsland(abyssChasmX + WorldGen.genRand.Next(70, 78), voidIslandY, 65, 85, 35, 45, ModContent.TileType(), false, false, false); + break; + } + + //increase y value so islands cant be spammed on top of each other + voidIslandY += WorldGen.genRand.Next(20, 32); + } + } + + //place chests in each location saved from before AbyssItemArray = CalamityUtils.ShuffleArray(AbyssItemArray); for (int abyssHouse = 0; abyssHouse < TotalPlacedIslandsSoFar; abyssHouse++) //11 15 19 { + bool isInLayer2 = AbyssIslandPositions[abyssHouse].Y < (rockLayer + y * 0.145); + if (abyssHouse != 20) { - AbyssIslandHouse(AbyssIslandPositions[abyssHouse].X, - AbyssIslandPositions[abyssHouse].Y, - AbyssItemArray[abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse], //10 choices 0 to 9 - AbyssIslandPositions[abyssHouse].Y > (rockLayer + y * 0.143)); + AbyssChest(AbyssIslandPositions[abyssHouse].X, AbyssIslandPositions[abyssHouse].Y, AbyssItemArray[abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse]); } } - if (AtLeftSideOfWorld) + //clean up + for (int abyssIndex = abyssMinX + 5; abyssIndex < abyssMaxX - 5; abyssIndex++) { - for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 + for (int abyssIndex2 = 5; abyssIndex2 < abyssChasmY; abyssIndex2++) { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + Tile tile = Main.tile[abyssIndex, abyssIndex2]; + Tile tileUp = Main.tile[abyssIndex, abyssIndex2 - 1]; + Tile tileDown = Main.tile[abyssIndex, abyssIndex2 + 1]; + Tile tileLeft = Main.tile[abyssIndex - 1, abyssIndex2]; + Tile tileRight = Main.tile[abyssIndex + 1, abyssIndex2]; + + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) { - if (!Main.tile[abyssIndex, abyssIndex2].HasTile) + //slope tiles + Tile.SmoothSlope(abyssIndex, abyssIndex2, true); + + //kill any individual floating tiles + if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) { - if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 > rockLayer) - { - if (WorldGen.genRand.NextBool(5)) - { - WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } - else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 < (int)Main.worldSurface) - { - if (WorldGen.genRand.NextBool(3)) - { - WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); - } - } + WorldGen.KillTile(abyssIndex, abyssIndex2); } } + + if (!tile.HasTile && tile.WallType > 0) + { + //fill up any air pockets with water + tile.Get().LiquidType = LiquidID.Water; + tile.LiquidAmount = byte.MaxValue; + } + + //kill obsidian + if (tile.TileType == TileID.Obsidian) + { + WorldGen.KillTile(abyssIndex, abyssIndex2); + } } } - else + + //ambient tiles and pots + for (int abyssIndex = abyssMinX + 5; abyssIndex < abyssMaxX - 5; abyssIndex++) { - for (int abyssIndex = abyssChasmX - 80; abyssIndex < x; abyssIndex++) //3965 + for (int abyssIndex2 = 0; abyssIndex2 < Main.maxTilesY - 200; abyssIndex2++) { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + Tile tileToGrowVineOn = Main.tile[abyssIndex, abyssIndex2]; + + if (!Main.tile[abyssIndex, abyssIndex2].HasTile) { - if (!Main.tile[abyssIndex, abyssIndex2].HasTile) + Tile tile = Main.tile[abyssIndex, abyssIndex2 + 1]; + + //above the 4th layer + if (abyssIndex2 < Main.maxTilesY - 200 && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) { - if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 > rockLayer) + //sulphur shale stuff + if (tile.TileType == ModContent.TileType()) { - if (WorldGen.genRand.NextBool(5)) + //tube coral + if (WorldGen.genRand.NextBool(85)) { - WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGen.PlaceObject(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + + //shale rock piles + if (WorldGen.genRand.NextBool(18)) + { + ushort[] ShalePiles = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(ShalePiles)); + } + + //pire corals + if (WorldGen.genRand.NextBool(15)) + { + ushort[] PireCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PireCorals)); + } + + //sulphur fossils + if (WorldGen.genRand.NextBool(12)) + { + ushort[] SulphuricFossils = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(SulphuricFossils)); + } + + //ribs + if (WorldGen.genRand.NextBool(12)) + { + ushort[] Ribs = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Ribs)); } } - else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && - abyssIndex2 < (int)Main.worldSurface) + + //planty mush stuff + if (tile.TileType == ModContent.TileType()) { - if (WorldGen.genRand.NextBool(3)) + if (WorldGen.genRand.NextBool(8)) { - WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + ushort[] PlantPiles = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PlantPiles)); + } + } + + //abyss gravel stuff + if (tile.TileType == ModContent.TileType()) + { + //rare pearls + if (WorldGen.genRand.NextBool(50)) + { + WorldGen.PlaceObject(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + + //giant kelp on abyss gravel + if (WorldGen.genRand.NextBool(15)) + { + ushort[] Kelps = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Kelps)); + } + + //plany mush piles + if (WorldGen.genRand.NextBool(15)) + { + ushort[] PlantPiles = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PlantPiles)); + } + + //gravel rock piles + if (WorldGen.genRand.NextBool(15)) + { + ushort[] GravelPiles = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(GravelPiles)); + } + + //abyss gravel vents + if (WorldGen.genRand.NextBool(45)) + { + ushort[] Vents = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Vents)); + } + + //pirate crates + if (WorldGen.genRand.NextBool(17)) + { + ushort[] PirateCrate = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PirateCrate)); + } + } + + //prye mantle stuff + if (tile.TileType == ModContent.TileType()) + { + //spider coral + if (WorldGen.genRand.NextBool(12)) + { + ushort[] SpiderCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(SpiderCorals)); + } + + //thermal vent + if (WorldGen.genRand.NextBool(15)) + { + ushort[] Vents = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Vents)); + } + } + + //voidstone stuff + if (tile.TileType == ModContent.TileType()) + { + //bulb trees + if (WorldGen.genRand.NextBool(25)) + { + ushort[] BulbTrees = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(BulbTrees)); } } } + + //pots + if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType()) && abyssIndex2 > rockLayer) + { + if (WorldGen.genRand.NextBool(5)) + { + WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + + //sulphur pots + else if (tile.TileType == ModContent.TileType() && abyssIndex2 < (int)Main.worldSurface) + { + if (WorldGen.genRand.NextBool(3)) + { + WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + } + } + } + + //esentially what this does is grow one vine on the bottom of a tile, then use the util to keep placing the vine until it decides to stop + if (tileToGrowVineOn.TileType == ModContent.TileType() && !Main.tile[abyssIndex, abyssIndex2 + 1].HasTile) + { + if (WorldGen.genRand.Next(2) == 0) + { + WorldGen.PlaceTile(abyssIndex, abyssIndex2 + 1, (ushort)ModContent.TileType()); + } + } + if (tileToGrowVineOn.TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(abyssIndex, abyssIndex2, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + } + + //same as above but for sulphur vines + if (tileToGrowVineOn.TileType == ModContent.TileType() && !Main.tile[abyssIndex, abyssIndex2 + 1].HasTile) + { + if (WorldGen.genRand.Next(5) == 0) + { + WorldGen.PlaceTile(abyssIndex, abyssIndex2 + 1, (ushort)ModContent.TileType()); + } + } + if (tileToGrowVineOn.TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(abyssIndex, abyssIndex2, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); } } } + + //ugh ill edit this later so i can customize the check positions and tiles for columns + //SulphurousSea.GenerateColumnsInCaverns(); } - #region Houses - public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) + public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, int tileType, bool hasChest, bool hasClumps, bool hasScoria) { float islandWidth = WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 float smallIslandWidth = (float)WorldGen.genRand.Next(sizeMin, sizeMax) / (float)5; //20 30 @@ -443,7 +736,9 @@ namespace CalamityMod.World islandPositionY = l; } Main.tile[k, l].Get().HasTile = true; - Main.tile[k, l].TileType = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); + + Main.tile[k, l].TileType = (ushort)tileType; + CalamityUtils.SafeSquareTileFrame(k, l, true); } } @@ -479,11 +774,25 @@ namespace CalamityMod.World } num14 += WorldGen.genRand.Next(-3, 4); num15 = WorldGen.genRand.Next(4, 8); - int num16 = isVoid ? ModContent.TileType() : ModContent.TileType(); - if (WorldGen.genRand.NextBool(4)) + int num16 = tileType; + + //chance to place clumps of whatever defined block + if (hasClumps && WorldGen.genRand.NextBool(3)) { - num16 = hasChest ? ModContent.TileType() : ModContent.TileType(); + //if the tile isnt pyre mantle place scoria or planty mush + if (tileType != ModContent.TileType()) + { + //if scoria is enabled, then place it, otherwise place planty mush clumps + num16 = hasScoria ? ModContent.TileType() : ModContent.TileType(); + } + //if the tile is pyre mantle then always place scoria + else + { + //place molten pyre mantle and scorcia ore + num16 = hasScoria ? ModContent.TileType() : ModContent.TileType(); + } } + for (int n = m - num15; n <= m + num15; n++) { for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) @@ -495,6 +804,7 @@ namespace CalamityMod.World if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) { Main.tile[n, num17].Get().HasTile = true; + Main.tile[n, num17].TileType = (ushort)num16; CalamityUtils.SafeSquareTileFrame(n, num17, true); } @@ -502,39 +812,7 @@ namespace CalamityMod.World } } } - if (hasTenebris) - { - int p = islandPositionX; - int num150; - for (p += WorldGen.genRand.Next(5); p < islandPositionXAgain; p += WorldGen.genRand.Next(num150, (int)(num150 * 1.5))) - { - int num14 = islandPositionY; - while (!Main.tile[p, num14].HasTile) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); //-3 4 - num150 = 1; //4 8 - int num16 = ModContent.TileType(); - for (int n = p - num150; n <= p + num150; n++) - { - for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) - { - if (num17 > islandPositionYAgain) - { - float arg_409_0 = Math.Abs(n - p); - float num18 = (Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (num150 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].Get().HasTile = true; - Main.tile[n, num17].TileType = (ushort)num16; - CalamityUtils.SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - } + int sizeMinSmall2 = sizeMin2 / 8; int sizeMaxSmall2 = sizeMax2 / 8; islandWidth = WorldGen.genRand.Next(sizeMin2, sizeMax2); @@ -588,7 +866,7 @@ namespace CalamityMod.World { num24 += WorldGen.genRand.Next(0, 4); int num25 = WorldGen.genRand.Next(2, 5); - int num26 = isVoid ? ModContent.TileType() : ModContent.TileType(); + int num26 = tileType; for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) { for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) @@ -605,175 +883,53 @@ namespace CalamityMod.World } } } - num23 += WorldGen.genRand.Next(num25, (int)(num25 * 1.5)); - } - } - //Place backwall - for (int backwallX = islandPositionX - 20; backwallX <= islandPositionXAgain + 20; backwallX++) - { - for (int backwallJ = islandPositionYAgain - 20; backwallJ <= islandPositionY + 20; backwallJ++) - { - //Check to see if the tile is surrounded by other tiles to place a wall - bool AmISurroundedByTiles = true; - for (int i2 = backwallX - 1; i2 <= backwallX + 1; i2++) - { - for (int j2 = backwallJ - 1; j2 <= backwallJ + 1; j2++) - { - if (!Main.tile[i2, j2].HasTile) - { - AmISurroundedByTiles = false; - } - } - } - if (AmISurroundedByTiles) - { - Main.tile[backwallX, backwallJ].WallType = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); - WorldGen.SquareWallFrame(backwallX, backwallJ, true); - } - } - } - for (int num34 = islandPositionX; num34 <= islandPositionXAgain; num34++) - { - int num35 = islandPositionYAgain - 10; - while (!Main.tile[num34, num35 + 1].HasTile) - { - num35++; - } - if (num35 < islandPositionY && Main.tile[num34, num35 + 1].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) - { - if (WorldGen.genRand.NextBool(10)) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) - { - Main.tile[num37, num35].Get().HasTile = false; - Main.tile[num37, num35].LiquidAmount = 255; - Main.tile[num37, num35].Get().LiquidType = LiquidID.Water; - CalamityUtils.SafeSquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) - { - Main.tile[num37, num35 + 1].Get().HasTile = false; - Main.tile[num37, num35 + 1].LiquidAmount = 255; - Main.tile[num37, num35 + 1].Get().LiquidType = LiquidID.Water; - CalamityUtils.SafeSquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].TileType == (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType())) - { - Main.tile[num37, num35 + 2].Get().HasTile = false; - Main.tile[num37, num35 + 2].LiquidAmount = 255; - Main.tile[num37, num35 + 2].Get().LiquidType = LiquidID.Water; - CalamityUtils.SafeSquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.NextBool(5)) - { - Main.tile[num34, num35].LiquidAmount = 255; - } - Main.tile[num34, num35].Get().LiquidType = LiquidID.Water; - CalamityUtils.SafeSquareTileFrame(num34, num35, true); + num23 += WorldGen.genRand.Next(num25, (int)(num25 * 1.5)); } } } - public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) + public static void AbyssChest(int i, int j, int itemChoice) { - ushort type = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); //tile - ushort wall = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.NextBool(2)) + //place an island + //always place abyss gravel because chests will never place outside of layer 2 for now + AbyssIsland(i, j + 2, 55, 75, 35, 45, ModContent.TileType(), false, true, false); + + //clear decently big circular area where the chest will be + for (int clearX = i - 2; clearX <= i + 2; clearX++) { - num = -1; - } - int num2 = WorldGen.genRand.Next(5, 9); - int num3 = 3; - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].HasTile) + for (int clearY = j - 8; clearY <= j - 1; clearY++) { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) + //clear area for the chest to place + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); + + WorldUtils.Gen(new Point(clearX, clearY), new Shapes.Circle(radius), Actions.Chain(new GenAction[] { - Main.tile[l, m].Get().HasTile = true; - Main.tile[l, m].TileType = type; - Main.tile[l, m].WallType = wall; - Main.tile[l, m].Get().IsHalfBlock = false; - Main.tile[l, m].Get().Slope = SlopeType.Solid; - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].WallType == wall) + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(clearX, clearY), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - Main.tile[n, num8].Get().HasTile = false; - } + new Actions.ClearTile() + })); } } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + + //place cluster where chest will spawn + WorldGen.TileRunner(i, j + 4, 8, 5, ModContent.TileType(), true, 0, 0, false, true); + + //clear another small square exactly around where the chest will be so it has a flat area to place on + for (int clearX = i - 7; clearX <= i + 7; clearX++) { - Main.tile[num11, num10].Get().HasTile = false; - Main.tile[num11, num10 - 1].Get().HasTile = false; - Main.tile[num11, num10 - 2].Get().HasTile = false; + for (int clearY = j - 1; clearY <= j + 5; clearY++) + { + WorldGen.PlaceTile(clearX, clearY, ModContent.TileType()); + } } + switch (itemChoice) { case 0: @@ -810,8 +966,104 @@ namespace CalamityMod.World itemChoice = ItemID.NeptunesShell; break; //fallback case. Should never happen naturally } - WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest + + //place the chest itself + //TODO: will create a proper loot pool to go in abyss chests along with the main item + int ChestIndex = WorldGen.PlaceChest(i, j - 2, (ushort)ModContent.TileType(), false, 1); + + int[] Potions1 = new int[] { ItemID.ShinePotion, ItemID.GillsPotion, ItemID.TeleportationPotion, ItemID.LuckPotionLesser }; + int[] Potions2 = new int[] { ItemID.ThornsPotion, ItemID.FlipperPotion, ItemID.BattlePotion, ItemID.IronskinPotion }; + + if (ChestIndex != -1) + { + Main.chest[ChestIndex].item[0].SetDefaults(itemChoice); + + Main.chest[ChestIndex].item[1].SetDefaults(WorldGen.genRand.Next(Potions1)); + Main.chest[ChestIndex].item[1].stack = WorldGen.genRand.Next(1, 3); + + Main.chest[ChestIndex].item[2].SetDefaults(WorldGen.genRand.Next(Potions2)); + Main.chest[ChestIndex].item[2].stack = WorldGen.genRand.Next(1, 3); + + Main.chest[ChestIndex].item[3].SetDefaults(ItemID.HealingPotion); + Main.chest[ChestIndex].item[3].stack = WorldGen.genRand.Next(1, 3); + + Main.chest[ChestIndex].item[4].SetDefaults(ItemID.ManaPotion); + Main.chest[ChestIndex].item[4].stack = WorldGen.genRand.Next(2, 5); + + Main.chest[ChestIndex].item[5].SetDefaults(ModContent.ItemType()); + Main.chest[ChestIndex].item[5].stack = WorldGen.genRand.Next(3, 12); + + Main.chest[ChestIndex].item[6].SetDefaults(ItemID.GoldCoin); + Main.chest[ChestIndex].item[6].stack = WorldGen.genRand.Next(2, 5); + } + } + + public static void PlaceSnailFossil(int i, int j) + { + //place an island + AbyssIsland(i, j + 2, 55, 75, 35, 45, ModContent.TileType(), false, false, false); + + //clear decently big circular area where the chest will be + for (int clearX = i - 2; clearX <= i + 2; clearX++) + { + for (int clearY = j - 8; clearY <= j - 1; clearY++) + { + //clear area for the chest to place + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); + + WorldUtils.Gen(new Point(clearX, clearY), new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(clearX, clearY), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile() + })); + } + } + + //place cluster where chest will spawn + WorldGen.TileRunner(i, j + 4, 8, 5, ModContent.TileType(), true, 0, 0, false, true); + + //clear another small square exactly around where the chest will be so it has a flat area to place on + for (int clearX = i - 7; clearX <= i + 7; clearX++) + { + for (int clearY = j - 1; clearY <= j + 5; clearY++) + { + WorldGen.PlaceTile(clearX, clearY, ModContent.TileType()); + } + } + + WorldGen.PlaceObject(i, j - 2, (ushort)ModContent.TileType()); + } + + public static void UnlockAllAbyssChests() + { + int genLimit = Main.maxTilesX / 2; + int abyssChasmX = AtLeftSideOfWorld ? genLimit - (genLimit - 135) + 35 : genLimit + (genLimit - 135) - 35; + int abyssMinX = AtLeftSideOfWorld ? 0 : abyssChasmX - 150; + int abyssMaxX = AtLeftSideOfWorld ? abyssChasmX + 150 : Main.maxTilesX; + + //loop to unlock all abyss treasure chests + for (int x = abyssMinX; x < abyssMaxX; x++) + { + for (int y = (int)Main.worldSurface; y < Main.maxTilesY - 300; y++) + { + //make SURE to check for the entire chest at once, otherwise it will break when unlocking + if (Main.tile[x, y].TileType == ModContent.TileType() && //top left + Main.tile[x + 1, y].TileType == ModContent.TileType() && //top right + Main.tile[x, y + 1].TileType == ModContent.TileType() && //bottom left + Main.tile[x + 1, y + 1].TileType == ModContent.TileType()) //bottom right + { + Chest.Unlock(x, y); + NetMessage.SendData(MessageID.Unlock, -1, -1, null, Main.LocalPlayer.whoAmI, 1f, x, y); + } + } + } } - #endregion } } diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs new file mode 100644 index 0000000000..00530dd0a5 --- /dev/null +++ b/World/AerialiteOreGen.cs @@ -0,0 +1,76 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; +using Terraria.WorldBuilding; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using System.Collections.Generic; +using CalamityMod.DataStructures; + +namespace CalamityMod.World +{ + public class AerialiteOreGen + { + public static void Generate(bool Convert) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int x = 5; x < Main.maxTilesX - 5; x++) + { + for (int y = 5; y < Main.worldSurface; y++) + { + if (!Convert) + { + Tile tile = Main.tile[x, y]; + + if (WorldGen.genRand.Next(365) == 0 && tile.TileType == TileID.Cloud && tile.HasTile) + { + ShapeData circle = new ShapeData(); + ShapeData biggerCircle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); + + //big cloud circle + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius + 1), Actions.Chain(new GenAction[] + { + blotchMod.Output(biggerCircle) + })); + + WorldUtils.Gen(new Point(x, y), new ModShapes.All(biggerCircle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)TileID.Cloud) + })); + + //circle of ore + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius), 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()) + })); + } + } + + if (Convert) + { + if (Main.tile[x, y].TileType == ModContent.TileType()) + { + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 2c59c7d6b7..8e804e2428 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -54,12 +54,12 @@ namespace CalamityMod.World while (y < Main.worldSurface) { if (Main.tile[x, y].HasTile && - (Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType())) + (Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType())) { astralTileCount++; if (astralTileCount > astralTilesAllowed) @@ -124,16 +124,18 @@ namespace CalamityMod.World { float worldEdgeMargin = (float)Main.maxTilesX * 0.08f; int xLimit = Main.maxTilesX / 2; - int x = Abyss.AtLeftSideOfWorld ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400); - while ((float)x > (float)Main.spawnTileX - worldEdgeMargin && (float)x < (float)Main.spawnTileX + worldEdgeMargin) - { - x = Abyss.AtLeftSideOfWorld ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400); - } + + int realX = Abyss.AtLeftSideOfWorld ? rand.Next(SulphurousSea.BiomeWidth + 300, xLimit - 400) : rand.Next(xLimit + 400, Main.maxTilesX - SulphurousSea.BiomeWidth - 300); + + //clamp so it doesnt crash hopefully + int x = Utils.Clamp(realX, SulphurousSea.BiomeWidth + 300, Main.maxTilesX - SulphurousSea.BiomeWidth - 300); + //world surface = 920 large 740 medium 560 small int y = (int)(Main.worldSurface * 0.5); //Large = 522, Medium = 444, Small = 336 while (y < Main.maxTilesY) { - if (Main.tile[x, y].HasTile && Main.tileSolid[(int)Main.tile[x, y].TileType]) + //check to place the astral meteor on valid tiles, place automatically on ebonstone walls, and avoid platforms + if (((Main.tile[x, y].HasTile && Main.tileSolid[(int)Main.tile[x, y].TileType]) || Main.tile[x, y].WallType == 3) && !TileID.Sets.Platforms[Main.tile[x, y].TileType]) { int suitableTiles = 0; int checkRadius = 15; @@ -145,20 +147,31 @@ namespace CalamityMod.World { suitableTiles++; - // Avoid floating islands: Clouds and Sunplate both harshly punish attempted meteor spawns + //Avoid floating islands: Clouds and Sunplate both harshly punish attempted meteor spawns if (Main.tile[l, m].TileType == TileID.Cloud || Main.tile[l, m].TileType == TileID.Sunplate) { suitableTiles -= 100; } - // Avoid Sulphurous Sea beach: Cannot be converted by astral + //Avoid the hallowed so it doesnt get demolished by the astral biome + else if (Main.tile[l, m].TileType == TileID.HallowedGrass || Main.tile[l, m].TileType == TileID.Pearlstone) + { + suitableTiles -= 100; + } + //Avoid living trees, doesnt land on them too often but its better to prevent it + else if (Main.tile[l, m].TileType == TileID.LivingWood || Main.tile[l, m].TileType == TileID.LeafBlock) + { + suitableTiles -= 100; + } + //Avoid Sulphurous Sea beach: Cannot be converted by astral else if (Main.tile[l, m].TileType == ModContent.TileType() || Main.tile[l, m].TileType == ModContent.TileType()) { suitableTiles -= 100; } - - // Prevent the Astral biome from overriding or interfering with an AA biome + //Prevent the Astral biome from overriding or interfering with an AA biome else if (ancientsAwakened is not null && aaTilesToAvoid.Contains(Main.tile[l, m].TileType)) + { suitableTiles -= 100; + } } // Liquid aversion makes meteors less likely to fall in lakes @@ -201,6 +214,8 @@ namespace CalamityMod.World public static bool GenerateAstralMeteor(int i, int j) { + WorldGen.gen = true; + UnifiedRandom rand = WorldGen.genRand; if (i < 50 || i > Main.maxTilesX - 50) { @@ -379,6 +394,8 @@ namespace CalamityMod.World } } + WorldGen.gen = false; + if (Main.netMode != NetmodeID.MultiplayerClient) { NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); @@ -394,70 +411,34 @@ namespace CalamityMod.World if (j < 181) j = 181; - int checkWidth = 180; - float averageHeight = 0f; - float lowestHeight = 0f; + int xOffset = WorldGen.dungeonX < Main.maxTilesX / 2 ? WorldGen.genRand.Next(-80, -40) : WorldGen.genRand.Next(40, 80); - int xAreaToSpawn = i; - - Dictionary xAreaHeightMap = new Dictionary(); - - // Gauge the bumpiness of various potential locations. - // The least bumpy one will be selected as the place to spawn the monolith. - for (int tries = 0; tries < 30; tries++) + bool altarPlaced = false; + while (!altarPlaced) { - int x = i + Main.rand.Next(-60, 61); + WorldGen.gen = true; - // Don't attempt to add duplicate keys. - if (xAreaHeightMap.ContainsKey(x)) - continue; + int x = i + xOffset; + int y = j - 100; - float averageRelativeHeight = 0f; - for (int dx = -30; dx <= 30; dx++) + while (!WorldGen.SolidTile(x, y) && y <= Main.worldSurface) { - WorldUtils.Find(new Point(x + dx, j - 180), Searches.Chain(new Searches.Down(360), new Conditions.IsSolid()), out Point result); - averageRelativeHeight += Math.Abs(result.Y - j); + y += 5; } - averageRelativeHeight /= 60f; - xAreaHeightMap.Add(x, averageRelativeHeight); - } - i = xAreaHeightMap.OrderBy(x => x.Value).First().Key; - - for (int x = i - checkWidth / 2; x < i + checkWidth / 2; x++) - { - int y = j - 200; - Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(x, y); - while (!Main.tileSolid[tileAtPosition.TileType] || - !tileAtPosition.HasTile || - TileID.Sets.Platforms[tileAtPosition.TileType]) + if (Main.tile[x, y].HasTile || Main.tile[x, y].WallType > 0) { - y++; - if (y > j - 10) - break; - tileAtPosition = CalamityUtils.ParanoidTileRetrieval(x, y); + bool place = true; + SchematicManager.PlaceSchematic>(SchematicManager.AstralBeaconKey, new Point(x, y - 5), SchematicAnchor.Center, ref place); + + WorldGen.gen = false; + + altarPlaced = true; } - lowestHeight = (int)MathHelper.Max(lowestHeight, y); - averageHeight += y; } - lowestHeight -= 35f; - averageHeight /= checkWidth; - float height = lowestHeight; - - // If there's a sudden change between the average and lowest height (which is indicative of holes/chasms), go with the average. - if (Math.Abs(lowestHeight - averageHeight) > 50f) - height = averageHeight; - - // WorldGen.gen prevents NewItem from working, and thus prevents a bunch of dumb items from being spawned immediately and deleting the WoF/Aureus loot in the process. - WorldGen.gen = true; - // Add the average height of a tree to the Y position to offset trees usually messing with the calculation. - // Then also add 10 blocks because these things seem to always like to appear standing on the floor. - int finalVerticalOffset = 18; - bool _ = true; - SchematicManager.PlaceSchematic>(SchematicManager.AstralBeaconKey, new Point(i, (int)height + finalVerticalOffset), SchematicAnchor.Center, ref _); - WorldGen.gen = false; } } + return true; } @@ -1236,7 +1217,7 @@ namespace CalamityMod.World if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance. { float distY = center.Y - point.Y; - point.Y -= distY * 8f; + point.Y -= distY * 3f; } float distance1 = Vector2.Distance(point, focus1); float distance2 = Vector2.Distance(point, focus2); diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs new file mode 100644 index 0000000000..7355304bd7 --- /dev/null +++ b/World/BrimstoneCrag.cs @@ -0,0 +1,616 @@ +using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags.Spike; +using CalamityMod.Tiles.Crags.Tree; +using CalamityMod.Tiles.Crags.Lily; +using CalamityMod.Tiles.Ores; +using CalamityMod.Walls; +using CalamityMod.Schematics; +using static CalamityMod.Schematics.SchematicManager; +using Terraria; +using Terraria.IO; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.WorldBuilding; +using Terraria.Utilities; +using Terraria.GameContent.Generation; +using Microsoft.Xna.Framework; +using System; +using System.Linq; +using System.Collections.Generic; + +namespace CalamityMod.World +{ + public class BrimstoneCrag + { + static int StartX = 0; + + static int lavaLakePlaceDelay = 0; + static int lavaLakeBigPlaceDelay = 0; + static int numLavaLakes = 0; + + //all the main crags terrain generation + private static void GenCrags() + { + //set StartX here so it can properly scale with worldsize (just to be safe) + //the 25's are there to offset it from the exact edge of the world so that no "out of bounds" crashing occurs + StartX = WorldGen.dungeonX < Main.maxTilesX / 2 ? 25 : (Main.maxTilesX - (Main.maxTilesX / 5)) - 25; + + //set these to be able to easily place things in certain locations, like structures + int biomeStart = StartX; + int biomeEdge = biomeStart + (Main.maxTilesX / 5); + int biomeMiddle = (biomeStart + biomeEdge) / 2; + + //clear literally everything in the area the biome will generate in + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 200; y < Main.maxTilesY - 2; y++) + { + Tile tile = Main.tile[x, y]; + tile.ClearEverything(); + WorldGen.KillWall(x, y); + } + } + + //place basic rectangle of brimstone slag + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 90; y <= Main.maxTilesY - 5; y++) + { + WorldGen.PlaceTile(x, y, (ushort)ModContent.TileType()); + Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); + } + } + + //place clusters of slag around the edges of the main square to create a more interesting shape + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 110; y <= Main.maxTilesY - 20; y++) + { + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + Tile tileDown = Main.tile[x, y + 1]; + Tile tileLeft = Main.tile[x - 1, y]; + Tile tileRight = Main.tile[x + 1, y]; + + if (tile.TileType == ModContent.TileType() && (tileUp.TileType != ModContent.TileType() || + tileDown.TileType != ModContent.TileType() || tileLeft.TileType != ModContent.TileType() || + tileRight.TileType != ModContent.TileType())) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + int radius = WorldGen.genRand.Next(5, 20); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius), 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()) + })); + } + } + } + + //place ceiling of slag across the top of the biome + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 192; y++) + { + if (WorldGen.genRand.Next(25) == 0) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + int radius = WorldGen.genRand.Next(3, 7); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius), 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()) + })); + } + } + } + + //tile cleanup + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 140; y <= Main.maxTilesY - 5; 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]; + + //place tiles under slag tiles that are sticking out and look weird + if (tile.TileType == ModContent.TileType() && !tileDown.HasTile) + { + WorldGen.PlaceTile(x, y + 1, (ushort)ModContent.TileType()); + } + + //same as above, but for scorched remains + if (tile.TileType == ModContent.TileType() && !tileDown.HasTile) + { + WorldGen.PlaceTile(x, y + 1, (ushort)ModContent.TileType()); + } + + //place more walls behind slag so theres not just a box of walls from the initial rectangle + if (tile.HasTile && tileDown.HasTile && tileDown2.HasTile && Main.tile[x, y + 5].HasTile) + { + Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); + } + + if (tile.LiquidType == LiquidID.Water && tile.LiquidAmount > 0) + { + tile.ClearEverything(); + tile.LiquidType = LiquidID.Lava; + tile.LiquidAmount = 255; + } + } + } + + //ceiling cleanup + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 195; y <= Main.maxTilesY - 180; y++) + { + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + + if (tile.TileType == ModContent.TileType() && !tileUp.HasTile) + { + WorldGen.PlaceTile(x, y - 1, (ushort)ModContent.TileType()); + } + } + } + + //place lava throughout the biome + for (int x = biomeStart; x <= biomeEdge; x++) + { + //cooldown before another lava pit can be placed + if (lavaLakeBigPlaceDelay > 0) + { + lavaLakeBigPlaceDelay--; + } + + //surface lava pits + if (lavaLakeBigPlaceDelay == 0) + { + //do not place lava in the general middle area of the biome because it keeps flooding the crag bridge + if (numLavaLakes != 2 && numLavaLakes != 3) + { + LavaTileRunner runner = new LavaTileRunner(new Vector2(x, Main.maxTilesY - 165), new Vector2(0, 5), new Point16(-500, 500), + new Point16(250, 1000), 15f, WorldGen.genRand.Next(300, 1000), 0, true, true); + runner.Start(); + } + + numLavaLakes++; + lavaLakeBigPlaceDelay = 200; //set lava lake delay so it cant just spam lava lakes everywhere + } + } + + //place random blotches of lava underground + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 100; y <= Main.maxTilesY - 20; y++) + { + if (WorldGen.genRand.Next(1200) == 0) + { + LavaTileRunner runner = new LavaTileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(0, 5), + new Point16(-12, 12), 15f, WorldGen.genRand.Next(-12, 25), 0, true, true); + runner.Start(); + } + } + } + + //scorched remains patches + for (int x = biomeStart + 30; x <= biomeEdge - 30; x++) + { + if (WorldGen.genRand.Next(145) == 0) + { + ScorchedGrassPatches(new Point(x, Main.maxTilesY - 135)); + } + } + + //place clumps of Infernal Suevite + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 150; y <= Main.maxTilesY - 45; y++) + { + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + Tile tileDown = Main.tile[x, y + 1]; + Tile tileLeft = Main.tile[x - 1, y]; + Tile tileRight = Main.tile[x + 1, y]; + + //only place ore nearby lava + if (WorldGen.genRand.Next(180) == 0 && tile.TileType == ModContent.TileType() && (tileUp.LiquidAmount > 0 || + tileDown.LiquidAmount > 0 || tileLeft.LiquidAmount > 0 || tileRight.LiquidAmount > 0)) + { + WorldGen.TileRunner(x + WorldGen.genRand.Next(-15, 15), y + WorldGen.genRand.Next(-15, 15), + WorldGen.genRand.Next(10, 12), WorldGen.genRand.Next(10, 12), ModContent.TileType(), false, 0f, 0f, false, true); + } + } + } + + //place bridge in the center of the biome + bool firstItem = false; + SchematicManager.PlaceSchematic(SchematicManager.CragBridgeKey, new Point(biomeMiddle, Main.maxTilesY - 100), + SchematicAnchor.Center, ref firstItem, new Action(FillBrimstoneChests)); + + //place crag ruins + bool place = true; + + int house1Offset = WorldGen.genRand.Next(0, 55); + PlaceSquareForCragHouses(biomeStart + 150 + house1Offset, Main.maxTilesY - 125); + SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey3, + new Point(biomeStart + 150 + house1Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + + int house2Offset = WorldGen.genRand.Next(-55, 0); + PlaceSquareForCragHouses(biomeMiddle - 235 + house2Offset, Main.maxTilesY - 125); + SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey1, + new Point(biomeMiddle - 235 + house2Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + + int house3Offset = WorldGen.genRand.Next(0, 55); + PlaceSquareForCragHouses(biomeMiddle + 235 + house3Offset, Main.maxTilesY - 125); + SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey4, + new Point(biomeMiddle + 235 + house3Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + + int house4Offset = WorldGen.genRand.Next(-55, 0); + PlaceSquareForCragHouses(biomeEdge - 150 + house4Offset, Main.maxTilesY - 125); + SchematicManager.PlaceSchematic>(SchematicManager.CragRuinKey2, + new Point(biomeEdge - 150 + house4Offset, Main.maxTilesY - 125), SchematicAnchor.BottomCenter, ref place); + + //lava clean up again + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) + { + Tile tile = Main.tile[x, y]; + Tile tileAbove = Main.tile[x, y - 1]; + + if (tile.LiquidAmount > 0) + { + tile.LiquidType = LiquidID.Lava; + tile.LiquidAmount = 255; + } + + //get rid of lava above scorched remains as much as possible + if (tile.TileType == ModContent.TileType() && !tileAbove.HasTile) + { + for (int i = x - 1; i <= x + 1; i++) + { + for (int j = y - 5; j <= y; j++) + { + Tile lavaTile = Main.tile[i, j]; + Tile lavaTileDown = Main.tile[i, j + 1]; + + if (lavaTile.WallType == 0 && lavaTileDown.WallType == 0) + { + lavaTile.LiquidAmount = 0; + } + } + } + } + } + } + + //clean up any lava in the biomes surface to prevent it from being obnoxiously flooded + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 150; y <= Main.maxTilesY - 122; y++) + { + Main.tile[x, y].LiquidAmount = 0; + } + } + + //settle all liquids + CalamityUtils.SettleWater(); + + //spread grass on all scorched remains with no lava above them + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 110; y++) + { + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + + if (tile.TileType == ModContent.TileType() && !tileUp.HasTile && tileUp.LiquidAmount == 0) + { + tile.TileType = (ushort)ModContent.TileType(); + } + } + } + + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) + { + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + Tile tileDown = Main.tile[x, y + 1]; + Tile tileLeft = Main.tile[x - 1, y]; + Tile tileRight = Main.tile[x + 1, y]; + + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType()) + { + //slope tiles + Tile.SmoothSlope(x, y, true); + + //kill any individual floating tiles + if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) + { + WorldGen.KillTile(x, y); + } + } + } + } + } + + //place ambient objects + private static void GenCragsAmbience() + { + int biomeStart = StartX; + int biomeEdge = biomeStart + (Main.maxTilesX / 5); + int biomeMiddle = (biomeStart + biomeEdge) / 2; + + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) + { + Tile tile = Main.tile[x, y]; + + //stalactites and stalagmites + if (tile.TileType == ModContent.TileType()) + { + if (WorldGen.genRand.Next(20) == 0) + { + ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y + 2, WorldGen.genRand.Next(Stalactites)); + } + + if (WorldGen.genRand.Next(8) == 0) + { + ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y + 2, WorldGen.genRand.Next(Stalactites)); + } + + if (WorldGen.genRand.Next(25) == 0) + { + ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Stalagmites)); + } + + if (WorldGen.genRand.Next(8) == 0) + { + ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Stalagmites)); + } + } + + //place lillies on scorched remains grass + if (tile.TileType == ModContent.TileType()) + { + //place them often since they are pretty big tiles, also dont place them in lava + ushort[] Lillies = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() }; + + PlaceCragLily(x, y - 1, WorldGen.genRand.Next(Lillies)); + } + } + + //separate y loop so trees dont grow too deep + for (int y = Main.maxTilesY - 150; y <= Main.maxTilesY - 122; y++) + { + Tile tile = Main.tile[x, y]; + + Tile.SmoothSlope(x, y, true); + + //stalactites and stalagmites + if (tile.TileType == ModContent.TileType()) + { + //grow spine tree + if (WorldGen.genRand.Next(8) == 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + PlaceTree(x, y - 1, ModContent.TileType()); + } + } + } + } + } + + public static void PlaceSquareForCragHouses(int x, int y) + { + //loop to place tiles under the house so it doesnt look weird + for (int i = x - 25; i <= x + 25; i++) + { + for (int j = y; j <= y + 15; j++) + { + WorldGen.PlaceTile(i, j, ModContent.TileType()); + } + } + } + + public static bool PlaceTree(int x, int y, int tileType) + { + int minDistance = 5; + int treeNearby = 0; + + for (int i = x - minDistance; i < x + minDistance; i++) + { + for (int j = y - minDistance; j < y + minDistance; j++) + { + if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == tileType) + { + treeNearby++; + if (treeNearby > 0) + { + return false; + } + } + } + } + + SpineTree.Spawn(x, y, 22, 28, false); + + return true; + } + + public static bool PlaceCragLily(int x, int y, int tileType) + { + int minDistance = 15; + int lilyNearby = 0; + + for (int i = x - minDistance; i < x + minDistance; i++) + { + for (int j = y - minDistance; j < y + minDistance; j++) + { + if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == tileType) + { + lilyNearby++; + if (lilyNearby > 0) + { + return false; + } + } + } + } + + for (int upChechY = y - 10; upChechY < y; upChechY++) + { + if (Main.tile[x, upChechY].HasTile) + { + return false; + } + } + + WorldGen.PlaceObject(x, y, tileType); + + return true; + } + + public static void FillBrimstoneChests(Chest chest, int Type, bool firstItem) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ObsidianSkinPotion, ItemID.BattlePotion, ItemID.InfernoPotion, ItemID.PotionOfReturn); + List contents = new List() + { + new ChestItem(ItemID.HellstoneBar, WorldGen.genRand.Next(4, 6)), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(4, 15)), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(2, 5)), + new ChestItem(ItemID.HellfireArrow, WorldGen.genRand.Next(25, 50)), + new ChestItem(potionType, WorldGen.genRand.Next(1, 3)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 12)), + }; + + if (!firstItem) + { + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + } + else + { + contents.RemoveAt(0); + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + //re-add hellstone bars to the list since removing the first item also removes hellstone bars for some reason + contents.Insert(1, new ChestItem(ItemID.HellstoneBar, WorldGen.genRand.Next(2, 5))); + } + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + + //shamelessly copy pasted from the astral biome generation + public static void ScorchedGrassPatches(object obj) + { + //Pre-calculate all variables necessary for elliptical area checking + Point origin = (Point)obj; + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.15f; + float otherAngle = MathHelper.PiOver2 - angle; + + int distanceInTiles = WorldGen.genRand.Next(30, 45); + float distance = distanceInTiles * 16f; + float constant = distance * 2f / (float)Math.Sin(angle); + + float fociSpacing = distance * (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; + + UnifiedRandom rand = WorldGen.genRand; + for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++) + { + for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++) + { + if (CheckInEllipse(new Point(x, y), topFoci, bottomFoci, constant, center, out float dist, y < origin.Y)) + { + //If we're in the outer blurPercent% of the ellipse + float percent = dist / constant; + float blurPercent = 0.98f; + if (percent > blurPercent) + { + float outerEdgePercent = (percent - blurPercent) / (1f - blurPercent); + if (rand.NextFloat(1f) > outerEdgePercent && Main.tile[x, y].HasTile && WorldGen.InWorld(x, y)) + { + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); + } + } + else if (Main.tile[x, y].HasTile && WorldGen.InWorld(x, y)) + { + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); + } + } + } + } + } + + //shamelessly copy pasted from the astral biome generation + public static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) + { + Vector2 point = tile.ToWorldCoordinates(); + if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance. + { + float distY = center.Y - point.Y; + point.Y -= distY * 8f; + } + float distance1 = Vector2.Distance(point, focus1); + float distance2 = Vector2.Distance(point, focus2); + distance = distance1 + distance2; + return distance <= distanceConstant; + } + + public static void GenAllCragsStuff() + { + GenCrags(); + GenCragsAmbience(); + } + } +} \ No newline at end of file diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 73a303db62..b0fd996e33 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -25,6 +25,11 @@ namespace CalamityMod.World public static bool revenge = false; // Revengeance Mode public static bool death = false; // Death Mode public static bool armageddon = false; // Armageddon Mode + public static bool LegendaryMode => Main.getGoodWorld && Main.masterMode; // Evaluates to whether vanilla's "Legendary Mode" is enabled (Master Mode on For the Worthy) + + // TODO -- This is intentionally a constant so that all relevant code gets compiled out, or at the very least cannot be re-enabled without extensive IL editing. + // When the 1.4.4 port occurs, this will be changed to a property which retrieves Main.zenithWorld. + internal const bool getFixedBoi = false; // True when the "get fixed boi" (aka "Zenith") seed is active, which combines all other seeds. // Sunken Sea public static Rectangle SunkenSeaLocation = Rectangle.Empty; @@ -52,6 +57,7 @@ namespace CalamityMod.World public static ExoMech DraedonMechToSummon; public static Vector2 DraedonSummonPosition = Vector2.Zero; public static bool TalkedToDraedon = false; + public static bool DraedonMechdusa = false; public static bool AbleToSummonDraedon { get @@ -82,6 +88,7 @@ namespace CalamityMod.World public static Vector2 JungleLabCenter; public static Vector2 HellLabCenter; public static Vector2 IceLabCenter; + public static Vector2 CavernLabCenter; #endregion } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 99d5acc6c4..dbac9ccaf4 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -1,4 +1,6 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Walls; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.LabFinders; @@ -27,20 +29,27 @@ namespace CalamityMod.World if (tile.LiquidType == LiquidID.Lava && careAboutLava) return true; if (tile.TileType == TileID.BlueDungeonBrick || - tile.TileType == TileID.GreenDungeonBrick || - tile.TileType == TileID.PinkDungeonBrick) + tile.TileType == TileID.GreenDungeonBrick || + tile.TileType == TileID.PinkDungeonBrick) { return true; } if (tile.TileType == TileID.LihzahrdBrick || - tile.WallType == WallID.LihzahrdBrickUnsafe) + tile.WallType == WallID.LihzahrdBrickUnsafe) { return true; } if (tile.TileType == TileID.Crimstone || - tile.WallType == WallID.CrimstoneUnsafe || - tile.TileType == TileID.Ebonstone || - tile.WallType == WallID.EbonstoneUnsafe) + tile.WallType == WallID.CrimstoneUnsafe || + tile.TileType == TileID.Ebonstone || + tile.WallType == WallID.EbonstoneUnsafe) + { + return true; + } + if (tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || + tile.WallType == ModContent.WallType() || + tile.WallType == ModContent.WallType()) { return true; } @@ -56,6 +65,7 @@ namespace CalamityMod.World { new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(8, 14 + 1)), new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(7, 12 + 1)), + new ChestItem(ModContent.ItemType(), 1), new ChestItem(ItemID.Torch, WorldGen.genRand.Next(15, 29 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(5, 11 + 1)), new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(5, 7 + 1)), @@ -72,17 +82,12 @@ namespace CalamityMod.World else if(rng < 0.7f) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); else if (rng < 0.8f) - contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); else if (rng < 0.9f) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); else contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); - //Add suspicious scrap into the chest rarely. Chance depends on the world size - int probability = Main.maxTilesX <= 4200f ? 0 : Main.maxTilesX >= 8400f ? 2 : 1; - if (Main.rand.Next(probability) == 0f) - contents.Insert(2, new ChestItem(ModContent.ItemType(), 1)); - for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -102,7 +107,6 @@ namespace CalamityMod.World placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); - int activeTilesInArea = 0; int xCheckArea = 40; bool canGenerateInLocation = true; @@ -116,22 +120,19 @@ namespace CalamityMod.World Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (ShouldAvoidLocation(new Point(x, y))) canGenerateInLocation = false; - - if (tile.HasTile) - activeTilesInArea++; } } - if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + if (!canGenerateInLocation || nearbyOtherWorkshop || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) tries++; else { bool _ = true; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillWorkshopChest)); - structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); break; } - } while (tries <= 25000); + } while (tries <= 10000); } #endregion @@ -160,7 +161,7 @@ namespace CalamityMod.World else if (rng < 0.7f) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); else if (rng < 0.8f) - contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); else if (rng < 0.9f) contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); else @@ -185,7 +186,6 @@ namespace CalamityMod.World placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); - int activeTilesInArea = 0; int xCheckArea = 30; bool canGenerateInLocation = true; @@ -199,22 +199,19 @@ namespace CalamityMod.World Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (ShouldAvoidLocation(new Point(x, y))) canGenerateInLocation = false; - - if (tile.HasTile) - activeTilesInArea++; } } - if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + if (!canGenerateInLocation || nearbyOtherWorkshop || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) tries++; else { bool _ = true; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillLaboratoryChest)); - structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); break; } } - while (tries <= 25000); + while (tries <= 10000); } #endregion @@ -234,7 +231,7 @@ namespace CalamityMod.World }; //Adds the Ice Seeking Mechanism - contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); if (!hasPlacedMurasama) { @@ -255,11 +252,12 @@ namespace CalamityMod.World string mapKey = HellLabKey; PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); SchematicMetaTile[,] schematic = TileMaps[mapKey]; - + do { int underworldTop = Main.maxTilesY - 200; - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.82), (int)(Main.maxTilesX * 0.925)); + //gen opposite to the brimstone crags + int placementPositionX = (Main.dungeonX > Main.maxTilesX / 2) ? WorldGen.genRand.Next((int)(Main.maxTilesX / 12), (int)(Main.maxTilesX / 9)) : WorldGen.genRand.Next((int)(Main.maxTilesX * 0.82), (int)(Main.maxTilesX * 0.925)); int placementPositionY = WorldGen.genRand.Next(Main.maxTilesY - 150, Main.maxTilesY - 125); placementPoint = new Point(placementPositionX, placementPositionY); @@ -286,12 +284,12 @@ namespace CalamityMod.World { bool hasPlacedMurasama = false; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedMurasama, new Action(FillHellLaboratoryChest)); - structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); CalamityWorld.HellLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; break; } } - while (tries <= 50000); + while (tries <= 20000); } #endregion @@ -312,7 +310,7 @@ namespace CalamityMod.World }; //Adds the Planetoid Seeking Mechanism - contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); if (!hasPlacedLogAndSchematic) { @@ -348,35 +346,38 @@ namespace CalamityMod.World else placementPositionX = WorldGen.genRand.Next(ugDesert.Right - 10, ugDesert.Right + 20) - labWidth; - // Somewhere in the middle third of the Sunken Sea, which itself is in the lower half of the Underground Desert - int sunkenSeaHeight = ugDesert.Height / 4; - int placementPositionY = (int)(ugDesert.Center.Y + Main.rand.NextFloat(0.33f, 0.67f) * sunkenSeaHeight) - labHeight; + int sunkenSeaY = 0; + + //copied the desert position code from the sunken sea's generation so the lab always generates within the sunken sea properly + for (int y = Main.maxTilesY - 200; y >= Main.worldSurface; y--) + { + if (Main.tile[placementPositionX, y].WallType == ModContent.WallType() || + Main.tile[placementPositionX, y].WallType == ModContent.WallType()) + { + sunkenSeaY = y - 80; //offset so it generates nicely + break; + } + } + + int placementPositionY = sunkenSeaY - labHeight; placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); - int xCheckArea = 25; - bool shouldAvoidArea = false; - float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; - for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + if (structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) { - for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) - { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (ShouldAvoidLocation(new Point(x, y), false)) - shouldAvoidArea = true; - } - } - tries++; - if (!shouldAvoidArea && structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + bool hasPlacedLogAndSchematic = false; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillSunkenSeaLaboratoryChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); + //Reverted changes to center point placement; the change caused it to not center like it should, offsetting the range at which the bio lab theme plays + CalamityWorld.SunkenSeaLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; break; + } + //try again if the structure is colliding with a structure from another mod + else + tries++; } - while (tries < 50000); - - bool hasPlacedLogAndSchematic = false; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillSunkenSeaLaboratoryChest)); - structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)), 4); - CalamityWorld.SunkenSeaLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; + while (tries <= 1000); } #endregion @@ -457,12 +458,12 @@ namespace CalamityMod.World { bool hasPlacedLogAndSchematic = false; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillIceLaboratoryChest)); - structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); CalamityWorld.IceLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; break; } } - while (tries <= 50000); + while (tries <= 20000); } #endregion @@ -530,6 +531,9 @@ namespace CalamityMod.World { if (tile.TileType == TileID.Mud || tile.TileType == TileID.JungleGrass) jungleTilesInArea++; + if (tile.TileType == TileID.MushroomGrass || tile.TileType == TileID.MushroomPlants || tile.TileType == TileID.MushroomVines) + jungleTilesInArea -= 10; + activeTilesInArea++; } } @@ -542,12 +546,12 @@ namespace CalamityMod.World { bool hasPlacedLogAndSchematic = false; PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillPlagueLaboratoryChest)); - structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); CalamityWorld.JungleLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; break; } } - while (tries <= 50000); + while (tries <= 20000); } #endregion @@ -605,5 +609,82 @@ namespace CalamityMod.World } } #endregion + + #region Cavern Lab + public static void FillCavernLaboratoryChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(10, 17 + 1)), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(10, 15 + 1)), + new ChestItem(ItemID.Torch, WorldGen.genRand.Next(20, 40 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(8, 16 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(7, 10 + 1)), + new ChestItem(ItemID.Dynamite, WorldGen.genRand.Next(4, 6 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(4, 7 + 1)), + new ChestItem(ModContent.ItemType(), 1), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceCavernLab(out Point placementPoint, List workshopPoints, StructureMap structures) + { + int tries = 0; + string mapKey = CavernLabKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.55f), (int)(Main.maxTilesY * 0.8f)); + + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int plainTilesInArea = 0; + int xCheckArea = 30; + bool canGenerateInLocation = true; + + // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. + bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + //Ignore lava + if (ShouldAvoidLocation(new Point(x, y), false)) + canGenerateInLocation = false; + + if (tile.HasTile) + { + //Only spawn on normal cave tiles. Some special seeds are weeping rn. + if (tile.TileType == TileID.Dirt || tile.TileType == TileID.Stone || tile.TileType == TileID.Mud || TileID.Sets.Conversion.Moss[tile.TileType]) + plainTilesInArea++; + + //Letting it spawn in natural mud means avoiding every other mud biome at all costs + if (tile.TileType == TileID.JungleGrass || tile.TileType == TileID.MushroomGrass) + plainTilesInArea -= 1000; + } + } + } + if (!canGenerateInLocation || nearbyOtherWorkshop || plainTilesInArea < totalTiles * 0.3f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + tries++; + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillCavernLaboratoryChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); + CalamityWorld.CavernLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; + break; + } + } + while (tries <= 20000); + } + #endregion } } diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs new file mode 100644 index 0000000000..6c216b4dd0 --- /dev/null +++ b/World/DungeonArchive.cs @@ -0,0 +1,150 @@ +using CalamityMod.Schematics; +using static CalamityMod.Schematics.SchematicManager; +using Terraria; +using Terraria.IO; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.WorldBuilding; +using Terraria.Utilities; +using Terraria.GameContent.Generation; +using Microsoft.Xna.Framework; +using System; +using System.Linq; +using System.Collections.Generic; + +namespace CalamityMod.World +{ + public class DungeonArchive + { + public static void PlaceArchive() + { + int worldThird = Main.maxTilesX / 3; + + int dungeonArchiveColor = 0; //0 = blue, 1 = green, 2 = pink + + //start much higher above the top of hell so it doesnt get nuked by the crags generation, and so it wont generate too low + for (int j = Main.maxTilesY - 380; j > 0; j--) + { + int i = 100; + if (WorldGen.dungeonSide == 1) + { + i = Main.maxTilesX - 100; + } + + bool shouldContinue = true; + bool placedArchive = false; + + while (shouldContinue) + { + if (WorldGen.dungeonSide == 1) + { + i--; + if (i < Main.maxTilesX - worldThird) + { + shouldContinue = false; + } + } + else + { + i++; + if (i > worldThird) + { + shouldContinue = false; + } + } + + Tile tile = Main.tile[i, j]; + Tile tileUp1 = Main.tile[i, j - 1]; + Tile tileUp2 = Main.tile[i, j - 2]; + Tile tileUp3 = Main.tile[i, j - 3]; + Tile tileUp4 = Main.tile[i, j - 4]; + Tile tileUp5 = Main.tile[i, j - 5]; + + int[] DungeonWalls = { 7, 94, 95, 8, 98, 99, 9, 96, 97 }; + //if (Main.tileDungeon[tile.TileType] && DungeonWalls.Contains(tileUp.WallType) && !tileUp.HasTile) + + if (Main.tileDungeon[tile.TileType] && !tileUp1.HasTile && !tileUp2.HasTile && !tileUp3.HasTile && !tileUp4.HasTile && !tileUp5.HasTile) + { + //i += WorldGen.dungeonSide * -16; + + //determine the archive brick color + if (tile.TileType == TileID.BlueDungeonBrick) + dungeonArchiveColor = 0; + else if (tile.TileType == TileID.GreenDungeonBrick) + dungeonArchiveColor = 1; + else if (tile.TileType == TileID.PinkDungeonBrick) + dungeonArchiveColor = 2; + + placedArchive = true; + + break; + } + } + + if (placedArchive) + { + bool firstItem = false; + + if (dungeonArchiveColor == 0) + { + SchematicManager.PlaceSchematic(SchematicManager.BlueArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + ref firstItem, new Action(FillArchiveChests)); + } + if (dungeonArchiveColor == 1) + { + SchematicManager.PlaceSchematic(SchematicManager.GreenArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + ref firstItem, new Action(FillArchiveChests)); + } + if (dungeonArchiveColor == 2) + { + SchematicManager.PlaceSchematic(SchematicManager.PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + ref firstItem, new Action(FillArchiveChests)); + } + + break; + } + } + } + + public static void FillArchiveChests(Chest chest, int Type, bool firstItem) + { + int potionType1 = Utils.SelectRandom(WorldGen.genRand, ItemID.HunterPotion, ItemID.IronskinPotion); + int potionType2 = Utils.SelectRandom(WorldGen.genRand, ItemID.ShinePotion, ItemID.SwiftnessPotion); + List contents1 = new List() + { + new ChestItem(ItemID.ShadowKey, 1), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 20)), + new ChestItem(ItemID.ManaPotion, WorldGen.genRand.Next(10, 20)), + new ChestItem(potionType1, WorldGen.genRand.Next(4, 8)), + new ChestItem(potionType2, WorldGen.genRand.Next(4, 8)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(5, 10)), + }; + + List contents2 = new List() + { + new ChestItem(ItemID.SpellTome, WorldGen.genRand.Next(2, 3)), + new ChestItem(ItemID.Book, WorldGen.genRand.Next(12, 25)), + new ChestItem(ItemID.TallyCounter, 1), + new ChestItem(potionType1, WorldGen.genRand.Next(4, 8)), + new ChestItem(potionType2, WorldGen.genRand.Next(4, 8)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(5, 10)), + }; + + //this is normally not a good idea with separate items lists, but both lists are the same size so it is fine here + for (int i = 0; i < contents1.Count; i++) + { + if (!firstItem) + { + chest.item[i].SetDefaults(contents1[i].Type); + chest.item[i].stack = contents1[i].Stack; + } + else + { + chest.item[i].SetDefaults(contents2[i].Type); + chest.item[i].stack = contents2[i].Stack; + } + } + } + } +} diff --git a/World/GiantHive.cs b/World/GiantHive.cs new file mode 100644 index 0000000000..176efbcf9f --- /dev/null +++ b/World/GiantHive.cs @@ -0,0 +1,646 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Tiles; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FurnitureAncient; +using CalamityMod.Tiles.Ores; +using CalamityMod.Walls; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using System.Reflection; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.IO; +using Terraria.ModLoader; +using Terraria.Utilities; +using Terraria.WorldBuilding; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; + +namespace CalamityMod.World +{ + public class GiantHive + { + public static bool GrowLivingJungleTree(Point origin) + { + int treeHeight = (int)Main.worldSurface - (Main.maxTilesY / 10); //start here to not touch floating islands + bool validHeightFound = false; + int attempts = 0; + + while (!validHeightFound && attempts++ < 100000) + { + while (!WorldGen.SolidTile(origin.X, treeHeight)) + { + treeHeight++; + } + + if (Main.tile[origin.X, treeHeight].HasTile || Main.tile[origin.X, treeHeight].WallType > 0) + { + validHeightFound = true; + } + } + + int extraWidth = 0; + + while (validHeightFound) + { + //place the roots first so the bottom of the hole doesnt look strange + for (int k = 0; k < 6; k++) + { + double angle = (double)k / 3.0 * 2.0 + 0.57075; + WorldUtils.Gen(new Point(origin.X + 2, origin.Y - 30), new ShapeRoot((int)angle, WorldGen.genRand.Next(80, 120)), + Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), + new Actions.SetTile(TileID.LivingMahogany, setSelfFrames: true))); + } + + for (int y = treeHeight - 50; y <= origin.Y - 30; y++) + { + //increase extra width to make the tree wider as it goes down + if (y % 45 == 0 && extraWidth < 3) + { + extraWidth++; + } + + //place branches at the top of the tree + if (y <= treeHeight - 45) + { + //create a list of points for the ends of each branch + List list = new List(); + + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-3, 3), y), new ShapeBranch(-0.6853981852531433, + WorldGen.genRand.Next(5, 25)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), + new Modifiers.SkipWalls(87), new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames(frameNeighbors: true))); + + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-3, 3), y), new ShapeBranch(-2.45619455575943, + WorldGen.genRand.Next(5, 25)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), + new Modifiers.SkipWalls(87), new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames(frameNeighbors: true))); + + //place living mahogany leaves at the end of each branch + foreach (Point item in list) + { + WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), + new Modifiers.SkipTiles(383, 21, 467, 226, 237), new Modifiers.SkipWalls(78, 87), new Actions.SetTile(TileID.LivingMahoganyLeaves), new Actions.SetFrames(frameNeighbors: true))); + } + } + + //place the tree itself + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-1 - extraWidth, 1), y), new Shapes.Rectangle(6 + extraWidth, 3 + extraWidth), + Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.RemoveWall(), + new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames())); + + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-1, 1), y), new Shapes.Rectangle(6 + extraWidth, 3 + extraWidth), + Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.RemoveWall(), + new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames())); + + //dig hole in tree + ShapeData circle = new ShapeData(); + ShapeData biggerCircle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + int radius = extraWidth - 1; + + WorldUtils.Gen(new Point(origin.X + 2, y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(origin.X + 2, y), new Shapes.Circle(radius + 1), Actions.Chain(new GenAction[] + { + blotchMod.Output(biggerCircle) + })); + + //main circle of walls, also dig out hole in the tree + WorldUtils.Gen(new Point(origin.X + 2, y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceWall(WallID.LivingWood) + })); + + //chance to place blocks inside the tree for randomness + if (WorldGen.genRand.Next(20) == 0) + { + WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-2, 2), y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile(TileID.LivingMahogany) + })); + } + + //bigger circle so that walls can place behind blocks (basically makes it not look ugly in game) + WorldUtils.Gen(new Point(origin.X + 2, y), new ModShapes.All(biggerCircle), Actions.Chain(new GenAction[] + { + new Actions.PlaceWall(WallID.LivingWood) + })); + } + + return true; + } + + return false; + } + + public static bool CanPlaceGiantHive(Point origin, StructureMap structures) + { + if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100))) + return false; + + if (TooCloseToImportantLocations(origin)) + return false; + + Ref ref1 = new Ref(0); + Ref ref2 = new Ref(0); + Ref ref3 = new Ref(0); + WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(ref1), new Modifiers.OnlyTiles(TileID.JungleGrass, TileID.Mud), new Actions.Scanner(ref2), new Modifiers.OnlyTiles(TileID.JungleGrass), new Actions.Scanner(ref3))); + if (ref2.Value / (float)ref1.Value < 0.75f || ref3.Value < 2) + return false; + + int num = 0; + int[] array = new int[1000]; + int[] array2 = new int[1000]; + Vector2 larvaLocation = origin.ToVector2(); + int numHiveTunnels = WorldGen.genRand.Next(10, 13); + + for (int i = 0; i < numHiveTunnels; i++) + { + Vector2 vector2 = larvaLocation; + int num3 = WorldGen.genRand.Next(2, 5); + for (int j = 0; j < num3; j++) + vector2 = CreateHiveTunnel((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); + + larvaLocation = vector2; + array[num] = (int)larvaLocation.X; + array2[num] = (int)larvaLocation.Y; + num++; + } + + FrameOutAllHiveContents(origin, 50); + + for (int k = 0; k < num; k++) + { + int num4 = array[k]; + int y = array2[k]; + int num5 = 1; + if (WorldGen.genRand.NextBool()) + num5 = -1; + + bool flag = false; + while (WorldGen.InWorld(num4, y, 10) && BadSpotForHoneyFall(num4, y)) + { + num4 += num5; + if (Math.Abs(num4 - array[k]) > 50) + { + flag = true; + break; + } + } + + if (!flag) + { + num4 += num5; + if (!SpotActuallyNotInHive(num4, y)) + { + CreateBlockedHoneyCube(num4, y); + CreateDentForHoneyFall(num4, y, num5); + } + } + } + + GrowLivingJungleTree(new Point(origin.X, origin.Y)); + + CreateStandForLarva(larvaLocation); + + // Generate a second larva stand + Vector2 secondLarvaLocation = default; + int maxAttempts = 1000; + for (int l = 0; l < maxAttempts; l++) + { + Vector2 vector3 = larvaLocation; + vector3.X += WorldGen.genRand.Next(-50, 51); + vector3.Y += WorldGen.genRand.Next(-50, 51); + if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe) + { + secondLarvaLocation = vector3; + CreateStandForLarva(vector3); + break; + } + } + + // Honey chests + Vector2 honeyChestLocation = default; + for (int l = 0; l < maxAttempts; l++) + { + Vector2 vector3 = larvaLocation; + vector3.X += WorldGen.genRand.Next(-100, 101); + vector3.Y += WorldGen.genRand.Next(-100, 101); + if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && Vector2.Distance(secondLarvaLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe) + { + honeyChestLocation = vector3; + CreateStandAndPlaceHoneyChest(vector3); + break; + } + } + for (int l = 0; l < maxAttempts; l++) + { + Vector2 vector3 = larvaLocation; + vector3.X += WorldGen.genRand.Next(-100, 101); + vector3.Y += WorldGen.genRand.Next(-100, 101); + if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && Vector2.Distance(secondLarvaLocation, vector3) > 10f && Vector2.Distance(honeyChestLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe) + { + CreateStandAndPlaceHoneyChest(vector3); + break; + } + } + + structures.AddProtectedStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); + return true; + } + + private static void FrameOutAllHiveContents(Point origin, int squareHalfWidth) + { + int num = Math.Max(10, origin.X - squareHalfWidth); + int num2 = Math.Min(Main.maxTilesX - 10, origin.X + squareHalfWidth); + int num3 = Math.Max(10, origin.Y - squareHalfWidth); + int num4 = Math.Min(Main.maxTilesY - 10, origin.Y + squareHalfWidth); + for (int i = num; i < num2; i++) + { + for (int j = num3; j < num4; j++) + { + Tile tile = Main.tile[i, j]; + if (tile.HasTile && tile.TileType == TileID.Hive) + WorldGen.SquareTileFrame(i, j); + + if (tile.WallType == WallID.HiveUnsafe) + WorldGen.SquareWallFrame(i, j); + } + } + } + + private static Vector2 CreateHiveTunnel(int i, int j, UnifiedRandom random) + { + double num = random.Next(20, 26); + float num2 = random.Next(30, 41); + float num3 = Main.maxTilesX / 4200; + num3 = (num3 + 1f) / 2f; + num *= (double)num3; + num2 *= num3; + + double num4 = num; + Vector2 result = default; + result.X = i; + result.Y = j; + Vector2 vector = default; + vector.X = random.Next(-10, 11) * 0.2f; + vector.Y = random.Next(-10, 11) * 0.2f; + while (num > 0.0 && num2 > 0f) + { + if (result.Y > (Main.maxTilesY - 250)) + num2 = 0f; + + num = num4 * (double)(1f + random.Next(-20, 20) * 0.01f); + num2 -= 1f; + int num5 = (int)(result.X - num); + int num6 = (int)(result.X + num); + int num7 = (int)(result.Y - num); + int num8 = (int)(result.Y + num); + if (num5 < 1) + num5 = 1; + + if (num6 > Main.maxTilesX - 1) + num6 = Main.maxTilesX - 1; + + if (num7 < 1) + num7 = 1; + + if (num8 > Main.maxTilesY - 1) + num8 = Main.maxTilesY - 1; + + for (int k = num5; k < num6; k++) + { + for (int l = num7; l < num8; l++) + { + if (!WorldGen.InWorld(k, l, 50)) + { + num2 = 0f; + } + else + { + if (Main.tile[k - 10, l].WallType == WallID.LihzahrdBrickUnsafe) + num2 = 0f; + + if (Main.tile[k + 10, l].WallType == WallID.LihzahrdBrickUnsafe) + num2 = 0f; + + if (Main.tile[k, l - 10].WallType == WallID.LihzahrdBrickUnsafe) + num2 = 0f; + + if (Main.tile[k, l + 10].WallType == WallID.LihzahrdBrickUnsafe) + num2 = 0f; + } + + if (l < Main.worldSurface && Main.tile[k, l - 5].WallType == WallID.None) + num2 = 0f; + + float num9 = Math.Abs(k - result.X); + float num10 = Math.Abs(l - result.Y); + double num11 = Math.Sqrt(num9 * num9 + num10 * num10); + if (num11 < num4 * 0.4 * (1.0 + random.Next(-10, 11) * 0.005)) + { + Main.tile[k, l].LiquidAmount = byte.MaxValue; + Main.tile[k, l].Get().LiquidType = LiquidID.Honey; + Main.tile[k, l].WallType = WallID.HiveUnsafe; + Main.tile[k, l].Get().HasTile = false; + Main.tile[k, l].Get().IsHalfBlock = false; + Main.tile[k, l].Get().Slope = SlopeType.Solid; + } + else if (num11 < num4 * 0.75 * (1.0 + random.Next(-10, 11) * 0.005)) + { + Main.tile[k, l].LiquidAmount = 0; + if (Main.tile[k, l].WallType != WallID.HiveUnsafe) + { + Main.tile[k, l].Get().HasTile = true; + Main.tile[k, l].Get().IsHalfBlock = false; + Main.tile[k, l].Get().Slope = SlopeType.Solid; + Main.tile[k, l].TileType = TileID.Hive; + } + } + + if (num11 < num4 * 0.6 * (1.0 + random.Next(-10, 11) * 0.005)) + { + Main.tile[k, l].WallType = WallID.HiveUnsafe; + if (random.NextBool()) + { + Main.tile[k, l].LiquidAmount = byte.MaxValue; + Main.tile[k, l].Get().LiquidType = LiquidID.Honey; + } + } + } + } + + result += vector; + num2 -= 1f; + vector.Y += random.Next(-10, 11) * 0.05f; + vector.X += random.Next(-10, 11) * 0.05f; + } + + return result; + } + + private static bool TooCloseToImportantLocations(Point origin) + { + int x = origin.X; + int y = origin.Y; + int num = 150; + for (int i = x - num; i < x + num; i += 10) + { + if (i <= 0 || i > Main.maxTilesX - 1) + continue; + + for (int j = y - num; j < y + num; j += 10) + { + if (j > 0 && j <= Main.maxTilesY - 1) + { + if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == TileID.LihzahrdBrick) + return true; + + if (Main.tile[i, j].WallType == WallID.CrimstoneUnsafe || Main.tile[i, j].WallType == WallID.EbonstoneUnsafe || Main.tile[i, j].WallType == WallID.LihzahrdBrickUnsafe) + return true; + } + } + } + + return false; + } + + private static void CreateDentForHoneyFall(int x, int y, int dir) + { + dir *= -1; + y++; + int num = 0; + while ((num < 4 || WorldGen.SolidTile(x, y)) && x > 10 && x < Main.maxTilesX - 10) + { + num++; + x += dir; + if (WorldGen.SolidTile(x, y)) + { + WorldGen.PoundTile(x, y); + if (!Main.tile[x, y + 1].HasTile) + { + Main.tile[x, y + 1].Get().HasTile = true; + Main.tile[x, y + 1].TileType = TileID.Hive; + } + } + } + } + + private static void CreateBlockedHoneyCube(int x, int y) + { + for (int i = x - 1; i <= x + 2; i++) + { + for (int j = y - 1; j <= y + 2; j++) + { + if (i >= x && i <= x + 1 && j >= y && j <= y + 1) + { + Main.tile[i, j].Get().HasTile = false; + Main.tile[i, j].LiquidAmount = byte.MaxValue; + Main.tile[i, j].Get().LiquidType = LiquidID.Honey; + } + else + { + Main.tile[i, j].Get().HasTile = true; + Main.tile[i, j].TileType = TileID.Hive; + } + } + } + } + + private static bool SpotActuallyNotInHive(int x, int y) + { + for (int i = x - 1; i <= x + 2; i++) + { + for (int j = y - 1; j <= y + 2; j++) + { + if (i < 10 || i > Main.maxTilesX - 10) + return true; + + if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType != TileID.Hive) + return true; + } + } + + return false; + } + + private static bool BadSpotForHoneyFall(int x, int y) + { + if (Main.tile[x, y].HasTile && Main.tile[x, y + 1].HasTile && Main.tile[x + 1, y].HasTile) + return !Main.tile[x + 1, y + 1].HasTile; + + return true; + } + + public static void CreateStandForLarva(Vector2 position) + { + WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp((int)position.X, 5, Main.maxTilesX - 5); + WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp((int)position.Y, 5, Main.maxTilesY - 5); + WorldGen.numLarva++; + if (WorldGen.numLarva >= WorldGen.larvaX.Length) + WorldGen.numLarva = WorldGen.larvaX.Length - 1; + + int num = (int)position.X; + int num2 = (int)position.Y; + for (int i = num - 1; i <= num + 1 && i > 0 && i < Main.maxTilesX; i++) + { + for (int j = num2 - 2; j <= num2 + 1 && j > 0 && j < Main.maxTilesY; j++) + { + if (j != num2 + 1) + { + Main.tile[i, j].Get().HasTile = false; + continue; + } + + Main.tile[i, j].Get().HasTile = true; + Main.tile[i, j].TileType = TileID.Hive; + Main.tile[i, j].Get().Slope = SlopeType.Solid; + Main.tile[i, j].Get().IsHalfBlock = false; + } + } + } + + public static void CreateStandAndPlaceHoneyChest(Vector2 position) + { + int chestPlacementX = Utils.Clamp((int)position.X, 5, Main.maxTilesX - 5); + int chestPlacementY = Utils.Clamp((int)position.Y, 5, Main.maxTilesY - 5); + + int num = (int)position.X; + int num2 = (int)position.Y; + for (int i = num; i <= num + 1 && i > 0 && i < Main.maxTilesX; i++) + { + for (int j = num2 - 1; j <= num2 + 1 && j > 0 && j < Main.maxTilesY; j++) + { + if (j != num2 + 1) + { + Main.tile[i, j].Get().HasTile = false; + continue; + } + + Main.tile[i, j].Get().HasTile = true; + Main.tile[i, j].TileType = TileID.Hive; + Main.tile[i, j].Get().Slope = SlopeType.Solid; + Main.tile[i, j].Get().IsHalfBlock = false; + } + } + + int num144 = chestPlacementX; + int num145 = chestPlacementY; + for (int num146 = num144; num146 <= num144 + 1; num146++) + { + for (int num147 = num145 - 1; num147 <= num145 + 1; num147++) + { + if (num147 != num145 + 1) + { + Main.tile[num146, num147].Get().HasTile = false; + } + else + { + Main.tile[num146, num147].Get().HasTile = true; + Main.tile[num146, num147].TileType = TileID.Hive; + Main.tile[num146, num147].Get().Slope = SlopeType.Solid; + Main.tile[num146, num147].Get().IsHalfBlock = false; + } + } + } + + int chestID = WorldGen.PlaceChest(num144, num145, 21, false, 29); + FillHoneyChest(chestID, WorldGen.genRand); + } + + // Honey chest stuff, this is also used by the Hive Planetoid + private static int[] FocusLootHoney = new int[] + { + ItemID.NaturesGift, + ItemID.Bezoar, + ItemID.FlowerBoots, + ItemID.BeeMinecart + }; + + private static int[] PotionLootHoney = new int[] + { + ItemID.LifeforcePotion, + ItemID.RegenerationPotion, + ItemID.ManaRegenerationPotion, + ItemID.HeartreachPotion, + ModContent.ItemType() + }; + + private static int[] BarLootHoney = new int[] + { + WorldGen.silverBar == TileID.Silver ? ItemID.SilverBar : ItemID.TungstenBar, + WorldGen.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar + }; + + public static void FillHoneyChest(int id, UnifiedRandom random) + { + if (id < 0) + return; + + Chest chest = Main.chest[id]; + if (chest == null) + return; + + int index = 0; + + chest.item[index++].SetDefaults(random.Next(FocusLootHoney)); + + if (random.Next(3) <= 1) + { + chest.item[index].SetDefaults(random.Next(BarLootHoney)); + chest.item[index].SetDefaults(random.Next(7, 15)); + } + else + { + chest.item[index].SetDefaults(ItemID.GoldCoin); + chest.item[index++].stack = random.Next(3, 5); + } + + if (random.NextBool()) + { + chest.item[index].SetDefaults(random.Next(PotionLootHoney)); + chest.item[index++].stack = random.Next(1, 4); + } + else + { + chest.item[index].SetDefaults(ItemID.BottledHoney); + chest.item[index++].stack = random.Next(3, 7); + } + + if (random.NextBool()) + { + chest.item[index].SetDefaults(ItemID.Stinger); + chest.item[index++].stack = random.Next(4, 6); + } + else + { + chest.item[index].SetDefaults(ItemID.JungleSpores); + chest.item[index++].stack = random.Next(3, 5); + } + + if (random.NextBool()) + { + chest.item[index].SetDefaults(ItemID.RecallPotion); + chest.item[index++].stack = random.Next(1, 4); + } + else + { + chest.item[index].SetDefaults(ItemID.JungleTorch); + chest.item[index++].stack = random.Next(18, 36); + } + } + } +} diff --git a/World/MechanicShed.cs b/World/MechanicShed.cs new file mode 100644 index 0000000000..29863c3360 --- /dev/null +++ b/World/MechanicShed.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; +using static CalamityMod.Schematics.SchematicManager; + +namespace CalamityMod.World +{ + public class MechanicShed + { + public static void PlaceMechanicShed(StructureMap structures) + { + string mapKey = MechanicShedKey; + var schematic = TileMaps[mapKey]; + + int placementPositionX = WorldGen.genRand.Next(WorldGen.snowOriginLeft + 100, WorldGen.snowOriginRight - 100); + int placementPositionY = (int)Main.worldSurface - (Main.maxTilesY / 8); + + bool foundValidGround = false; + int attempts = 0; + while (!foundValidGround && attempts++ < 100000) + { + while (!WorldGen.SolidTile(placementPositionX, placementPositionY) && placementPositionY <= Main.worldSurface) + { + placementPositionY++; + } + + if (Main.tile[placementPositionX, placementPositionY].HasTile || Main.tile[placementPositionX, placementPositionY].WallType > 0) + { + foundValidGround = true; + } + } + + Point placementPoint = new Point(placementPositionX, placementPositionY + 6); + + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); + SchematicAnchor anchorType = SchematicAnchor.BottomCenter; + + bool place = true; + PlaceSchematic(mapKey, placementPoint, anchorType, ref place, new Action(FillMechanicChest)); + + Rectangle protectionArea = CalamityUtils.GetSchematicProtectionArea(schematic, placementPoint, anchorType); + structures.AddProtectedStructure(protectionArea, 30); + } + + public static void FillMechanicChest(Chest chest, int Type, bool place) + { + int gizmoGoobabGadgets = Utils.SelectRandom(WorldGen.genRand, ItemID.Stopwatch, ItemID.LifeformAnalyzer, ItemID.DPSMeter); + List contents = new List() + { + new ChestItem(ItemID.Toolbox, 1), + new ChestItem(ItemID.ActuationAccessory, 1), + new ChestItem(gizmoGoobabGadgets, 1), + new ChestItem(ItemID.BuilderPotion, WorldGen.genRand.Next(1, 3)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(1, 3)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + } +} diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index 130ec4a78b..833faabded 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Tiles; @@ -11,11 +12,14 @@ using CalamityMod.Walls; using Microsoft.Xna.Framework; using System; using System.Reflection; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.IO; using Terraria.ModLoader; +using Terraria.Utilities; using Terraria.WorldBuilding; +using Terraria.GameContent.Generation; namespace CalamityMod.World { @@ -189,7 +193,7 @@ namespace CalamityMod.World { if ((Main.tile[x, y].TileFrameX == 18 && Main.tile[x, y].TileFrameY == 0) || (Main.tile[x, y].TileFrameX == 45 && Main.tile[x, y].TileFrameY == 0)) { - if (WorldGen.genRand.Next(3) == 0) + if (WorldGen.genRand.NextBool(3)) { for (int dx = -1; dx < 2; dx++) { @@ -210,392 +214,6 @@ namespace CalamityMod.World } #endregion - // NOTE - The crag gen is scheduled for a rework soon. As such, its code will not be moved. - - #region UnderworldIsland - public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) - { - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < Main.maxTilesY - 270) - { - num9 = Main.maxTilesY - 270; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].Get().HasTile = true; - Main.tile[k, l].TileType = (ushort)ModContent.TileType(); - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].HasTile) - { - num14--; - if (num14 < Main.maxTilesX - WorldGen.genRand.Next(265, 275 + 1)) - break; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = ModContent.TileType(); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = ModContent.TileType(); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].Get().HasTile = true; - Main.tile[n, num17].TileType = (ushort)num16; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].HasTile || Main.tile[num23, num24].TileType != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = ModContent.TileType(); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].TileType = (ushort)num26; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].HasTile) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].TileType == (ushort)ModContent.TileType()) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].TileType == (ushort)ModContent.TileType()) - { - Main.tile[num37, num35].Get().HasTile = false; - Main.tile[num37, num35].LiquidAmount = 255; - Main.tile[num37, num35].Get().LiquidType = LiquidID.Water; - WorldGen.SquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].TileType == (ushort)ModContent.TileType()) - { - Main.tile[num37, num35 + 1].Get().HasTile = false; - Main.tile[num37, num35 + 1].LiquidAmount = 255; - Main.tile[num37, num35 + 1].Get().LiquidType = LiquidID.Water; - WorldGen.SquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].TileType == (ushort)ModContent.TileType()) - { - Main.tile[num37, num35 + 2].Get().HasTile = false; - Main.tile[num37, num35 + 2].LiquidAmount = 255; - Main.tile[num37, num35 + 2].Get().LiquidType = LiquidID.Water; - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].LiquidAmount = 255; - } - Main.tile[num34, num35].Get().LiquidType = LiquidID.Water; - WorldGen.SquareTileFrame(num34, num35, true); - } - } - } - #endregion - - #region UnderworldIslandHouse - public static void UnderworldIslandHouse(int i, int j, int item) - { - ushort type = (ushort)ModContent.TileType(); //tile - int wall = ModContent.WallType(); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].HasTile) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].Get().HasTile = true; - Main.tile[l, m].LiquidAmount = 0; - Main.tile[l, m].TileType = type; - Main.tile[l, m].WallType = 0; - Main.tile[l, m].Get().IsHalfBlock = false; - Main.tile[l, m].Get().Slope = SlopeType.Solid; - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].WallType == 0) - { - Main.tile[n, num8].Get().HasTile = false; - Main.tile[n, num8].WallType = (ushort)wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].Get().HasTile = false; - Main.tile[num11, num10 - 1].Get().HasTile = false; - Main.tile[num11, num10 - 2].Get().HasTile = false; - } - WorldGen.PlaceTile(num9, num10, ModContent.TileType(), true, false, -1); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - Main.tile[num9, num12].Get().HasTile = true; - Main.tile[num9, num12].LiquidAmount = 0; - Main.tile[num9, num12].TileType = type; - Main.tile[num9, num12].WallType = 0; - Main.tile[num9, num12].Get().IsHalfBlock = false; - Main.tile[num9, num12].Get().Slope = SlopeType.Solid; - } - WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest - int num22 = i + (num2 / 2 + 1) * -num; - WorldGen.PlaceTile(num22, num7 - 1, ModContent.TileType(), true, false, -1); //table - WorldGen.PlaceTile(num22 - 2, num7 - 1, ModContent.TileType(), true, false, 0); //chair - Tile tile = Main.tile[num22 - 2, num7 - 1]; - tile.TileFrameX += 18; - Tile tile2 = Main.tile[num22 - 2, num7 - 2]; - tile2.TileFrameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, ModContent.TileType(), true, false, 0); //chair - } - #endregion - #region ChasmGenerator public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) { @@ -631,31 +249,40 @@ namespace CalamityMod.World { if (num > 0f) { - num3 += WorldGen.genRand.Next(2); - num3 -= WorldGen.genRand.Next(2); + num3 += WorldGen.genRand.Next(10); + num3 -= WorldGen.genRand.Next(10); float smallHoleLimit = 790f; //small + if (Main.maxTilesY > 1500) - { smallHoleLimit = 1360f; if (Main.maxTilesY > 2100) { smallHoleLimit = 1950f; } } + { + smallHoleLimit = 1360f; + + if (Main.maxTilesY > 2100) + { + smallHoleLimit = 1950f; + } + } + if (ocean && num > smallHoleLimit) { if (num3 < 7.0) //min width { num3 = 7.0; //min width } - if (num3 > 11.0) //max width + if (num3 > 45.0) //max width { - num3 = 11.0; //max width + num3 = 45.0; //max width } } else //dig large hole { - if (num3 < (ocean ? 45.0 : 8.0)) //min width + if (num3 < (ocean ? 30.0 : 8.0)) //min width { - num3 = ocean ? 45.0 : 8.0; //min width + num3 = ocean ? 30.0 : 8.0; //min width } - if (num3 > (ocean ? 50.0 : 20.0)) //max width + if (num3 > (ocean ? 70.0 : 20.0)) //max width { - num3 = ocean ? 50.0 : 20.0; //max width + num3 = ocean ? 70.0 : 20.0; //max width } if (num == 1f && num3 < (ocean ? 50.0 : 15.0)) { @@ -673,7 +300,7 @@ namespace CalamityMod.World if (Main.maxTilesY > 2100) { if (((double)vector.Y > Abyss.AbyssChasmBottom && num > 0f && ocean) || - (vector.Y >= Main.maxTilesY && num > 0f && !ocean)) + (vector.Y >= Main.maxTilesY && num > 0f && !ocean)) { num = 0f; } @@ -681,7 +308,7 @@ namespace CalamityMod.World else if (Main.maxTilesY > 1500) { if (((double)vector.Y > Abyss.AbyssChasmBottom && num > 0f && ocean) || - (vector.Y > Main.maxTilesY && num > 0f && !ocean)) + (vector.Y > Main.maxTilesY && num > 0f && !ocean)) { num = 0f; } @@ -689,11 +316,12 @@ namespace CalamityMod.World else { if (((double)vector.Y > Abyss.AbyssChasmBottom && num > 0f && ocean) || - (vector.Y > Main.maxTilesY && num > 0f && !ocean)) + (vector.Y > Main.maxTilesY && num > 0f && !ocean)) { num = 0f; } } + num -= 1f; int num4; int num5; diff --git a/World/Planets/MudPlanet.cs b/World/Planets/MudPlanet.cs index 44a0a18bb9..b7d2e063ed 100644 --- a/World/Planets/MudPlanet.cs +++ b/World/Planets/MudPlanet.cs @@ -109,7 +109,7 @@ namespace CalamityMod.World.Planets { int testX = origin.X + _random.Next(-radius, radius); int testY = origin.Y + _random.Next(-radius, radius); - if (WorldGen.EmptyTileCheck(testX - 1, testX + 1, testY - 1, testY + 1) && _tiles[testX, testY].WallType == WallID.HiveUnsafe) + if (WorldGen.EmptyTileCheck(testX - 1, testX + 1, testY - 1, testY + 1) && _tiles[testX, testY].WallType == WallID.HiveUnsafe) { for (int floorX = testX - 1; floorX <= testX + 1; floorX++) { @@ -119,7 +119,7 @@ namespace CalamityMod.World.Planets } //Place chest int chestID = WorldGen.PlaceChest(testX, testY + 1, 21, false, 29); - FillHoneyChest(chestID); + GiantHive.FillHoneyChest(chestID, WorldGen.genRand); placedChest = true; } } @@ -237,7 +237,7 @@ namespace CalamityMod.World.Planets } //Potion loot - if (_random.Next(2) == 0) + if (_random.NextBool()) { chest.item[index].SetDefaults(_random.Next(PotionLoot)); chest.item[index++].stack = _random.Next(1, 4); @@ -249,7 +249,7 @@ namespace CalamityMod.World.Planets } //Weaponry - if (_random.Next(2) == 0) + if (_random.NextBool()) { chest.item[index].SetDefaults(_random.Next(new int[] { ItemID.Shuriken, ItemID.ThrowingKnife })); chest.item[index++].stack = _random.Next(50, 100); @@ -261,7 +261,7 @@ namespace CalamityMod.World.Planets } //Recall potion - if (_random.Next(2) == 0) + if (_random.NextBool()) { chest.item[index].SetDefaults(ItemID.RecallPotion); chest.item[index++].stack = _random.Next(1, 4); @@ -273,90 +273,5 @@ namespace CalamityMod.World.Planets } } - - //--------------------- - //HONEY CHEST STUFF - //--------------------- - - private int[] FocusLootHoney = new int[] - { - ItemID.NaturesGift, - ItemID.Bezoar, - ItemID.SharpeningStation - }; - - private int[] PotionLootHoney = new int[] - { - ItemID.LifeforcePotion, - ItemID.RegenerationPotion, - ItemID.ManaRegenerationPotion, - ItemID.HeartreachPotion, - ModContent.ItemType(), - ModContent.ItemType() - }; - - private int[] BarLootHoney = new int[] - { - WorldGen.silverBar == TileID.Silver ? ItemID.SilverBar : ItemID.TungstenBar, - WorldGen.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar - }; - - private void FillHoneyChest(int id) - { - Chest chest = Main.chest[id]; - int index = 0; - - //Focus loot - chest.item[index++].SetDefaults(_random.Next(FocusLootHoney)); - - //Bars - if (_random.Next(3) <= 1) - { - chest.item[index].SetDefaults(_random.Next(BarLootHoney)); - chest.item[index].SetDefaults(_random.Next(7, 15)); - } - else - { - chest.item[index].SetDefaults(ItemID.GoldCoin); - chest.item[index++].stack = _random.Next(3, 5); // 3 or 4 gold coins - } - - //Potion loot - if (_random.Next(2) == 0) - { - chest.item[index].SetDefaults(_random.Next(PotionLootHoney)); - chest.item[index++].stack = _random.Next(1, 4); - } - else //Healing potion - { - chest.item[index].SetDefaults(ItemID.BottledHoney); - chest.item[index++].stack = _random.Next(3, 7); - } - - //Weaponry - if (_random.Next(2) == 0) - { - chest.item[index].SetDefaults(ItemID.Stinger); - chest.item[index++].stack = _random.Next(4, 6); - } - else - { - chest.item[index].SetDefaults(ItemID.JungleSpores); - chest.item[index++].stack = _random.Next(3, 5); - } - - //Recall potion - if (_random.Next(2) == 0) - { - chest.item[index].SetDefaults(ItemID.RecallPotion); - chest.item[index++].stack = _random.Next(1, 4); - } - else //glowsticks - { - chest.item[index].SetDefaults(ItemID.YellowTorch); - chest.item[index++].stack = _random.Next(18, 36); - } - - } } } diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index df9046edfa..036c09c16e 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -4,6 +4,8 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Schematics; using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Tiles.Abyss.Stalactite; using CalamityMod.Walls; using Microsoft.Xna.Framework; using System; @@ -40,7 +42,7 @@ namespace CalamityMod.World public const int TotalSandTilesBeforeWaterMax = 45; - public const float OpenSeaWidthPercentage = 0.53f; + public const float OpenSeaWidthPercentage = 0.795f; public const float IslandWidthPercentage = 0.36f; @@ -206,9 +208,8 @@ namespace CalamityMod.World ClearAloneTiles(); var scrapPilePositions = PlaceScrapPiles(); GenerateColumnsInCaverns(); - GenerateSteamGeysersInCaverns(); GenerateHardenedSandstone(); - PlaceStalactites(); + PlaceAmbience(); GenerateChests(scrapPilePositions); } #endregion @@ -308,11 +309,12 @@ namespace CalamityMod.World float depthFactor = (float)Math.Pow(Math.Sin((1f - i / (float)width) * MathHelper.PiOver2), descentSmoothness); // Determine the top and botton of the water strip. - int top = YStart; - int bottom = top + (int)(maxDepth * depthFactor); + int top = YStart - 20; + int bottom = top + (int)(maxDepth * depthFactor * 2); for (int y = top; y < bottom; y++) { if (y >= top + DepthForWater) + Main.tile[x, y + WorldGen.genRand.Next(22, 25)].WallType = (ushort)ModContent.WallType(); Main.tile[x, y].LiquidAmount = byte.MaxValue; Main.tile[x, y].Get().HasTile = false; } @@ -363,7 +365,13 @@ namespace CalamityMod.World int depth = BlockDepth; int shallowWaterCaveCount = TotalCavesInShallowWater; int minCaveWidth = MinCaveWidth; + + // Large worlds typically have this property evaluate to 14.841, which is then ceiling'd to 15. + // XL worlds will have a value larger than 15... which will break the lower loops and go out of bounds. int maxCaveWidth = MaxCaveWidth; + if (maxCaveWidth > 15) + maxCaveWidth = 15; + ushort wallID = (ushort)ModContent.WallType(); for (int i = 2; i < shallowWaterCaveCount; i++) @@ -690,7 +698,9 @@ namespace CalamityMod.World else if (tileAtPosition.HasTile && ValidBeachCovertTiles.Contains(tileAtPosition.TileType) && WorldGen.genRand.NextFloat() >= ditherChance) Main.tile[x, y].TileType = sandID; - if (tileAtPosition.WallType > WallID.None) + //do not replace dungeon walls ever + int[] DungeonWalls = { 7, 94, 95, 8, 98, 99, 9, 96, 97 }; + if (tileAtPosition.WallType > WallID.None && !DungeonWalls.Contains(tileAtPosition.WallType)) Main.tile[x, y].WallType = wallID; } } @@ -739,9 +749,9 @@ namespace CalamityMod.World // Check to see if the tile has any cardinal neighbors. If it doesn't, destroy it. if (!CalamityUtils.ParanoidTileRetrieval(x - 1, y).HasTile && - !CalamityUtils.ParanoidTileRetrieval(x + 1, y).HasTile && - !CalamityUtils.ParanoidTileRetrieval(x, y - 1).HasTile && - !CalamityUtils.ParanoidTileRetrieval(x, y + 1).HasTile) + !CalamityUtils.ParanoidTileRetrieval(x + 1, y).HasTile && + !CalamityUtils.ParanoidTileRetrieval(x, y - 1).HasTile && + !CalamityUtils.ParanoidTileRetrieval(x, y + 1).HasTile) { WorldUtils.Gen(new(x, y), new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] { @@ -830,6 +840,7 @@ namespace CalamityMod.World return pastPlacementPositions; } + //GenerateColumnsInCaverns(int width, int depth, int maxHeight, int minHeight, int columnCount) public static void GenerateColumnsInCaverns() { int columnCount = ColumnCount; @@ -858,7 +869,7 @@ namespace CalamityMod.World // Try again if there is no tile above or the ceiling is not level. if (!WorldUtils.Find(new(x, y), searchCondition, out Point top) || - !WorldUtils.Find(new(x + 1, y), searchCondition, out Point topRight) || top.Y != topRight.Y) + !WorldUtils.Find(new(x + 1, y), searchCondition, out Point topRight) || top.Y != topRight.Y) { tryAgain = true; } @@ -873,50 +884,10 @@ namespace CalamityMod.World continue; } - GenerateColumn(x, top.Y, y); - } - } - - public static void GenerateSteamGeysersInCaverns() - { - int geyserCount = GeyserCount; - int width = BiomeWidth; - int depth = BlockDepth; - ushort geyserID = (ushort)ModContent.TileType(); - - for (int g = 0; g < geyserCount; g++) - { - int x = GetActualX(WorldGen.genRand.Next(20, width - 32)); - int y = WorldGen.genRand.Next(YStart + depth / 2, YStart + depth - 42); - - bool tryAgain = false; - - // Try again if inside a tile. - for (int dx = 0; dx < 2; dx++) + if (WorldGen.genRand.NextBool(2)) { - for (int dy = 0; dy < 2; dy++) - { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x + dx, y - dy); - if (tile.HasTile) - tryAgain = true; - } + GenerateColumn(x, top.Y, y); } - - // Try again if there is no ground. - for (int dx = 0; dx < 2; dx++) - { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x + dx, y + 1); - if (!WorldGen.SolidTile(tile)) - tryAgain = true; - } - - if (tryAgain) - { - g--; - continue; - } - - WorldGen.PlacePot(x, y, geyserID); } } @@ -974,7 +945,7 @@ namespace CalamityMod.World if (WorldGen.InWorld(x + dx, y + dy)) { if (CalamityUtils.ParanoidTileRetrieval(x + dx, y + dy).TileType != sandstoneID && - SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x + dx, y + dy).TileType)) + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x + dx, y + dy).TileType)) { Main.tile[x + dx, y + dy].WallType = sandstoneWallID; Main.tile[x + dx, y + dy].TileType = sandstoneID; @@ -986,43 +957,78 @@ namespace CalamityMod.World } } - public static void PlaceStalactites() - { - static int heightFromType(int type) - { - if (type <= 2) - return 2; - else if (type <= 4) - return 3; - else - return 4; - }; - - for (int i = 1; i < BiomeWidth; i++) + public static void PlaceAmbience() + { + for (int i = 0; i < BiomeWidth; i++) { int x = GetActualX(i); - for (int y = YStart; y <= YStart + BlockDepth; y++) + for (int y = YStart - 140; y < Main.rockLayer; y++) { - if (y - YStart > BlockDepth * 0.25f) - { - if (WorldGen.SolidTile(x, y - 1) && WorldGen.genRand.NextBool(10)) - { - int dy = 1; - while (!CalamityUtils.ParanoidTileRetrieval(x, y + dy).HasTile) - { - dy++; - if (dy > StalactitePairMaxDistance) - break; - } - if (dy <= StalactitePairMaxDistance && dy >= StalactitePairMinDistance) - { - int type = WorldGen.genRand.Next(6); - type++; - int height = heightFromType(type); + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + Tile tileDown = Main.tile[x, y + 1]; - PlaceStalactite(x, y, height, CalamityMod.Instance.Find($"SulphurousStalactite{type}").Type); - if (WorldGen.SolidTile(x, y + dy + 1)) - PlaceStalacmite(x, y + dy, height, CalamityMod.Instance.Find($"SulphurousStalacmite{type}").Type); + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + //stalagmites, fossiles, and ribs + if (tileUp.LiquidType == LiquidID.Water && tileUp.LiquidAmount > 0 && !tileUp.HasTile) + { + if (WorldGen.genRand.NextBool(25)) + { + ushort[] Crates = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Crates)); + } + + if (WorldGen.genRand.NextBool(18)) + { + ushort[] Vents = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Vents)); + } + + if (WorldGen.genRand.NextBool(12)) + { + ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Stalagmites)); + } + + if (WorldGen.genRand.NextBool(15)) + { + ushort[] SulphuricFossils = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(SulphuricFossils)); + } + + if (WorldGen.genRand.NextBool(18)) + { + ushort[] Ribs = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Ribs)); + } + } + + //stalactites + if (tileDown.LiquidType == LiquidID.Water && tileDown.LiquidAmount > 0 && !tileDown.HasTile) + { + if (WorldGen.genRand.NextBool(12)) + { + ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y + 1, WorldGen.genRand.Next(Stalactites)); } } } @@ -1369,7 +1375,7 @@ namespace CalamityMod.World if (Abyss.AtLeftSideOfWorld) return x; - return Main.maxTilesX - x; + return (Main.maxTilesX - 1) - x; } public static float CalculateDitherChance(int width, int top, int bottom, int x, int y) diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index af4b297478..9642273722 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -4,8 +4,10 @@ using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; +using Terraria.DataStructures; namespace CalamityMod.World { @@ -202,6 +204,7 @@ namespace CalamityMod.World 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++) @@ -241,14 +244,13 @@ namespace CalamityMod.World float num10 = num3 + num5; Tile tile = Main.tile[num6, num7]; bool flag = num8 >= 0.8f; - if (num10 > 3.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent + 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.WallType = (ushort)ModContent.WallType(); tile.LiquidAmount = 192; - if (num4 % 15 == 2) + if (num4 % 5 == 2) { - tile.ResetToType((ushort)ModContent.TileType()); + tile.ResetToType((ushort)ModContent.TileType()); tile.Get().HasTile = true; tile.LiquidAmount = 0; } @@ -260,7 +262,7 @@ namespace CalamityMod.World tile.LiquidAmount = 192; if (!flag || tile.HasTile) { - tile.ResetToType((ushort)ModContent.TileType()); + tile.ResetToType((ushort)ModContent.TileType()); tile.Get().HasTile = true; Tile.SmoothSlope(num6, num7, true); tile.LiquidAmount = 0; @@ -300,11 +302,71 @@ namespace CalamityMod.World } } } + + //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.Next(1000) == 0 && 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 AddTileVariance(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector, float overallBiomeScale) + 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); @@ -451,6 +513,7 @@ namespace CalamityMod.World new Actions.SetFrames(true) })); } + int num3 = i + start.X; int num4 = j + start.Y; Tile tile = Main.tile[num3, num4]; @@ -462,14 +525,21 @@ namespace CalamityMod.World } } } + } + + 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 tile2 = Main.tile[num5, num6]; - if (tile2.HasTile && (tile2.TileType == ModContent.TileType() || tile2.TileType == ModContent.TileType())) + 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--) @@ -507,11 +577,12 @@ namespace CalamityMod.World break; } } - if (tile2.TileType == ModContent.TileType() || (tile2.TileType == ModContent.TileType() && WorldGen.genRand.Next(8) == 0)) + if (tile.TileType == ModContent.TileType() || ((tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType()) && WorldGen.genRand.Next(8) == 0)) { if (flag3 ^ flag4) { - if (tile2.Slope == 0 && !tile2.IsHalfBlock) + if (tile.Slope == 0 && !tile.IsHalfBlock) { Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; tile3.TileType = (ushort)ModContent.TileType(); @@ -529,7 +600,7 @@ namespace CalamityMod.World } if (flag ^ flag2) { - if (tile2.Slope == 0 && !tile2.IsHalfBlock) + if (tile.Slope == 0 && !tile.IsHalfBlock) { Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; tile3.TileType = (ushort)ModContent.TileType(); @@ -547,92 +618,142 @@ namespace CalamityMod.World } } } - if (!tile2.HasTile) + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) { - if (tile2.WallType == ModContent.WallType() || tile2.WallType == ModContent.WallType()) + if (WorldGen.genRand.Next(7) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(10) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(10) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(5) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + //stalactites + if (WorldGen.genRand.Next(5) == 0) + { + ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(num5, num6 + 2, WorldGen.genRand.Next(Stalactites)); + } + if (WorldGen.genRand.Next(5) == 0) + { + WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + //stalagmites + if (WorldGen.genRand.Next(5) == 0) + { + ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(num5, num6 - 2, WorldGen.genRand.Next(Stalagmites)); + } + if (WorldGen.genRand.Next(5) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + } + if (!tile.HasTile) + { + if (tile.TileType == ModContent.TileType() || tile.WallType == ModContent.WallType()) { - if (WorldGen.genRand.Next(5) == 0) - { - PlaceTit(num5, num6, (ushort)ModContent.TileType()); - } - if (WorldGen.genRand.Next(8) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(10) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(8) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } if (WorldGen.genRand.Next(4) == 0) { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); + 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) { - // 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); - - // Place the majority of the terrain as clusters - ClusterGroup clusterGroup = new ClusterGroup(); - clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); - PlaceClusters(clusterGroup, origin, arbitrary42GodVector); - - // "Now place the rest of the Sunken Sea" except it's called Tile Variance - AddTileVariance(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++) + 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) { - if (i + origin.X > 0 && i + origin.X < Main.maxTilesX - 1 && j + origin.Y > 0 && j + origin.Y < Main.maxTilesY - 1) + 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); + + // 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++) { - WorldGen.SquareWallFrame(i + origin.X, j + origin.Y, true); - WorldUtils.TileFrame(i + origin.X, j + origin.Y, true); + 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); + } } } - // Sunken Sea generation always succeeds - return true; + // Add Tile Variance (sand, crystals, etc.) + AddTileVariance(clusterGroup, origin, arbitrary42GodVector, scale); + + return true; + } + + return false; } + /* public static void PlaceTit(int x, int y, ushort type = 165) { if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].HasTile && !Main.tile[x, y + 1].HasTile) @@ -691,5 +812,6 @@ namespace CalamityMod.World } } } + */ } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index f2bbf73d97..7c59aa5e26 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -2,14 +2,652 @@ using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.SummonItems; +using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Walls; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.WorldBuilding; + +using static CalamityMod.Schematics.SchematicManager; namespace CalamityMod.World { public class UndergroundShrines { + public static bool ShouldAvoidLocation(Point placementPoint, bool careAboutLiquids = true) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(placementPoint.X, placementPoint.Y); + if (tile.LiquidAmount > 0 && careAboutLiquids) + return true; + if (tile.TileType == TileID.BlueDungeonBrick || + tile.TileType == TileID.GreenDungeonBrick || + tile.TileType == TileID.PinkDungeonBrick) + { + return true; + } + if (tile.TileType == TileID.LihzahrdBrick || + tile.WallType == WallID.LihzahrdBrickUnsafe) + { + return true; + } + if (tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || + tile.WallType == ModContent.WallType() || + tile.WallType == ModContent.WallType()) + { + return true; + } + + return false; + } + + #region Corruption Shrine + public static void FillCorruptionShrineChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.BattlePotion, ItemID.HunterPotion, ItemID.TrapsightPotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.RottenChunk, WorldGen.genRand.Next(24, 28 + 1)), + new ChestItem(ItemID.CorruptionKey, 1), + new ChestItem(ItemID.CorruptTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceCorruptionShrine(StructureMap structures) + { + int tries = 0; + string mapKey = CorruptionShrineKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.35f)); + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int corruptStuffInArea = 0; + bool canGenerateInLocation = true; + + float totalTiles = schematicSize.X * schematicSize.Y; + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; + + //Should generate within the bounds of the walls. + if (tile.TileType == TileID.Ebonstone || tile.WallType == WallID.EbonstoneUnsafe) + corruptStuffInArea++; + + //Do not cut into the altars + if (tile.TileType == TileID.DemonAltar) + canGenerateInLocation = false; + } + } + if (!canGenerateInLocation || corruptStuffInArea < totalTiles * 0.5f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillCorruptionShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + + } while (tries <= 20000); + } + #endregion + + #region Crimson Shrine + public static void FillCrimsonShrineChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.BattlePotion, ItemID.HunterPotion, ItemID.TrapsightPotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.Vertebrae, WorldGen.genRand.Next(24, 28 + 1)), + new ChestItem(ItemID.CrimsonKey, 1), + new ChestItem(ItemID.CrimsonTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceCrimsonShrine(StructureMap structures) + { + int tries = 0; + string mapKey = CrimsonShrineKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.35f)); + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int crimsonStuffInArea = 0; + bool canGenerateInLocation = true; + + float groundThreshold = schematicSize.Y * 0.4f; + float groundTiles = schematicSize.X * groundThreshold; + float totalTiles = schematicSize.X * schematicSize.Y; + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; + + //Crimson does not generate walls in blocks very much, so both walls and tiles are grouped + if (tile.TileType == TileID.Crimstone || tile.WallType == WallID.CrimstoneUnsafe) + crimsonStuffInArea++; + + //Do not cut into the altars + if (tile.TileType == TileID.DemonAltar) + canGenerateInLocation = false; + } + } + if (!canGenerateInLocation || crimsonStuffInArea < totalTiles * 0.5f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillCrimsonShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + + } while (tries <= 20000); + } + #endregion + + #region Desert Shrine + public static void FillDesertShrineChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.SpelunkerPotion, ItemID.MiningPotion, ItemID.BuilderPotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemID.DungeonDesertKey, 1), + new ChestItem(ItemID.DesertTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceDesertShrine(StructureMap structures) + { + int tries = 0; + string mapKey = DesertShrineKey; + + do + { + int placementPositionX = WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Right); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.3f), (int)(Main.maxTilesY * 0.55f)); + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int desertTilesInArea = 0; + int xCheckArea = 50; + bool canGenerateInLocation = true; + + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; + + if (tile.TileType == TileID.DesertFossil || tile.TileType == TileID.Sand || tile.TileType == TileID.HardenedSand || tile.TileType == TileID.Sandstone) + desertTilesInArea++; + } + } + if (!canGenerateInLocation || desertTilesInArea < totalTiles * 0.3f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillDesertShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + + } while (tries <= 20000); + } + #endregion + + #region Granite Shrine + public static void FillGraniteShrineChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.Geode, WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemID.BlueTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceGraniteShrine(StructureMap structures) + { + int tries = 0; + string mapKey = GraniteShrineKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.55f), (int)(Main.maxTilesY * 0.85f)); + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int graniteWallsInArea = 0; + bool canGenerateInLocation = true; + + float totalTiles = schematicSize.X * schematicSize.Y; + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; + + //The granite geode is supposed to fully float in free air. No tile replacements + if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile) + graniteWallsInArea++; + } + } + if (!canGenerateInLocation || graniteWallsInArea < totalTiles * 0.95f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillGraniteShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + + } while (tries <= 20000); + } + #endregion + + #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(ModContent.ItemType(), 1), + new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemID.FrozenKey, 1), + new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(foodType, WorldGen.genRand.Next(10, 12 + 1)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceIceShrine(StructureMap structures) + { + int tries = 0; + string mapKey = IceShrineKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.25f), (int)(Main.maxTilesX * 0.75f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.35f), (int)(Main.maxTilesY * 0.7f)); + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int iceTilesInArea = 0; + int xCheckArea = 80; + int yCheckArea = 20; + bool canGenerateInLocation = true; + + float totalTiles = (schematicSize.X + xCheckArea * 2) * (schematicSize.Y + yCheckArea * 2); + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + { + for (int y = placementPoint.Y - yCheckArea; y < placementPoint.Y + schematicSize.Y + yCheckArea; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + //Ice biomes obviously have a lot of water + if (ShouldAvoidLocation(new Point(x, y), false)) + canGenerateInLocation = false; + + if (tile.TileType == TileID.SnowBlock || tile.TileType == TileID.IceBlock) + iceTilesInArea++; + } + } + if (!canGenerateInLocation || iceTilesInArea < totalTiles * 0.35f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillIceShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + + } while (tries <= 20000); + } + #endregion + + #region Marble Shrine + public static void FillMarbleShrineChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(WorldGen.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar, WorldGen.genRand.Next(12, 15 + 1)), + new ChestItem(ItemID.WhiteTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceMarbleShrine(StructureMap structures) + { + int tries = 0; + string mapKey = MarbleShrineKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.55f), (int)(Main.maxTilesY * 0.85f)); + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int marbleStuffInArea = 0; + int airTilesBetweenPillar = 0; + bool canGenerateInLocation = true; + + float totalTiles = schematicSize.X * schematicSize.Y; + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (ShouldAvoidLocation(new Point(x, y))) + canGenerateInLocation = false; + + //Marble biomes either have blocks or walls, occasionally both + //This should be near maximum to prevent the structure from overextending + if (tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) + marbleStuffInArea++; + + //There should be some space between the pillars so it doesn't make pillars in the middle of nowhere zone + float pillarFoundationBound = schematicSize.Y * 0.2f; + bool pillarSpace = y <= placementPoint.Y + schematicSize.Y - pillarFoundationBound && y >= placementPoint.Y + pillarFoundationBound; + if (pillarSpace && !tile.HasTile) + airTilesBetweenPillar++; + } + } + + if (!canGenerateInLocation || marbleStuffInArea < totalTiles * 0.9f || airTilesBetweenPillar < totalTiles * 0.3f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillMarbleShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + + } while (tries <= 20000); + } + #endregion + + #region Mushroom Shrine + public static void FillMushroomShrineChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.SpelunkerPotion, ItemID.MiningPotion, ItemID.BuilderPotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.TruffleWorm, 3), + //TODO -- Mushroom Torches are 1.4.4. exclusive + //new ChestItem(ItemID.MushroomTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceMushroomShrine(StructureMap structures) + { + int tries = 0; + string mapKey = MushroomShrineKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.5f), (int)(Main.maxTilesY * 0.8f)); + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int realMushroomsInArea = 0; + int extraArea = 20; + int yExtraArea = 40; + bool canGenerateInLocation = true; + + float requiredShrooms = 20; //for now lower this, will look through the gen later + for (int x = placementPoint.X - extraArea; x < placementPoint.X + schematicSize.X + extraArea; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y + yExtraArea; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + + //For some reason, mushroom biomes are very wet + //It gets way too difficult to generate if it doesn't ignore water + + if (ShouldAvoidLocation(new Point(x, y), false)) + canGenerateInLocation = false; + + //Only generated within the area of mushroom plants + if (tile.TileType == TileID.MushroomPlants || tile.TileType == TileID.MushroomVines || tile.TileType == TileID.MushroomTrees) + realMushroomsInArea++; + } + } + if (!canGenerateInLocation || realMushroomsInArea < requiredShrooms || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillMushroomShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; + } + + } while (tries <= 20000); + } + #endregion + + #region Surface Shrine + public static void FillSurfaceShrineChest(Chest chest) + { + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.TeleportationPotion, ItemID.CalmingPotion, ItemID.SwiftnessPotion); + List contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.PinkGel, WorldGen.genRand.Next(24, 28 + 1)), + new ChestItem(ItemID.Torch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + public static void PlaceSurfaceShrine(StructureMap structures) + { + int tries = 0; + string mapKey = SurfaceShrineKey; + + do + { + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2f), (int)(Main.maxTilesX * 0.8f)); + int numTilesBelowSurface = WorldGen.genRand.Next(25, 50); + + //use Main.worldSurface and not WorldGen.WorldSurface, i believe that is why it was genning on the surface so much + int placementPositionY = (int)Main.worldSurface + numTilesBelowSurface; + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int normalTilesInArea = 0; + int activeTilesInArea = 0; + bool canGenerateInLocation = true; + + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + // Liquids are fine, the structure is sealed. + if (ShouldAvoidLocation(new Point(x, y), false)) + canGenerateInLocation = false; + + if (tile.TileType == TileID.Dirt || tile.TileType == TileID.Stone || tile.TileType == TileID.ClayBlock || tile.TileType == TileID.Sand) + normalTilesInArea++; + + if (tile.HasTile) + activeTilesInArea++; + + // Avoid the desert due to sand checks. + if (tile.WallType == WallID.HardenedSand || tile.WallType == WallID.Sandstone) + canGenerateInLocation = false; + } + } + + if (!canGenerateInLocation || normalTilesInArea < activeTilesInArea * 0.8f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + { + tries++; + } + else + { + Point result; + Point shrineTunnelPlacementPoint = new Point(placementPoint.X + (int)(schematicSize.X * 0.5f), placementPoint.Y); + bool flag = WorldUtils.Find(shrineTunnelPlacementPoint, Searches.Chain(new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result); + if (WorldUtils.Find(shrineTunnelPlacementPoint, Searches.Chain(new Searches.Up(shrineTunnelPlacementPoint.Y - result.Y), new Conditions.IsTile(TileID.Sand)), out Point _)) + { + tries++; + } + else if (!flag) + { + tries++; + } + else + { + result.Y += numTilesBelowSurface; + + bool[] array = new bool[TileID.Sets.GeneralPlacementTiles.Length]; + for (int i = 0; i < array.Length; i++) + array[i] = TileID.Sets.GeneralPlacementTiles[i]; + + array[TileID.Containers] = false; + array[TileID.Containers2] = false; + + if (!structures.CanPlace(new Rectangle(shrineTunnelPlacementPoint.X, result.Y + 10, 1, shrineTunnelPlacementPoint.Y - result.Y - 9), array, 2)) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillSurfaceShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + + // Generate entrance tunnel + ShapeData data = new ShapeData(); + WorldUtils.Gen(new Point(shrineTunnelPlacementPoint.X, result.Y + 10), new Shapes.Rectangle(1, shrineTunnelPlacementPoint.Y - result.Y - 9), Actions.Chain(new Modifiers.Blotches(2, 0.2), new Modifiers.SkipTiles(TileID.LivingWood, TileID.LeafBlock), new Actions.ClearTile().Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(TileID.Sand), new Actions.SetTile(TileID.HardenedSand).Output(data))); + WorldUtils.Gen(new Point(shrineTunnelPlacementPoint.X, result.Y + 10), new ModShapes.All(data), new Actions.SetFrames(frameNeighbors: true)); + + break; + } + } + } + + } while (tries <= 20000); + } + #endregion + + //Enums and generation methods for old shrines + //Currently still used for Abyss (Terminus) shrine #region Enumeration public enum UndergroundShrineType { @@ -110,44 +748,48 @@ namespace CalamityMod.World public static void SpecialChest(UndergroundShrineType shrineType) { int item = 0; - int chestType = 0; + //1.4 chests are dubious and use another ID type, so there's 2 now + int chestType = 21; + int chestSubType = 0; switch (shrineType) { case UndergroundShrineType.Surface: - item = ModContent.ItemType(); + item = ModContent.ItemType(); //Default chest break; case UndergroundShrineType.Cavern: item = ModContent.ItemType(); - chestType = 44; + chestSubType = 44; //Obsidian break; case UndergroundShrineType.WorldEvil: item = WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType(); - chestType = WorldGen.crimson ? 43 : 3; + chestType = WorldGen.crimson ? 21 : 467; //Flesh and Lesion + chestSubType = WorldGen.crimson ? 43 : 3; break; case UndergroundShrineType.Ice: item = ModContent.ItemType(); - chestType = 47; + chestSubType = 47; //Glass break; case UndergroundShrineType.Desert: item = ModContent.ItemType(); - chestType = 30; + chestType = 467; + chestSubType = 10; //Sandstone break; case UndergroundShrineType.Mushroom: item = ModContent.ItemType(); - chestType = 32; + chestSubType = 32; //Mushroom break; case UndergroundShrineType.Granite: item = ModContent.ItemType(); - chestType = 50; + chestSubType = 50; //Granite break; case UndergroundShrineType.Marble: item = ModContent.ItemType(); - chestType = 51; + chestSubType = 51; //Marble break; case UndergroundShrineType.Abyss: item = ModContent.ItemType(); - chestType = 4; + chestType = ModContent.TileType(); break; } @@ -172,12 +814,12 @@ namespace CalamityMod.World } // Place the chest, finally - WorldGen.AddBuriedChest(CalamityWorld.SChestX[(int)shrineType], CalamityWorld.SChestY[(int)shrineType], item, false, chestType); + WorldGen.AddBuriedChest(CalamityWorld.SChestX[(int)shrineType], CalamityWorld.SChestY[(int)shrineType], item, false, chestSubType, false, (ushort)(chestType)); } #endregion #region Direct Gen - public static void PlaceShrines() + /*public static void PlaceShrines() { int x = Main.maxTilesX; int y = Main.maxTilesY; @@ -218,7 +860,7 @@ namespace CalamityMod.World } } - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Cavern Shrine + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Cavern { int tilesX = WorldGen.genRand.Next((int)(x * 0.3), generateBack); int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.7)); @@ -295,7 +937,7 @@ namespace CalamityMod.World break; } } - } + }*/ #endregion } } diff --git a/World/VernalPass.cs b/World/VernalPass.cs new file mode 100644 index 0000000000..93fbc7bbcb --- /dev/null +++ b/World/VernalPass.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; +using static CalamityMod.Schematics.SchematicManager; + +namespace CalamityMod.World +{ + public class VernalPass + { + public static void PlaceVernalPass(StructureMap structures) + { + string mapKey = VernalKey; + var schematic = TileMaps[mapKey]; + + int placementPositionX = WorldGen.genRand.Next(WorldGen.tLeft, WorldGen.tRight); + int placementPositionY = WorldGen.tTop < Main.rockLayer - 10 ? WorldGen.tBottom + 120 : WorldGen.tTop - 120; + Point placementPoint = new Point(placementPositionX, placementPositionY); + + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); + SchematicAnchor anchorType = SchematicAnchor.Center; + + bool firstItem = false; + PlaceSchematic(mapKey, placementPoint, anchorType, ref firstItem, new Action(FillVernalPassChests)); + + // Add the Vernal Pass as a protected structure. + Rectangle protectionArea = CalamityUtils.GetSchematicProtectionArea(schematic, placementPoint, anchorType); + structures.AddProtectedStructure(protectionArea, 30); + } + + public static void FillVernalPassChests(Chest chest, int Type, bool firstItem) + { + int mainItem = Utils.SelectRandom(WorldGen.genRand, ItemID.StaffofRegrowth, ItemID.AnkletoftheWind, ItemID.FeralClaws); + + int bars = Utils.SelectRandom(WorldGen.genRand, ItemID.GoldBar, ItemID.PlatinumBar); + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ThornsPotion, ItemID.BattlePotion, ItemID.ShinePotion, ItemID.HunterPotion); + List contents = new List() + { + new ChestItem(bars, WorldGen.genRand.Next(4, 7)), + new ChestItem(ItemID.JungleSpores, WorldGen.genRand.Next(4, 8)), + new ChestItem(ItemID.Stinger, WorldGen.genRand.Next(2, 5)), + new ChestItem(ItemID.JungleTorch, WorldGen.genRand.Next(2, 5)), + new ChestItem(potionType, WorldGen.genRand.Next(1, 4)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(1, 3)), + }; + + if (!firstItem) + { + contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); + } + else + { + contents.RemoveAt(0); + contents.Insert(0, new ChestItem(mainItem, 1)); + contents.Insert(1, new ChestItem(bars, WorldGen.genRand.Next(4, 7))); + } + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + } +} diff --git a/build.txt b/build.txt index 4f61b25b2b..4797dc7a0f 100644 --- a/build.txt +++ b/build.txt @@ -1,8 +1,8 @@ author = Fabsol and the Dev Team -version = 2.0.1.005 +version = 2.0.2.001 displayName = Calamity Mod homepage = https://discord.gg/calamity -buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes +buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, .github\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes, Effects\Compiler\* hideCode = true hideResources = true includeSource = false