diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 20e9fc81b2..6f648e8f7b 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -4,25 +4,25 @@ using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; -using CalamityMod.Projectiles.Typeless; -using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; +using CalamityMod.Projectiles.Typeless; using System.Collections.Generic; using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Yharon; namespace CalamityMod.Balancing { @@ -94,7 +94,7 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Demon Scythes. + // 50% resist to Demon Scythe. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); #endregion @@ -102,7 +102,7 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Demon Scythes. + // 50% resist to Demon Scythe. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); // 40% resist to Sky Glaze. @@ -118,37 +118,48 @@ namespace CalamityMod.Balancing #endregion #region Wall of Flesh - //45% resist to Corro/Crimslime Staff. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.WallofFleshEye, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType(), ProjectileType())))); + // 40% resist to Corro/Crimslime Staff. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.WallofFleshEye, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType())))); #endregion #region Aquatic Scourge // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Dormant Brimseekers. + // 50% resist to Adamantite Throwing Axe's lightning. + // Twisting Thunder and Gael's greatsword use this projectile too, but they are far beyond progression, so who cares! + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + + // 50% resist to Dormant Brimseeker. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Mounted Scanner. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 40% resist to SHPC. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 40% resist to Cryophobia. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 40% resist to SHPC. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 30% resist to Meowthrower. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + + // 25% resist to Snowstorm Staff. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); #endregion #region The Destroyer // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Dormant Brimseekers. + // 50% resist to Dormant Brimseeker. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 50% resist to Adamantite Throwing Axe's lightning. + // See Aquatic Scourge comment. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + // 45% resist to Mounted Scanner. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); @@ -158,11 +169,11 @@ namespace CalamityMod.Balancing // 25% resist to SHPC. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); - // 15% resist to Mineral Mortar's Projectile. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 25% resist to Snowstorm Staff. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); - // 15% resist to Snowstorm Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + // 15% resist to Mineral Mortar's projectile. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); #endregion #region Astrum Aureus @@ -174,12 +185,14 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(ResistTrueMelee(0.5f)))); + // 50% resist to Aegis Blade's explosions because the true melee resist ain't enough. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 40% resist to Flying Dragon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileID.DD2SquireSonicBoom)))); // 30% resist to Aurora Blazer. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - #endregion #region Duke Fishron @@ -193,6 +206,12 @@ namespace CalamityMod.Balancing #endregion #region Lunatic Cultist + // 50% resist to Aegis Blade's explosions. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + + // 35% resist to Subduction Slicer's flame pillars. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + // 20% resist to Art Attack. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); @@ -216,16 +235,13 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(ResistTrueMelee(0.5f)))); - // 25% resist to Resurrection Butterfly. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + // 20% resist to Resurrection Butterfly. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); #endregion #region Moon Lord // 20% resist to Mercurial Tides (True Biome Blade). NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); - - // 15% resist to Pestilent Defiler. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType(), ProjectileType())))); #endregion #region Profaned Guardians @@ -247,10 +263,10 @@ namespace CalamityMod.Balancing // 50% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Dazzling Stabbers. + // 50% resist to Dazzling Stabber Staff. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Elemental Axes. + // 50% resist to Elemental Axe. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Pristine Fury's alt fire. @@ -264,8 +280,8 @@ namespace CalamityMod.Balancing #endregion #region Old Duke - // 60% resist to Last Mourning. - // This will technically catch pumpkins from the Horseman's Blade but that shouldn't really matter. + // 60% resist to The Last Mourning's projectiles. + // This will technically catch pumpkins from The Horseman's Blade but that shouldn't really matter. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileID.FlamingJack))); // 20% resist to Time Bolt. @@ -319,11 +335,8 @@ namespace CalamityMod.Balancing // 20% resist to Zenith. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FinalFractal)))); - // 15% resist to Enforcer projectiles. + // 15% resist to The Enforcer's projectiles. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - - // 15% resist to Murasama. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); #endregion #region Exo Mechs: Artemis and Apollo @@ -331,7 +344,7 @@ namespace CalamityMod.Balancing // TODO -- NPC sets (mostly worm bosses) should probably be their own holding class. int[] exoTwins = new int[] { NPCType(), NPCType() }; - // 10% resist to Eclipse's Fall stealth strike. + // 10% resist to Eclipse's Fall's mini spears. NPCSpecificBalancingChanges.AddRange(Bundle(exoTwins, Do(new ProjectileResistBalancingRule(0.9f, ProjectileType())))); #endregion @@ -339,10 +352,10 @@ namespace CalamityMod.Balancing // 65% resist to true melee. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(ResistTrueMelee(0.35f)))); - // 65% resist to Enforcer projectiles. + // 65% resist to The Enforcer's projectiles. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); - // 65% resist to Final Dawn lunge. + // 65% resist to The Final Dawn's lunge. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 60% resist to Dynamic Pursuer. @@ -351,10 +364,10 @@ namespace CalamityMod.Balancing // 50% resist to Chicken Cannon. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Tarragon Throwing Darts Thorns. (LOL) + // 50% resist to Tarragon Throwing Dart's thorns. (LOL) NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Vehemence skulls. + // 50% resist to Vehemence's skulls. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType())))); // 50% resist to Yharim's Crystal. @@ -365,14 +378,14 @@ namespace CalamityMod.Balancing // 40% resist to Rancor. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - + + // 35% resist to The Anomaly's Nanogun bomb explosions. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + // 35% resist to Ultima. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - // 35% resist to Anomaly's Nanogun bomb explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); - - // 30% resist to Eclipse Fall. + // 30% resist to Eclipse's Fall. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Prismatic Breaker's laser beam. @@ -384,7 +397,7 @@ namespace CalamityMod.Balancing // 30% resist to Sirius. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - // 30% resist to Dragon Scales and The Wand's tornadoes + // 30% resist to Dragon Scales and The Wand's tornadoes. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); // 25% resist to the Spin Throw part of the Ark of the Cosmos' combo. @@ -402,22 +415,22 @@ namespace CalamityMod.Balancing // 25% resist to Zenith. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); - // 20% resist to Blood Boiler fire. + // 20% resist to Blood Boiler. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Eradicator beams. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - // 20% resist to Plasma Grenade and Dynamic Pursuer's explosions + // 20% resist to Plasma Grenade and Dynamic Pursuer's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(),ProjectileType(), ProjectileType())))); // 20% resist to Voltaic Climax / Void Vortex hitscan beams. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - // 15% resist to Final Dawn AoE sweep flames. + // 15% resist to The Final Dawn's AoE sweep flames. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); - // 15% resist to Godslayer Slugs. + // 15% resist to God Slayer Slugs. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to Gruesome Eminence. diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs index c385db4eec..92cab6a912 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +20,8 @@ namespace CalamityMod.Buffs.StatBuffs CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.abyssalDivingSuitPrevious) { - player.gills = true; + if (player.IsUnderwater()) + player.gills = true; modPlayer.abyssalDivingSuitPower = true; modPlayer.depthCharm = true; modPlayer.jellyfishNecklace = true; diff --git a/Buffs/StatBuffs/Haste.cs b/Buffs/StatBuffs/Haste.cs new file mode 100644 index 0000000000..e4fa6b578c --- /dev/null +++ b/Buffs/StatBuffs/Haste.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class Haste : ModBuff + { + public override void SetStaticDefaults() + { + 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) + { + // keep the buff active as long as the player's haste level is up + if (player.Calamity().hasteLevel > 0) + { + player.buffTime[buffIndex] = 60; + } + } + } +} diff --git a/Buffs/StatBuffs/Haste.png b/Buffs/StatBuffs/Haste.png new file mode 100644 index 0000000000..b0e7aebaac Binary files /dev/null and b/Buffs/StatBuffs/Haste.png differ diff --git a/Buffs/StatDebuffs/FrozenLungs.png b/Buffs/StatDebuffs/FrozenLungs.png index c44a4a4a0f..62fea4a1b6 100644 Binary files a/Buffs/StatDebuffs/FrozenLungs.png and b/Buffs/StatDebuffs/FrozenLungs.png differ diff --git a/Buffs/StatDebuffs/TemporalSadness.png b/Buffs/StatDebuffs/TemporalSadness.png index 48d71f8a78..2997431ce1 100644 Binary files a/Buffs/StatDebuffs/TemporalSadness.png and b/Buffs/StatDebuffs/TemporalSadness.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index cdd577d58f..d05a267f4d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -978,6 +978,8 @@ namespace CalamityMod.CalPlayer public bool avertorBonus = false; public bool divineBless = false; public bool infiniteFlight = false; + public int hasteCounter = 0; + public int hasteLevel = 0; #endregion #region Minion @@ -2469,6 +2471,8 @@ namespace CalamityMod.CalPlayer healingPotionMultiplier = 1f; avertorBonus = false; divineBless = false; + hasteLevel = 0; + hasteCounter = 0; #endregion #region Armor Set Bonuses @@ -3656,7 +3660,8 @@ namespace CalamityMod.CalPlayer (silvaSet ? 0.05f : 0f) + (blueCandle ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f); + ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) + + (hasteLevel * 0.05f); float runSpeedMult = 1f + (lunicCorpsLegs ? 0.1f : 0f) + @@ -3670,7 +3675,8 @@ namespace CalamityMod.CalPlayer (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f); + ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) + + (hasteLevel * 0.05f); if ((Player.slippy || Player.slippy2) && Player.iceSkate) runAccMult *= 0.6f; diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index bffea92b00..90cc0a06f0 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -190,7 +190,7 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(chanceForBiomeCrate)) { if (ZoneCalamity) - itemDrop = ModContent.ItemType(); + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); else itemDrop = Main.hardMode ? ItemID.LavaCrateHard : ItemID.LavaCrate; } @@ -267,9 +267,9 @@ namespace CalamityMod.CalPlayer { List biomeCrateList = new List(); - biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneAstral); - biomeCrateList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); - biomeCrateList.AddWithCondition(ModContent.ItemType(), canSulphurFish); + biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), ZoneAstral); + biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), ZoneSunkenSea); + biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : 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); @@ -309,15 +309,15 @@ namespace CalamityMod.CalPlayer { if (ZoneAstral) { - itemDrop = ModContent.ItemType(); + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); } if (ZoneSunkenSea) { - itemDrop = ModContent.ItemType(); + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); } if (canSulphurFish) { - itemDrop = ModContent.ItemType(); + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); } } return; @@ -546,7 +546,7 @@ namespace CalamityMod.CalPlayer { if (attempt.crate) { - itemDrop = ModContent.ItemType(); + itemDrop = Main.hardMode? ModContent.ItemType() : ModContent.ItemType(); } else if (attempt.legendary) { diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 435da62a02..2e574f5687 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -741,30 +741,6 @@ namespace CalamityMod.CalPlayer // The amount of damage that will be dealt is yet to be determined. // - if (areThereAnyDamnBosses && CalamityMod.bossVelocityDamageScaleValues.ContainsKey(npc.type)) - { - CalamityMod.bossVelocityDamageScaleValues.TryGetValue(npc.type, out float velocityScalar); - - if (((npc.type == NPCID.EyeofCthulhu || npc.type == NPCID.Spazmatism) && npc.ai[0] >= 2f) || (npc.type == NPCID.Plantera && npc.life / (float)npc.lifeMax <= 0.5f) || - (npc.type == ModContent.NPCType() && npc.life / (float)npc.lifeMax < 0.6f)) - velocityScalar = CalamityMod.bitingEnemeyVelocityScale; - - if (npc.velocity == Vector2.Zero) - { - contactDamageReduction += 1f - velocityScalar; - } - else - { - float amount = npc.velocity.Length() / (npc.Calamity().maxVelocity * 0.5f); - if (amount > 1f) - amount = 1f; - - float damageReduction = MathHelper.Lerp(velocityScalar, 1f, amount); - if (damageReduction < 1f) - contactDamageReduction += 1f - damageReduction; - } - } - if (transformer) { if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || @@ -1318,6 +1294,10 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(BuffID.Weak, 300); } + else if (proj.type == ProjectileID.CursedFlameHostile) + { + Player.AddBuff(BuffID.CursedInferno, 120); + } else if (proj.type == ProjectileID.ThornBall) { Player.AddBuff(BuffID.Poisoned, 480); @@ -2011,8 +1991,8 @@ namespace CalamityMod.CalPlayer if (hideOfDeus) { hideOfDeusMeleeBoostTimer += 3 * hurtInfo.Damage; - if (hideOfDeusMeleeBoostTimer > 900) - hideOfDeusMeleeBoostTimer = 900; + if (hideOfDeusMeleeBoostTimer > 600) + hideOfDeusMeleeBoostTimer = 600; } if (Player.whoAmI == Main.myPlayer) @@ -2408,7 +2388,7 @@ namespace CalamityMod.CalPlayer int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(320); astralStarDamage = Player.ApplyArmorAccDamageBonusesTo(astralStarDamage); - Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), blazeDamage, 5f, Player.whoAmI, 0f, 1f); + Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), blazeDamage, 5f, Player.whoAmI, 0f, 1f); for (int n = 0; n < 12; n++) { CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), astralStarDamage, 5f, Player.whoAmI); diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 46dceb4a38..14435855ad 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -953,7 +953,7 @@ namespace CalamityMod.CalPlayer { if (!Main.rand.NextBool(3)) continue; - + Dust holyCinder = Dust.NewDustDirect(Player.position, Player.width, Player.height, (int)CalamityDusts.ProfanedFire); holyCinder.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f); holyCinder.velocity.Y -= Main.rand.NextFloat(1f, 3f); @@ -1025,7 +1025,7 @@ namespace CalamityMod.CalPlayer Vector2 spawnPoint = new Vector2(Player.Center.X + Main.rand.Next(-1000, 1001), Player.Center.Y - Main.rand.Next(700, 801)); if (Player.miscCounter % slimeRainRate == 0f) - { + { if (DownedBossSystem.downedAquaticScourge && !DownedBossSystem.downedPolterghast && Main.rand.NextBool(12)) { NPC.NewNPC(new EntitySource_SpawnNPC(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); @@ -1119,7 +1119,7 @@ namespace CalamityMod.CalPlayer { Player.velocity.Y += Player.gravity * Player.gravDir * (BalancingConstants.HoldingDownGravityMultiplier - 1f); if (Player.Calamity().gSabaton) - { + { Player.maxFallSpeed *= 1.5f; } if (Player.velocity.Y * Player.gravDir > Player.maxFallSpeed) @@ -1259,7 +1259,7 @@ namespace CalamityMod.CalPlayer } } - if (target > 0) + if (target > 0) { unstableSelectedTarget = Main.npc[target]; unstableSelectedTarget.Calamity().arcZapCooldown = 18; @@ -1479,7 +1479,7 @@ namespace CalamityMod.CalPlayer auralisAurora--; if (auralisAuroraCooldown > 0) auralisAuroraCooldown--; - + if (blazingCore) { if (blazingCoreSuccessfulParry > 0) @@ -1491,7 +1491,7 @@ namespace CalamityMod.CalPlayer { FlameLickedShell.HandleParryCountdown(Player); } - + // Silver Armor "Medkit" effect if (silverMedkitTimer > 0) { @@ -1871,6 +1871,25 @@ namespace CalamityMod.CalPlayer else if (polarisBoostCounter >= 10) polarisBoostTwo = true; + // Haste buff + if (hasteLevel > 0) + { + // capped out at 3 + if (hasteLevel > 3) + hasteLevel = 3; + // if the haste counter hits 5 seconds, subtract a haste level, and if there are none left afterwards, delete the buff + if (++hasteCounter == 300) + { + hasteLevel--; + if (hasteLevel <= 0) + { + if (Player.FindBuffIndex(ModContent.BuffType()) > -1) + Player.ClearBuff(ModContent.BuffType()); + } + hasteCounter = 0; + } + } + // Calcium Potion buff if (calcium) Player.noFallDmg = true; @@ -2488,7 +2507,7 @@ namespace CalamityMod.CalPlayer if (decayEffigy) { Player.buffImmune[ModContent.BuffType()] = true; - if (!ZoneAbyss) + if (!ZoneAbyss && Player.IsUnderwater()) { Player.gills = true; } @@ -2767,9 +2786,6 @@ namespace CalamityMod.CalPlayer } } - if (CalamityLists.scopedWeaponList.Contains(Player.ActiveItem().type)) - Player.scope = true; - if (CalamityLists.highTestFishList.Contains(Player.ActiveItem().type)) Player.accFishingLine = true; diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index a6e99b607d..69b9abc839 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -120,9 +120,18 @@ namespace CalamityMod.CalPlayer break; case ItemID.BeeKeeper: + case ItemID.BladeofGrass: target.AddBuff(BuffID.Poisoned, 240); break; + case ItemID.FieryGreatsword: + target.AddBuff(BuffID.OnFire3, 180); + break; + + case ItemID.Muramasa: + target.AddBuff(BuffType(), 30); + break; + case ItemID.IceSickle: case ItemID.Frostbrand: target.AddBuff(BuffID.Frostburn2, 300); @@ -155,6 +164,7 @@ namespace CalamityMod.CalPlayer // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). if (target.type == NPCID.TargetDummy || target.type == NPCType()) return; + if (rageModeActive && shatteredCommunity) Player.GetModPlayer().AccumulateRageDamage(damageDone); } @@ -245,6 +255,7 @@ namespace CalamityMod.CalPlayer case ProjectileID.Bee: case ProjectileID.GiantBee: + case ProjectileID.BladeOfGrass: target.AddBuff(BuffID.Poisoned, 120); break; @@ -881,7 +892,7 @@ namespace CalamityMod.CalPlayer titanCooldown = 15; } - if (corrosiveSpine && modProj.stealthStrikeHitCount < 3) + if (corrosiveSpine && modProj.stealthStrikeHitCount < 3 && (Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()]) < 3) { for (int i = 0; i < 3; i++) { @@ -903,7 +914,7 @@ namespace CalamityMod.CalPlayer if (type != -1) { - int damage = (int)Player.GetTotalDamage().ApplyTo(24); + int damage = (int)Player.GetTotalDamage().ApplyTo(22); damage = Player.ApplyArmorAccDamageBonusesTo(damage); float speed = Main.rand.NextFloat(5f, 11f); diff --git a/CalamityLists.cs b/CalamityLists.cs index 1423df9741..ed977d0ed9 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -122,7 +122,6 @@ namespace CalamityMod public static List angryBonesList; public static List hornetList; public static List mossHornetList; - public static List bossMinionList; public static List minibossList; public static List pierceResistList; @@ -1024,6 +1023,8 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), + NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), @@ -1587,17 +1588,7 @@ namespace CalamityMod NPCType() }; - // TODO -- override HoldItem => Player.scope = true; on these items - scopedWeaponList = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - + // TODO -- override HoldItem => Player.accFishingLine = true; on these items, just like the scope fix... highTestFishList = new List() { ItemID.GoldenFishingRod, @@ -2097,7 +2088,7 @@ namespace CalamityMod { ProjectileID.Arkhalis, ProjectileID.ChargedBlasterLaser, - ProjectileID.ClingerStaff, + ProjectileID.ClingerStaff, ProjectileID.FinalFractal, ProjectileID.FlyingKnife, ProjectileID.LastPrismLaser, @@ -2148,6 +2139,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -2703,113 +2695,6 @@ namespace CalamityMod { NPCID.Deerclops, 44 } }; - bossMinionList = new List() - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.SlimeSpiked, - NPCID.ServantofCthulhu, - NPCType(), - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.SkeletronHand, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.LeechHead, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.WallofFleshEye, - NPCID.TheHungry, - NPCID.TheHungryII, - NPCID.QueenSlimeMinionBlue, - NPCID.QueenSlimeMinionPink, - NPCID.QueenSlimeMinionPurple, - NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeSaw, - NPCID.PrimeVice, - NPCType(), - NPCID.Probe, - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.PlanterasTentacle, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.Spore, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistLeft, - NPCID.GolemFistRight, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.AncientDoom, - NPCID.MoonLordLeechBlob, - NPCID.MoonLordFreeEye, - NPCID.MoonLordHand, - NPCID.MoonLordHead, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - legOverrideList = new List() { EquipLoader.GetEquipSlot(CalamityMod.Instance, "ProfanedSoulCrystal", EquipType.Legs), @@ -2897,7 +2782,6 @@ namespace CalamityMod angryBonesList = null; hornetList = null; mossHornetList = null; - bossMinionList = null; minibossList = null; pierceResistList = null; pierceResistExceptionLeviAureusList = null; diff --git a/CalamityMod.cs b/CalamityMod.cs index 911ac975a9..d11f1c6fe0 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -116,11 +116,6 @@ namespace CalamityMod // Boss Kill Time data structure public static SortedDictionary bossKillTimes; - // Boss velocity scaling data structure - public static SortedDictionary bossVelocityDamageScaleValues; - public const float velocityScaleMin = 0.5f; - public const float bitingEnemeyVelocityScale = 0.8f; - // Life steal cap public const int lifeStealCap = 10; @@ -136,6 +131,7 @@ namespace CalamityMod // Please keep this in alphabetical order so it's easy to read internal Mod ancientsAwakened = null; internal Mod bossChecklist = null; + internal Mod coloredDamageTypes = null; internal Mod crouchMod = null; internal Mod dialogueTweak = null; internal Mod fargos = null; @@ -166,6 +162,8 @@ namespace CalamityMod ModLoader.TryGetMod("AAMod", out ancientsAwakened); bossChecklist = null; ModLoader.TryGetMod("BossChecklist", out bossChecklist); + coloredDamageTypes = null; + ModLoader.TryGetMod("ColoredDamageTypes", out coloredDamageTypes); crouchMod = null; ModLoader.TryGetMod("CrouchMod", out crouchMod); dialogueTweak = null; @@ -231,7 +229,6 @@ namespace CalamityMod VanillaArmorChangeManager.Load(); SetupVanillaDR(); SetupBossKillTimes(); - SetupBossVelocityScalingValues(); SchematicManager.Load(); CustomLavaManagement.Load(); Attunement.Load(); @@ -401,6 +398,7 @@ namespace CalamityMod ancientsAwakened = null; bossChecklist = null; + coloredDamageTypes = null; crouchMod = null; dialogueTweak = null; fargos = null; @@ -420,8 +418,6 @@ namespace CalamityMod DRValues = null; bossKillTimes?.Clear(); bossKillTimes = null; - bossVelocityDamageScaleValues?.Clear(); - bossVelocityDamageScaleValues = null; BalancingChangesManager.Unload(); Attunement.Unload(); @@ -651,7 +647,7 @@ namespace CalamityMod { NPCID.EaterofWorldsHead, 7200 }, // 2:00 (120 seconds) { NPCID.EaterofWorldsBody, 7200 }, { NPCID.EaterofWorldsTail, 7200 }, - { NPCID.BrainofCthulhu, 5400 }, // 1:30 (90 seconds, total length of fight including Creepers phase) + { NPCID.BrainofCthulhu, 7200 }, // 2:00 (120 seconds, total length of fight including Creepers phase) { NPCID.Creeper, 1800 }, // 0:30 (30 seconds, length of Creepers phase) { NPCID.Deerclops, 5400 }, // 1:30 (90 seconds) { NPCID.QueenBee, 7200 }, // 2:00 (120 seconds) @@ -736,126 +732,6 @@ namespace CalamityMod } #endregion - #region Boss Velocity Contact Damage Scale Values - private void SetupBossVelocityScalingValues() - { - bossVelocityDamageScaleValues = new SortedDictionary { - { NPCID.KingSlime, velocityScaleMin }, - { NPCID.EyeofCthulhu, velocityScaleMin }, // Increases in phase 2 - { NPCID.EaterofWorldsHead, bitingEnemeyVelocityScale }, - { NPCID.EaterofWorldsBody, velocityScaleMin }, - { NPCID.EaterofWorldsTail, velocityScaleMin }, - { NPCID.Creeper, velocityScaleMin }, - { NPCID.BrainofCthulhu, velocityScaleMin }, - { NPCID.QueenBee, velocityScaleMin }, - { NPCID.SkeletronHead, velocityScaleMin }, - { NPCID.SkeletronHand, velocityScaleMin }, - { NPCID.TheHungry, bitingEnemeyVelocityScale }, - { NPCID.TheHungryII, bitingEnemeyVelocityScale }, - { NPCID.LeechHead, bitingEnemeyVelocityScale }, - { NPCID.LeechBody, velocityScaleMin }, - { NPCID.LeechTail, velocityScaleMin }, - { NPCID.QueenSlimeBoss, velocityScaleMin }, - { NPCID.Spazmatism, velocityScaleMin }, // Increases in phase 2 - { NPCID.Retinazer, velocityScaleMin }, - { NPCID.TheDestroyer, bitingEnemeyVelocityScale }, - { NPCID.TheDestroyerBody, velocityScaleMin }, - { NPCID.TheDestroyerTail, velocityScaleMin }, - { NPCID.SkeletronPrime, velocityScaleMin }, - { NPCID.PrimeCannon, velocityScaleMin }, - { NPCID.PrimeLaser, velocityScaleMin }, - { NPCID.PrimeSaw, velocityScaleMin }, - { NPCID.PrimeVice, velocityScaleMin }, - { NPCID.Plantera, velocityScaleMin }, // Increases in phase 2 - { NPCID.PlanterasTentacle, bitingEnemeyVelocityScale }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { NPCID.HallowBoss, velocityScaleMin }, - { NPCID.Golem, velocityScaleMin }, - { NPCID.GolemFistLeft, velocityScaleMin }, - { NPCID.GolemFistRight, velocityScaleMin }, - { NPCID.GolemHead, velocityScaleMin }, - { NPCID.DukeFishron, velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, // Increases in phase 2 - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale } - }; - } - #endregion - #region Music // This function returns an available Calamity Music Mod track, or null if the Calamity Music Mod is not available. diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index dd9088655a..17da40a107 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -108,10 +108,20 @@ namespace CalamityMod AndroombaFriendly.SwapSolution(index, solType); break; case CalamityModMessageType.SyncAndroombaAI: - int idx = reader.ReadInt32(); - int phase = reader.ReadInt32(); - if (Main.netMode != NetmodeID.MultiplayerClient) - AndroombaFriendly.ChangeAI(idx, phase); + { + int idx = reader.ReadInt32(); + int phase = reader.ReadInt32(); + if (Main.netMode != NetmodeID.MultiplayerClient) + AndroombaFriendly.ChangeAI(idx, phase); + } + break; + case CalamityModMessageType.SyncSlabCrabAI: + { + int idx = reader.ReadInt32(); + int phase = reader.ReadInt32(); + if (Main.netMode != NetmodeID.MultiplayerClient) + AndroombaFriendly.ChangeAI(idx, phase); + } break; case CalamityModMessageType.ServersideSpawnOldDuke: byte playerIndex2 = reader.ReadByte(); @@ -344,6 +354,7 @@ namespace CalamityMod DeleteAllSuperDummies, SyncAndroombaSolution, SyncAndroombaAI, + SyncSlabCrabAI, ServersideSpawnOldDuke, ArmoredDiggerCountdownSync, // TODO -- remove this mechanic entirely ProvidenceDyeConditionSync, // TODO -- this packetstorms if you hit Provi with spam weapons. It should ONLY send a packet if the status changes. diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index a1d3ef4179..c02786779b 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -323,7 +323,7 @@ namespace CalamityMod { 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 } }, + { NPCID.Creeper, new int[] { 20, 36, 66, 80, 108 } }, { ModContent.NPCType(), new int[] { 35, 63, 81, 90, 135 } }, { ModContent.NPCType(), new int[] { 25, 50, 62, 68, 90 } }, @@ -340,8 +340,8 @@ namespace CalamityMod { ModContent.NPCType(), new int[] { 10, 20, 26, 30, 45 } }, { NPCID.QueenBee, new int[] { 30, 54, 81, 99, 135 } }, - { NPCID.Bee, new int[] { 20, 24, 30, 36, 54 } }, - { NPCID.BeeSmall, new int[] { 15, 18, 24, 30, 45 } }, + { NPCID.Bee, new int[] { 20, 24, 48, 60, 72 } }, + { NPCID.BeeSmall, new int[] { 15, 18, 30, 44, 54 } }, { NPCID.SkeletronHead, new int[] { 35, // Same for all phases @@ -349,7 +349,7 @@ namespace CalamityMod 88, // 114 while spinning 99, // 128 while spinning 132 } }, // 171 while spinning - { NPCID.SkeletronHand, new int[] { 20, 44, 55, 66, 99 } }, + { NPCID.SkeletronHand, new int[] { 20, 44, 77, 88, 110 } }, { NPCID.ChaosBall, new int[] { -1, -1, -1, 40, 60 } }, { NPCID.Deerclops, new int[] { 20, 40, 50, 60, 80 } }, @@ -552,7 +552,7 @@ namespace CalamityMod EnemyStats.ProjectileDamageValues = new SortedDictionary, int[]> { - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 48, 66 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 0, 0, 44, 48, 66 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 68, 90 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 68, 90 } }, @@ -562,8 +562,12 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 68, 90 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 68, 90 } }, - { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 32, 48, 60, 68, 90 } }, - { new Tuple(NPCID.EaterofWorldsHead, ModContent.ProjectileType()), new int[] { 22, 36, 44, 48, 66 } }, + { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 0, 0, 60, 68, 90 } }, + { new Tuple(NPCID.EaterofWorldsHead, ModContent.ProjectileType()), new int[] { 0, 0, 0, 48, 66 } }, + + { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 0, 0, 68, 76, 102 } }, + { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodShot), new int[] { 0, 0, 60, 68, 90 } }, + { new Tuple(NPCID.Creeper, ProjectileID.BloodShot), new int[] { 0, 0, 60, 68, 90 } }, { 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 } }, @@ -602,8 +606,8 @@ namespace CalamityMod 68, 76, 102 } }, // 66 to 90, depending on life - { new Tuple(NPCID.WallofFleshEye, ProjectileID.DeathLaser), new int[] { 40, 72, 88, 96, 132 } }, - { new Tuple(NPCID.WallofFlesh, ProjectileID.DemonSickle), new int[] { 52, 92, 112, 124, 168 } }, + { new Tuple(NPCID.WallofFleshEye, ProjectileID.DeathLaser), new int[] { 0, 0, 88, 96, 132 } }, + { new Tuple(NPCID.WallofFlesh, ProjectileID.DemonSickle), new int[] { 0, 0, 112, 124, 168 } }, { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeGelAttack), new int[] { 60, 120, 136, 152, 210 } }, { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeSmash), new int[] { 80, 160, 188, 200, 270 } }, diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index edd6b46474..47c10cb3e8 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -192,6 +192,10 @@ namespace CalamityMod.Effects internal static Effect DeerclopsShadowShader; #endregion + #region YuH's Shaders + internal static Effect TeslaTrailShader; + #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 @@ -406,6 +410,11 @@ namespace CalamityMod.Effects RegisterMiscShader(DeerclopsShadowShader, "ShadowPass", "DeerclopsShadowShader"); #endregion + + #region Loading YuH's Shaders + TeslaTrailShader = LoadShader("TeslaTrail"); + RegisterMiscShader(TeslaTrailShader, "TrailPass", "TeslaTrail"); + #endregion } } } diff --git a/Effects/TeslaTrail.fx b/Effects/TeslaTrail.fx new file mode 100644 index 0000000000..3d1e36fe99 --- /dev/null +++ b/Effects/TeslaTrail.fx @@ -0,0 +1,56 @@ +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; +matrix uWorldViewProjection; +float4 uShaderSpecificData; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + return input.Color; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/TeslaTrail.xnb b/Effects/TeslaTrail.xnb new file mode 100644 index 0000000000..dddb5a1b3a Binary files /dev/null and b/Effects/TeslaTrail.xnb differ diff --git a/Items/Accessories/AnechoicPlating.cs b/Items/Accessories/AnechoicPlating.cs index 77358ce953..c6b90f1931 100644 --- a/Items/Accessories/AnechoicPlating.cs +++ b/Items/Accessories/AnechoicPlating.cs @@ -8,6 +8,10 @@ namespace CalamityMod.Items.Accessories public class AnechoicPlating : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; diff --git a/Items/Accessories/AquaticEmblem.cs b/Items/Accessories/AquaticEmblem.cs index bc9a9983b9..958a5c23bf 100644 --- a/Items/Accessories/AquaticEmblem.cs +++ b/Items/Accessories/AquaticEmblem.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Items.Accessories player.npcTypeNoAggro[NPCID.PinkJellyfish] = true; player.npcTypeNoAggro[NPCID.Crab] = true; player.npcTypeNoAggro[NPCID.Squid] = true; - player.gills = true; + if (player.IsUnderwater()) + player.gills = true; } } } diff --git a/Items/Accessories/DepthCharm.cs b/Items/Accessories/DepthCharm.cs index bd24061306..5d8efc5b12 100644 --- a/Items/Accessories/DepthCharm.cs +++ b/Items/Accessories/DepthCharm.cs @@ -9,6 +9,10 @@ namespace CalamityMod.Items.Accessories public class DepthCharm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index 3e66faa753..fa58539daf 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories player.buffImmune[ModContent.BuffType()] = true; modPlayer.hideOfDeus = true; if (modPlayer.hideOfDeusMeleeBoostTimer > 0) - player.GetDamage() += 0.5f; + player.GetDamage() += 0.3f; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Frostburn] = true; diff --git a/Items/Accessories/IronBoots.cs b/Items/Accessories/IronBoots.cs index 1ca7b5f98a..fd0925f6d1 100644 --- a/Items/Accessories/IronBoots.cs +++ b/Items/Accessories/IronBoots.cs @@ -9,6 +9,10 @@ namespace CalamityMod.Items.Accessories public class IronBoots : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 5cf41613f3..2cdc349fe1 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Items.Accessories { public class SandCloak : ModItem, ILocalizedModType { + public static float KnockbackStrength = 0.3f; + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { diff --git a/Items/Armor/Sulphurous/SulphurousHelmet.cs b/Items/Armor/Sulphurous/SulphurousHelmet.cs index ce99062974..6e78118aa0 100644 --- a/Items/Armor/Sulphurous/SulphurousHelmet.cs +++ b/Items/Armor/Sulphurous/SulphurousHelmet.cs @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Armor.Sulphurous { player.GetDamage() += 0.04f; player.GetCritChance() += 2; - player.gills = true; + if (player.IsUnderwater()) + player.gills = true; } public override void AddRecipes() diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 8699c788af..4cdcdf7210 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -437,20 +437,20 @@ namespace CalamityMod.Items modPlayer.canFireAtaxiaRogueProjectile = false; int flareID = ModContent.ProjectileType(); - // Ataxia Rogue Flares: 8 x 50%, soft cap starts at 120 base damage - int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 120); + // Ataxia Rogue Flares: 6 x 50%, soft cap starts at 90 base damage + int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 90); flareDamage = player.ApplyArmorAccDamageBonusesTo(flareDamage); if (player.whoAmI == Main.myPlayer) { SoundEngine.PlaySound(SoundID.Item20, player.Center); - float spread = 45f * 0.0174f; + float spread = 60f * 0.0174f; double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; + double deltaAngle = spread / 6f; double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 30f * i; Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI); Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI); } @@ -1256,7 +1256,8 @@ namespace CalamityMod.Items } else if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water { - player.gills = true; + if (player.IsUnderwater()) + player.gills = true; player.ignoreWater = true; player.noFallDmg = true; if (!player.mount.Active) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index f76e0aae59..965677ac33 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -284,22 +284,11 @@ namespace CalamityMod.Items if (item.type == ItemID.AnkhShield) EditTooltipByNum(1, (line) => line.Text += ", including Mighty Wind"); - // Water removing items cannot be used in the Abyss - string noAbyssLine = "\nCannot be used in the Abyss"; - if (item.type == ItemID.SuperAbsorbantSponge) - EditTooltipByNum(0, (line) => line.Text += noAbyssLine); - if (item.type == ItemID.EmptyBucket) - EditTooltipByName("Defense", (line) => line.Text += noAbyssLine); - // If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed. if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) EditTooltipByNum(0, (line) => line.Text += "\nDemon Altars now drop Souls of Night instead of generating ores when destroyed" + "\nHardmode ores now generate after defeating Mechanical Bosses for the first time"); - // Bottled Honey gives the Honey buff - if (item.type == ItemID.BottledHoney) - EditTooltipByName("HealLife", (line) => line.Text += "\nGrants the Honey buff for 2 minutes"); - // Warmth Potion provides debuff immunities if (item.type == ItemID.WarmthPotion) { @@ -448,16 +437,22 @@ namespace CalamityMod.Items EditTooltipByName("Knockback", (line) => line.Text += "\nIncreases how frequently the Orichalcum set bonus triggers on hit"); // Adamantite - if (item.type == ItemID.AdamantiteSword || item.type == ItemID.AdamantiteGlaive) + if (item.type == ItemID.AdamantiteSword) + EditTooltipByName("Material", (line) => line.Text += "\nSlows enemies on hit"); + + if (item.type == ItemID.AdamantiteGlaive) EditTooltipByName("Knockback", (line) => line.Text += "\nSlows enemies on hit"); // Titanium - if (item.type == ItemID.TitaniumSword || item.type == ItemID.TitaniumTrident) + if (item.type == ItemID.TitaniumSword) + EditTooltipByName("Material", (line) => line.Text += "\nDeals increased damage to enemies with high knockback resistance"); + + if (item.type == ItemID.TitaniumTrident) EditTooltipByName("Knockback", (line) => line.Text += "\nDeals increased damage to enemies with high knockback resistance"); // Hallowed (and True Excalibur) if (item.type == ItemID.Excalibur || item.type == ItemID.Gungnir || item.type == ItemID.TrueExcalibur) - EditTooltipByName("Knockback", (line) => line.Text += "\nDeals double damage to enemies above 75% life"); + EditTooltipByName("Material", (line) => line.Text += "\nDeals double damage to enemies above 75% life"); #endregion // Other melee weapon tooltips @@ -466,13 +461,27 @@ namespace CalamityMod.Items if (item.type == ItemID.CandyCaneSword || item.type == ItemID.FruitcakeChakram) EditTooltipByName("Knockback", (line) => line.Text += "\nHeals you on hit"); - // Stylish Scissors, all Phaseblades, and all Phasesabers - if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade) || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber) || item.type == ItemID.OrangePhaseblade || item.type == ItemID.OrangePhasesaber) + // Stylish Scissors, all Phaseblades, and all Phasesabers ignore 100% of defense + if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber) || item.type == ItemID.OrangePhasesaber) EditTooltipByName("Knockback", (line) => line.Text += "\nIgnores 100% of enemy defense"); - if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) + // Phaseblades are done separately to ensure it appears under the Material line + if (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade || item.type == ItemID.OrangePhaseblade) + EditTooltipByName("Material", (line) => line.Text += "\nIgnores 100% of enemy defense"); + + // Bone Sword, Breaker Blade, and Mandible Blade ignore 50% of defense + if (item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) EditTooltipByName("Knockback", (line) => line.Text += "\nIgnores 50% of enemy defense"); + // Mandible Blade is done separately to ensure it appears under the Material line + if (item.type == ItemID.AntlionClaw) + EditTooltipByName("Material", (line) => line.Text += "\nIgnores 50% of enemy defense"); + + // Muramasa inflicts Nightwither + if (item.type == ItemID.Muramasa) + EditTooltipByName("Material", (line) => line.Text += "\nInflicts Nightwither on hit"); + + // Death Sickle inflict Whispering Death if (item.type == ItemID.DeathSickle) EditTooltipByNum(0, (line) => line.Text += "\nInflicts Whispering Death on hit"); #endregion @@ -573,7 +582,7 @@ namespace CalamityMod.Items if (item.type == ItemID.HellfireTreads) { EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("fire blocks", "the Burning and On Fire! debuffs")); - EditTooltipByNum(3, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5\n" + + EditTooltipByNum(2, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5\n" + "All attacks inflict Hellfire"); } @@ -583,10 +592,6 @@ namespace CalamityMod.Items "Nearby fairies grant +2 HP/s life regen, 10 defense and 10% movement speed\n" + "Fairies are immune to damage and will no longer flee"); - // Armor Crunch immunity pre-Golem. - if (item.type == ItemID.ArmorPolish || item.type == ItemID.ArmorBracing) - EditTooltipByNum(0, (line) => line.Text += " and Armor Crunch"); - // Reduced Nightwither and Holy Flames damage, and melee speed removal. if (item.type == ItemID.MoonStone) { @@ -691,10 +696,9 @@ namespace CalamityMod.Items if (item.type == ItemID.MechanicalGlove) { - string extraLine = "\n12% increased melee speed, does not stack with downgrades"; - EditTooltipByNum(1, (line) => line.Text = "12% increased melee damage" + extraLine); - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12% increased melee speed", "12% increased melee speed, does not stack with downgrades")); - EditTooltipByNum(0, (line) => line.Text += "\n10% increased true melee damage"); + string extraLine = "\n10% increased true melee damage"; + string extraLine2 = "\n12% increased melee speed, does not stack with downgrades" + extraLine; + EditTooltipByNum(1, (line) => line.Text = "12% increased melee damage" + extraLine2); } if (item.type == ItemID.FireGauntlet) @@ -920,9 +924,11 @@ namespace CalamityMod.Items if (item.type == ItemID.Picksaw) EditTooltipByNum(0, (line) => line.Text += "\nCan mine Scoria Ore located in the Abyss"); - if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe - || item.type == ItemID.SolarFlareDrill || item.type == ItemID.VortexDrill || item.type == ItemID.NebulaDrill || item.type == ItemID.StardustDrill) - EditTooltipByName("Knockback", (line) => line.Text += "\nCan mine Uelibloom Ore"); + if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe) + EditTooltipByName("Material", (line) => line.Text += "\nCan mine Uelibloom Ore"); + + if (item.type == ItemID.SolarFlareDrill || item.type == ItemID.VortexDrill || item.type == ItemID.NebulaDrill || item.type == ItemID.StardustDrill) + EditTooltipByName("TileBoost", (line) => line.Text += "\nCan mine Uelibloom Ore"); #endregion // Rebalances and information about vanilla set bonuses diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index b11b67c31d..51829924ef 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -60,6 +60,7 @@ namespace CalamityMod.Items { ItemID.CandyCornRifle, Do(PointBlank, DamageExact(66)) }, { ItemID.Cascade, Do(AutoReuse, DamageExact(30)) }, { ItemID.ChainGuillotines, Do(DamageExact(100)) }, + { ItemID.ChainGun, Do(PointBlank, DamageExact(35)) }, { ItemID.ChainKnife, Do(AutoReuse, DamageRatio(1.34f)) }, // Uses ratios due to remix seed // Charged Blaster Cannon is now an earlier Last Prism-like, so it will probably need careful balance attention. // { ItemID.ChargedBlasterCannon, Do(DamageRatio(1.33f)) }, @@ -77,7 +78,8 @@ namespace CalamityMod.Items { ItemID.CrimsonYoyo, Do(AutoReuse, DamageExact(20)) }, // Artery { ItemID.CrystalDart, Do(DamageExact(20)) }, { ItemID.CrystalSerpent, Do(DamageExact(45)) }, - { ItemID.CrystalStorm, Do(DamageExact(40))}, + { ItemID.CrystalStorm, Do(DamageExact(40)) }, + { ItemID.CursedArrow, Do(DamageExact(15)) }, { ItemID.CursedDart, Do(DamageExact(25)) }, { ItemID.Cutlass, Do(UseRatio(0.9f), DamageRatio(1.85f)) }, { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, @@ -125,13 +127,14 @@ namespace CalamityMod.Items { ItemID.HallowedRepeater, Do(PointBlank, UseExact(12)) }, { ItemID.Handgun, Do(PointBlank, UseExact(22), DamageExact(36)) }, { ItemID.HellwingBow, Do(PointBlank, DamageExact(16)) }, - { ItemID.HighVelocityBullet, Do(DamageExact(15)) }, + { ItemID.HighVelocityBullet, Do(DamageExact(13)) }, { ItemID.HiveFive, Do(AutoReuse, DamageExact(26)) }, { ItemID.HornetStaff, Do(AutoReuse, DamageExact(13), UseExact(30)) }, { ItemID.IceBlade, Do(UseMeleeSpeed) }, { ItemID.IceBoomerang, Do(UseExact(25), ShootSpeedExact(9)) }, { ItemID.IceRod, Do(UseExact(6), DamageExact(30), ShootSpeedExact(20)) }, { ItemID.IceSickle, Do(AutoReuse, UseMeleeSpeed, DamageExact(75), ShootSpeedExact(20f)) }, + { ItemID.IchorArrow, Do(DamageExact(11)) }, { ItemID.ImpStaff, Do(AutoReuse, UseExact(30), DamageExact(25)) }, { ItemID.InfernoFork, Do(DamageRatio(1.2f)) }, { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(80), UseExact(25)) }, @@ -153,12 +156,14 @@ namespace CalamityMod.Items { ItemID.MedusaHead, Do(ManaExact(6), DamageRatio(1.2f)) }, { ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)/*, DamageRatio(1.33f) */) }, { ItemID.MeteorStaff, Do(DamageExact(58), ManaExact(7), ShootSpeedExact(13f)) }, + { ItemID.MiniNukeI, Do(DamageExact(90)) }, + { ItemID.MiniNukeII, Do(DamageExact(90)) }, { ItemID.Minishark, Do(PointBlank, DamageExact(4)) }, { ItemID.MoltenFury, Do(PointBlank, UseExact(29), AutoReuse) }, { 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.Muramasa, Do(CritDelta(+20)) }, + { ItemID.Muramasa, Do(CritDelta(+10)) }, { ItemID.MushroomSpear, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(100)) }, { ItemID.Musket, Do(PointBlank, DamageExact(22)) }, { ItemID.MythrilHalberd, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(95), ShootSpeedRatio(1.25f)) }, @@ -202,8 +207,6 @@ namespace CalamityMod.Items { ItemID.RedPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) }, { ItemID.RedRyder, Do(PointBlank, DamageExact(24)) }, { ItemID.RedsYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's throw and valkyrie's yoyo are the same weapon - { ItemID.RocketIII, Do(DamageRatio(0.75f)) }, - { ItemID.RocketIV, Do(DamageRatio(0.75f)) }, { ItemID.Sandgun, Do(PointBlank, DamageExact(22), UseExact(20)) }, { ItemID.SapphireStaff, Do(DamageExact(25)) }, { ItemID.SDMG, Do(PointBlank, DamageExact(80)) }, @@ -245,6 +248,7 @@ namespace CalamityMod.Items { ItemID.TheRottedFork, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.TheUndertaker, Do(PointBlank, AutoReuse, DamageExact(15)) }, { ItemID.ThunderSpear, Do(AutoReuse, UseMeleeSpeed) }, // Storm Spear + { ItemID.ThunderStaff, Do(DamageExact(18)) }, //Thunder Zapper { ItemID.TitaniumRepeater, Do(PointBlank, DamageExact(52)) }, { ItemID.TitaniumSword, Do(UseTurn, ScaleRatio(1.45f), DamageExact(77)) }, { ItemID.TitaniumTrident, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(72), ShootSpeedRatio(1.25f)) }, @@ -255,6 +259,7 @@ namespace CalamityMod.Items { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(107)) }, { ItemID.TrueNightsEdge, Do(DamageExact(105), ScaleRatio(1.2f)) }, { ItemID.Tsunami, Do(PointBlank, DamageExact(49)) }, + { ItemID.TungstenBullet, Do(DamageExact(8)) }, { ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageExact(15)) }, { ItemID.UnholyArrow, Do(DamageExact(11)) }, { ItemID.UnholyTrident, Do(ManaRatio(0.78f), DamageRatio(0.91f)) }, // Uses ratios due to remix seed @@ -430,7 +435,6 @@ namespace CalamityMod.Items #region CATEGORY 5: Point Blank support { ItemID.Blowpipe, pointBlank }, { ItemID.BorealWoodBow, pointBlank }, - { ItemID.ChainGun, pointBlank }, { ItemID.ChlorophyteShotbow, pointBlank }, { ItemID.CopperBow, pointBlank }, { ItemID.DartPistol, pointBlank }, diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 010b11a2cd..d7da76bafb 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches Item.ResearchUnlockCount = 5; ItemID.Sets.IsFishingCrate[Type] = true; ItemID.Sets.IsFishingCrateHardmode[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Fishing/AstralCatches/MonolithCrate.cs b/Items/Fishing/AstralCatches/MonolithCrate.cs new file mode 100644 index 0000000000..060d03675b --- /dev/null +++ b/Items/Fishing/AstralCatches/MonolithCrate.cs @@ -0,0 +1,65 @@ +using CalamityMod.Items.Critters; +using CalamityMod.Tiles.Astral; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.AstralCatches +{ + public class MonolithCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Materials + itemLoot.Add(ItemID.FallenStar, 1, 5, 10); + itemLoot.Add(ItemID.Meteorite, 5, 10, 20); + itemLoot.Add(ItemID.MeteoriteBar, 10, 1, 3); + + // Pet + itemLoot.Add(ModContent.ItemType(), 10); + + // Bait + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + itemLoot.Add(ItemID.EnchantedNightcrawler, 5, 1, 3); + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + + itemLoot.Add(ItemID.Firefly, 3, 1, 3); + + // Potions + itemLoot.AddCratePotionRules(false); + + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + } + } +} diff --git a/Items/Fishing/AstralCatches/MonolithCrate.png b/Items/Fishing/AstralCatches/MonolithCrate.png new file mode 100644 index 0000000000..a361991305 Binary files /dev/null and b/Items/Fishing/AstralCatches/MonolithCrate.png differ diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 572e31a6c4..81452c16a8 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { Item.ResearchUnlockCount = 5; ItemID.Sets.IsFishingCrate[Type] = true; + ItemID.Sets.IsFishingCrateHardmode[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs new file mode 100644 index 0000000000..55ff0e63e7 --- /dev/null +++ b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs @@ -0,0 +1,64 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Crags; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.BrimstoneCragCatches +{ + public class SlagCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // Materials + itemLoot.Add(ItemID.Obsidian, 1, 2, 5); + itemLoot.Add(ItemID.Hellstone, 4, 2, 5); + itemLoot.Add(ItemID.HellstoneBar, 10, 1, 3); + itemLoot.Add(ModContent.ItemType(), 1, 1, 4); + + // Weapons (none) + + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); + + // Potions + itemLoot.Add(ItemID.InfernoPotion, 10, 1, 3); + itemLoot.AddCratePotionRules(false); + + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + } + } +} diff --git a/Items/Fishing/BrimstoneCragCatches/SlagCrate.png b/Items/Fishing/BrimstoneCragCatches/SlagCrate.png new file mode 100644 index 0000000000..b69cdfa6ba Binary files /dev/null and b/Items/Fishing/BrimstoneCragCatches/SlagCrate.png differ diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs new file mode 100644 index 0000000000..d268fe1979 --- /dev/null +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -0,0 +1,122 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Tools.ClimateChange; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles.Abyss; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent.ItemDropRules; + +namespace CalamityMod.Items.Fishing.SulphurCatches +{ + public class HydrothermalCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + ItemID.Sets.IsFishingCrateHardmode[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) + { + // 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.downedCalamitasClone); + var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); + var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); + var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); + var tier3AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke); + + // Materials + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + itemLoot.Add(ModContent.ItemType(), 1, 5, 10); + + tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); + tier2AcidRain.Add(ModContent.ItemType(), 10, 1, 3); + 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); + + // Pre-HM Abyss Weapons + tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); + + // Post-AS Acid Rain Weapons (and Nuclear Rod) + tier2AcidRain.Add(new OneFromOptionsDropRule(10, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); + + // Pre-HM Abyss Equipment (and Torrential Tear) + tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); + + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); + + // Potions + itemLoot.Add(ModContent.ItemType(), 10, 1, 3); + itemLoot.AddCratePotionRules(); + + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + } + } +} diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.png b/Items/Fishing/SulphurCatches/HydrothermalCrate.png new file mode 100644 index 0000000000..9597cd29af Binary files /dev/null and b/Items/Fishing/SulphurCatches/HydrothermalCrate.png differ diff --git a/Items/Fishing/SulphurCatches/SulphurousCrate.cs b/Items/Fishing/SulphurCatches/SulphurousCrate.cs index 9d938e65e4..8c663bd6c9 100644 --- a/Items/Fishing/SulphurCatches/SulphurousCrate.cs +++ b/Items/Fishing/SulphurCatches/SulphurousCrate.cs @@ -9,7 +9,6 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Items.Placeables.Ores; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -53,13 +52,8 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // 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.downedCalamitasClone); - var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); - var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); - var tier3AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke); // Materials itemLoot.Add(ModContent.ItemType(), 1, 5, 10); @@ -68,13 +62,6 @@ namespace CalamityMod.Items.Fishing.SulphurCatches itemLoot.Add(ModContent.ItemType(), 1, 5, 10); tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - tier2AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - 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); // Pre-HM Abyss Weapons tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, @@ -85,17 +72,6 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType() )); - // Post-AS Acid Rain Weapons (and Nuclear Rod) - tier2AcidRain.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - // Pre-HM Abyss Equipment (and Torrential Tear) tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, ModContent.ItemType(), @@ -112,7 +88,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches // Potions itemLoot.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(); + itemLoot.AddCratePotionRules(false); // Money itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs new file mode 100644 index 0000000000..3b4c80f0f8 --- /dev/null +++ b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs @@ -0,0 +1,71 @@ +using CalamityMod.Items.Critters; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; +using Terraria; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Fishing.SunkenSeaCatches +{ + [LegacyName("SunkenCrate")] + public class EutrophicCrate : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Fishing"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + ItemID.Sets.IsFishingCrate[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.consumable = true; + Item.rare = ItemRarityID.Green; + Item.value = Item.sellPrice(gold: 1); + Item.createTile = ModContent.TileType(); + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } + + public override bool CanRightClick() => true; + public override void ModifyItemLoot(ItemLoot itemLoot) + { + var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); + + // Materials + itemLoot.Add(ModContent.ItemType(), 1, 10, 30); + itemLoot.Add(ModContent.ItemType(), 1, 10, 30); + postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); + postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); + + // Bait + itemLoot.Add(ItemID.MasterBait, 10, 1, 2); + itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); + itemLoot.Add(ModContent.ItemType(), 5, 1, 3); + itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); + + // Potions + itemLoot.AddCratePotionRules(false); + + // Money + itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); + itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + } + } +} diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.png b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.png new file mode 100644 index 0000000000..cdf1b87ab6 Binary files /dev/null and b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.png differ diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs similarity index 85% rename from Items/Fishing/SunkenSeaCatches/SunkenCrate.cs rename to Items/Fishing/SunkenSeaCatches/PrismCrate.cs index c1a1504501..ecf064395c 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Critters; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Weapons.Magic; @@ -12,13 +13,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { - public class SunkenCrate : ModItem, ILocalizedModType + public class PrismCrate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 5; ItemID.Sets.IsFishingCrate[Type] = true; + ItemID.Sets.IsFishingCrateHardmode[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -29,7 +32,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.consumable = true; Item.rare = ItemRarityID.Green; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); + Item.createTile = ModContent.TileType(); Item.useTurn = true; Item.autoReuse = true; Item.useAnimation = 15; @@ -37,10 +40,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.useStyle = ItemUseStyleID.Swing; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Crates; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) diff --git a/Items/Fishing/SunkenSeaCatches/PrismCrate.png b/Items/Fishing/SunkenSeaCatches/PrismCrate.png new file mode 100644 index 0000000000..cb1cfc1fbc Binary files /dev/null and b/Items/Fishing/SunkenSeaCatches/PrismCrate.png differ diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.png b/Items/Fishing/SunkenSeaCatches/SunkenCrate.png deleted file mode 100644 index 134f920a56..0000000000 Binary files a/Items/Fishing/SunkenSeaCatches/SunkenCrate.png and /dev/null differ diff --git a/Items/Placeables/Banners/SlabCrabBanner.cs b/Items/Placeables/Banners/SlabCrabBanner.cs new file mode 100644 index 0000000000..55579a31c3 --- /dev/null +++ b/Items/Placeables/Banners/SlabCrabBanner.cs @@ -0,0 +1,7 @@ +namespace CalamityMod.Items.Placeables.Banners +{ + public class SlabCrabBanner : BaseBanner + { + public override int BannerTileStyle => 5; + } +} diff --git a/Items/Placeables/Banners/SlabCrabBanner.png b/Items/Placeables/Banners/SlabCrabBanner.png new file mode 100644 index 0000000000..225fe1fc01 Binary files /dev/null and b/Items/Placeables/Banners/SlabCrabBanner.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index a09bb66da5..e0d84b0c4f 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.FurnitureAshen; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -34,6 +35,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations AddIngredient(10). AddIngredient(10). AddTile(TileID.Anvils). + AddDecraftCondition(Condition.DownedMechBossAny). Register(); } } diff --git a/Items/Placeables/FurnitureAshen/AshenBasin.cs b/Items/Placeables/FurnitureAshen/AshenBasin.cs index ae11cf0880..f600afabb4 100644 --- a/Items/Placeables/FurnitureAshen/AshenBasin.cs +++ b/Items/Placeables/FurnitureAshen/AshenBasin.cs @@ -1,7 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { @@ -29,6 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen AddIngredient(10). AddIngredient(5). AddTile(). + AddDecraftCondition(Condition.DownedMechBossAny). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs index 1fecb1d01a..97689b96f4 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPlating.cs @@ -34,10 +34,10 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddTile(TileID.HeavyWorkBench). Register(); - //CreateRecipe(). - //AddIngredient(4). - //AddTile(TileID.WorkBenches). - //Register(); + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); } } } diff --git a/Items/Placeables/Walls/WulfrumPlatingWall.cs b/Items/Placeables/Walls/WulfrumPlatingWall.cs new file mode 100644 index 0000000000..aae4c868da --- /dev/null +++ b/Items/Placeables/Walls/WulfrumPlatingWall.cs @@ -0,0 +1,38 @@ +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumPlatingWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumPlatingWall.png b/Items/Placeables/Walls/WulfrumPlatingWall.png new file mode 100644 index 0000000000..22d0216af5 Binary files /dev/null and b/Items/Placeables/Walls/WulfrumPlatingWall.png differ diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index 7b561fd668..53ba65d230 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.SummonItems public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { - ItemID.Sets.SortingPriorityBossSpawns[Type] = 3; // Worm Food / Bloody Spine + ItemID.Sets.SortingPriorityBossSpawns[Type] = 3; // Worm Food / Bloody Spine } public override void SetDefaults() @@ -42,7 +42,7 @@ namespace CalamityMod.Items.SummonItems 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); + int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-160, 161)), (int)(player.position.Y - 320f), ModContent.NPCType(), 1); Main.npc[npc].timeLeft *= 20; CalamityUtils.BossAwakenMessage(npc); } diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index 06e2fe3937..be1c8f26c9 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -127,10 +127,6 @@ namespace CalamityMod.Items.Tools } } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { if (hit.Crit) diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index fe0c4dcbc0..540854e01e 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public class GaussDagger : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public const int HitsRequiredForFlux = 2; public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); @@ -41,17 +40,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - target.Calamity().GaussFluxTimer += 50; - if (target.Calamity().GaussFluxTimer >= 30 * HitsRequiredForFlux) + if (target.Calamity().GaussFluxTimer == 0) { - target.Calamity().GaussFluxTimer = 0; + target.Calamity().GaussFluxTimer = 50; if (player.whoAmI == Main.myPlayer) { Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, 0f, player.whoAmI, 0f, target.whoAmI); diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index 5ec53539fe..b00b0c4786 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.UsesCharge = true; modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.075f; + modItem.ChargePerUse = 0.07f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index e93dd1e781..224d4f86a6 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 36; Item.height = 40; - Item.damage = 123; + Item.damage = 87; Item.DamageType = DamageClass.Magic; Item.mana = 9; Item.useTime = 25; diff --git a/Items/Weapons/Magic/HadalUrn.cs b/Items/Weapons/Magic/HadalUrn.cs index 7d61e03972..10e18d86dd 100644 --- a/Items/Weapons/Magic/HadalUrn.cs +++ b/Items/Weapons/Magic/HadalUrn.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 38; - Item.damage = 30; + Item.damage = 37; Item.DamageType = DamageClass.Magic; Item.mana = 10; Item.useTime = 16; diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index fe1d49aabd..8397dc14ca 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.Vilethorn). AddIngredient(ItemID.MagicMissile). - AddIngredient(ItemID.WandofSparking). + AddIngredient(ItemID.WandofFrosting). AddIngredient(ItemID.AmberStaff). AddIngredient(10). AddTile(TileID.DemonAltar). @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.CrimsonRod). AddIngredient(ItemID.MagicMissile). - AddIngredient(ItemID.WandofSparking). + AddIngredient(ItemID.WandofFrosting). AddIngredient(ItemID.AmberStaff). AddIngredient(10). AddTile(TileID.DemonAltar). diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index a71a0e76f0..b17d91e6d1 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 66; Item.height = 66; - Item.damage = 49; + Item.damage = 39; Item.DamageType = DamageClass.Magic; Item.channel = true; - Item.mana = 13; - Item.useTime = 80; - Item.useAnimation = 80; + Item.mana = 18; + Item.useTime = 70; + Item.useAnimation = 70; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5; diff --git a/Items/Weapons/Magic/Teslastaff.cs b/Items/Weapons/Magic/Teslastaff.cs new file mode 100644 index 0000000000..205d1a177d --- /dev/null +++ b/Items/Weapons/Magic/Teslastaff.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Sounds; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class Teslastaff : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + Item.staff[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 38; + Item.height = 38; + Item.damage = 166; + Item.DamageType = DamageClass.Magic; + Item.mana = 10; + Item.useTime = 10; + Item.useAnimation = 10; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = CommonCalamitySounds.LightningSound with { Pitch = 1.1f }; + Item.noMelee = true; + Item.channel = true; + Item.knockBack = 0f; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.reuseDelay = 60; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.ThunderStaff). + AddRecipeGroup("AnyCopperBar", 20). + AddIngredient(2). + AddIngredient(6). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Magic/Teslastaff.png b/Items/Weapons/Magic/Teslastaff.png new file mode 100644 index 0000000000..d36c5aec94 Binary files /dev/null and b/Items/Weapons/Magic/Teslastaff.png differ diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index 6633938bfc..01a3016107 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 64; Item.height = 64; - Item.damage = 38; + Item.damage = 46; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.useTime = 18; diff --git a/Items/Weapons/Magic/VeeringWind.cs b/Items/Weapons/Magic/VeeringWind.cs index 0c7a597d8a..46f11b85da 100644 --- a/Items/Weapons/Magic/VeeringWind.cs +++ b/Items/Weapons/Magic/VeeringWind.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 32; - Item.damage = 15; + Item.damage = 19; Item.DamageType = DamageClass.Magic; - Item.mana = 20; + Item.mana = 14; Item.useTime = Item.useAnimation = 36; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -47,6 +47,12 @@ namespace CalamityMod.Items.Weapons.Magic public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 0.5f : 1f; + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.altFunctionUse == 2) + mult *= 2f; + } + 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) @@ -59,7 +65,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) { - int totalProjectiles = 24; + int totalProjectiles = 12; for (int i = 0; i < totalProjectiles; i++) { Vector2 waveVelocity = ((MathHelper.TwoPi * i / (float)totalProjectiles) + velocity.ToRotation()).ToRotationVector2() * velocity.Length(); diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index ae2f0f7b0c..80a06a1262 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 58; Item.height = 58; - Item.damage = 105; + Item.damage = 75; Item.DamageType = DamageClass.Melee; Item.useTime = 20; Item.useAnimation = 20; @@ -30,10 +30,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 3f; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Frostburn2, 300); diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index fc38d3a9f0..4216caf6b9 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,47 +14,27 @@ namespace CalamityMod.Items.Weapons.Melee public class AbyssBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static readonly SoundStyle SpinSound = new("CalamityMod/Sounds/Item/SpinningWoosh") { Volume = 0.65f }; public override void SetDefaults() { Item.width = 74; Item.height = 74; - Item.damage = 130; + Item.damage = 70; + Item.knockBack = 7.5f; + Item.useTime = 65; + Item.useAnimation = 65; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; + + Item.noMelee = true; + Item.noUseGraphic = true; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; - Item.useTime = 18; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 8f; - Item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.75), knockback, player.whoAmI); - 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, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index 630cf718b5..a947423749 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 72; Item.height = 72; Item.scale = 1.2f; - Item.damage = 108; + Item.damage = 152; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 15; + Item.useAnimation = Item.useTime = 16; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4.25f; @@ -59,8 +59,8 @@ namespace CalamityMod.Items.Weapons.Melee public override float UseSpeedMultiplier(Player player) { if (player.altFunctionUse != 2) - return 1f; - return 1.33f; + return 1.8f; + return 1f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -75,11 +75,6 @@ namespace CalamityMod.Items.Weapons.Melee Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index a3fcc5c503..bb0ded6b0a 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -45,11 +45,6 @@ namespace CalamityMod.Items.Weapons.Melee int lifeAmount = player.statLifeMax2 - player.statLife; damage.Base += lifeAmount * 0.1f; } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index a87334a2db..3937a061f1 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Items.Weapons.Melee public static float MaxThrowReach = 760; public static float snapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap - public static float chargeDamageMultiplier = 1.4f; //Extra damage from charge + public static float MaxCharge = 15f; // Maximum charge value AKA how much charge you get from a parry + public static float chargeDamageMultiplier = 1.35f; //Extra damage from charge public static float chainDamageMultiplier = 0.1f; public static int DashIframes = 10; @@ -202,7 +203,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 barOrigin = barBG.Size() * 0.5f; float yOffset = 50f; Vector2 drawPos = position + Vector2.UnitY * scale * (frame.Height - yOffset); - Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / 10f * barFG.Width), barFG.Height); + Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / MaxCharge * barFG.Width), barFG.Height); Color color = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 0.6f) % 1, 1, 0.75f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f); spriteBatch.Draw(barBG, drawPos, null, color, 0f, barOrigin, scale * barScale, 0f, 0f); diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index 83b49f4bc8..485cfe5275 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -26,11 +26,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.Rarity10BuyPrice; Item.rare = ItemRarityID.Red; } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index 8f5356f226..a0cc632ece 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 56; Item.height = 60; - Item.damage = 30; - Item.scale = 1.05f; + Item.damage = 41; + Item.scale = 1.15f; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 26; + Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; @@ -30,6 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffID.Poisoned, 60); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index 33e6367ca7..146d175f0f 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 56; Item.height = 56; - Item.damage = 23; + Item.damage = 20; Item.DamageType = DamageClass.Melee; Item.useAnimation = 21; Item.useTime = 21; diff --git a/Items/Weapons/Melee/BrimstoneSword.cs b/Items/Weapons/Melee/BrimstoneSword.cs index 33c84da548..bb9acedc0a 100644 --- a/Items/Weapons/Melee/BrimstoneSword.cs +++ b/Items/Weapons/Melee/BrimstoneSword.cs @@ -69,11 +69,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index 79d108682a..b43504e244 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Items.Weapons.Melee { @@ -68,13 +69,9 @@ namespace CalamityMod.Items.Weapons.Melee if (Main.rand.NextBool(3)) Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 180); var source = player.GetSource_ItemUse(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, Item.knockBack, player.whoAmI); @@ -82,6 +79,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { + target.AddBuff(ModContent.BuffType(), 180); var source = player.GetSource_ItemUse(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, Item.knockBack, player.whoAmI); diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index f865455fe6..193d102ea4 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -259,18 +259,21 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && + bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; + return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType())); } + // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. + public override bool AltFunctionUse(Player player) => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (mainAttunement == null) + if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) return false; - int powerLungeCounter = 0; //Unused here ComboResetTimer = 1f; return mainAttunement.Shoot(player, source, ref position, ref velocity.X, ref velocity.Y, ref type, ref damage, ref knockback, ref Combo, ref CanLunge, ref powerLungeCounter); diff --git a/Items/Weapons/Melee/ChronomancersScythe.cs b/Items/Weapons/Melee/ChronomancersScythe.cs new file mode 100644 index 0000000000..ab7d51386d --- /dev/null +++ b/Items/Weapons/Melee/ChronomancersScythe.cs @@ -0,0 +1,88 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class ChronomancersScythe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 45; + Item.height = 45; + Item.DamageType = DamageClass.MeleeNoSpeed; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.damage = 153; + Item.knockBack = 4f; + Item.useAnimation = 25; + Item.useTime = 5; + Item.autoReuse = false; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item71; + + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().donorItem = true; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; + } + public override bool AltFunctionUse(Player player) => true; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse == 2) + { + int p = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer, ai2: player.direction); + float rot = -MathHelper.PiOver2 + MathHelper.PiOver4; + Main.projectile[p].rotation = player.direction * rot; + return false; + } + else + { + return true; + } + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2f) + { + Item.reuseDelay = 10; + Item.channel = false; + Item.useTurn = false; + } + else + { + Item.reuseDelay = 0; + Item.channel = true; + Item.useTurn = true; + } + return base.CanUseItem(player); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.IceSickle). + AddIngredient(ItemID.FastClock). + AddIngredient(ItemID.LunarBar, 10). + AddIngredient(6). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/ChronomancersScythe.png b/Items/Weapons/Melee/ChronomancersScythe.png new file mode 100644 index 0000000000..60187a3259 Binary files /dev/null and b/Items/Weapons/Melee/ChronomancersScythe.png differ diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index 142394b369..34a67f7f49 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -29,10 +29,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 9f; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index e67e36ebfc..3a7488089e 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -20,16 +20,16 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 98; + Item.damage = 270; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 18; + Item.useAnimation = Item.useTime = 40; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2.4f; Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.rare = ModContent.RarityType(); - Item.Calamity().donorItem = true; //Yatagarasu#0001 + Item.Calamity().donorItem = true; // revertusernamechange on Discord (Yatagarasu) } public override bool MeleePrefix() => true; diff --git a/Items/Weapons/Melee/DepthCrusher.cs b/Items/Weapons/Melee/DepthCrusher.cs index 0f3c7e6c2d..e874a94843 100644 --- a/Items/Weapons/Melee/DepthCrusher.cs +++ b/Items/Weapons/Melee/DepthCrusher.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,64 +11,27 @@ namespace CalamityMod.Items.Weapons.Melee public class DepthCrusher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private const int HammerPower = 70; - - public override void SetStaticDefaults() - { - - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; - } public override void SetDefaults() { Item.width = 56; Item.height = 50; - Item.damage = 36; - Item.knockBack = 5.25f; - Item.useTime = 17; - Item.useAnimation = 22; - Item.hammer = HammerPower; + Item.damage = 35; + Item.knockBack = 7.25f; + Item.useTime = 65; + Item.useAnimation = 65; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; + Item.noMelee = true; + Item.noUseGraphic = true; Item.DamageType = DamageClass.Melee; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.UseSound = SoundID.Item1; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; Item.autoReuse = true; + Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } - - public override bool AltFunctionUse(Player player) => true; - - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - Item.hammer = 0; - } - else - { - Item.hammer = HammerPower; - } - return base.CanUseItem(player); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 180); - } } } diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 4243649280..8beacc22f5 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -105,11 +105,6 @@ namespace CalamityMod.Items.Weapons.Melee Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.ShadowFlame, 150); diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index da08fa16d1..a4df78b470 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 66; Item.height = 66; - Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index 5146db722d..845a4c46ff 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -33,10 +33,6 @@ namespace CalamityMod.Items.Weapons.Melee Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 44); } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Venom, 300); diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index dc049aaad3..f2a0223988 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -182,10 +182,14 @@ namespace CalamityMod.Items.Weapons.Melee #endregion + // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. + public override bool AltFunctionUse(Player player) => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (mainAttunement == null) + if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) return false; + return true; } @@ -245,7 +249,8 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && + bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; + return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index df0cd6036c..6df94f7a0f 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Healing; +using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -45,28 +44,32 @@ namespace CalamityMod.Items.Weapons.Melee player.HealEffect(4); } - OnHitEffects(player, target.Center, target.life, target.lifeMax, Item.knockBack, Item.damage, hit.Crit); + OnHitEffects(player, target.Center, target.life, target.lifeMax, Item.knockBack, Item.damage); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - OnHitEffects(player, target.Center, target.statLife, target.statLifeMax2, Item.knockBack, Item.damage, false); + OnHitEffects(player, target.Center, target.statLife, target.statLifeMax2, Item.knockBack, Item.damage); } - // this should use onHitNPC and ModifyHitNPC instead of onHitEffects - private void OnHitEffects(Player player, Vector2 targetPos, int targetLife, int targetMaxLife, float knockback, int damage, bool crit) + + private void OnHitEffects(Player player, Vector2 targetPos, int targetLife, int targetMaxLife, float knockback, int damage) { var source = player.GetSource_ItemUse(Item); - if (crit) - damage /= 2; - Projectile.NewProjectile(source, targetPos, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.5f), 0f, player.whoAmI); + // Grand Guardian is classed as a regular melee weapon, so despite being a true melee on-hit, these scale with regular melee. + StatModifier playerMeleeDmg = player.GetTotalDamage(); + int rainbowBoomDamage = (int)playerMeleeDmg.ApplyTo(damage * 0.5f); + int rainBoltDamage = (int)playerMeleeDmg.ApplyTo(damage * 0.75f); + + Projectile.NewProjectile(source, targetPos, Vector2.Zero, ModContent.ProjectileType(), rainbowBoomDamage, 0f, player.whoAmI); + if (targetLife <= (targetMaxLife * 0.5f) && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) { float randomSpeedX = Main.rand.Next(6, 13); float randomSpeedY = Main.rand.Next(6, 13); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); - Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); + Projectile.NewProjectile(source, targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); + Projectile.NewProjectile(source, targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); + Projectile.NewProjectile(source, targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), rainBoltDamage, knockback, player.whoAmI); } if (targetLife <= 0 && !player.moonLeech && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) { diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index 28af951194..cb57beb4fc 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -62,11 +62,6 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanHitPvp(Player player, Player target) => player.altFunctionUse != 2; - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 0cbe50cc9b..cc038d5078 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; Item.rare = ModContent.RarityType(); - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 14)); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index 32691fc059..6f45078c77 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -13,44 +14,28 @@ namespace CalamityMod.Items.Weapons.Melee public class NeptunesBounty : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static readonly SoundStyle SpinSound = new("CalamityMod/Sounds/Item/SpinningWoosh") { Volume = 0.65f }; public override void SetDefaults() { Item.width = 122; Item.height = 122; - Item.damage = 270; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 22; - Item.useTime = 22; - Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; + Item.damage = 455; Item.knockBack = 9f; - Item.UseSound = SoundID.Item1; + Item.useTime = 65; + Item.useAnimation = 65; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 3f; + + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = null; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; Item.value = CalamityGlobalItem.Rarity13BuyPrice; Item.rare = ModContent.RarityType(); } - - 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, 33); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 300); - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index 7ec9968d89..de85a9bbd0 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -326,15 +326,24 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && + bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; + return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType())); } - //No need for any wacky zany hijinx in the shoot method for once??? damn - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) => mainAttunement == null ? false : true; + // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. + public override bool AltFunctionUse(Player player) => true; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) + return false; + + return true; + } internal static ChargingEnergyParticleSet BiomeEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.White, Color.White, 0.04f, 20f); internal static void UpdateAllParticleSets() diff --git a/Items/Weapons/Melee/PlagueKeeper.cs b/Items/Weapons/Melee/PlagueKeeper.cs index 413843a762..d6c14cb50d 100644 --- a/Items/Weapons/Melee/PlagueKeeper.cs +++ b/Items/Weapons/Melee/PlagueKeeper.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 74; Item.height = 90; - Item.damage = 80; + Item.damage = 68; Item.DamageType = DamageClass.Melee; Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; @@ -29,10 +29,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 9f; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index ca58d894e6..4dbc25cde9 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -1,15 +1,16 @@ -using Microsoft.Xna.Framework; -using System; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { public class StellarStriker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { Item.width = 90; @@ -29,19 +30,22 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 12f; } + // Stellar Striker is classed as a regular melee weapon, so despite being a true melee on-hit, these scale with regular melee. + private int GetOnHitDamage(Player player) => (int)player.GetTotalDamage().ApplyTo(0.5f * Item.damage); + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { if (player.whoAmI == Main.myPlayer) - SpawnFlares(player, Item.knockBack, Item.damage, hit.Crit); + SpawnFlares(player, Item.knockBack, GetOnHitDamage(player)); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { if (player.whoAmI == Main.myPlayer) - SpawnFlares(player, Item.knockBack, Item.damage, true); + SpawnFlares(player, Item.knockBack, GetOnHitDamage(player)); } - private void SpawnFlares(Player player, float knockback, int damage, bool crit) + private void SpawnFlares(Player player, float knockback, int damage) { var source = player.GetSource_ItemUse(Item); SoundEngine.PlaySound(SoundID.Item88, player.Center); @@ -66,9 +70,6 @@ namespace CalamityMod.Items.Weapons.Melee mouseDistance = cometSpeed / mouseDistance; } - if (crit) - damage /= 2; - for (int j = 0; j < 2; j++) { realPlayerPos = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); @@ -90,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee mouseYDist *= mouseDistance; float speedX = mouseXDist; float speedY = mouseYDist + (float)Main.rand.Next(-80, 81) * 0.02f; - int proj = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX, speedY, ProjectileID.LunarFlare, (int)(damage * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); + int proj = Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX, speedY, ProjectileID.LunarFlare, damage, knockback, i, 0f, (float)Main.rand.Next(3)); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].DamageType = DamageClass.Melee; } diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index 91c06f0f10..977207ce44 100644 --- a/Items/Weapons/Melee/TeardropCleaver.cs +++ b/Items/Weapons/Melee/TeardropCleaver.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 56; Item.height = 66; - Item.damage = 45; + Item.damage = 38; Item.DamageType = DamageClass.Melee; Item.useAnimation = 24; Item.useStyle = ItemUseStyleID.Swing; @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.scale = 1.5f; + Item.scale = 1.1f; Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; } diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index 87ae4c0694..9a7680bbf6 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -34,10 +34,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.Calamity().donorItem = true; } - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { bool isDoGSegment = target.type == ModContent.NPCType() || target.type == ModContent.NPCType(); diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index 3ffdcb90cf..1531ecbd30 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -18,6 +18,8 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { + // TODO -- CANNOT RENAME this and True Biome Blade to "TrueBiomeBlade" and "BiomeBlade" internally without corrupting existing items + // (Comment copied from an equivalent one on OmegaBiomeBlade from June 2022) public class TrueBiomeBlade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -289,7 +291,8 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && + bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; + return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || @@ -298,9 +301,12 @@ namespace CalamityMod.Items.Weapons.Melee n.type == ProjectileType())); } + // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. + public override bool AltFunctionUse(Player player) => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (mainAttunement == null) + if (mainAttunement == null || player.altFunctionUse != ItemAlternativeFunctionID.None) return false; ComboResetTimer = 1f; diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index 5cfc2524a1..4b95e8d948 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 16; Item.height = 16; - Item.damage = 60; + Item.damage = 62; Item.DamageType = DamageClass.Melee; Item.useTime = 30; Item.useAnimation = 30; diff --git a/Items/Weapons/Ranged/AntiMaterielRifle.cs b/Items/Weapons/Ranged/AntiMaterielRifle.cs index 7ed1fd2a5b..3a1552f5c9 100644 --- a/Items/Weapons/Ranged/AntiMaterielRifle.cs +++ b/Items/Weapons/Ranged/AntiMaterielRifle.cs @@ -37,6 +37,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-30, 0); + public override void HoldItem(Player player) => player.scope = true; + // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index dc1e3458cf..ab3719fc2c 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -59,6 +59,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override void HoldItem(Player player) => player.scope = true; + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 50; public override void AddRecipes() diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index e31233e9fc..7782be14e7 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -1,8 +1,9 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.width = 40; - Item.height = 76; + Item.width = 50; + Item.height = 112; Item.damage = 48; Item.DamageType = DamageClass.Ranged; Item.useTime = 20; @@ -32,6 +33,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = true; } + 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/Ranged/CosmicBolterGlow").Value); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); diff --git a/Items/Weapons/Ranged/CosmicBolter.png b/Items/Weapons/Ranged/CosmicBolter.png index 87db9b0226..c56363cc87 100644 Binary files a/Items/Weapons/Ranged/CosmicBolter.png and b/Items/Weapons/Ranged/CosmicBolter.png differ diff --git a/Items/Weapons/Ranged/CosmicBolterGlow.png b/Items/Weapons/Ranged/CosmicBolterGlow.png new file mode 100644 index 0000000000..37d467276c Binary files /dev/null and b/Items/Weapons/Ranged/CosmicBolterGlow.png differ diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs index 13d1b3fe67..f516abce50 100644 --- a/Items/Weapons/Ranged/DeepcoreGK2.cs +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 142; Item.height = 64; - Item.damage = 45; - Item.ArmorPenetration = 15; + Item.damage = 41; + Item.ArmorPenetration = 10; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; Item.useTime = Item.useAnimation = 14; diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 14df69eb5d..d3695d38cc 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -47,6 +47,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-15, 0); + public override void HoldItem(Player player) => player.scope = true; + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 50; public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 85be2dd435..4470d1f72c 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 72; Item.height = 32; - Item.damage = 30; + Item.damage = 36; Item.DamageType = DamageClass.Ranged; Item.useTime = 6; Item.useAnimation = 6; diff --git a/Items/Weapons/Ranged/MidasPrime.cs b/Items/Weapons/Ranged/MidasPrime.cs index 38eab995aa..80a5cc8604 100644 --- a/Items/Weapons/Ranged/MidasPrime.cs +++ b/Items/Weapons/Ranged/MidasPrime.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Ranged long cashAvailable = Utils.CoinsCount(out bool overflow, player.inventory); // If the player has at least 1 gold in their inventory, spend it and use a gold coin - if (overflow || cashAvailable > 10000) + if (overflow || (cashAvailable >= 10000 && (Main.LocalPlayer.InventoryHas(ItemID.GoldCoin) || Main.LocalPlayer.InventoryHas(ItemID.PlatinumCoin)))) { player.BuyItem(10000); nextShotGoldCoin = true; diff --git a/Items/Weapons/Ranged/PlagueTaintedSMG.cs b/Items/Weapons/Ranged/PlagueTaintedSMG.cs index 1b75a3f9be..47191b0199 100644 --- a/Items/Weapons/Ranged/PlagueTaintedSMG.cs +++ b/Items/Weapons/Ranged/PlagueTaintedSMG.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 98; Item.height = 50; - Item.damage = 76; + Item.damage = 78; Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/Shroomer.cs b/Items/Weapons/Ranged/Shroomer.cs index 3306097044..3deeaacc0c 100644 --- a/Items/Weapons/Ranged/Shroomer.cs +++ b/Items/Weapons/Ranged/Shroomer.cs @@ -36,6 +36,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-25, 0); + public override void HoldItem(Player player) => player.scope = true; + 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, ModContent.ProjectileType(), (int)(damage * 0.5), knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 81535fa2fb..06ed3272c5 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -38,10 +38,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Bullet; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); + + public override void HoldItem(Player player) => player.scope = true; public override bool CanConsumeAmmo(Item ammo, Player player) { diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 06fce23617..81b6545f39 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -41,6 +41,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-28, 0); + public override void HoldItem(Player player) => player.scope = true; + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/TyrannysEnd.png b/Items/Weapons/Ranged/TyrannysEnd.png index df8a87b0f9..35335871e6 100644 Binary files a/Items/Weapons/Ranged/TyrannysEnd.png and b/Items/Weapons/Ranged/TyrannysEnd.png differ diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index 72879055d4..00283ddd32 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 30; Item.height = 40; - Item.damage = 64; + Item.damage = 67; Item.noMelee = true; Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 12; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.25f; Item.UseSound = SoundID.Item1; @@ -34,16 +34,16 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } + public override float StealthVelocityMultiplier => 1.3f; + 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) { if (player.Calamity().StealthStrikeAvailable()) { int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) - { Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; - } return false; } return true; diff --git a/Items/Weapons/Rogue/ConsecratedWater.png b/Items/Weapons/Rogue/ConsecratedWater.png index 05478e95bd..9d87b59cc1 100644 Binary files a/Items/Weapons/Rogue/ConsecratedWater.png and b/Items/Weapons/Rogue/ConsecratedWater.png differ diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 3cfd27ec4a..af19d6cd38 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue } public override float StealthVelocityMultiplier => 1.1f; - public override float StealthDamageMultiplier => 3f; + public override float StealthDamageMultiplier => 2.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/EnchantedAxe.png b/Items/Weapons/Rogue/EnchantedAxe.png index cdae20aa68..3bab8e0e63 100644 Binary files a/Items/Weapons/Rogue/EnchantedAxe.png and b/Items/Weapons/Rogue/EnchantedAxe.png differ diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index b9764af235..5faceb0e07 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 34; - Item.damage = 50; + Item.damage = 82; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 9; diff --git a/Items/Weapons/Rogue/SubductionSlicer.cs b/Items/Weapons/Rogue/SubductionSlicer.cs index b5b84384bb..e701c302a1 100644 --- a/Items/Weapons/Rogue/SubductionSlicer.cs +++ b/Items/Weapons/Rogue/SubductionSlicer.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 50; Item.height = 48; - Item.damage = 90; + Item.damage = 95; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index ddb4d6940d..3353de3bd1 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 1666; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 30; // 29 because of useStyle 1 + Item.useTime = Item.useAnimation = 80; // 79 because of useStyle 1 Item.autoReuse = true; Item.noMelee = true; Item.knockBack = 0f; diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 6c040b6f23..9c0441788b 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity2BuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.NPCDeath34; + Item.UseSound = Stormlion.DeathSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index a3201816ea..3f9f0ed6c4 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -16,6 +16,7 @@ LuminousCorvina: Lumenyl grows on the fins of these exotic corvina, making these MirageJelly: Using the light refracted from lumenyl crystals and water warmed by the scorching heat of scoria, these jellyfish can create afterimages of themselves to confuse predators, or catch prey of their own. MorayEel: When a fish bites your heel and it looks like an eel, that's a moray. When it swims in the reef and has two sets of teeth, that's a moray. When you're slapped in the face with a slimy embrace, that's a moray. Oarfish: Oarfish are known for laying thousands or even millions of eggs in astonishingly quick gestation cycles. These eggs are the most abundant source of food in the Abyss, being part of the reason even the smallest and least threatening creatures can live in the otherwise near inhospitable depths of the sea. +SlabCrab: Despite its shell being as hard as rock, the Slab Crab hides at the most pacific zone of the Abyss; for it cannot withstand the acidic water above, nor the fearsome predators below. Whereas it would normally be prey that only the strongest could dine on, in this habitat, it manages to barely evade natural selection. ReaperShark: Apex predators of the void, these sharks take advantage of both their stealthiness and might to hunt anything and everything that comes near. Using their arms for purposes from hurling colossal squids into the Abyss' walls to crushing the heavily armored heads of eidolon wyrms, few can match their raw strength. ToxicMinnow: These abnormally large minnows have evolved to use nutrients from plants they consume to create toxins inside their body, which is then released after they die. They have next to no predators due to this, and contribute nearly nothing to their environment. Viperfish: Omnivorous fish that dwell in the middle sections of the Abyss, viperfish rest firmly near the bottom of the food chain. Their wide mouth normally reserved for filter feeding can double as a means to scare off predators by mimicking the much more threatening gulper eels. diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 33803350fd..e8c09e9d2e 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -753,6 +753,11 @@ HallowedRuneRegeneration: { Description: Regenerating life } +Haste: { + DisplayName: Haste + Description: Increased movement speed and acceleration +} + IceShieldBuff: { DisplayName: Ice Shield Description: Absorbs 20% damage from the next hit you take, then shatters diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 4e0d24f0fa..0d7071c6da 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -46,7 +46,7 @@ AbyssalDivingSuit: { Provides light underwater and extra mobility on ice Provides a moderate amount of light in the abyss Greatly reduces breath loss in the abyss - Reduces creature's ability to detect you in the abyss + Makes it more difficult for abyss creatures to detect you Reduces the defense reduction that the abyss causes Grants immunity to the sulphurous waters Allows you to fall faster while in liquids @@ -160,7 +160,7 @@ AnechoicPlating: { DisplayName: Anechoic Plating Tooltip: ''' - Reduces creature's ability to detect you in the abyss + Makes it more difficult for abyss creatures to detect you Reduces the defense reduction that the abyss causes ''' } @@ -544,8 +544,8 @@ DimensionalSoulArtifact: { DisplayName: Dimensional Soul Artifact Tooltip: ''' - Power Multiplies all damage by 1.2x, but at the cost of increasing damage taken by 15% + Power ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 13a8b24a11..8e96193a93 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -24,6 +24,11 @@ AstrophageItem: { Tooltip: Summons an astrophage to follow you around } +MonolithCrate: { + DisplayName: Monolith Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + ProcyonidPrawn: { DisplayName: Procyonid Prawn Tooltip: "" @@ -110,12 +115,22 @@ Shadowfish: { Tooltip: Darkness spreads } +SlagCrate: { + DisplayName: Slag Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + Slurpfish: { DisplayName: Slurpfish QuestDescription: Y'know, it'd be an absolute calamity if I sent you to the ancient ruins in the depths of hell to catch a fish. And I plan to do just that. Now scram! The fish isn't going to catch itself. } // Sunken Sea Catches +EutrophicCrate: { + DisplayName: Eutrophic Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + EutrophicSandfish: { DisplayName: Eutrophic Sandfish QuestDescription: 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! @@ -126,6 +141,11 @@ GreenwaveLoach: { Tooltip: An endangered fish that is highly prized in the market } +PrismCrate: { + DisplayName: Prism Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + PrismaticGuppy: { DisplayName: Prismatic Guppy Tooltip: Throwing these in an aquarium would be insanity @@ -165,11 +185,6 @@ SparklingEmpress: { ''' } -SunkenCrate: { - DisplayName: Sunken Crate - Tooltip: "{$CommonItemTooltip.RightClickToOpen}" -} - SunkenSailfish: { DisplayName: Sunken Sailfish Tooltip: Zooming at 60 miles per hour @@ -220,6 +235,11 @@ Gorecodile: { Tooltip: Press to extract blood orbs } +HydrothermalCrate: { + DisplayName: Hydrothermal Crate + Tooltip: "{$CommonItemTooltip.RightClickToOpen}" +} + Spadefish: { DisplayName: Spadefish Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index dce69a81b1..61ed6fc57d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -289,6 +289,11 @@ EutrophicSand: { Tooltip: "" } +HardenedEutrophicSand: { + DisplayName: Hardened Eutrophic Sand + Tooltip: "" +} + AbyssTreasureChest: { DisplayName: Ancient Treasure Chest Tooltip: "" @@ -3411,8 +3416,8 @@ VoidstoneWall: { Tooltip: "" } -HardenedEutrophicSand: { - DisplayName: Hardened Eutrophic Sand +WulfrumPlatingWall: { + DisplayName: Wulfrum Plating Wall Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 12235427e5..4544c93f1f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -34,7 +34,7 @@ GaussDagger: { Tooltip: ''' Slices through foes with turbulent magnetic force - Repeated strikes envelop foes in a damaging magnetic flux + Striking foes envelops them in a damaging magnetic flux ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 822eecb526..70605d8067 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -718,7 +718,11 @@ SlitheringEels: { SnowstormStaff: { DisplayName: Snowstorm Staff - Tooltip: Fires a snowflake that follows the mouse cursor + Tooltip: + ''' + Fires snowflakes that follows the mouse cursor + Snowflakes split into ice stars on enemy hits + ''' } SoulPiercer: { @@ -771,6 +775,18 @@ TerraRay: { ''' } +Teslastaff: { + DisplayName: Teslastaff + Tooltip: + ''' + Fires a channeled beam of pinpoint-accurate lightning + The beam has limited turning speed capability + Each successive hit on the same enemy increases damage per hit + The damage increases 10% per hit to a maximum of 500% damage + This damage will rapidly decrease after the enemy stops being hit + ''' +} + TheDanceofLight: { DisplayName: The Dance of Light Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 5ad8896f88..9555d9856b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -12,8 +12,8 @@ AbyssBlade: { DisplayName: Abyss Blade Tooltip: ''' - Fires short-range tridents - Hitting enemies will inflict the crush depth debuff + Tosses a spinning abyssal sword that ricochets and releases water energy upon hitting a tile + The sword will fly towards enemies after a ricochet ''' } @@ -84,7 +84,7 @@ ArkoftheCosmos: { to snip out the scissor blades in front of you Hitting an enemy with it will parry them, granting you brief invulnerability You can parry projectiles to make them deal 160 less damage for a short period - Parrying anything will empower the next 10 swings of the sword + Parrying anything will empower the next 15 swings of the sword ''' BlastInfo: ''' @@ -169,7 +169,7 @@ BansheeHook: { Basher: { DisplayName: Basher - Tooltip: Inflicts irradiated on enemy hits + Tooltip: Swings a rotten club that poisons and irradiates enemies on hit } BladecrestOathsword: { @@ -249,6 +249,18 @@ CelestialClaymore: { Tooltip: Spawns cosmic energy stars near the cursor that inflict several debuffs } +ChronomancersScythe: { + DisplayName: Chronomancer's Scythe + Tooltip: + ''' + Rapidly fires icicles + Press to swing the scythe around you creating a clock pattern of homing icicles + Direct hits with the scythe have a chance to spawn clocks + Collecting the clocks increases movement speed and acceleration by 5% for each clock collected + This stacks up to 3 times and each level wears off after 5 seconds + ''' +} + ClamCrusher: { DisplayName: Clam Crusher Tooltip: @@ -276,8 +288,9 @@ CosmicShiv: { DisplayName: Cosmic Shiv Tooltip: ''' - Fires a cosmic beam that homes in on enemies - Upon hitting an enemy, a barrage of offscreen objects home in on the enemy as well as raining stars + Fires a cosmic star that homes in on enemies + Upon hitting an enemy, a barrage of blades will persistently strike + Landing more stars causes more blades to strike ''' } @@ -308,8 +321,8 @@ DepthCrusher: { DisplayName: Depth Crusher Tooltip: ''' - Hitting enemies will inflict the Riptide debuff - Press to use without hammering down walls + Tosses a heavy abyssal crusher that releases water energy upon hitting a tile + The crusher will ricochet off of tiles and enemies ''' } @@ -781,8 +794,8 @@ NeptunesBounty: { DisplayName: Neptune's Bounty Tooltip: ''' - Fires a trident that rains additional tridents as it travels - Hitting enemies will inflict the crush depth debuff + Tosses a spinning abyssal sword constantly releases water energy while spinning + Once the blade begins falling it will redirect itself towards enemies with increased velocity ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index f66eaa054e..2a3815daaf 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -329,7 +329,7 @@ CrackshotColt: { Press to toss a Copper Coin in the air Striking a coin with a bullet causes it to ricochet into the nearest enemy Up to 4 coins can be tossed simultaneously, and shots will ricochet off multiple coins if possible - Ricocheted bullets always critically strike + Coins guarantee a critical strike after a short delay ''' } @@ -380,7 +380,7 @@ DeepcoreGK2: { DisplayName: Deepcore GK2 Tooltip: ''' - Bullets are twice as large and ignores 15 points of enemy defense + Bullets are twice as large and ignores 10 points of enemy defense 'For rock and stone!' ''' } @@ -731,7 +731,7 @@ MidasPrime: { Press to toss a Gold Coin or Silver Coin in the air Striking a coin with a bullet causes it to ricochet into the nearest enemy Up to 4 coins can be tossed simultaneously, and shots will ricochet off multiple coins if possible - Ricocheted bullets always critically strike and do bonus damage based on the coins used + Coins guarantee a critical strike after a short delay and bullets do bonus damage based on coins used ''' UltrakillEasterEgg: ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 07f73df839..6438ff65c1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -9,7 +9,7 @@ AcidicRainBarrel: { AdamantiteThrowingAxe: { DisplayName: Adamantite Throwing Axe - Tooltip: Stealth strikes summon lightning bolts on enemy hits + Tooltip: Stealth strikes ignore gravity and rain down lightning on enemy hits } AlphaVirus: { @@ -489,7 +489,7 @@ GildedDagger: { Tooltip: ''' Throws a shiny blade that ricochets towards another enemy on hit - Stealth strikes cause the blade to home in after ricocheting, with each ricochet dealing 20% more damage + Stealth strikes cause the blade to home in after ricocheting, with each ricochet dealing 5% more damage Stealth strikes also have increased piercing ''' } @@ -508,7 +508,7 @@ GleamingDagger: { Tooltip: ''' Throws a shiny blade that ricochets towards another enemy on hit - Stealth strikes cause the blade to home in after ricocheting, with each ricochet dealing 20% more damage + Stealth strikes cause the blade to home in after ricocheting, with each ricochet dealing 5% more damage Stealth strikes also have increased piercing ''' } @@ -1170,7 +1170,7 @@ SubductionSlicer: { Tooltip: ''' Throws a scythe that explodes on enemy hits - Stealth strikes also summon an orange pillar of fire on enemy hits + Stealth strikes also summon a pillar of fire on enemy hits ''' } diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 06acb0756d..7629952a49 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -18,6 +18,7 @@ MirageJelly.DisplayName: Mirage Jelly MorayEel.DisplayName: Moray Eel OarfishHead.DisplayName: Oarfish ReaperShark.DisplayName: Reaper Shark +SlabCrab.DisplayName: Slab Crab ToxicMinnow.DisplayName: Toxic Minnow Viperfish.DisplayName: Viperfish AcidEel.DisplayName: Acid Eel diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 8b116b409a..e640dacd06 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -200,6 +200,7 @@ SlitheringEelProjectile.DisplayName: Slithering Eel SmallSpirit.DisplayName: Small Angry Spirit Snowball.DisplayName: Snowball Snowflake.DisplayName: Snowflake +SnowflakeIceStar.DisplayName: Ice Star SolarElementalBeam.DisplayName: Solar Beam SoulPiercerBeam.DisplayName: Soul Piercer SoulPiercerBolt.DisplayName: Soul Piercer @@ -217,6 +218,7 @@ TacticiansTrumpCardProj.DisplayName: Trump Beam TearsofHeavenProjectile.DisplayName: Tears of Heaven TerraBeam.DisplayName: Terra Beam TerraShard.DisplayName: Terra Shard +Teslabeam.DisplayName: Teslabeam ThunderstormShot.DisplayName: Thunderous Shot ThunderstormShotSplit.DisplayName: Thunderous Shot TradewindsProjectile.DisplayName: Tradewinds Feather diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 791af11470..55716472e8 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -56,14 +56,19 @@ BrokenBiomeBladeHoldout.DisplayName: Broken Biome Blade BurningMeteor.DisplayName: Meteor CatastropheClaymoreSparkle.DisplayName: Catastrophe Sparkle ChainedMeatHook.DisplayName: Enchanted Meat Hook +ChronoIcicleLarge.DisplayName: Chrono Icicle +ChronoIcicleSmall.DisplayName: Chrono Icicle +ChronomancersScytheHoldout.DisplayName: Chronomancer's Scythe ClamCrusherFlail.DisplayName: Clam Crusher CometQuasherMeteor.DisplayName: Comet Quasher Meteor CosmicBolt.DisplayName: Cosmic Bolt CosmicDischargeFlail.DisplayName: Cosmic Discharge CosmicIceBurst.DisplayName: Cosmic Ice CosmicOrb.DisplayName: Cosmic Orb +CosmicShivAura.DisplayName: Cosmic Shiv Aura CosmicShivBall.DisplayName: Cosmic Energy CosmicShivBlade.DisplayName: Cosmic Beam +CosmicShivTrail.DisplayName: Cosmic Shiv Trail CosmicSpiritBomb1.DisplayName: Cosmic Bomb CosmicSpiritBomb2.DisplayName: Cosmic Bomb CosmicSpiritBomb3.DisplayName: Cosmic Bomb @@ -305,3 +310,9 @@ WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YateveoBloomProj.DisplayName: Yateveo Bloom YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard +DepthCrusherProjectile.DisplayName: Depth Crusher +DepthCrusherSplitProjectile.DisplayName: Depth Crusher Jet +AbyssBladeProjectile.DisplayName: Abyss Blade +AbyssBladeSplitProjectile.DisplayName: Abyss Blade Jet +NeptunesBountyProjectile.DisplayName: Neptune's Bounty +NeptunesBountySplitProjectile.DisplayName: Neptune's Bounty Jet diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 51989ca220..5210f77e32 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -30,6 +30,7 @@ BossRushTierAnimation.DisplayName: Boss Rush Tier Animation BrimstoneHellfireballFriendly2.DisplayName: Hellfire ChaoticGeyser.DisplayName: Chaotic Geyser ChlorophyteLifePulse.DisplayName: Life Pulse +ChronoClock.DisplayName: Chrono Clock CoralBubble.DisplayName: Bubble CoralBubbleSmall.DisplayName: Bubble CryonicShield.DisplayName: Cryonic Shield @@ -58,13 +59,13 @@ FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem GhostlyBolt.DisplayName: Bolt GodKiller.DisplayName: God Killer -GodSlayerBlaze.DisplayName: Blaze GodSlayerShrapnel.DisplayName: Flame GodSlayerShrapnelRound.DisplayName: Round GoldenGunProj.DisplayName: Golden Round GreenLabSeeker.DisplayName: Seeking Mechanism HellfireExplosionFriendly2.DisplayName: Explosion HeronBobber.DisplayName: Heron Bobber +HideOfAstrumDeusExplosion.DisplayName: Explosion HolyExplosion.DisplayName: Explosion HolyExplosionSupreme.DisplayName: Explosion HydrothermalSmoke.DisplayName: Smoke diff --git a/Localization/en-US/Mods.CalamityMod.Tiles.hjson b/Localization/en-US/Mods.CalamityMod.Tiles.hjson index 6b076edf60..5a7ad68da1 100644 --- a/Localization/en-US/Mods.CalamityMod.Tiles.hjson +++ b/Localization/en-US/Mods.CalamityMod.Tiles.hjson @@ -1,4 +1,5 @@ // Ambient Objects +GiantBulb: Giant Plantera Bulb Fossil: Fossil Column: Column Ribs: Ribs diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index b9b8987d39..e25f8dc89c 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -18,6 +18,7 @@ using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; @@ -138,7 +139,7 @@ namespace CalamityMod /// 17.0 = Lunatic Cultist
/// 18.0 = Moon Lord /// - private static readonly Dictionary BossChecklistProgressionValues = new Dictionary + private static readonly Dictionary BossChecklistProgressionValues = new() { { "DesertScourge", 1.6f }, { "GiantClam", 1.61f }, @@ -187,6 +188,7 @@ namespace CalamityMod FargosSupport(); DialogueTweakSupport(); SummonersAssociationSupport(); + ColoredDamageTypesSupport(); } #region WikiThis @@ -1040,6 +1042,17 @@ namespace CalamityMod if (fargos is null) return; + // Stat Sheet support + double Damage(DamageClass damageClass) => Math.Round(Main.LocalPlayer.GetTotalDamage(damageClass).Additive * Main.LocalPlayer.GetTotalDamage(damageClass).Multiplicative * 100 - 100); + int Crit(DamageClass damageClass) => (int)Main.LocalPlayer.GetTotalCritChance(damageClass); + + int rogueItem = ModContent.ItemType(); + DamageClass rogueDamageClass = ModContent.GetInstance(); + Func rogueDamage = () => $"Rogue Damage: {Damage(rogueDamageClass)}%"; + Func rogueCrit = () => $"Rogue Critical: {Crit(rogueDamageClass)}%"; + fargos.Call("AddStat", rogueItem, rogueDamage); + fargos.Call("AddStat", rogueItem, rogueCrit); + void AddToMutantShop(string bossName, string summonItemName, Func downed, int price) { BossChecklistProgressionValues.TryGetValue(bossName, out float order); @@ -1183,5 +1196,43 @@ namespace CalamityMod }); } #endregion + + #region Colored Damage Types + // These are vanilla Terraria's colors for tooltips and damage + private static Color DefaultTooltipColor = Color.White; + private static Color DefaultDamageColor = new(255, 160, 80); + private static Color DefaultCritColor = new(255, 100, 30); + + // These are Colored Damage Types' colors for the Melee class + private static Color MeleeTooltipColor = new(254, 121, 2); + private static Color MeleeDamageColor = new(254, 121, 2); + private static Color MeleeCritColor = new(253, 62, 3); + + private static Color RogueTooltipColor = new(206, 132, 227); + private static Color RogueDamageColor = new(206, 132, 227); + private static Color RogueCritColor = new(194, 38, 212); + private static Color StealthTooltipColor = RogueTooltipColor; + private static Color StealthDamageColor = new(185, 105, 250); + private static Color StealthCritColor = new(144, 33, 235); + + public static void ColoredDamageTypesSupport() + { + Mod coloredDamageTypes = GetInstance().coloredDamageTypes; + if (coloredDamageTypes is null) + return; + + // Anything that directly uses AverageDamageClass uses the default vanilla colors. + coloredDamageTypes.Call("AddDamageType", AverageDamageClass.Instance, DefaultTooltipColor, DefaultDamageColor, DefaultCritColor); + + // True melee uses the same colorations as regular Melee. + coloredDamageTypes.Call("AddDamageType", TrueMeleeDamageClass.Instance, MeleeTooltipColor, MeleeDamageColor, MeleeCritColor); + coloredDamageTypes.Call("AddDamageType", TrueMeleeNoSpeedDamageClass.Instance, MeleeTooltipColor, MeleeDamageColor, MeleeCritColor); + + // Rogue has its own lavender color. Stealth strikes are hued towards violet so they stick out more. + // They would be hued towards magenta, but that would make them collide with Nebula-colored Magic in Colored Damage Types config. + coloredDamageTypes.Call("AddDamageType", RogueDamageClass.Instance, RogueTooltipColor, RogueDamageColor, RogueCritColor); + coloredDamageTypes.Call("AddDamageType", StealthDamageClass.Instance, StealthTooltipColor, StealthDamageColor, StealthCritColor); + } + #endregion } } diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 9ac54fa763..8325b3cd14 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -13,6 +13,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.NPCs.Abyss { @@ -280,7 +281,11 @@ namespace CalamityMod.NPCs.Abyss NPC.netUpdate = true; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => target.AddBuff(BuffID.Poisoned, 60 * (this.shouldTarget ? 10 : 5)); //10 sec for explosion, 5 sec for non explosion + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + { + target.AddBuff(BuffID.Poisoned, 60 * (this.shouldTarget ? 4 : 2)); //4 sec for explosion, 2 sec for non explosion + target.AddBuff(ModContent.BuffType(), 60 * (this.shouldTarget ? 4 : 2)); //4 sec for explosion, 2 sec for non explosion + } public override bool CheckDead() { diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index d0b2b2bc6d..864380f5a1 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -288,7 +288,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 180, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 2f17785853..227c06701a 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -354,7 +354,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 90); } } } diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs new file mode 100644 index 0000000000..249f87b1a7 --- /dev/null +++ b/NPCs/Abyss/SlabCrab.cs @@ -0,0 +1,465 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; + +namespace CalamityMod.NPCs.Abyss +{ + public class SlabCrab : ModNPC + { + enum AIState + { + Hiding = 0, + IdleAnim = 1, + Enraged = 2, + Active = 3, + Walking = 4 + } + + public Player Target => Main.player[NPC.target]; + public ref float CurrentPhase => ref NPC.ai[0]; + public ref float AITimer => ref NPC.ai[1]; + public ref float HopTimer => ref NPC.ai[2]; + public ref float CalmDownTimer => ref NPC.ai[3]; + + public bool playerCrossed = false; + public const int BaseDefense = 10; // the crab's defense while hostile + public const int BaseAttack = 20; // the crab's damage while hostile + public const float BaseKB = 1f; // the crab's knockback taken while hostile + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 23; + } + + public override void SetDefaults() + { + NPC.width = 44; + NPC.height = 30; + + NPC.damage = BaseAttack; + NPC.lifeMax = 300; + + NPC.aiStyle = AIType = -1; + + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.lavaImmune = true; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.chaseable = false; + NPC.knockBackResist = 0f; + NPC.defense = 999998; + NPC.HitSound = SoundID.NPCHit33; + NPC.DeathSound = SoundID.NPCDeath36; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + NPC.GravityIgnoresLiquid = true; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SlabCrab") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + writer.Write(playerCrossed); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + playerCrossed = reader.ReadBoolean(); + NPC.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + NPC.direction = NPC.velocity.X != 0 ? Math.Sign(NPC.velocity.X) : NPC.direction; + NPC.spriteDirection = -NPC.direction; + // the crab cannot be awoken for 1.5 seconds after spawning + NPC.localAI[0]++; + if (NPC.localAI[0] < 90) + return; + // Enables expert scaling, if damage is 0 in set defaults expert scaling will not happen. + NPC.damage = 0; + switch (CurrentPhase) + { + case (int)AIState.Hiding: + NPC.ShowNameOnHover = false; + NPC.chaseable = false; + NPC.defense = 999998; + AITimer++; + NPC.TargetClosest(false); + // if the block below it is mined, instantly start running + if (NPC.velocity.Y > 0) + { + ChangeAIHook((int)AIState.Active); + } + // randomly start looking around after a bit + if (AITimer > 300 && Main.rand.NextBool(420)) + { + ChangeAIHook((int)AIState.IdleAnim); + } + HandlePlayerDetection(); + HandlePickaxeInteraction(); + break; + case (int)AIState.IdleAnim: + NPC.ShowNameOnHover = true; + NPC.chaseable = false; + NPC.defense = 999998; + AITimer++; + NPC.TargetClosest(false); + // if the block below it is mined, instantly start running + if (NPC.velocity.Y > 0) + { + ChangeAIHook((int)AIState.Active); + } + // if the animation finishes, go back to stone mode + if (AITimer > 90) + { + ChangeAIHook((int)AIState.Hiding); + } + HandlePlayerDetection(); + HandlePickaxeInteraction(); + break; + case (int)AIState.Enraged: + NPC.ShowNameOnHover = true; + AITimer++; + NPC.defense = BaseDefense; + NPC.knockBackResist = 0f; + NPC.chaseable = false; + NPC.TargetClosest(false); + // give the animation time to play out then start attacking + if (AITimer > 24) + { + ChangeAIHook((int)AIState.Active); + } + break; + case (int)AIState.Active: + { + NPC.ShowNameOnHover = true; + NPC.defense = BaseDefense; + NPC.knockBackResist = BaseKB; + NPC.damage = BaseAttack; + NPC.chaseable = true; + // if the player is out of range (affected by if the crab can see the player), start ticking down the calmdown timer + bool outofRange = ((Target.Center.Distance(NPC.Center) > 600) || (Target.Center.Distance(NPC.Center) > 320 && !Collision.CanHitLine(NPC.Center, 1, 1, Target.Center, 1, 1))); + if (outofRange) + { + CalmDownTimer++; + } + else if (CalmDownTimer > 0) + { + CalmDownTimer--; + } + if (NPC.velocity.Y == 0f) + { + AITimer++; + NPC.knockBackResist = 0.6f; + NPC.TargetClosest(true); + NPC.velocity.X *= 0.85f; + + float hopRate = MathHelper.Lerp(25f, 10f, 1f - NPC.life / (float)NPC.lifeMax); + float lungeForwardSpeed = 6f; + float jumpSpeed = 7f; + if (Collision.CanHit(NPC.Center, 1, 1, Target.Center, 1, 1)) + lungeForwardSpeed *= 1.2f; + + // ocne the calmdown timer hits 3 seconds and the crab is on the ground, go back to hiding + if (outofRange && CalmDownTimer > 180) + { + playerCrossed = false; + ChangeAIHook((int)AIState.Hiding); + NPC.velocity.X = 0; + } + // after 3 hops, start walking once the crab is on the ground + if (HopTimer >= 3) + { + ChangeAIHook((int)AIState.Walking); + } + if (Main.netMode != NetmodeID.MultiplayerClient && AITimer > hopRate) + { + HopTimer++; + + // Make a bigger leap every 3 hops. + if (HopTimer % 3f == 2f) + lungeForwardSpeed *= 1.5f; + + AITimer = 0f; + NPC.velocity.Y -= jumpSpeed; + NPC.velocity.X = lungeForwardSpeed * NPC.direction; + NPC.netUpdate = true; + } + } + else + { + NPC.knockBackResist = 0.2f; + NPC.velocity.X *= 0.995f; + } + } + break; + case 4: + { + AITimer++; + NPC.knockBackResist = BaseKB; + NPC.damage = BaseAttack; + NPC.defense = BaseDefense; + // deaggro code is the same as above + bool outofRange = ((Target.Center.Distance(NPC.Center) > 300) || (Target.Center.Distance(NPC.Center) > 120 && !Collision.CanHitLine(NPC.Center, 1, 1, Target.Center, 1, 1))); + if (outofRange) + { + CalmDownTimer++; + } + else if (CalmDownTimer > 0) + { + CalmDownTimer--; + } + // turn around + if (NPC.oldPosition == NPC.position) + { + NPC.direction *= -1; + NPC.netUpdate = true; + } + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, 5 * NPC.direction, 0.0125f); + if (outofRange && Main.rand.NextBool(3) && CalmDownTimer > 180) + { + playerCrossed = false; + ChangeAIHook((int)AIState.Hiding); + NPC.velocity.X = 0; + } + // after 4 seconds and the player is still in the crab's line of sight, start leaping at them again + if (AITimer > 240 && Collision.CanHitLine(NPC.Center, 1, 1, Target.Center, 1, 1)) + { + ChangeAIHook((int)AIState.Active); + } + } + break; + } + // heavy + if (NPC.velocity.Y > 0) + { + NPC.velocity.Y *= 1.1f; + } + } + + public void ChangePhase(float ai0, float ai1 = -1, float ai2 = -1, float ai3 = -1) + { + CurrentPhase = ai0; + AITimer = ai1 == -1 ? 0 : ai1; + HopTimer = ai2 == -1 ? 0 : ai2; + CalmDownTimer = ai3 == -1 ? 0 : ai3; + NPC.netUpdate = true; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI); + } + + public void ChangeAIHook(float phase) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + ChangePhase((int)phase); + } + else + { + var netMessage = Mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncSlabCrabAI); + netMessage.Write(NPC.whoAmI); + netMessage.Write((int)phase); + netMessage.Send(); + } + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + // Don't draw the bar if in stealth mode. + if (CurrentPhase < (int)AIState.Enraged) + return false; + return null; + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneAbyssLayer1 && spawnInfo.Water) + { + return SpawnCondition.OceanMonster.Chance; + } + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 5, 10, 30); + } + + public override void FindFrame(int frameHeight) + { + // walkie + if (NPC.IsABestiaryIconDummy || CurrentPhase == (int)AIState.Active) + { + if (NPC.velocity.Y == 0) + { + if (NPC.frameCounter++ % 6 == 0) + { + NPC.frame.Y += frameHeight; + } + } + if (NPC.velocity.X != 0 || NPC.IsABestiaryIconDummy) + { + if (NPC.frame.Y > frameHeight * 22 || NPC.frame.Y < frameHeight * 19) + { + NPC.frame.Y = frameHeight * 19; + } + } + else + { + NPC.frame.Y = frameHeight * 19; + } + return; + } + switch (CurrentPhase) + { + case (int)AIState.Hiding: + NPC.frame.Y = 0; + break; + case (int)AIState.IdleAnim: + if (NPC.frameCounter++ % 6 == 0) + { + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y > frameHeight * 14) + { + NPC.frame.Y = frameHeight * 0; + } + break; + case (int)AIState.Enraged: + if (NPC.frame.Y > frameHeight * 18 || NPC.frame.Y < frameHeight * 15) + { + NPC.frame.Y = frameHeight * 15; + } + if (NPC.frame.Y < frameHeight * 18) + { + NPC.frameCounter++; + } + if (NPC.frameCounter >= 6) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; + } + break; + default: + if (NPC.frameCounter++ % 6 == 0) + { + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y > frameHeight * 22 || NPC.frame.Y < frameHeight * 19) + { + NPC.frame.Y = frameHeight * 19; + } + break; + } + } + // the crab is invincible while hiding + public override bool? CanBeHitByItem(Player player, Item item) => CurrentPhase > (int)AIState.IdleAnim; + + public override bool? CanBeHitByProjectile(Projectile projectile) => CurrentPhase > (int)AIState.IdleAnim; + + public void HandlePickaxeInteraction() + { + Player player = Main.LocalPlayer; + Rectangle tileMaus = new Rectangle(Player.tileTargetX * 16, Player.tileTargetY * 16, 16, 16); + // check if the player is holding a pickaxe + if (player.HeldItem.pick > 0) + { + // check if the tile sized cursor intersects with the crab + if (tileMaus.Intersects(NPC.getRect())) + { + // check if the crab is within range of the player's mining distance + if (player.Distance(NPC.Center) < (new Vector2(Player.tileRangeX, Player.tileRangeY).Length() + player.HeldItem.tileBoost) * 16) + { + // finally check if the player is actually swinging their pickaxe + if (player.ItemAnimationActive) + { + // ouch! + player.ApplyDamageToNPC(NPC, (int)player.GetDamage(DamageClass.MeleeNoSpeed).ApplyTo(player.HeldItem.damage), 0, player.direction); + SoundEngine.PlaySound(SoundID.Dig, NPC.Center); // this is the dig sound that shale piles use + if (CurrentPhase < (int)AIState.Enraged) + { + ChangeAIHook((int)AIState.Enraged); + } + } + } + } + } + } + + public void HandlePlayerDetection() + { + if (!playerCrossed) + { + // if the player is within a 4 pixel distance of the NPC's horizontal position and is within its line of sight, mark the player as noticed + if (Math.Abs(Target.position.X - NPC.position.X) < 4 && Collision.CanHitLine(NPC.Center, 1, 1, Target.Center, 1, 1)) + { + playerCrossed = true; + } + } + else + { + // once the player moves 8 blocks away, jump them + if (Target.Distance(NPC.Center) > 128) + { + ChangeAIHook((int)AIState.Enraged); + } + } + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Water, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Water, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), 90); + } + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (!NPC.IsABestiaryIconDummy) + { + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Abyss/SlabCrabGlow").Value; + + var effects = NPC.spriteDirection != 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); + } + } + } +} diff --git a/NPCs/Abyss/SlabCrab.png b/NPCs/Abyss/SlabCrab.png new file mode 100644 index 0000000000..d1e3465c13 Binary files /dev/null and b/NPCs/Abyss/SlabCrab.png differ diff --git a/NPCs/Abyss/SlabCrabGlow.png b/NPCs/Abyss/SlabCrabGlow.png new file mode 100644 index 0000000000..0af1cd2b82 Binary files /dev/null and b/NPCs/Abyss/SlabCrabGlow.png differ diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 43e88471c6..7a9c5393d2 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -128,7 +128,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 120, true); + target.AddBuff(ModContent.BuffType(), 120, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 8c4eac6828..ee45db7fa7 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -62,7 +62,25 @@ namespace CalamityMod.NPCs npc.chaseable = true; npc.netUpdate = true; } - npc.damage = npc.defDamage; + + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = 4f; + float minimalDamageVelocity = 8f; + if (npc.velocity.Length() <= minimalContactDamageVelocity) + { + if (head) + npc.damage = (int)(npc.defDamage * 0.5f); + else + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + if (head) + npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + else + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } } else npc.damage = 0; @@ -611,9 +629,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); - // Set damage - npc.damage = npc.defDamage; - // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -787,6 +802,9 @@ namespace CalamityMod.NPCs if (npc.ai[0] == -1f) { + // Avoid cheap bullshit + npc.damage = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) { int phase; @@ -815,6 +833,9 @@ namespace CalamityMod.NPCs // Pick a location to teleport to else if (npc.ai[0] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.chaseable = true; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -962,6 +983,9 @@ namespace CalamityMod.NPCs // Float above target and fire projectiles else if (npc.ai[0] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.chaseable = true; npc.rotation = npc.velocity.X * 0.04f; @@ -1041,6 +1065,9 @@ namespace CalamityMod.NPCs // Cocoon bullet hell else if (npc.ai[0] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.defense = npc.defDefense * 4; npc.chaseable = false; @@ -1150,6 +1177,9 @@ namespace CalamityMod.NPCs // Laser beam attack else if (npc.ai[0] == 5f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.chaseable = true; npc.defense = npc.defDefense * 2; @@ -1534,9 +1564,6 @@ namespace CalamityMod.NPCs else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - // Reset damage from bullet hell phases - npc.damage = npc.defDamage; - // Distance from destination where Cal Clone stops moving float movementDistanceGateValue = 100f; @@ -1605,10 +1632,12 @@ namespace CalamityMod.NPCs // Bullet hell phase if (calamityGlobalNPC.newAI[2] > 0f) { + // Avoid cheap bullshit + npc.damage = 0; + if (calamityGlobalNPC.newAI[3] < 900f) { calamityGlobalNPC.newAI[3] += 1f; - npc.damage = 0; npc.dontTakeDamage = true; npc.alpha = 255; @@ -1798,11 +1827,13 @@ namespace CalamityMod.NPCs } npc.alpha = npc.dontTakeDamage ? 255 : 0; - npc.damage = npc.dontTakeDamage ? 0 : npc.defDamage; // Float above target and fire lasers or fireballs if (npc.ai[1] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[2] += 1f; float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); if (npc.ai[2] >= phaseTimer || phase4) @@ -1852,6 +1883,9 @@ namespace CalamityMod.NPCs // Float to the side of the target and fire else if (npc.ai[1] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; @@ -1908,6 +1942,9 @@ namespace CalamityMod.NPCs } else if (npc.ai[1] == 2f) { + // Set damage + npc.damage = npc.defDamage; + npc.rotation = rotation; float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; @@ -1921,11 +1958,17 @@ namespace CalamityMod.NPCs } else if (npc.ai[1] == 3f) { + // Set damage + npc.damage = npc.defDamage; + npc.ai[2] += 1f; float chargeTime = phase4 ? 35f : death ? 40f : 45f; if (npc.ai[2] >= chargeTime) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity *= 0.9f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -1969,6 +2012,9 @@ namespace CalamityMod.NPCs } else { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[2] += 1f; if (npc.ai[2] >= (phase4 ? 15f : 30f)) { @@ -2088,6 +2134,9 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) { + // Avoid cheap bullshit + npc.damage = (int)(npc.defDamage * 0.5f); + float calCloneBroProjAttackMaxSpeed = 5f; float calCloneBroProjAttackAccel = 0.1f; calCloneBroProjAttackMaxSpeed += 2f * enrageScale; @@ -2206,6 +2255,9 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 1f) { + // Set damage + npc.damage = npc.defDamage; + SoundEngine.PlaySound(SoundID.Roar, npc.Center); npc.rotation = calCloneBroRotation; @@ -2253,6 +2305,9 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 2f) { + // Set damage + npc.damage = npc.defDamage; + npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); if (expertMode) npc.ai[2] += 0.25f; @@ -2261,6 +2316,9 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= 75f) { + // Avoid cheap bullshit + npc.damage = (int)(npc.defDamage * 0.5f); + npc.velocity.X *= 0.93f; npc.velocity.Y *= 0.93f; @@ -2395,6 +2453,9 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) { + // Avoid cheap bullshit + npc.damage = (int)(npc.defDamage * 0.5f); + float calCloneBroProjAttackMaxSpeed = 4.5f; float calCloneBroProjAttackAccel = 0.2f; calCloneBroProjAttackMaxSpeed += 2f * enrageScale; @@ -2513,6 +2574,9 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 1f) { + // Set damage + npc.damage = npc.defDamage; + SoundEngine.PlaySound(SoundID.Roar, npc.Center); npc.rotation = calCloneBroRotation; @@ -2560,6 +2624,9 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 2f) { + // Set damage + npc.damage = npc.defDamage; + npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); if (expertMode) npc.ai[2] += 0.25f; @@ -2568,6 +2635,9 @@ namespace CalamityMod.NPCs if (npc.ai[2] >= 60f) //50 { + // Avoid cheap bullshit + npc.damage = (int)(npc.defDamage * 0.5f); + npc.velocity.X *= 0.93f; npc.velocity.Y *= 0.93f; @@ -2624,24 +2694,14 @@ namespace CalamityMod.NPCs 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; - // Don't deal contact damage for 2 seconds after the teleport phase to avoid cheap bullshit - float noContactDamageTime = 120f; - - bool dontDealContactDamage = npc.localAI[3] > noProjectileOrPhaseIncrementTime - noContactDamageTime; bool dontAttack = npc.localAI[3] > 0f; if (dontAttack) - { npc.localAI[3] -= 1f; - if (dontDealContactDamage) - npc.damage = 0; - } - // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -2894,6 +2954,9 @@ namespace CalamityMod.NPCs // Start up if (npc.ai[0] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[0] = 1f; npc.netUpdate = true; CustomGravity(); @@ -2902,6 +2965,9 @@ namespace CalamityMod.NPCs // Idle else if (npc.ai[0] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + // Slow down npc.velocity.X *= 0.8f; @@ -2943,6 +3009,9 @@ namespace CalamityMod.NPCs // Walk else if (npc.ai[0] == 2f) { + // Avoid cheap bullshit + npc.damage = 0; + // Set walking direction if (Math.Abs(npc.Center.X - player.Center.X) < 200f * npc.scale) { @@ -3033,6 +3102,9 @@ namespace CalamityMod.NPCs // Jump else if (npc.ai[0] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.noTileCollide = false; if (npc.velocity.Y == 0f) @@ -3050,6 +3122,9 @@ namespace CalamityMod.NPCs } else if (npc.ai[1] == -1f) { + // Set damage + npc.damage = npc.defDamage; + // Set jump velocity, reset and set AI to next phase (Stomp) float distanceFromPlayerOnXAxis = npc.Center.X - player.Center.X; npc.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1; @@ -3113,6 +3188,9 @@ namespace CalamityMod.NPCs { if (npc.velocity.Y == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc SoundStyle soundToPlay = Main.zenithWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound; SoundEngine.PlaySound(soundToPlay, npc.Center); @@ -3231,6 +3309,9 @@ namespace CalamityMod.NPCs } else { + // Set damage + npc.damage = npc.defDamage; + // Set velocities while falling, this happens before the stomp // Fall through if (!player.dead) @@ -3315,6 +3396,9 @@ namespace CalamityMod.NPCs // Teleport else if (npc.ai[0] == 5f) { + // Avoid cheap bullshit + npc.damage = 0; + // Slow down npc.velocity.X *= 0.8f; @@ -3529,9 +3613,30 @@ namespace CalamityMod.NPCs // Deus cannot hit for 3 seconds or while invulnerable if (calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage) + { npc.damage = 0; + } else - npc.damage = npc.defDamage; + { + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = 2f; + float minimalDamageVelocity = 8f; + if (npc.velocity.Length() <= minimalContactDamageVelocity) + { + if (head) + npc.damage = (int)(npc.defDamage * 0.5f); + else + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + if (head) + npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + else + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + } // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 30422e9123..a427b18236 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -3551,6 +3551,7 @@ namespace CalamityMod.NPCs if (targetData.Type == NPCTargetType.Player) targetDead = Main.player[npc.target].dead; + bool deathModeVelocityBuff = true; float maxVelocity = 6f; float acceleration = 0.05f; if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) @@ -3619,48 +3620,59 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.ServantofCthulhu) { - maxVelocity = 5f + npc.ai[2] * 3f; - acceleration = 0.03f + npc.ai[2] * 0.15f; + maxVelocity = 5f + npc.ai[2] * 2f; + acceleration = 0.03f + npc.ai[2] * 0.03f; } 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 flyAwayAccel = (npc.ai[1] - flyAwayTime) / flyAwayTime; - if (flyAwayAccel > 1f) + bool notQueenBeeBee = npc.ai[3] == 0f; + if (notQueenBeeBee) { - flyAwayAccel = 1f; + 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 flyAwayAccel = (npc.ai[1] - flyAwayTime) / flyAwayTime; + if (flyAwayAccel > 1f) + { + flyAwayAccel = 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; + } + + maxVelocity = 5f; + acceleration = 0.1f * flyAwayAccel; } 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; + deathModeVelocityBuff = false; + maxVelocity = 5f + npc.ai[2] * 2f; + acceleration = 0.1f + npc.ai[2] * 0.04f; } - - maxVelocity = 5f + npc.ai[2] * 3f; - acceleration = 0.1f + npc.ai[2] * 0.15f; - acceleration *= flyAwayAccel; } + maxVelocity *= 1.25f; acceleration *= 1.25f; - if (CalamityWorld.death) + if (CalamityWorld.death && deathModeVelocityBuff) { maxVelocity *= 1.25f; acceleration *= 1.25f; } + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float targetXDist = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); float targetYDist = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); @@ -3672,11 +3684,11 @@ namespace CalamityMod.NPCs targetYDist -= vector.Y; float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); float targetDistCheck = targetDistance; + bool flag = false; if (targetDistance > 600f) - { flag = true; - } + if (targetDistance == 0f) { targetXDist = npc.velocity.X; @@ -3688,42 +3700,37 @@ namespace CalamityMod.NPCs targetXDist *= targetDistance; targetYDist *= targetDistance; } + 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 (targetDistCheck > 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) - { npc.velocity.Y = npc.velocity.Y + 0.03f; - } else - { npc.velocity.Y = npc.velocity.Y - 0.03f; - } + if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { npc.velocity.X = npc.velocity.X + 0.03f; - } else - { npc.velocity.X = npc.velocity.X - 0.03f; - } + if (npc.ai[0] > 200f) - { npc.ai[0] = -200f; - } } + if (targetDistCheck < 150f && (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid)) { npc.velocity.X = npc.velocity.X + targetXDist * 0.009f; npc.velocity.Y = npc.velocity.Y + targetYDist * 0.009f; } + if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) { if (npc.ai[3] == 1f) { - float pushVelocity = 0.5f + npc.ai[2] * 0.25f; + float pushVelocity = 0.5f + npc.ai[2] * 0.2f; for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active) @@ -3748,42 +3755,37 @@ namespace CalamityMod.NPCs } } } + if (targetDead) { targetXDist = (float)npc.direction * maxVelocity / 2f; targetYDist = -maxVelocity / 2f; } + if (npc.velocity.X < targetXDist) { npc.velocity.X = npc.velocity.X + acceleration; 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 && targetXDist > 0f) - { npc.velocity.X = npc.velocity.X + acceleration; - } } else if (npc.velocity.X > targetXDist) { npc.velocity.X = npc.velocity.X - acceleration; 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 && targetXDist < 0f) - { npc.velocity.X = npc.velocity.X - acceleration; - } } + if (npc.velocity.Y < targetYDist) { npc.velocity.Y = npc.velocity.Y + acceleration; 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 && targetYDist > 0f) - { npc.velocity.Y = npc.velocity.Y + acceleration; - } } else if (npc.velocity.Y > targetYDist) { npc.velocity.Y = npc.velocity.Y - acceleration; 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 && targetYDist < 0f) - { npc.velocity.Y = npc.velocity.Y - acceleration; - } } if (npc.type == NPCID.ServantofCthulhu) @@ -3841,19 +3843,20 @@ namespace CalamityMod.NPCs Projectile.NewProjectile(npc.GetSource_FromAI(), vector.X, vector.Y, targetXDist, targetYDist, projType, projDamage, 0f, Main.myPlayer, 0f, 0f); } } + int npcXPos = (int)npc.position.X + npc.width / 2; int npcTileY = (int)npc.position.Y + npc.height / 2; int npcTileX = npcXPos / 16; npcTileY /= 16; if (!WorldGen.SolidTile(npcTileX, npcTileY)) - { Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0.1f, 0.05f); - } + if (targetXDist > 0f) { npc.spriteDirection = 1; npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist); } + if (targetXDist < 0f) { npc.spriteDirection = -1; @@ -3867,52 +3870,41 @@ namespace CalamityMod.NPCs 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) - { npc.spriteDirection = 1; - } if (npc.velocity.X < 0f) - { npc.spriteDirection = -1; - } + npc.rotation = npc.velocity.X * 0.1f; } else - { npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - MathHelper.PiOver2; - } + 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 reboundSpeed = 0.7f; if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) - { reboundSpeed = 0.4f; - } + if (npc.collideX) { npc.netUpdate = true; npc.velocity.X = npc.oldVelocity.X * -reboundSpeed; if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { npc.velocity.X = 2f; - } if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { npc.velocity.X = -2f; - } } + if (npc.collideY) { npc.netUpdate = true; npc.velocity.Y = npc.oldVelocity.Y * -reboundSpeed; if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { npc.velocity.Y = 2f; - } if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { npc.velocity.Y = -2f; - } } + if (npc.type == NPCID.BloodSquid) { int bloodDust = Dust.NewDust(npc.position, npc.width, npc.height, 5, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100); @@ -3930,9 +3922,8 @@ namespace CalamityMod.NPCs { int dustType = 18; if (npc.type == NPCID.Crimera) - { dustType = 5; - } + int idleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), dustType, npc.velocity.X, 2f, 75, npc.color, npc.scale); Dust dust = Main.dust[idleDust]; dust.velocity.X *= 0.5f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 9930b88b3c..a400440a21 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -167,9 +167,6 @@ namespace CalamityMod.NPCs // Used to change the Expert Mode coin drop multiplier private const double NPCValueMultiplier_ExpertCalamity = 1.5; - // Max velocity used in contact damage scaling - public float maxVelocity = 0f; - // Dash damage immunity timer public const int maxPlayerImmunities = Main.maxPlayers + 1; public int[] dashImmunityTime = new int[maxPlayerImmunities]; @@ -387,8 +384,6 @@ namespace CalamityMod.NPCs myClone.miscDefenseLoss = miscDefenseLoss; - myClone.maxVelocity = maxVelocity; - myClone.dashImmunityTime = new int[maxPlayerImmunities]; for (int i = 0; i < maxPlayerImmunities; ++i) myClone.dashImmunityTime[i] = dashImmunityTime[i]; @@ -917,7 +912,7 @@ namespace CalamityMod.NPCs // Dragonfire if (dragonFire > 0) { - int baseDragonFireDoTValue = (int)(760 * heatDamageMult); + int baseDragonFireDoTValue = (int)(960 * heatDamageMult); ApplyDPSDebuff(baseDragonFireDoTValue, baseDragonFireDoTValue / 5, ref npc.lifeRegen, ref damage); } @@ -1077,8 +1072,8 @@ namespace CalamityMod.NPCs if (miracleBlight > 0) ApplyDPSDebuff(2500, 500, ref npc.lifeRegen, ref damage); - // Reduce DoT on worm bosses by 75%. - if (wormBoss && npc.lifeRegen < 0) + // Reduce DoT on worm bosses and Creepers by 75%. + if ((wormBoss || npc.type == NPCID.Creeper) && npc.lifeRegen < 0) { npc.lifeRegen /= 4; if (npc.lifeRegen > -1) @@ -1415,17 +1410,17 @@ namespace CalamityMod.NPCs } else if ((npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) && CalamityPlayer.areThereAnyDamnBosses) { - npc.lifeMax = (int)(npc.lifeMax * 2.5); + npc.lifeMax = (int)(npc.lifeMax * 1.5); npc.scale *= 1.25f; } else if (npc.type == NPCID.BrainofCthulhu) { - npc.lifeMax = (int)(npc.lifeMax * 1.1); + npc.lifeMax = (int)(npc.lifeMax * 1.65); npc.npcSlots = 12f; } else if (npc.type == NPCID.Creeper) { - npc.lifeMax = (int)(npc.lifeMax * 1.1); + npc.lifeMax = (int)(npc.lifeMax * 1.4); } else if (CalamityLists.EaterofWorldsIDs.Contains(npc.type)) { @@ -2263,6 +2258,11 @@ namespace CalamityMod.NPCs npc.coldDamage = true; break; + // These go through walls and are very annoying with the new tombstone breaking spawning them mechanic in 1.4 + case NPCID.Ghost: + npc.lifeMax = (int)(npc.lifeMax * 0.5); + break; + case NPCID.PirateGhost: npc.lifeMax = (int)(npc.lifeMax * 0.33); break; @@ -2822,12 +2822,6 @@ namespace CalamityMod.NPCs dashImmunityTime[i]--; } - if (CalamityPlayer.areThereAnyDamnBosses) - { - if (npc.velocity.Length() > maxVelocity) - maxVelocity = npc.velocity.Length(); - } - if (KillTime > 0 || npc.type == NPCType()) { // Apply Boss Effects while any boss NPC is active @@ -4325,6 +4319,11 @@ namespace CalamityMod.NPCs switch (npc.type) { + case NPCID.VileSpitEaterOfWorlds: + case NPCID.VileSpit: + target.AddBuff(BuffType(), 240); + break; + case NPCID.ShadowFlameApparition: target.AddBuff(BuffType(), 180); break; @@ -5808,8 +5807,141 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { + // Create additional afterimages in the cardinal directions in Rev+ + if (npc.type == NPCID.BrainofCthulhu) + { + float secondAfterimageSetHealthValue = (int)(npc.lifeMax * 0.8f); + if (npc.life < secondAfterimageSetHealthValue) + { + Color currentColor = npc.GetAlpha(drawColor); + float opacityScale = 1f - npc.life / (float)secondAfterimageSetHealthValue; + float opacity = Main.getGoodWorld ? 1f : opacityScale; + + opacity = MathHelper.Clamp(opacity, 0f, 1f); + currentColor.R = (byte)((float)(int)currentColor.R * opacity); + currentColor.G = (byte)((float)(int)currentColor.G * opacity); + currentColor.B = (byte)((float)(int)currentColor.B * opacity); + currentColor.A = (byte)((float)(int)currentColor.A * opacity); + int totalAfterimages = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 12 : 4; + for (int i = 0; i < totalAfterimages; i++) + { + Vector2 position = npc.position; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (i > 3) + { + currentColor *= 0.5f; + distanceFromTargetX *= 0.5f; + distanceFromTargetY *= 0.5f; + } + + switch (i) + { + case 0: + case 4: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y; + break; + + case 1: + case 5: + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + position.X = Main.player[Main.myPlayer].Center.X; + break; + + case 2: + case 6: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y; + break; + + case 3: + case 7: + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + position.X = Main.player[Main.myPlayer].Center.X; + break; + + case 8: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; + + case 9: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + break; + + case 10: + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + case 11: + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + break; + + default: + break; + } + + position.X -= npc.width / 2; + position.Y -= npc.height / 2; + + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)TextureAssets.Npc[npc.type].Width() * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)TextureAssets.Npc[npc.type].Height() * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + + // Telegraph for charge and blood shots + else if (npc.type == NPCID.Creeper) + { + float beginTelegraphGateValue = BrainOfCthulhuAI.TimeBeforeCreeperAttack - BrainOfCthulhuAI.CreeperTelegraphTime; + if (npc.ai[1] > beginTelegraphGateValue || npc.ai[0] == 1f) + { + float colorScale = npc.ai[0] == 1f ? 1f : MathHelper.Clamp((npc.ai[1] - beginTelegraphGateValue) / BrainOfCthulhuAI.CreeperTelegraphTime, 0f, 1f); + Color drawColor2 = new Color(150, 30, 30, 0) * colorScale; + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + for (int i = 0; i < 2; i++) + { + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + + // Telegraph for slaps + else if (npc.type == NPCID.SkeletronHand) + { + float beginTelegraphGateValue = SkeletronAI.HandSlapGateValue - SkeletronAI.HandSlapTelegraphTime; + if (npc.ai[3] > beginTelegraphGateValue) + { + float colorScale = MathHelper.Clamp((npc.ai[3] - beginTelegraphGateValue) / SkeletronAI.HandSlapTelegraphTime, 0f, 1f); + Color drawColor2 = new Color(150, 150, 150, 0) * colorScale; + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + for (int i = 0; i < 2; i++) + { + spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + // His afterimages I can't get to work, so fuck it - if (npc.type == NPCID.SkeletronPrime) + else if (npc.type == NPCID.SkeletronPrime) { Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index a192ded31d..27f399b3dc 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -90,6 +90,7 @@ namespace CalamityMod.NPCs private static readonly string[] DemolitionistNames = { "Tavish DeGroot", // <@!442447226992721930> (magicoal) + "Fimmy", // <@!407348617079160832> (darkmega5) }; private static readonly string[] DryadNames = { @@ -132,6 +133,7 @@ namespace CalamityMod.NPCs "Leeman", // <@!281999243168841728> (Tweee#5831) "Mihai", // <@!373941893467209730> (cmihaii.) "Aka Retribution", // <@!302318734633205761> (azurr_nihilo) + "Cooler Kevin", // <@!614126424751603714> (exellent.) }; private static readonly string[] MechanicNames = { diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index a4e7110938..569ed19305 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Crabulon if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) NPC.scale = 2f; - NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30 : 15; + NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 30; if (BossRushEvent.BossRushActive) NPC.lifeMax = 8000; if (Main.getGoodWorld) @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Crabulon double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; NPC.lifeMax += (int)(NPC.lifeMax * HPBoost); AIType = -1; - NPC.knockBackResist = 0.75f; + NPC.knockBackResist = 0.5f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.canGhostHeal = false; @@ -58,37 +58,40 @@ namespace CalamityMod.NPCs.Crabulon public override void AI() { - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0f, 0.2f, 0.4f); + Lighting.AddLight(NPC.Center, 0f, 0.2f, 0.4f); + + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - float xVelocityLimit = BossRushEvent.BossRushActive ? 7.5f : 5f; - float yVelocityLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.5f : revenge ? 1.25f : 1f; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + float xVelocityLimit = BossRushEvent.BossRushActive ? 12f : death ? 8f : revenge ? 6f : 5f; + float yVelocityLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.25f : death ? 0.75f : revenge ? 0.9f : 1f; + NPC.TargetClosest(); Player player = Main.player[NPC.target]; + NPC.velocity.Y += 0.02f; if (NPC.velocity.Y > yVelocityLimit) - { NPC.velocity.Y = yVelocityLimit; - } + if (NPC.position.X + NPC.width < player.position.X) { if (NPC.velocity.X < 0f) - { NPC.velocity.X *= 0.98f; - } + NPC.velocity.X += 0.1f; } else if (NPC.position.X > player.position.X + player.width) { if (NPC.velocity.X > 0f) - { NPC.velocity.X *= 0.98f; - } + NPC.velocity.X -= 0.1f; } + if (NPC.velocity.X > xVelocityLimit || NPC.velocity.X < -xVelocityLimit) - { NPC.velocity.X *= 0.97f; - } + NPC.rotation = NPC.velocity.X * 0.1f; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) @@ -155,16 +158,13 @@ namespace CalamityMod.NPCs.Crabulon public override void HitEffect(NPC.HitInfo hit) { - for (int k = 0; k < 3; k++) - { + for (int k = 0; k < 2; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { - for (int k = 0; k < 10; k++) - { + for (int k = 0; k < 6; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, 56, hit.HitDirection, -1f, 0, default, 1f); - } } } } diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 69213ea855..708c8be7eb 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -190,46 +190,32 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.ai[0] < 2f) { - Vector2 mushBombDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - int mushBombAmt = 1; - NPC.localAI[3] += 2f; - if (phase2) - { - NPC.localAI[3] += 1f; - mushBombAmt += 2; - } - if (phase3) - { - NPC.localAI[3] += 2f; - mushBombAmt += 3; - } + int mushBombAmt = phase3 ? 6 : phase2 ? 3 : 1; + float fireRate = phase3 ? 4f : phase2 ? 2f : 1f; + NPC.localAI[3] += fireRate; if (NPC.ai[3] == 0f) { - if (NPC.localAI[3] > 600f) + float shootMushroomsGateValue = revenge ? 120f : expertMode ? 200f : 300f; + if (NPC.localAI[3] > shootMushroomsGateValue) { NPC.ai[3] = 1f; NPC.localAI[3] = 0f; } } - else if (NPC.localAI[3] > 45f) + else if (NPC.localAI[3] > 30f) { NPC.localAI[3] = 0f; NPC.ai[3] += 1f; if (NPC.ai[3] >= mushBombAmt) NPC.ai[3] = 0f; - float mushBombSpeed = 10f; + float mushBombSpeed = phase3 ? 14f : phase2 ? 12f : 10f; int type = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - if (phase2) - mushBombSpeed += 1f; - if (phase3) - mushBombSpeed += 1f; - - mushBombDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + Vector2 mushBombDirection = NPC.Center; float playerXDist = player.position.X + player.width * 0.5f - mushBombDirection.X; float playerYDist = player.position.Y + player.height * 0.5f - mushBombDirection.Y; float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); @@ -238,13 +224,18 @@ namespace CalamityMod.NPCs.Crabulon playerYDist *= playerDistance; mushBombDirection.X += playerXDist; mushBombDirection.Y += playerYDist; - Projectile.NewProjectile(NPC.GetSource_FromAI(), mushBombDirection.X, mushBombDirection.Y, playerXDist, playerYDist - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); + float yVelocity = death ? 1f : expertMode ? 2.5f : 5f; + Vector2 mushBombVelocity = new Vector2(playerXDist, playerYDist - yVelocity); + Projectile.NewProjectile(NPC.GetSource_FromAI(), mushBombDirection, mushBombVelocity, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); } } } if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity *= 0.98f; NPC.ai[1] += 1f; @@ -252,10 +243,9 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += 1f; if (phase3) NPC.ai[1] += 2f; - if (NPC.justHit) - NPC.ai[1] += 4f; - if (NPC.ai[1] >= (death ? 150f : revenge ? 180f : 240f)) + float idleTime = death ? 30f : expertMode ? 60f : 120f; + if (NPC.ai[1] >= idleTime) { NPC.TargetClosest(); NPC.noGravity = true; @@ -267,16 +257,16 @@ namespace CalamityMod.NPCs.Crabulon } else if (NPC.ai[0] == 1f) { - float walkingVelocity = 2f; + // Avoid cheap bullshit + NPC.damage = 0; + + float walkingVelocity = (death ? (5f + 2f * (1f - lifeRatio)) : expertMode ? 5f : 3.5f) + 2.5f * enrageScale; if (phase2) - walkingVelocity = 2.5f; + walkingVelocity += 0.5f; if (phase3) - walkingVelocity = 3f; - if (death) - walkingVelocity += 2f * (1f - lifeRatio); + walkingVelocity += 1f; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) walkingVelocity *= 2f; - walkingVelocity += 2.5f * enrageScale; bool shouldWalkSlower = false; if (Math.Abs(NPC.Center.X - player.Center.X) < 50f) @@ -285,7 +275,7 @@ namespace CalamityMod.NPCs.Crabulon if (shouldWalkSlower) { NPC.velocity.X *= 0.9f; - if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + if (Math.Abs(NPC.velocity.X) < 0.1f) NPC.velocity.X = 0f; } else @@ -293,10 +283,11 @@ namespace CalamityMod.NPCs.Crabulon float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; + float inertia = revenge ? 10f : 20f; if (NPC.direction > 0) - NPC.velocity.X = (NPC.velocity.X * 20f + walkingVelocity) / 21f; + NPC.velocity.X = (NPC.velocity.X * inertia + walkingVelocity) / (inertia + 1f); if (NPC.direction < 0) - NPC.velocity.X = (NPC.velocity.X * 20f - walkingVelocity) / 21f; + NPC.velocity.X = (NPC.velocity.X * inertia - walkingVelocity) / (inertia + 1f); } if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && player.position.Y <= NPC.position.Y + NPC.height && !NPC.collideX) @@ -311,9 +302,12 @@ namespace CalamityMod.NPCs.Crabulon Vector2 collisionCheckPosition = new Vector2(NPC.Center.X - 40, NPC.position.Y + NPC.height - 20); bool fallDownOnTopOfTarget = NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f; + float acceleration = death ? 0.1f : expertMode ? 0.05f : 0.025f; + float acceleration2 = death ? 0.8f : expertMode ? 0.4f : 0.2f; if (fallDownOnTopOfTarget) { - NPC.velocity.Y += 0.5f; + float fallSpeed = death ? 2f : expertMode ? 1f : 0.5f; + NPC.velocity.Y += fallSpeed; } else if (Collision.SolidCollision(collisionCheckPosition, 80, 20)) { @@ -321,12 +315,13 @@ namespace CalamityMod.NPCs.Crabulon NPC.velocity.Y = 0f; if (NPC.velocity.Y > -0.2f) - NPC.velocity.Y -= 0.025f; + NPC.velocity.Y -= acceleration; else - NPC.velocity.Y -= 0.2f; + NPC.velocity.Y -= acceleration2; - if (NPC.velocity.Y < -4f) - NPC.velocity.Y = -4f; + float upwardSpeedCap = death ? 16f : expertMode ? 8f : 4f; + if (NPC.velocity.Y < -upwardSpeedCap) + NPC.velocity.Y = -upwardSpeedCap; } else { @@ -334,14 +329,15 @@ namespace CalamityMod.NPCs.Crabulon NPC.velocity.Y = 0f; if (NPC.velocity.Y < 0.1f) - NPC.velocity.Y += 0.025f; + NPC.velocity.Y += acceleration; else NPC.velocity.Y += 0.5f; } } NPC.ai[1] += 1f; - if (NPC.ai[1] >= (360f - (death ? 120f * (1f - lifeRatio) : 0f))) + float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 120f * (1f - lifeRatio) : 0f); + if (NPC.ai[1] >= stompPhaseGateValue) { NPC.TargetClosest(); NPC.noGravity = false; @@ -356,6 +352,9 @@ namespace CalamityMod.NPCs.Crabulon } else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.noTileCollide = false; if (NPC.velocity.Y == 0f) { @@ -374,49 +373,54 @@ namespace CalamityMod.NPCs.Crabulon break; case 1: case 2: - NPC.ai[1] += 3f; + NPC.ai[1] += 2f; break; case 3: - NPC.ai[1] += 6f; + NPC.ai[1] += 4f; break; default: break; } } if (phase2) - NPC.ai[1] += !revenge ? 4f : 1f; + NPC.ai[1] += !revenge ? 2f : 1f; if (phase3) - NPC.ai[1] += !revenge ? 4f : 1f; + NPC.ai[1] += !revenge ? 2f : 1f; } - float jumpGateValue = (bossRush ? 40f : 120f) / (enrageScale + 1f); + float jumpGateValue = (bossRush ? 15f : expertMode ? 60f : 120f) / (enrageScale + 1f); if (NPC.ai[1] >= jumpGateValue) { NPC.ai[1] = -20f; } else if (NPC.ai[1] == -1f) { - int velocityX = 4; - float velocityY = -12f; + float maxVelocityXIncrease = death ? 6f : 4f; + float maxVelocityYIncrease = death ? 3f : 2f; + float velocityX = 6f + (expertMode ? (maxVelocityXIncrease * (1f - lifeRatio)) : 0f); + float velocityY = 12f + (expertMode ? (maxVelocityYIncrease * (1f - lifeRatio)) : 0f); float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); float speedMult = 1f; if (revenge) { + float velocityXAdjustment = velocityX; + float velocityYAdjustment = velocityY / 3f; + switch ((int)NPC.ai[3]) { case 0: // Normal break; case 1: // High - velocityY -= 4f; + velocityY += velocityYAdjustment; break; case 2: // Low - velocityY += 4f; + velocityY -= velocityYAdjustment; break; case 3: // Long and low - velocityX += 4; - velocityY += 4f; + velocityX += velocityXAdjustment; + velocityY -= velocityYAdjustment; break; default: break; @@ -434,14 +438,14 @@ namespace CalamityMod.NPCs.Crabulon if (expertMode) { if (player.position.Y < NPC.Bottom.Y) - NPC.velocity.Y = velocityY; + NPC.velocity.Y = -velocityY; else NPC.velocity.Y = 1f; NPC.noTileCollide = true; } else - NPC.velocity.Y = velocityY; + NPC.velocity.Y = -velocityY; float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; @@ -458,21 +462,24 @@ namespace CalamityMod.NPCs.Crabulon { if (NPC.velocity.Y == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + SoundEngine.PlaySound(SoundID.Item14, NPC.Center); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - if (NPC.ai[2] % 2f == 0f && phase2 && revenge) + if ((NPC.ai[2] % 2f == 0f || death) && ((phase2 && revenge) || (phase3 && expertMode))) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 12f : 10f; + float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 15f : 10f; Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; destination.Normalize(); destination *= projectileVelocity; - int numProj = bossRush ? 48 : CalamityWorld.death ? 24 : 20; + int numProj = bossRush ? 48 : CalamityWorld.death ? 30 : 20; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) { @@ -484,19 +491,20 @@ namespace CalamityMod.NPCs.Crabulon } NPC.TargetClosest(); + NPC.ai[2] += 1f; if (NPC.ai[2] >= (phase2 ? 4f : 3f)) { - if (revenge && !phase2) + if (revenge && (!phase2 || (phase3 && death))) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 12f : 10f; + float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 15f : 10f; Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; destination.Normalize(); destination *= projectileVelocity; - int numProj = bossRush ? 30 : CalamityWorld.death ? 15 : 11; + int numProj = bossRush ? 30 : CalamityWorld.death ? 18 : 12; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) { @@ -509,6 +517,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[0] = 0f; NPC.ai[2] = 0f; + if (revenge) NPC.ai[3] = 0f; @@ -520,6 +529,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.direction = playerLocation < 0 ? 1 : -1; NPC.ai[0] = 2f; + if (revenge) NPC.ai[3] += 1f; @@ -533,6 +543,8 @@ namespace CalamityMod.NPCs.Crabulon int stompDust = 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[stompDust].velocity *= 0.2f; } + + // Destroy tiles with stomps in Zenith seed if (Main.zenithWorld) { int x = j / 16; @@ -559,6 +571,9 @@ namespace CalamityMod.NPCs.Crabulon } else { + // Set damage + NPC.damage = NPC.defDamage; + if (!player.dead && expertMode) { if ((player.position.Y > NPC.Bottom.Y && NPC.velocity.Y > 0f) || (player.position.Y < NPC.Bottom.Y && NPC.velocity.Y < 0f)) @@ -569,61 +584,46 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width) { - NPC.velocity.X *= 0.9f; - NPC.velocity.Y += death ? 0.18f : 0.15f; + float slowDownMultiplier = death ? 0.84f : expertMode ? 0.92f : 0.96f; + NPC.velocity.X *= slowDownMultiplier; + + float fallSpeedIncrease = death ? 0.24f : expertMode ? 0.12f : 0.06f; + NPC.velocity.Y += fallSpeedIncrease; } else { - float velocityX = 0.11f + - (expertMode ? 0.02f : 0f) + - (revenge ? 0.02f : 0f) + - (death ? 0.02f : 0f); - velocityX += 0.05f * enrageScale; - + float velocityX = (death ? 0.2f : expertMode ? 0.15f : 0.1f) + 0.05f * enrageScale; if (NPC.direction < 0) NPC.velocity.X -= velocityX; else if (NPC.direction > 0) NPC.velocity.X += velocityX; - float topXSpeed = 2.5f; - topXSpeed += enrageScale; - if (revenge) - { - topXSpeed += 1f; - } + float topXSpeed = (death ? 5.5f : expertMode ? 4f : 2.5f) + enrageScale; if (phase2) - { topXSpeed += 1f; - } if (phase3) - { topXSpeed += 1f; - } + if (NPC.velocity.X < -topXSpeed) - { NPC.velocity.X = -topXSpeed; - } if (NPC.velocity.X > topXSpeed) - { NPC.velocity.X = topXSpeed; - } } } } if (NPC.localAI[0] == 0f && NPC.life > 0) - { NPC.localAI[0] = NPC.lifeMax; - } + if (NPC.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int crabShroomSpawnFreq = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.025 : 0.05)); + int crabShroomSpawnFreq = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.02 : 0.05)); if ((NPC.life + crabShroomSpawnFreq) < NPC.localAI[0]) { NPC.localAI[0] = NPC.life; - int crabShroomAmt = death ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; + int crabShroomAmt = death ? 4 : expertMode ? 3 : 2; for (int mush = 0; mush < crabShroomAmt; mush++) { int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); @@ -634,9 +634,7 @@ namespace CalamityMod.NPCs.Crabulon Main.npc[crabShroom].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f); Main.npc[crabShroom].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f); if (Main.netMode == NetmodeID.Server && crabShroom < Main.maxNPCs) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom, 0f, 0f, 0f, 0, 0, 0); - } + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom); } } } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 9db7c6c4f9..87b0f22221 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -221,9 +221,6 @@ namespace CalamityMod.NPCs.Cryogen NPC.HitSound = Main.zenithWorld ? SoundID.NPCHit41 : HitSound; NPC.DeathSound = Main.zenithWorld ? SoundID.NPCDeath14 : DeathSound; - // Reset damage - NPC.damage = NPC.defDamage; - if ((int)NPC.ai[0] + 1 > currentPhase) HandlePhaseTransition((int)NPC.ai[0] + 1); @@ -360,6 +357,9 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.1f; NPC.localAI[0] += 1f; @@ -417,6 +417,9 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] < chargePhaseGateValue) { NPC.ai[1] += 1f; @@ -540,6 +543,9 @@ namespace CalamityMod.NPCs.Cryogen } else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.ai[1] == chargeGateValue) { float chargeVelocity = Vector2.Distance(NPC.Center, player.Center) / chargeDuration * 2f; @@ -593,6 +599,9 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.ai[1] < chargePhaseGateValue) { NPC.ai[1] += 1f; @@ -688,6 +697,9 @@ namespace CalamityMod.NPCs.Cryogen } else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.ai[1] == chargeGateValue) { float chargeVelocity = Vector2.Distance(NPC.Center, player.Center) / chargeDuration * 2f; @@ -748,6 +760,9 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.1f; NPC.localAI[0] += 1f; @@ -842,9 +857,6 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[1] == 1f) { - // Avoid cheap bullshit - NPC.damage = 0; - Vector2 position = new Vector2(teleportLocationX * 16f - (NPC.width / 2), calamityGlobalNPC.newAI[2] * 16f - (NPC.height / 2)); for (int m = 0; m < 5; m++) { @@ -902,9 +914,6 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[1] == 2f) { - // Avoid cheap bullshit - NPC.damage = 0; - NPC.Opacity += 0.2f; if (NPC.Opacity >= 1f) { @@ -943,6 +952,9 @@ namespace CalamityMod.NPCs.Cryogen } else if (NPC.ai[0] == 4f) { + // Avoid cheap bullshit + NPC.damage = 0; + if (phase6) { if (NPC.ai[1] == 60f) @@ -1006,7 +1018,12 @@ namespace CalamityMod.NPCs.Cryogen NPC.rotation = NPC.velocity.X * 0.15f; } else + { + // Set damage + NPC.damage = NPC.defDamage; + NPC.rotation += NPC.direction * 0.5f; + } return; } @@ -1027,6 +1044,9 @@ namespace CalamityMod.NPCs.Cryogen if (playerDistance < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f) { + // Set damage + NPC.damage = NPC.defDamage; + if (playerDistance < chargeStartDistance) calamityGlobalNPC.newAI[2] = chargeCooldown; @@ -1062,6 +1082,9 @@ namespace CalamityMod.NPCs.Cryogen } else { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.1f; calamityGlobalNPC.newAI[3] += 1f; diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 3ea8d6943c..bb2f2f337c 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -52,7 +52,11 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.TargetClosest(); + bool revenge = CalamityWorld.revenge; float speed = revenge ? 12f : 11f; if (BossRushEvent.BossRushActive) @@ -72,23 +76,24 @@ namespace CalamityMod.NPCs.HiveMind float timeToReachTarget = speed / playerDistance; playerXDist *= timeToReachTarget; playerYDist *= timeToReachTarget; + NPC.ai[0] -= 1f; if (playerDistance < 200f || NPC.ai[0] > 0f) { + // Set damage + NPC.damage = NPC.defDamage; + if (playerDistance < 200f) - { NPC.ai[0] = 20f; - } + if (NPC.velocity.X < 0f) - { NPC.direction = -1; - } else - { NPC.direction = 1; - } + return; } + NPC.velocity.X = (NPC.velocity.X * 50f + playerXDist) / 51f; NPC.velocity.Y = (NPC.velocity.Y * 50f + playerYDist) / 51f; if (playerDistance < 350f) diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index e2dca93907..f4881d4079 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -454,7 +454,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.scale = 1f; NPC.alpha = 0; NPC.dontTakeDamage = false; - NPC.damage = NPC.defDamage; + NPC.damage = 0; NPC.netSpam = 0; NPC.netUpdate = true; } @@ -463,6 +463,9 @@ namespace CalamityMod.NPCs.HiveMind } else { + // Avoid cheap bullshit + NPC.damage = 0; + CalamityGlobalNPC.hiveMind = NPC.whoAmI; if (!player.active || player.dead) @@ -564,7 +567,6 @@ namespace CalamityMod.NPCs.HiveMind NPC.scale = 1f; NPC.alpha = 0; NPC.dontTakeDamage = false; - NPC.damage = NPC.defDamage; } else if (burrowTimer < -60) { @@ -639,25 +641,19 @@ namespace CalamityMod.NPCs.HiveMind { NPC.TargetClosest(); NPC.dontTakeDamage = true; - NPC.damage = 0; } } return; } - if (NPC.alpha != 0) - { - if (NPC.damage != 0) - NPC.damage = 0; - } - else - NPC.damage = NPC.defDamage; - switch (state) { case 0: // Slowdrift + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.alpha > 0) NPC.alpha -= 3; @@ -768,6 +764,9 @@ namespace CalamityMod.NPCs.HiveMind case 1: // Reelback and teleport + // Avoid cheap bullshit + NPC.damage = 0; + NPC.alpha += reelbackFade + 2 * (int)enrageScale; NPC.velocity -= deceleration; @@ -808,6 +807,9 @@ namespace CalamityMod.NPCs.HiveMind case 2: // Reelback for lunge + death legacy + // Avoid cheap bullshit + NPC.damage = 0; + NPC.alpha += reelbackFade + 2 * (int)enrageScale; NPC.velocity -= deceleration; @@ -838,6 +840,9 @@ namespace CalamityMod.NPCs.HiveMind case 3: // Lunge + // Avoid cheap bullshit + NPC.damage = 0; + NPC.netUpdate = true; NPC.netSpam = 0; if (NPC.alpha > 0) @@ -857,6 +862,9 @@ namespace CalamityMod.NPCs.HiveMind { if (phase2timer <= 0) { + // Set damage + NPC.damage = NPC.defDamage; + phase2timer = lungeTime - 4 * (int)enrageScale; NPC.velocity = player.Center + (bossRush ? player.velocity * 20f : Vector2.Zero) - NPC.Center; NPC.velocity.Normalize(); @@ -874,8 +882,14 @@ namespace CalamityMod.NPCs.HiveMind } else { + // Set damage + NPC.damage = NPC.defDamage; + if (phase2timer <= 0) { + // Avoid cheap bullshit + NPC.damage = 0; + state = 6; phase2timer = 0; deceleration = NPC.velocity / decelerationTime; @@ -887,6 +901,9 @@ namespace CalamityMod.NPCs.HiveMind case 4: // Enemy spawn arc + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.alpha > 0) { NPC.alpha -= 5; @@ -945,6 +962,9 @@ namespace CalamityMod.NPCs.HiveMind case 5: // Rain dash + // Avoid cheap bullshit + NPC.damage = 0; + if (NPC.alpha > 0) { NPC.alpha -= 5; @@ -998,6 +1018,9 @@ namespace CalamityMod.NPCs.HiveMind case 6: // Deceleration + // Avoid cheap bullshit + NPC.damage = 0; + NPC.velocity -= deceleration; phase2timer++; if (phase2timer == decelerationTime) diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 6007a3c6b1..72e30b4b56 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Leviathan { Main.npcFrameCount[NPC.type] = 6; NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(0) + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.5f }; @@ -183,8 +183,6 @@ namespace CalamityMod.NPCs.Leviathan if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) bubbleVelocity *= 2f; - NPC.damage = NPC.defDamage; - Vector2 vector = NPC.Center; // Phases @@ -197,6 +195,9 @@ namespace CalamityMod.NPCs.Leviathan { if (!HasBegunSummoningLeviathan && !Main.zenithWorld) { + // Avoid cheap bullshit + NPC.damage = 0; + // Use charging frames. NPC.ai[0] = 3f; @@ -295,6 +296,9 @@ namespace CalamityMod.NPCs.Leviathan // Hover near the target, invisible if the Leviathan is present and not sufficiently injured. if ((phase3 || death) && WaitingForLeviathan && !Main.zenithWorld) { + // Avoid cheap bullshit + NPC.damage = 0; + ChargeRotation(player, vector); ChargeLocation(player, vector, false, true); @@ -314,7 +318,6 @@ namespace CalamityMod.NPCs.Leviathan } NPC.dontTakeDamage = true; - NPC.damage = 0; if (NPC.ai[0] != -1f) { @@ -329,12 +332,9 @@ namespace CalamityMod.NPCs.Leviathan } // Alpha - if (NPC.damage != 0) - { - NPC.alpha -= 5; - if (NPC.alpha <= 0) - NPC.alpha = 0; - } + NPC.alpha -= 5; + if (NPC.alpha <= 0) + NPC.alpha = 0; // Play sound float extrapitch = Main.zenithWorld ? -0.5f : 0; @@ -419,6 +419,9 @@ namespace CalamityMod.NPCs.Leviathan // Get in position for bubble spawn else if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.02f; NPC.spriteDirection = NPC.direction; @@ -481,6 +484,9 @@ namespace CalamityMod.NPCs.Leviathan // Bubble spawn else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.02f; Vector2 bubbleSpawnPos = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale); Vector2 restingPos = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); @@ -584,6 +590,9 @@ namespace CalamityMod.NPCs.Leviathan // Fly near target and summon projectiles else if (NPC.ai[0] == 2f) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.rotation = NPC.velocity.X * 0.02f; float basey = Main.zenithWorld ? -100 : -350; @@ -716,6 +725,9 @@ namespace CalamityMod.NPCs.Leviathan // Set up charge else if (NPC.ai[0] == 3f) { + // Avoid cheap bullshit + NPC.damage = 0; + ChargeLocation(player, vector, leviAlive && !phase4, revenge); NPC.ai[1] += 1f; diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 1fed4d4214..3ba351ce91 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -84,6 +84,9 @@ namespace CalamityMod.NPCs.Leviathan return; } + // Avoid cheap bullshit + NPC.damage = 0; + bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -197,6 +200,9 @@ namespace CalamityMod.NPCs.Leviathan } else { + // Set damage + NPC.damage = NPC.defDamage; + Vector2 npcCenterAgain = NPC.Center; Vector2 targetCenterAgain = Main.player[NPC.target].Center; Vector2 vec2 = targetCenterAgain - npcCenterAgain; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 79137af19c..ed48dc743b 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -137,11 +137,6 @@ namespace CalamityMod.NPCs.Leviathan float spawnAnimationTime = 180f; bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime; - // Don't do damage during spawn animation - NPC.damage = NPC.defDamage; - if (spawnAnimation) - NPC.damage = 0; - // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -233,6 +228,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + // Despawn if (!player.active || player.dead || Vector2.Distance(player.Center, npcCenter) > 5600f) { NPC.TargetClosest(false); @@ -277,6 +273,9 @@ namespace CalamityMod.NPCs.Leviathan // Slowly drift up when spawning if (spawnAnimation) { + // Avoid cheap bullshit + NPC.damage = 0; + float minSpawnVelocity = 0.4f; float maxSpawnVelocity = 4f; float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime); @@ -297,6 +296,9 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[0] == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + float hoverSpeed = (sirenAlive && !phase4) ? 3.5f : 7f; float hoverAcceleration = (sirenAlive && !phase4) ? 0.1f : 0.2f; hoverSpeed += 2f * enrageScale; @@ -428,6 +430,9 @@ namespace CalamityMod.NPCs.Leviathan } else if (NPC.ai[0] == 1f) { + // Avoid cheap bullshit + NPC.damage = 0; + Vector2 aberrationSpawn = new Vector2(npcCenter.X, NPC.position.Y + NPC.height * 0.8f); Vector2 leviCenterAberration = npcCenter; float playerXDist = player.Center.X - leviCenterAberration.X; @@ -535,6 +540,9 @@ namespace CalamityMod.NPCs.Leviathan if (NPC.ai[1] % 2f == 0f) { + // Avoid cheap bullshit + NPC.damage = 0; + int dustAmt = 7; for (int j = 0; j < dustAmt; j++) { @@ -549,6 +557,9 @@ namespace CalamityMod.NPCs.Leviathan if (Math.Abs(NPC.position.Y + (NPC.height / 2) - (player.position.Y + (player.height / 2))) < 20f) { + // Set damage + NPC.damage = NPC.defDamage; + NPC.ai[1] += 1f; NPC.ai[2] = 0f; @@ -623,6 +634,9 @@ namespace CalamityMod.NPCs.Leviathan } else { + // Set damage + NPC.damage = NPC.defDamage; + if (NPC.velocity.X < 0f) NPC.direction = -1; else diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index 6a2fc01125..acd80e3091 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; using Terraria; +using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,9 @@ namespace CalamityMod.NPCs.NormalNPCs { public class Stormlion : ModNPC { + public static readonly SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/StormlionIdle"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/StormlionHit"); + public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/StormlionDeath"); public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 6; @@ -26,8 +30,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.knockBackResist = 0.2f; AnimationType = NPCID.WalkingAntlion; NPC.value = Item.buyPrice(0, 0, 2, 0); - NPC.HitSound = SoundID.NPCHit31; - NPC.DeathSound = SoundID.NPCDeath34; + NPC.HitSound = HitSound; + NPC.DeathSound = DeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToCold = true; @@ -45,6 +49,14 @@ namespace CalamityMod.NPCs.NormalNPCs }); } + public override void AI() + { + if (Main.rand.NextBool(800)) + { + SoundEngine.PlaySound(IdleSound, NPC.Center); + } + } + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index 6dbff3f85d..dec418c0c4 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -200,7 +200,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.netUpdate = true; return; } - NPC.noTileCollide = true; + NPC.noTileCollide = false; float velocityBoost = 1f; NPC.TargetClosest(true); bool closeToTargetX = false; @@ -235,52 +235,58 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.velocity.X = (NPC.velocity.X * 20f - velocityBoost) / 21f; } } - int collisionWidth = 80; - int collisionHeight = 20; - Vector2 collisionSize = new Vector2(NPC.Center.X - (float)(collisionWidth / 2), NPC.position.Y + (float)NPC.height - (float)collisionHeight); - bool shouldFallThroughTiles = false; - if (NPC.position.X < Main.player[NPC.target].position.X && NPC.position.X + (float)NPC.width > Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width && NPC.position.Y + (float)NPC.height < Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height - 16f) + if (NPC.velocity.Y >= 0f) { - shouldFallThroughTiles = true; - } - if (shouldFallThroughTiles) - { - NPC.velocity.Y = NPC.velocity.Y + 0.5f; - } - else if (Collision.SolidCollision(collisionSize, collisionWidth, collisionHeight)) - { - if (NPC.velocity.Y > 0f) + int fallFaceDirection = 0; + if (NPC.velocity.X < 0f) { - NPC.velocity.Y = 0f; + fallFaceDirection = -1; } - if (NPC.velocity.Y > -0.2f) + if (NPC.velocity.X > 0f) { - NPC.velocity.Y = NPC.velocity.Y - 0.025f; + fallFaceDirection = 1; } - else + Vector2 trashPosition = NPC.position; + trashPosition.X += NPC.velocity.X; + int xTileBelow = (int)((trashPosition.X + (float)(NPC.width / 2) + (float)((NPC.width / 2 + 1) * fallFaceDirection)) / 16f); + int yTileBelow = (int)((trashPosition.Y + (float)NPC.height - 1f) / 16f); + if ((float)(xTileBelow * 16) < trashPosition.X + (float)NPC.width && (float)(xTileBelow * 16 + 16) > trashPosition.X && ((Main.tile[xTileBelow, yTileBelow].HasUnactuatedTile && !Main.tile[xTileBelow, yTileBelow].TopSlope && !Main.tile[xTileBelow, yTileBelow - 1].TopSlope && Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow].TileType] && !Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow].TileType]) || (Main.tile[xTileBelow, yTileBelow - 1].IsHalfBlock && Main.tile[xTileBelow, yTileBelow - 1].HasUnactuatedTile)) && (!Main.tile[xTileBelow, yTileBelow - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow - 1].TileType] || Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow - 1].TileType] || (Main.tile[xTileBelow, yTileBelow - 1].IsHalfBlock && (!Main.tile[xTileBelow, yTileBelow - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow - 4].TileType] || Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow - 4].TileType]))) && (!Main.tile[xTileBelow, yTileBelow - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow - 2].TileType] || Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow - 2].TileType]) && (!Main.tile[xTileBelow, yTileBelow - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow, yTileBelow - 3].TileType] || Main.tileSolidTop[(int)Main.tile[xTileBelow, yTileBelow - 3].TileType]) && (!Main.tile[xTileBelow - fallFaceDirection, yTileBelow - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[xTileBelow - fallFaceDirection, yTileBelow - 3].TileType])) { - NPC.velocity.Y = NPC.velocity.Y - 0.2f; + float yPixelDistance = (float)(yTileBelow * 16); + if (Main.tile[xTileBelow, yTileBelow].IsHalfBlock) + { + yPixelDistance += 8f; + } + if (Main.tile[xTileBelow, yTileBelow - 1].IsHalfBlock) + { + yPixelDistance -= 8f; + } + if (yPixelDistance < trashPosition.Y + (float)NPC.height) + { + float percentageTileRisen = trashPosition.Y + (float)NPC.height - yPixelDistance; + float fullTileAmt = 16.1f; + if (percentageTileRisen <= fullTileAmt) + { + NPC.gfxOffY += NPC.position.Y + (float)NPC.height - yPixelDistance; + NPC.position.Y = yPixelDistance - (float)NPC.height; + if (percentageTileRisen < 9f) + { + NPC.stepSpeed = 1f; + } + else + { + NPC.stepSpeed = 2f; + } + } + } } - if (NPC.velocity.Y < -4f) + if (NPC.oldPosition == NPC.position) { - NPC.velocity.Y = -4f; - } - } - else - { - if (NPC.velocity.Y < 0f) - { - NPC.velocity.Y = 0f; - } - if (NPC.velocity.Y < 0.1f) - { - NPC.velocity.Y = NPC.velocity.Y + 0.025f; - } - else - { - NPC.velocity.Y = NPC.velocity.Y + 0.5f; + NPC.velocity.Y = -10f; + NPC.netUpdate = true; } } + NPC.velocity.Y = NPC.velocity.Y + 0.55f; if (NPC.velocity.Y > 10f) { NPC.velocity.Y = 10f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs index 9df41cebe8..2fac9045f5 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs @@ -11,6 +11,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { public static class BrainOfCthulhuAI { + public const float TimeBeforeCreeperAttack = 600f; + public const float CreeperTelegraphTime = 180f; + private const float SpinVelocity = 12f; + private const int SpinRadius = 45; + public static bool BuffedBrainofCthulhuAI(NPC npc, Mod mod) { // whoAmI variable @@ -27,11 +32,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) npc.TargetClosest(); - float enrageScale = bossRush ? 1f : 0f; + float enrageScale = bossRush ? 1.5f : 0f; if ((npc.position.Y / 16f) < Main.worldSurface || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; + enrageScale += 0.5f; } if (!Main.player[npc.target].ZoneCrimson || bossRush) { @@ -39,6 +44,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses enrageScale += 2f; } + // Despawn check + bool despawn = Main.player[npc.target].dead && !bossRush; + + // Despawn + if (despawn) + { + if (npc.localAI[3] < 120f) + npc.localAI[3] += 1f; + + if (npc.localAI[3] > 60f) + npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; + } + else if (npc.localAI[3] > 0f) + npc.localAI[3] -= 1f; + // Extra distance for teleports if enraged int teleportDistanceIncrease = (int)(enrageScale * 3); @@ -47,6 +67,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.localAI[0] = 1f; int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath(); + float attackTimerIncrement = 15f; for (int i = 0; i < brainOfCthuluCreepersCount; i++) { float brainX = npc.Center.X; @@ -54,7 +75,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses brainX += Main.rand.Next(-npc.width, npc.width); brainY += Main.rand.Next(-npc.height, npc.height); - int creeperSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)brainX, (int)brainY, NPCID.Creeper, 0, 0f, 0f, 0f, 0f, 255); + int creeperSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)brainX, (int)brainY, NPCID.Creeper, 0, 0f, i * attackTimerIncrement); Main.npc[creeperSpawn].velocity = new Vector2(Main.rand.Next(-30, 31) * 0.1f, Main.rand.Next(-30, 31) * 0.1f); Main.npc[creeperSpawn].netUpdate = true; } @@ -82,7 +103,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn gore if (npc.localAI[2] == 0f) { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.position); + SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); npc.localAI[2] = 1f; @@ -97,18 +118,57 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int j = 0; j < 20; j++) Dust.NewDust(npc.position, npc.width, npc.height, 5, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - SoundEngine.PlaySound(SoundID.Roar, npc.position); + SoundEngine.PlaySound(SoundID.Roar, npc.Center); } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Phases based on HP - bool phase3 = lifeRatio < 0.6f; + // Phases + + // Start spinning, create additional afterimages, shoot projectiles and charging phase + bool phase3 = lifeRatio < 0.8f; + + // Fire projectiles from 2 locations phase + bool phase4 = lifeRatio < 0.6f; + + // Fire projectiles from 4 locations phase + bool phase5 = lifeRatio < 0.4f; + + // Spin faster and shoot faster projectiles phase + bool phase6 = lifeRatio < 0.25f; + + // Super fast spin and charges phase + bool phase7 = lifeRatio < 0.1f; + + // Whether the fucking thing is spinning or not, dipshit bool spinning = npc.ai[0] == -4f; + // Spin variables + float spinVelocity = SpinVelocity; + int spinRadius = SpinRadius; + if (phase7) + { + spinVelocity *= 2f; + spinRadius *= 2; + } + else if (phase6) + { + spinVelocity *= 1.5f; + spinRadius = (int)(SpinRadius * 1.5f); + } + + // Charge variables + float chargeVelocity = (death ? 18f : 15f) + 3f * enrageScale; + if (phase7) + chargeVelocity *= 1.2f; + // KnockBack - float baseKnockBackResist = death ? 0.4f : 0.45f; + float baseKnockBackResist = death ? 0.1f : 0.3f; + if (!phase3) + npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); + else + npc.knockBackResist = 0f; // Gain defense while spinning npc.defense = npc.defDefense + (spinning ? 7 : 0); @@ -116,9 +176,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Take damage npc.dontTakeDamage = false; - // Deal no damage while spinning - npc.damage = spinning ? 0 : npc.defDamage; - // Target distance X float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; @@ -126,84 +183,90 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!spinning) { // Not charging - if (npc.ai[0] != -6f) + if (npc.ai[0] != -5f) { // Rubber band movement - Vector2 brainCenter = new Vector2(npc.Center.X, npc.Center.Y); - float targetXDist = Main.player[npc.target].Center.X - brainCenter.X; - float targetYDist = Main.player[npc.target].Center.Y - brainCenter.Y; - float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); - float velocityScale = death ? 4f : 2f; - float velocityBoost = velocityScale * (1f - lifeRatio); - float nonChargeSpeed = 8f + velocityBoost + 3f * enrageScale; - if (Main.getGoodWorld) - nonChargeSpeed *= 1.15f; + if (!despawn) + { + Vector2 brainCenter = new Vector2(npc.Center.X, npc.Center.Y); + float targetXDist = Main.player[npc.target].Center.X - brainCenter.X; + float targetYDist = Main.player[npc.target].Center.Y - brainCenter.Y; + float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); + float velocityScale = death ? 6f : 4.5f; + float velocityBoost = velocityScale * (1f - lifeRatio); + float nonChargeSpeed = 18f + velocityBoost + 3f * enrageScale; + if (Main.getGoodWorld) + nonChargeSpeed *= 1.15f; - targetDistance = nonChargeSpeed / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - npc.velocity.X = (npc.velocity.X * 50f + targetXDist) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + targetYDist) / 51f; + targetDistance = nonChargeSpeed / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + + float minInertia = death ? 60f : 75f; + float maxInertia = death ? 80f : 100f; + float inertia = MathHelper.Lerp(minInertia, maxInertia, lifeRatio); + npc.velocity.X = (npc.velocity.X * inertia + targetXDist) / (inertia + 1f); + npc.velocity.Y = (npc.velocity.Y * inertia + targetYDist) / (inertia + 1f); + } } - // Charge, -6 + // Charge, -5 else { - npc.ai[1] += 1f; + if (!despawn) + npc.ai[1] += 1f; + + float chargeDistance = 960f; // 60 tile charge distance + float chargeDuration = chargeDistance / chargeVelocity; + float chargeGateValue = 10f; + + if (npc.ai[1] < chargeGateValue) + { + // Avoid cheap bullshit + npc.damage = 0; + } + else + { + // Set damage + npc.damage = npc.defDamage; + } // Teleport - float timeGateValue = death ? 90f : 115f; + float timeGateValue = chargeDuration + chargeGateValue; if (npc.ai[1] >= timeGateValue) { - if (npc.knockBackResist == 0f) - npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); - - npc.ai[0] = -7f; + npc.ai[0] = -6f; npc.ai[1] = 0f; - npc.localAI[1] = 120f; + float maxTeleportPhaseDurationReduction = 60f; + float lerpHPScalar = (0.8f - lifeRatio) / 0.8f; + npc.localAI[1] = MathHelper.Lerp(0f, maxTeleportPhaseDurationReduction, lerpHPScalar); npc.netUpdate = true; } // Charge sound and velocity - else if (npc.ai[1] == 10f) + else if (npc.ai[1] == chargeGateValue && !despawn) { // Sound - SoundEngine.PlaySound(SoundID.ForceRoar, npc.position); + SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); // Velocity - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center + (bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center) * ((death ? 20f : 16f) + 4f * enrageScale); + npc.velocity = (Main.player[npc.target].Center + (bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; if (Main.getGoodWorld) npc.velocity *= 1.15f; } } - - // Rubber band movement, -5 - if (npc.ai[0] == -5f) - { - // Spin or teleport - npc.ai[2] += 1f; - if (npc.ai[2] >= 180f) - { - // Velocity and knockback - npc.knockBackResist = 0f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; - npc.ai[0] = -4f; - npc.ai[1] = playerLocation < 0 ? 1f : -1f; - npc.ai[2] = 0f; - npc.ai[3] = Main.rand.Next(61); - npc.localAI[1] = 0f; - npc.netUpdate = true; - } - } } // Circle around, -4 if (spinning) { + // Avoid cheap bullshit + npc.damage = 0; + // Charge sound if (npc.ai[2] == 0f) { - SoundEngine.PlaySound(SoundID.Roar, npc.position); + SoundEngine.PlaySound(SoundID.Roar, npc.Center); if (CalamityWorld.LegendaryMode) { @@ -216,34 +279,175 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Velocity - float velocity = MathHelper.TwoPi / (120 * 0.75f); + float velocity = MathHelper.TwoPi / spinRadius; npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.ai[1]); npc.ai[2] += 1f; float timer = (death ? 0f : 30f) + npc.ai[3]; + // Move the brain away from the target in order to ensure fairness if (npc.ai[2] >= timer - 5f) { - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 400f) // 25 tile distance + float minChargeDistance = 640f; // 40 tile distance + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < minChargeDistance) { npc.ai[2] -= 1f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * ((death ? -10f : -8f) - 2f * enrageScale); + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (-chargeVelocity - 2f * enrageScale); if (Main.getGoodWorld) npc.velocity *= 1.15f; } } - // Charge at target, -6 is straight line movement, -5 is rubber band movement + // Charge at target if (npc.ai[2] >= timer) { + // Shoot projectiles from 4 directions, alternating between diagonal and cardinal + float bloodShotVelocity = (death ? 7.5f : 6f) + enrageScale; + + // Scale projectile velocity + float phase7ProjectileVelocityMult = 1.2f; + float phase6ProjectileVelocityMult = 1.1f; + if (phase7) + bloodShotVelocity *= phase7ProjectileVelocityMult; + else if (phase6) + bloodShotVelocity *= phase6ProjectileVelocityMult; + + if (phase4) + { + bool alternativeFire = npc.ai[3] % 2f == 0f; + bool diagonalShots = alternativeFire || !phase5; + bool otherQuadrants = Main.rand.NextBool(); + int startingIndex = (otherQuadrants && !phase5) ? 2 : 0; + int totalProjectileSpreads = (phase5 || startingIndex == 2) ? 4 : 2; + for (int i = startingIndex; i < totalProjectileSpreads; i++) + { + Vector2 position = npc.Center; + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[Main.myPlayer].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[Main.myPlayer].Center.Y); + + switch (i) + { + case 0: + + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + if (diagonalShots) + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + else + position.Y = Main.player[Main.myPlayer].Center.Y; + + break; + + case 1: + + position.Y = Main.player[Main.myPlayer].Center.Y - distanceFromTargetY; + if (diagonalShots) + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + else + position.X = Main.player[Main.myPlayer].Center.X; + + break; + + case 2: + + position.X = Main.player[Main.myPlayer].Center.X + distanceFromTargetX; + if (diagonalShots) + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + else + position.Y = Main.player[Main.myPlayer].Center.Y; + + break; + + case 3: + + position.Y = Main.player[Main.myPlayer].Center.Y + distanceFromTargetY; + if (diagonalShots) + position.X = Main.player[Main.myPlayer].Center.X - distanceFromTargetX; + else + position.X = Main.player[Main.myPlayer].Center.X; + + break; + + default: + break; + } + + Vector2 projectileVelocity = (Main.player[npc.target].Center - position).SafeNormalize(Vector2.UnitY) * bloodShotVelocity; + float minFiringDistance = 560f; // 35 tile distance + bool firedFromRealBrain = Vector2.Distance(position, npc.Center) < 8f; + if (Vector2.Distance(position, Main.player[npc.target].Center) > minFiringDistance && !firedFromRealBrain) // The projectiles can only be fired if the target is more than 15 tiles away from the firing position + { + bool canHit = Collision.CanHitLine(position, 1, 1, Main.player[npc.target].Center, 1, 1); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.BloodShot; + int damage = npc.GetProjectileDamage(type); + int numProj = death ? 6 : 4; + int spread = death ? 22 : 15; + if (phase7) + { + numProj = death ? 4 : 2; + spread = death ? 15 : 10; + } + else if (phase5) + { + numProj = death ? 5 : 3; + spread = death ? 30 : 20; + } + + float rotation = MathHelper.ToRadians(spread); + for (int j = 0; j < numProj; j++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), position + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + if (!canHit) + Main.projectile[proj].tileCollide = false; + } + } + } + } + } + + Vector2 projectileVelocity2 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * bloodShotVelocity; + bool canHit2 = Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileID.BloodNautilusShot; + int damage = npc.GetProjectileDamage(type); + int numProj = death ? 9 : 7; + int spread = death ? 45 : 40; + if (phase7) + { + numProj = death ? 3 : 2; + spread = death ? 8 : 5; + } + else if (phase5) + { + numProj = death ? 4 : 2; + spread = death ? 15 : 10; + } + else if (phase4) + { + numProj = death ? 5 : 3; + spread = death ? 15 : 10; + } + + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity2.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + if (!canHit2) + Main.projectile[proj].tileCollide = false; + } + } + // Complete stop npc.velocity *= 0f; - // Adjust knockback - npc.knockBackResist = 0f; - - npc.ai[0] = -6f; + npc.ai[0] = -5f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -253,37 +457,36 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Pick teleport location - else if (npc.ai[0] == -1f || npc.ai[0] == -7f) + else if (npc.ai[0] == -1f || npc.ai[0] == -6f) { - // Adjust knockback - if (npc.ai[0] == -1f) - { - if (npc.knockBackResist == 0f) - npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); - } + // Set damage + npc.damage = npc.defDamage; if (Main.netMode != NetmodeID.MultiplayerClient) { - // Go to phase 3 + // Go to phase 3 and spin if (phase3 && npc.ai[0] == -1f) { - npc.ai[0] = -5f; - npc.ai[1] = 0f; + // Avoid cheap bullshit + npc.damage = 0; + + // Velocity + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * spinVelocity; + npc.ai[0] = -4f; + npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - npc.ai[3] = 0f; + + int maxRandomTime = phase7 ? 30 : 60; + npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; npc.localAI[1] = 0f; npc.alpha = 0; npc.netUpdate = true; } - npc.localAI[1] += 1f; + if (!despawn) + npc.localAI[1] += 1f; - int randomReduction = death ? 4 : (int)(5f * (1f - lifeRatio)); - int random = 5 - randomReduction; - if (npc.justHit) - npc.localAI[1] -= Main.rand.Next(random); - - if (npc.localAI[1] >= 60f) + if (npc.localAI[1] >= 210f) { npc.localAI[1] = 0f; npc.TargetClosest(); @@ -316,22 +519,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; if (numTeleportTries > 100) - goto Block_2784; + goto Block; } + + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[3] = 0f; - npc.ai[0] = npc.ai[0] == -7f ? -8f : -2f; + npc.ai[0] = npc.ai[0] == -6f ? -7f : -2f; npc.ai[1] = teleportTileX; npc.ai[2] = teleportTileY; npc.netUpdate = true; npc.netSpam = 0; - Block_2784: + Block: ; } } } // Teleport and turn invisible - else if (npc.ai[0] == -2f || npc.ai[0] == -8f) + else if (npc.ai[0] == -2f || npc.ai[0] == -7f) { // Avoid cheap bullshit npc.damage = 0; @@ -349,7 +556,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.position.X = npc.ai[1] * 16f - (npc.width / 2); npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); SoundEngine.PlaySound(SoundID.Item8, npc.Center); - npc.ai[0] = npc.ai[0] == -8f ? -9f : -3f; + npc.ai[0] = npc.ai[0] == -7f ? -8f : -3f; npc.netUpdate = true; npc.netSpam = 0; } @@ -358,7 +565,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Become visible - else if (npc.ai[0] == -3f || npc.ai[0] == -9f) + else if (npc.ai[0] == -3f || npc.ai[0] == -8f) { // Avoid cheap bullshit npc.damage = 0; @@ -370,17 +577,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[3] <= 0f) { - if (npc.ai[0] == -9f) + if (npc.ai[0] == -8f) { - // Adjust knockback - npc.knockBackResist = 0f; - - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * 24f; + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * spinVelocity; npc.ai[0] = -4f; npc.ai[1] = playerLocation < 0 ? 1f : -1f; npc.ai[2] = 0f; - npc.ai[3] = Main.rand.Next(61); + + int maxRandomTime = phase7 ? 30 : 60; + npc.ai[3] = Main.rand.Next(maxRandomTime) + 1; } else { @@ -405,8 +611,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Creeper count int creeperCount = NPC.CountNPCS(NPCID.Creeper); - int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; - creeperScale *= (int)enrageScale; + if (creeperCount > GetBrainOfCthuluCreepersCountRevDeath()) + creeperCount = GetBrainOfCthuluCreepersCountRevDeath(); + + float creeperRatio = creeperCount / (float)GetBrainOfCthuluCreepersCountRevDeath(); + float velocityScale = MathHelper.Lerp(0f, 2f, 1f - creeperRatio) + enrageScale; + + // Check for phase 2 bool phase2 = creeperCount <= 0; // Go to phase 2 @@ -421,24 +632,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Move towards target - Vector2 brainCenterPhase1 = new Vector2(npc.Center.X, npc.Center.Y); - float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X; - float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; - float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); - float maxMoveVelocity = (death ? 2f : 1f) + (creeperScale * 0.1f); - if (Main.getGoodWorld) - maxMoveVelocity *= 2f; + if (!despawn) + { + Vector2 brainCenterPhase1 = npc.Center; + float targetXDistPhase1 = Main.player[npc.target].Center.X - brainCenterPhase1.X; + float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; + float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); + float maxMoveVelocity = (death ? 2f : 1f) + velocityScale; + if (Main.getGoodWorld) + maxMoveVelocity *= 2f; - if (targetDistancePhase1 < maxMoveVelocity) - { - npc.velocity.X = targetXDistPhase1; - npc.velocity.Y = targetYDistPhase1; - } - else - { - targetDistancePhase1 = maxMoveVelocity / targetDistancePhase1; - npc.velocity.X = targetXDistPhase1 * targetDistancePhase1; - npc.velocity.Y = targetYDistPhase1 * targetDistancePhase1; + if (targetDistancePhase1 < maxMoveVelocity) + { + npc.velocity.X = targetXDistPhase1; + npc.velocity.Y = targetYDistPhase1; + } + else + { + targetDistancePhase1 = maxMoveVelocity / targetDistancePhase1; + npc.velocity.X = targetXDistPhase1 * targetDistancePhase1; + npc.velocity.Y = targetYDistPhase1 * targetDistancePhase1; + } } // Pick a teleport location @@ -446,10 +660,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (Main.netMode != NetmodeID.MultiplayerClient) { - // Teleport location - npc.localAI[1] += (death ? 2f : 1f) + (creeperScale * 0.1f); - if (npc.localAI[1] >= 300f) + if (!despawn) + npc.localAI[1] += (death ? 2f : 1f) + velocityScale; + + if (npc.localAI[1] >= 360f) { + // Teleport location npc.localAI[1] = 0f; npc.TargetClosest(); int phase1TeleportTries = 0; @@ -461,8 +677,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses phase1TeleportTileX = (int)Main.player[npc.target].Center.X / 16; phase1TeleportTileY = (int)Main.player[npc.target].Center.Y / 16; - int min = 18 + teleportDistanceIncrease; - int max = 26 + teleportDistanceIncrease; + int min = 28 + teleportDistanceIncrease; + int max = 30 + teleportDistanceIncrease; if (Main.rand.NextBool()) phase1TeleportTileX += Main.rand.Next(min, max); @@ -475,19 +691,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses phase1TeleportTileY -= Main.rand.Next(min, max); if (!WorldGen.SolidTile(phase1TeleportTileX, phase1TeleportTileY) && Collision.CanHit(new Vector2(phase1TeleportTileX * 16, phase1TeleportTileY * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { break; - } + if (phase1TeleportTries > 100) - { - goto Block_2801; - } + goto Block; } npc.ai[0] = 1f; npc.ai[1] = phase1TeleportTileX; npc.ai[2] = phase1TeleportTileY; npc.netUpdate = true; - Block_2801: + Block: ; } } @@ -507,6 +720,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.position.X = npc.ai[1] * 16f - (npc.width / 2); npc.position.Y = npc.ai[2] * 16f - (npc.height / 2); npc.ai[0] = 2f; + + // Move non-charging Creepers to new Brain location + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC creeper = Main.npc[i]; + if (creeper.active && creeper.type == NPCID.Creeper) + { + bool creeperCanTeleport = creeper.ai[0] == 0f; + if (creeperCanTeleport) + { + creeper.position.X = npc.position.X; + creeper.position.Y = npc.position.Y; + } + } + } } } @@ -525,22 +753,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - // Despawn - if (Main.player[npc.target].dead && !bossRush) - { - if (npc.localAI[3] < 120f) - npc.localAI[3] += 1f; - - if (npc.localAI[3] > 60f) - npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; - - npc.ai[0] = 2f; - npc.alpha = 10; - return false; - } - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - return false; } @@ -561,24 +773,55 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); - float enrageScale = bossRush ? 1f : 0f; + float enrageScale = bossRush ? 1.5f : 0f; if ((npc.position.Y / 16f) < Main.worldSurface || bossRush) - enrageScale += 1f; + enrageScale += 0.5f; if (!Main.player[npc.target].ZoneCrimson || bossRush) enrageScale += 2f; - // Creeper count, 0 to 20 - int creeperCount = NPC.CountNPCS(NPCID.Creeper); + // Creeper count + int creeperCount = NPC.CountNPCS(npc.type); + if (creeperCount > GetBrainOfCthuluCreepersCountRevDeath()) + creeperCount = GetBrainOfCthuluCreepersCountRevDeath(); + + float creeperRatio = creeperCount / (float)GetBrainOfCthuluCreepersCountRevDeath(); + + // Scale the aggressiveness of the charges with amount of Creepers remaining + float chargeAggressionScale = creeperRatio <= 0.1f ? 3.5f : creeperRatio <= 0.2f ? 2.5f : creeperRatio <= 0.4f ? 1.75f : creeperRatio <= 0.6f ? 1f : creeperRatio <= 0.8f ? 0.5f : 0f; + if (death) + chargeAggressionScale *= 1.25f; + + // Give off blood dust before charging + float beginTelegraphGateValue = TimeBeforeCreeperAttack - CreeperTelegraphTime; + bool showTelegraph = npc.ai[1] >= beginTelegraphGateValue || npc.ai[0] == 1f; + if (showTelegraph) + { + float dustScalar = npc.ai[0] == 1f ? 1f : MathHelper.Clamp((npc.ai[1] - beginTelegraphGateValue) / CreeperTelegraphTime, 0f, 1f); + int dustAmt = 1 + (int)Math.Round(4 * dustScalar); + Color dustColor = new Color(255, 50, 50, 0) * dustScalar; + for (int i = 0; i < dustAmt; i++) + { + Dust dust = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, 5, npc.velocity.X, npc.velocity.Y, 100, dustColor)]; + dust.noGravity = true; + dust.velocity = Vector2.Zero; + dust.scale = 1.2f; + } + } + + bool brainIsNotTeleporting = Main.npc[NPC.crimsonBoss].ai[0] == 0f; // Stay near Brain if (npc.ai[0] == 0f) { - Vector2 creeperCenter = new Vector2(npc.Center.X, npc.Center.Y); + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 creeperCenter = npc.Center; float brainXDist = Main.npc[NPC.crimsonBoss].Center.X - creeperCenter.X; float brainYDist = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenter.Y; float brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); - float velocity = death ? 10f : 7f; - velocity += 4f * enrageScale; + float velocity = (death ? 12f : 8f) + chargeAggressionScale; + velocity += 2f * enrageScale; // Max distance from Brain if (brainDistance > 90f) @@ -588,20 +831,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses brainYDist *= brainDistance; npc.velocity.X = (npc.velocity.X * 15f + brainXDist) / 16f; npc.velocity.Y = (npc.velocity.Y * 15f + brainYDist) / 16f; - return false; } // Increase speed - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < velocity) - { + if (npc.velocity.Length() < velocity) npc.velocity *= 1.05f; - } + + // Set alpha to brain alpha + npc.alpha = Main.npc[NPC.crimsonBoss].alpha; + + // Only increment the attack timer if the brain isn't teleporting + if (brainIsNotTeleporting) + npc.ai[1] += 1f + chargeAggressionScale; // Charge at target - int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; - creeperScale *= (int)enrageScale; - npc.ai[1] += (death ? 1f : 0.5f) + (creeperScale * 0.25f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 150f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= TimeBeforeCreeperAttack) { npc.ai[1] = 0f; npc.TargetClosest(); @@ -620,13 +864,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge else { - float chargeVelocity = death ? 10f : 7f; - chargeVelocity += 4f * enrageScale; + // Always fully visible while charging + npc.alpha = 0; + + // Set damage + npc.damage = npc.defDamage; + + float chargeVelocity = (death ? 9f : 6f) + chargeAggressionScale; + chargeVelocity += 2f * enrageScale; Vector2 targetDirection = Main.player[npc.target].Center - npc.Center; - targetDirection.Normalize(); + targetDirection = targetDirection.SafeNormalize(Vector2.UnitY); if (Main.getGoodWorld) { - targetDirection *= 12f; + targetDirection *= chargeVelocity + 6f; npc.velocity = (npc.velocity * 49f + targetDirection) / 50f; } else @@ -635,39 +885,39 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity = (npc.velocity * 99f + targetDirection) / 100f; } - Vector2 creeperCenterCharge = new Vector2(npc.Center.X, npc.Center.Y); - float brainXDistCharge = Main.npc[NPC.crimsonBoss].Center.X - creeperCenterCharge.X; - float brainYDistCharge = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenterCharge.Y; - float brainDistanceCharge = (float)Math.Sqrt(brainXDistCharge * brainXDistCharge + brainYDistCharge * brainYDistCharge); + // Return to Brain after a set time + float chargeDistance = 600f; + float returnToBrainGateValue = chargeDistance / chargeVelocity; - // Return to Brain - if (brainDistanceCharge > 700f || npc.justHit) - npc.ai[0] = 0f; - } - - // Push away from each other in death mode - if (death) - { - float pushVelocity = 0.5f; - for (int i = 0; i < Main.maxNPCs; i++) + npc.ai[1] += 1f; + if (npc.ai[1] >= returnToBrainGateValue) { - if (Main.npc[i].active) - { - if (i != npc.whoAmI && Main.npc[i].type == npc.type) - { - if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 48f) - { - if (npc.position.X < Main.npc[i].position.X) - npc.velocity.X -= pushVelocity; - else - npc.velocity.X += pushVelocity; + // Avoid cheap bullshit + npc.damage = 0; - if (npc.position.Y < Main.npc[i].position.Y) - npc.velocity.Y -= pushVelocity; - else - npc.velocity.Y += pushVelocity; - } + // Shoot blood shots + if (Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 160f && npc.ai[2] == 0f) + { + bool canHit = Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int projectileType = ProjectileID.BloodShot; + int damage = npc.GetProjectileDamage(projectileType); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, projectileVelocity, projectileType, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; + if (!canHit) + Main.projectile[proj].tileCollide = false; } + npc.ai[2] = 1f; + } + + if (brainIsNotTeleporting) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; } } } @@ -677,7 +927,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses public static int GetBrainOfCthuluCreepersCountRevDeath() { - return CalamityWorld.LegendaryMode ? 50 : Main.getGoodWorld ? 40 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 25; + return CalamityWorld.LegendaryMode ? 40 : Main.getGoodWorld ? 35 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; } private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs index abbaa9444e..aa8593f74d 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs @@ -78,6 +78,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[3] > 0f) npc.realLife = (int)npc.ai[3]; + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = 4f; + float minimalDamageVelocity = 8f; + if (npc.velocity.Length() <= minimalContactDamageVelocity) + { + if (npc.type == NPCID.TheDestroyer) + npc.damage = (int)(npc.defDamage * 0.5f); + else + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + if (npc.type == NPCID.TheDestroyer) + npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + else + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index b206f43f0b..6a13d90d5c 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -29,6 +29,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (CalamityWorld.LegendaryMode && npc.type == NPCID.EaterofWorldsHead) npc.reflectsProjectiles = true; + // Calculate contact damage based on velocity + float minimalContactDamageVelocity = 4f; + float minimalDamageVelocity = 8f; + if (npc.velocity.Length() <= minimalContactDamageVelocity) + { + if (npc.type == NPCID.EaterofWorldsHead) + npc.damage = (int)(npc.defDamage * 0.5f); + else + npc.damage = 0; + } + else + { + float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + if (npc.type == NPCID.EaterofWorldsHead) + npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar); + else + npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); + } + // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); diff --git a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs index e105ab0cc9..ff4a0c1177 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs @@ -11,6 +11,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { public static class EyeOfCthulhuAI { + private const float ProjectileOffset = 50f; + public static bool BuffedEyeofCthulhuAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -108,6 +110,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.SafeDirectionTo(Main.player[npc.target].Center).AngleBetween((npc.rotation + MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) && Vector2.Distance(npc.Center, Main.player[npc.target].Center) > 240f; + bool charge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= 320f; // 20 tile distance + if (dead) { npc.velocity.Y -= 0.04f; @@ -120,6 +124,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.ai[1] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + float hoverSpeed = 7f; float hoverAcceleration = 0.15f; hoverSpeed += 5f * enrageScale; @@ -137,13 +144,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses hoverAcceleration += 0.08f; } + float attackSwitchTimer = 180f - (death ? 180f * (1f - lifeRatio) : 0f); + bool timeToCharge = npc.ai[2] >= attackSwitchTimer; Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 400f; - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * hoverSpeed; - npc.SimpleFlyMovement(idealVelocity, hoverAcceleration); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * (hoverSpeed + (timeToCharge ? ((npc.ai[2] - attackSwitchTimer) * 0.01f) : 0f)); + npc.SimpleFlyMovement(idealVelocity, hoverAcceleration + (timeToCharge ? ((npc.ai[2] - attackSwitchTimer) * 0.001f) : 0f)); npc.ai[2] += 1f; - float attackSwitchTimer = 180f - (death ? 180f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= attackSwitchTimer) + if (timeToCharge && charge) { npc.ai[1] = 1f; npc.ai[2] = 0f; @@ -171,8 +179,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; if (spawnServant) SoundEngine.PlaySound(SoundID.NPCHit1, servantSpawnCenter); - else - SoundEngine.PlaySound(SoundID.NPCHit18, servantSpawnCenter); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -188,20 +194,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { int projType = ProjectileID.BloodNautilusShot; int projDamage = npc.GetProjectileDamage(projType); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(servantSpawnVelocity) * 10f, servantSpawnVelocity * 2f, projType, projDamage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(servantSpawnVelocity) * ProjectileOffset, servantSpawnVelocity * 2f, projType, projDamage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; } } - for (int m = 0; m < 10; m++) - Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); + if (spawnServant) + { + for (int m = 0; m < 10; m++) + Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); + } } } } else if (npc.ai[1] == 1f) { + // Set damage + npc.damage = npc.defDamage; + npc.rotation = eyeRotation; float additionalVelocityPerCharge = 2f; - float chargeSpeed = 6f + npc.ai[3] * additionalVelocityPerCharge; + float chargeSpeed = 8f + npc.ai[3] * additionalVelocityPerCharge; chargeSpeed += 5f * enrageScale; if (death) chargeSpeed += 10f * (1f - lifeRatio); @@ -218,22 +231,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.ai[1] == 2f) { + // Set damage + npc.damage = npc.defDamage; + int chargeDelay = 90; if (death) chargeDelay -= (int)Math.Round(40f * (1f - lifeRatio)); if (Main.getGoodWorld) chargeDelay -= 30; - float slowDownGateValue = chargeDelay * (death ? 0.5f : 0.44f); + float slowDownGateValue = chargeDelay * (death ? 0.75f : 0.65f); npc.ai[2] += 1f; if (npc.ai[2] >= slowDownGateValue) { + // Avoid cheap bullshit + npc.damage = 0; + float decelerationScalar = death ? ((lifeRatio - 0.6f) / 0.4f) : 1f; if (decelerationScalar < 0f) decelerationScalar = 0f; - npc.velocity *= (MathHelper.Lerp(0.925f, 0.975f, decelerationScalar)); + npc.velocity *= (MathHelper.Lerp(0.92f, 0.96f, decelerationScalar)); if (Main.getGoodWorld) npc.velocity *= 0.99f; @@ -255,6 +274,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float numCharges = death ? 4f : 3f; if (npc.ai[3] >= numCharges) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[1] = 0f; npc.ai[3] = 0f; } @@ -265,6 +287,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (phase2) { + // Avoid cheap bullshit + npc.damage = 0; + npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -279,6 +304,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[0] == 1f || npc.ai[0] == 2f) { + // Avoid cheap bullshit + npc.damage = 0; + if (Main.getGoodWorld) npc.reflectsProjectiles = true; @@ -326,7 +354,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 10f, perturbedSpeed, type, 15, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * ProjectileOffset, perturbedSpeed, type, 15, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; } } } @@ -377,13 +406,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else { npc.defense = 0; - npc.damage = (int)(npc.defDamage * (phase3 ? 1.4f : 1.2f)); + int setDamage = (int)(npc.defDamage * (phase3 ? 1.4f : 1.2f)); + int reducedSetDamage = (int)(setDamage * 0.5f); if (npc.ai[1] == 0f & phase3) npc.ai[1] = 5f; if (npc.ai[1] == 0f) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + float hoverSpeed = 5.5f + 3f * (0.6f - lifeRatio); float hoverAcceleration = 0.06f + 0.02f * (0.6f - lifeRatio); hoverSpeed += 4f * enrageScale; @@ -420,11 +453,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses hoverAcceleration += 0.1f; } - Vector2 idealHoverVelocity = npc.SafeDirectionTo(hoverDestination) * hoverSpeed; - npc.SimpleFlyMovement(idealHoverVelocity, hoverAcceleration); + float phaseLimit = 200f - (death ? 150f * (0.6f - lifeRatio) : 0f); + bool timeToCharge = npc.ai[2] >= phaseLimit; + Vector2 idealHoverVelocity = npc.SafeDirectionTo(hoverDestination) * (hoverSpeed + (timeToCharge ? ((npc.ai[2] - phaseLimit) * 0.01f) : 0f)); + npc.SimpleFlyMovement(idealHoverVelocity, hoverAcceleration + (timeToCharge ? ((npc.ai[2] - phaseLimit) * 0.001f) : 0f)); npc.ai[2] += 1f; - float phaseLimit = 200f - (death ? 150f * (0.6f - lifeRatio) : 0f); float projectileGateValue = (lifeRatio < 0.5f && death) ? 50f : 80f; if (npc.ai[2] % projectileGateValue == 0f && shootProjectile) { @@ -439,17 +473,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 10f, perturbedSpeed, type, 15, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * ProjectileOffset, perturbedSpeed, type, 15, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; } } - - SoundEngine.PlaySound(SoundID.NPCHit18, projectileSpawnCenter); - - for (int m = 0; m < 10; m++) - Dust.NewDust(projectileSpawnCenter, 20, 20, 5, projectileVelocity.X * 0.4f, projectileVelocity.Y * 0.4f, 0, default, 1f); } - if (npc.ai[2] >= phaseLimit) + if (timeToCharge && charge) { npc.ai[1] = 1f; npc.ai[2] = 0f; @@ -461,11 +491,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 1f) { + // Set damage + npc.damage = setDamage; + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); npc.rotation = eyeRotation; float additionalVelocityPerCharge = 3f; - float chargeSpeed = 9f + (3.5f * (0.6f - lifeRatio)) + npc.ai[3] * additionalVelocityPerCharge; + float chargeSpeed = 10f + (3.5f * (0.6f - lifeRatio)) + npc.ai[3] * additionalVelocityPerCharge; chargeSpeed += 4f * enrageScale; if (death) chargeSpeed += 6.5f * (0.6f - lifeRatio); @@ -486,20 +519,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 2f) { + // Set damage + npc.damage = setDamage; + int phase2ChargeDelay = 80; if (death) phase2ChargeDelay -= (int)Math.Round(35f * (0.6f - lifeRatio)); - float slowDownGateValue = phase2ChargeDelay * 0.75f; + float slowDownGateValue = phase2ChargeDelay * (death ? 0.85f : 0.75f); npc.ai[2] += 1f; if (npc.ai[2] >= slowDownGateValue) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + float decelerationScalar = death ? ((lifeRatio - 0.3f) / 0.3f) : 1f; if (decelerationScalar < 0f) decelerationScalar = 0f; - npc.velocity *= (MathHelper.Lerp(0.9f, 0.96f, decelerationScalar)); + npc.velocity *= (MathHelper.Lerp(0.9f, 0.95f, decelerationScalar)); if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) @@ -518,6 +557,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float numCharges = death ? 4f : 3f; if (npc.ai[3] >= numCharges) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + npc.ai[1] = 0f; npc.ai[3] = 0f; npc.netUpdate = true; @@ -534,6 +576,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if ((npc.ai[3] == 4f & phase3) && npc.Center.Y > Main.player[npc.target].Center.Y) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + npc.TargetClosest(); npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -545,6 +590,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (Main.netMode != NetmodeID.MultiplayerClient) { + // Set damage + npc.damage = setDamage; + float speedBoost = death ? 10f * (0.3f - lifeRatio) : 7f * (0.3f - lifeRatio); float finalChargeSpeed = 18f + speedBoost; finalChargeSpeed += 10f * enrageScale; @@ -616,8 +664,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 4f) { + // Set damage + npc.damage = setDamage; + if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); + SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); float lineUpDistControl = lineUpDist; npc.ai[2] += 1f; @@ -627,6 +678,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] >= lineUpDistControl) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + npc.velocity *= 0.95f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -650,6 +704,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float maxCharges = death ? (finalPhaseDeath ? 0f : penultimatePhaseDeath ? 1f : 2f) : finalPhaseRev ? 2f : 3f; if (npc.ai[3] >= maxCharges) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + npc.ai[1] = 0f; npc.ai[3] = 0f; } @@ -660,6 +717,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 5f) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + float offset = death ? 540f : 600f; float speedBoost = death ? 15f * (0.3f - lifeRatio) : 5f * (0.3f - lifeRatio); float accelerationBoost = death ? 0.425f * (0.3f - lifeRatio) : 0.125f * (0.3f - lifeRatio); @@ -698,8 +758,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; if (spawnServant) SoundEngine.PlaySound(SoundID.NPCDeath13, servantSpawnCenter); - else - SoundEngine.PlaySound(SoundID.NPCHit18, servantSpawnCenter); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -716,7 +774,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { int projType = ProjectileID.BloodNautilusShot; int projDamage = npc.GetProjectileDamage(projType); - Projectile.NewProjectile(npc.GetSource_FromAI(), servantSpawnCenter, servantSpawnVelocity * 2f, projType, projDamage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(servantSpawnVelocity) * ProjectileOffset, servantSpawnVelocity * 2f, projType, projDamage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; } if (CalamityWorld.LegendaryMode) @@ -729,13 +788,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * 10f, perturbedSpeed, type, 15, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(perturbedSpeed) * ProjectileOffset, perturbedSpeed, type, 15, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 600; } } } - for (int m = 0; m < 10; m++) - Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); + if (spawnServant) + { + for (int m = 0; m < 10; m++) + Dust.NewDust(servantSpawnCenter, 20, 20, 5, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); + } } if (npc.ai[2] >= timeGateValue) @@ -783,6 +846,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 6f) { + // Set damage + npc.damage = setDamage; + if (Main.netMode != NetmodeID.MultiplayerClient) { float speedBoost = death ? 15f * (0.3f - lifeRatio) : 5f * (0.3f - lifeRatio); @@ -800,8 +866,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 7f) { + // Set damage + npc.damage = setDamage; + if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Roar, npc.Center); + SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); float lineUpDistControl = (float)Math.Round(lineUpDist * 2.5f); npc.ai[2] += 1f; @@ -811,6 +880,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] >= lineUpDistControl) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + npc.velocity *= 0.95f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -823,6 +895,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lineUpDistNetUpdate = lineUpDistControl + 13f; if (npc.ai[2] >= lineUpDistNetUpdate) { + // Deal less damage overall while not charging + npc.damage = reducedSetDamage; + npc.netUpdate = true; if (npc.netSpam > 10) diff --git a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs index c24c7419d0..e4e4b3b6e5 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs @@ -30,9 +30,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses teleportScale *= teleportScaleSpeed; } - // Reset damage - npc.damage = npc.defDamage; - bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; @@ -249,6 +246,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Jump if (npc.velocity.Y == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity.X *= 0.8f; if (npc.velocity.X > -0.1f && npc.velocity.X < 0.1f) npc.velocity.X = 0f; @@ -258,6 +258,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[0] += (bossRush ? 15f : MathHelper.Lerp(1f, 8f, 1f - lifeRatio)); if (npc.ai[0] >= 0f) { + // Set damage + npc.damage = npc.defDamage; + npc.netUpdate = true; npc.TargetClosest(); diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index c4479e2103..37c9db5530 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -51,6 +51,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool phase3 = lifeRatio < 0.35f; bool phase4 = lifeRatio < 0.2f; + // Contact damage values for phase 2 + int setDamage = (int)(npc.defDamage * 1.4f); + int reducedSetDamage = (int)(setDamage * 0.5f); + // Variables and target bool enrage = bossRush; bool despawn = false; @@ -135,12 +139,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 npcCenterAccountingForHooks = new Vector2(hookPositionX, hookPositionY); float maxVelocityX = Main.player[npc.target].Center.X - npcCenterAccountingForHooks.X; float maxVelocityY = Main.player[npc.target].Center.Y - npcCenterAccountingForHooks.Y; + bool phase1MoveAway = !phase2 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 480f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (despawn) { maxVelocityY *= -1f; maxVelocityX *= -1f; velocity += 8f; } + else if (phase1MoveAway) + { + maxVelocityY *= -1f; + maxVelocityX *= -1f; + } float distanceFromTarget = (float)Math.Sqrt(maxVelocityX * maxVelocityX + maxVelocityY * maxVelocityY); if (death) @@ -330,6 +340,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Slow down and return to normal behavior if (npc.ai[3] <= BeginChargeSlowDownGateValue) { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + npc.velocity *= chargeDeceleration; float timeToDecelerateDecrement = bossRush ? 2f : phase4 ? 1.5f : 1f; npc.ai[3] -= timeToDecelerateDecrement; @@ -357,6 +370,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Emit spore gas in phase 3 else if (npc.ai[3] <= BeginChargeGateValue) { + // Set damage + npc.damage = setDamage; + float sporeGasDashGateValue = death ? 4f : 6f; if (phase3 && npc.ai[3] % sporeGasDashGateValue == 0f) { @@ -386,6 +402,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Move a specified distance away from the target and charge once that distance is reached else { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + // Line up before charging if (npc.Calamity().newAI[0] == 0f) { @@ -423,6 +442,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[3] -= timeToLineUpChargeDecrement; if (npc.ai[3] <= BeginChargeGateValue) { + // Set damage + npc.damage = setDamage; + // Charge npc.ai[3] = BeginChargeGateValue; npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * chargeVelocity; @@ -471,6 +493,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { + // Avoid cheap bullshit + npc.damage = phase2 ? reducedSetDamage : 0; + // Velocity ranges from 4 to 7.2, Acceleration ranges from 0.04 to 0.072, non-enraged phase 1 // Velocity ranges from 7 to 12.6, Acceleration ranges from 0.07 to 0.126, non-enraged phase 2 // Velocity ranges from 9 to 16.2, Acceleration ranges from 0.07 to 0.126, non-enraged phase 3 @@ -550,7 +575,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.DR = 0.15f; calamityGlobalNPC.unbreakableDR = false; npc.defense = 32; - npc.damage = npc.defDamage; // Fire projectiles if (!usingSeedGatling && !slowedAfterGatlingAttack) @@ -608,7 +632,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.DR = 0.15f; calamityGlobalNPC.unbreakableDR = false; npc.defense = 10; - npc.damage = (int)(npc.defDamage * 1.4f); // Spawn tentacles if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs index 48bfd3611d..7ea4a8117f 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses enrage = false; float maxEnrageScale = 2f; - float enrageScale = death ? 0.25f : 0f; + float enrageScale = death ? 0.5f : 0f; if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Bee spawn limit - int beeLimit = 20; + int beeLimit = 15; // Queen Bee Bee count int totalBees = 0; @@ -87,20 +87,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phases // Become more aggressive and start firing double stingers (triple in death mode) phase - bool phase2 = lifeRatio < 0.8f; + bool phase2 = lifeRatio < 0.85f; - // Begin launching beehives instead of bees phase, spawn hornets in death mode - bool phase3 = lifeRatio < 0.6f; + // Begin launching beehives instead of bees phase + bool phase3 = lifeRatio < 0.7f; - // Stop spawning bees from ass, spawn bees while charging and become more aggressive phase - bool phase4 = lifeRatio < 0.3f; + // Stop spawning bees from ass and start performing stinger arcs + diagonal dashes, spawn bees while charging and become more aggressive phase + bool phase4 = lifeRatio < 0.5f; + + // Perform many shorter-range dashes and use stinger arc in two possible directions phase + bool phase5 = lifeRatio < 0.3f; // Triple stinger (quintuple in death mode) bombardment phase - bool phase5 = lifeRatio < 0.1f; + bool phase6 = lifeRatio < 0.1f; // Despawn float distanceFromTarget = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (npc.ai[0] != 5f) + if (npc.ai[0] != 6f) { if (npc.timeLeft < 60) npc.timeLeft = 60; @@ -108,7 +111,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[0] = 4f; } if (Main.player[npc.target].dead) - npc.ai[0] = 5f; + npc.ai[0] = 6f; // Adjust slowing debuff immunity bool immuneToSlowingDebuffs = npc.ai[0] == 0f; @@ -132,8 +135,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Despawn phase - if (npc.ai[0] == 5f) + if (npc.ai[0] == 6f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity.Y *= 0.98f; if (npc.velocity.X < 0f) @@ -172,25 +178,42 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int phase; - do phase = Main.rand.Next(4); + int maxRandom = phase4 ? 5 : 4; + do phase = Main.rand.Next(maxRandom); while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4)); + bool charging = phase == 0; + + // 5 is stinger arc and charge + if (phase == 4) + phase = 5; + npc.TargetClosest(); npc.ai[0] = phase; npc.ai[1] = 0f; - npc.ai[2] = 0f; + + // Movement direction for the stinger arcs + npc.ai[2] = (phase == 5 && phase5) ? (Main.rand.NextBool() ? 1f : -1f) : phase == 5 ? 1f : 0f; + + // Velocity for the charges + npc.ai[3] = charging ? ((phase6 ? 25f : phase5 ? 14f : phase4 ? 25f : phase2 ? 20f : 15f) + 6f * enrageScale) : 0f; + + // Distance for the charges + calamityGlobalNPC.newAI[1] = charging ? ((phase6 ? 750f : phase5 ? 350f : phase4 ? 650f : phase2 ? 550f : 450f) - 100f * enrageScale) : 0f; + npc.SyncExtraAI(); } } // Charging phase else if (npc.ai[0] == 0f) { + // Charging distance from player + int chargeDistanceX = (int)calamityGlobalNPC.newAI[1]; + // Number of charges - int chargeAmt = (int)Math.Ceiling(2f + enrageScale); - if (phase3) - chargeAmt++; - if (phase4) - chargeAmt++; + int chargeAmt = (int)Math.Ceiling((phase6 ? 2f : phase5 ? 4f : phase4 ? 3f : 2f) + enrageScale); + if (death) + chargeAmt = phase6 ? 1 : phase5 ? 3 : phase4 ? 2 : 1; // Switch to a random phase if chargeAmt has been exceeded if (npc.ai[1] > (2 * chargeAmt) && npc.ai[1] % 2f == 0f) @@ -203,36 +226,38 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Charge velocity - float speed = 16f; - if (phase2) - speed += 8f; - if (phase4) - speed += 8f; - - speed += 8f * enrageScale; + float velocity = npc.ai[3]; // Line up and initiate charge if (npc.ai[1] % 2f == 0f) { - // Initiate charge - float chargeDistance = 20f; - chargeDistance += 20f * enrageScale; - if (death) - chargeDistance += MathHelper.Lerp(0f, 100f, 1f - lifeRatio); + // Avoid cheap bullshit + npc.damage = 0; - if (Math.Abs(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2))) < chargeDistance) + // Initiate charge + float chargeDistanceY = phase6 ? 100f : phase4 ? 50f : 20f; + chargeDistanceY += 100f * enrageScale; + if (death) + chargeDistanceY += MathHelper.Lerp(0f, 100f, 1f - lifeRatio); + + float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y); + if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) { + // Set damage + npc.damage = npc.defDamage; + // Set AI variables and speed npc.localAI[0] = 1f; npc.ai[1] += 1f; npc.ai[2] = 0f; // Get target location - Vector2 beeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float targetXDist = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - beeLocation.X; - float targetYDist = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - beeLocation.Y; + Vector2 beeLocation = npc.Center; + float targetXDist = Main.player[npc.target].Center.X - beeLocation.X; + float targetYDist = Main.player[npc.target].Center.Y - beeLocation.Y; float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist); - targetDistance = speed / targetDistance; + targetDistance = velocity / targetDistance; npc.velocity.X = targetXDist * targetDistance; npc.velocity.Y = targetYDist * targetDistance; @@ -248,44 +273,38 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Velocity variables npc.localAI[0] = 0f; - float chargeVelocity = 12f; - float chargeAcceleration = 0.15f; - if (phase2) - { - chargeVelocity += 3f; - chargeAcceleration += 0.125f; - } - if (phase4) - { - chargeVelocity += 3f; - chargeAcceleration += 0.125f; - } - chargeVelocity += 3f * enrageScale; - chargeAcceleration += 0.5f * enrageScale; + float chargeVelocityX = (phase4 ? 24f : phase2 ? 20f : 16f) + 8f * enrageScale; + float chargeVelocityY = (phase4 ? 18f : phase2 ? 15f : 12f) + 6f * enrageScale; + float chargeAccelerationX = (phase4 ? 0.9f : phase2 ? 0.7f : 0.5f) + 0.5f * enrageScale; + float chargeAccelerationY = (phase4 ? 0.45f : phase2 ? 0.35f : 0.25f) + 0.25f * enrageScale; // Velocity calculations - if (npc.position.Y + (npc.height / 2) < Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2)) - npc.velocity.Y += chargeAcceleration; + if (npc.Center.Y < Main.player[npc.target].Center.Y - chargeDistanceY) + npc.velocity.Y += chargeAccelerationY; + else if (npc.Center.Y > Main.player[npc.target].Center.Y + chargeDistanceY) + npc.velocity.Y -= chargeAccelerationY; else - npc.velocity.Y -= chargeAcceleration; + npc.velocity.Y *= 0.7f; - if (npc.velocity.Y < -chargeVelocity) - npc.velocity.Y = -chargeVelocity; - if (npc.velocity.Y > chargeVelocity) - npc.velocity.Y = chargeVelocity; + if (npc.velocity.Y < -chargeVelocityY) + npc.velocity.Y = -chargeVelocityY; + if (npc.velocity.Y > chargeVelocityY) + npc.velocity.Y = chargeVelocityY; - if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > 500f) - npc.velocity.X += chargeAcceleration * npc.direction; - else if (Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) < 300f) - npc.velocity.X -= chargeAcceleration * npc.direction; + float distanceXMax = 100f; + float distanceXMin = 20f; + if (distanceFromTargetX > chargeDistanceX + distanceXMax) + npc.velocity.X += chargeAccelerationX * npc.direction; + else if (distanceFromTargetX < chargeDistanceX + distanceXMin) + npc.velocity.X -= chargeAccelerationX * npc.direction; else - npc.velocity.X *= 0.8f; + npc.velocity.X *= 0.7f; // Limit velocity - if (npc.velocity.X < -chargeVelocity) - npc.velocity.X = -chargeVelocity; - if (npc.velocity.X > chargeVelocity) - npc.velocity.X = chargeVelocity; + if (npc.velocity.X < -chargeVelocityX) + npc.velocity.X = -chargeVelocityX; + if (npc.velocity.X > chargeVelocityX) + npc.velocity.X = chargeVelocityX; // Face the correct direction float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; @@ -299,6 +318,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { + // Set damage + npc.damage = npc.defDamage; + // Face the correct direction if (npc.velocity.X < 0f) npc.direction = -1; @@ -307,27 +329,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.spriteDirection = npc.direction; - // Charging distance from player - int chargingDistance = 400; - if (phase4) - chargingDistance = 600; - else if (phase2) - chargingDistance = 500; - chargingDistance -= (int)(100f * enrageScale); - // Get which side of the player the boss is on int chargeDirection = 1; - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) + if (npc.Center.X < Main.player[npc.target].Center.X) chargeDirection = -1; // If boss is in correct position, slow down, if not, reset bool shouldCharge = false; - if (npc.direction == chargeDirection && Math.Abs(npc.position.X + (npc.width / 2) - (Main.player[npc.target].position.X + (Main.player[npc.target].width / 2))) > chargingDistance) + if (npc.direction == chargeDirection && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > chargeDistanceX) { npc.ai[2] = 1f; shouldCharge = true; } - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > chargingDistance * 1.5f) + if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > chargeDistanceX * 1.5f) { npc.ai[2] = 1f; shouldCharge = true; @@ -339,19 +353,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] != 1f) { // Velocity fix if Queen Bee is slowed - if (npc.velocity.Length() < speed) - npc.velocity.X = speed * npc.direction; + if (npc.velocity.Length() < velocity) + npc.velocity.X = velocity * npc.direction; + + float accelerateGateValue = phase6 ? 30f : phase5 ? 10f : 90f; + if (enrageScale > 0f) + accelerateGateValue *= 0.5f; calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] > 90f) + if (calamityGlobalNPC.newAI[0] > accelerateGateValue) { npc.SyncExtraAI(); - npc.velocity.X *= 1.01f; + float velocityXLimit = velocity * 2f; + if (Math.Abs(npc.velocity.X) < velocityXLimit) + npc.velocity.X *= 1.01f; } // Spawn bees - bool spawnBee = phase4 && calamityGlobalNPC.newAI[0] % 20f == 0f; - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && spawnBee) + float beeSpawnGateValue = 20f; + bool spawnBee = phase4 && calamityGlobalNPC.newAI[0] % beeSpawnGateValue == 0f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (spawnBee) { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); @@ -376,7 +397,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Main.npc[spawn].ai[2] = enrageScale; Main.npc[spawn].ai[3] = 1f; - Main.npc[spawn].localAI[0] = 60f; } Main.npc[spawn].netUpdate = true; } @@ -427,20 +447,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Fly above target before bee spawning phase else if (npc.ai[0] == 2f) { + // Avoid cheap bullshit + npc.damage = 0; + + // Direction float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; // Get target location - float beeAttackAccel = death ? 0.125f : 0.1f; - Vector2 beeAttackPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float beeAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - beeAttackPosition.X; - float beeAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - beeAttackPosition.Y; - float beeAttackTargetDist = (float)Math.Sqrt(beeAttackTargetX * beeAttackTargetX + beeAttackTargetY * beeAttackTargetY); + float beeAttackAccel = death ? 0.3f : 0.24f; + float beeAttackSpeed = 12f + enrageScale * 3f; + bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + float distanceAboveTarget = !canHitTarget ? 0f : 320f; + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * distanceAboveTarget; + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * beeAttackSpeed; // Go to bee spawn phase calamityGlobalNPC.newAI[0] += 1f; - if (beeAttackTargetDist < 360f || calamityGlobalNPC.newAI[0] >= 180f) + if ((Vector2.Distance(npc.Center, hoverDestination) < 400f && canHitTarget) || calamityGlobalNPC.newAI[0] >= 180f) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -450,44 +475,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses return false; } - // Velocity calculations - if (npc.velocity.X < beeAttackTargetX) - { - npc.velocity.X += beeAttackAccel; - if (npc.velocity.X < 0f && beeAttackTargetX > 0f) - npc.velocity.X += beeAttackAccel; - } - else if (npc.velocity.X > beeAttackTargetX) - { - npc.velocity.X -= beeAttackAccel; - if (npc.velocity.X > 0f && beeAttackTargetX < 0f) - npc.velocity.X -= beeAttackAccel; - } - if (npc.velocity.Y < beeAttackTargetY) - { - npc.velocity.Y += beeAttackAccel; - if (npc.velocity.Y < 0f && beeAttackTargetY > 0f) - npc.velocity.Y += beeAttackAccel; - } - else if (npc.velocity.Y > beeAttackTargetY) - { - npc.velocity.Y -= beeAttackAccel; - if (npc.velocity.Y > 0f && beeAttackTargetY < 0f) - npc.velocity.Y -= beeAttackAccel; - } + npc.SimpleFlyMovement(idealVelocity, beeAttackAccel); } // Bee spawn phase else if (npc.ai[0] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.localAI[0] = 0f; // Get target location and spawn bees from ass - Vector2 beeSpawnLocation = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 queenBeeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float beeSpawnTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - queenBeeLocation.X; - float beeSpawnTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - queenBeeLocation.Y; - float beeSpawnTargetDist = (float)Math.Sqrt(beeSpawnTargetX * beeSpawnTargetX + beeSpawnTargetY * beeSpawnTargetY); + float beeAttackHoverSpeed = 16f + enrageScale * 4f; + float beeAttackHoverAccel = death ? 0.4f : 0.3f; + Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + Vector2 beeSpawnCollisionLocation = new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f); + bool canHitTarget = Collision.CanHit(beeSpawnCollisionLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 320f); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * beeAttackHoverSpeed; // Bee spawn timer npc.ai[1] += 1f; @@ -502,7 +508,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[1] += 1f; bool spawnBee = false; - float beeSpawnCheck = (phase3 ? 60f : 15f) - (phase3 ? 24f : 6f) * enrageScale; + float beeSpawnCheck = (phase3 ? 45f : 15f) - (phase3 ? 18f : 6f) * enrageScale; if (npc.ai[1] > beeSpawnCheck) { npc.ai[1] = 0f; @@ -523,19 +529,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (phase3 && !Main.zenithWorld) { Projectile.NewProjectile(npc.GetSource_FromAI(), beeSpawnLocation, (Main.player[npc.target].Center - beeSpawnLocation).SafeNormalize(Vector2.UnitY), ProjectileID.BeeHive, 0, 0f, Main.myPlayer, 0f, 0f, 1f); - - if (death) - { - int spawnType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); - int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, spawnType); - Main.npc[spawn].velocity = Main.player[npc.target].Center - npc.Center; - Main.npc[spawn].velocity.Normalize(); - Main.npc[spawn].velocity *= 5f; - Main.npc[spawn].ai[2] = enrageScale; - Main.npc[spawn].ai[3] = 1f; - Main.npc[spawn].localAI[0] = 60f; - Main.npc[spawn].netUpdate = true; - } } else { @@ -556,7 +549,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Main.npc[spawn].ai[2] = enrageScale; Main.npc[spawn].ai[3] = 1f; - Main.npc[spawn].localAI[0] = 60f; } Main.npc[spawn].netUpdate = true; } @@ -564,43 +556,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Velocity calculations if target is too far away - if (beeSpawnTargetDist > 400f || !Collision.CanHit(new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float beeAttackHoverSpeed = death ? 17.5f : 14f; - float beeAttackHoverAccel = death ? 0.125f : 0.1f; - queenBeeLocation = beeSpawnLocation; - beeSpawnTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - queenBeeLocation.X; - beeSpawnTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - queenBeeLocation.Y; - beeSpawnTargetDist = (float)Math.Sqrt(beeSpawnTargetX * beeSpawnTargetX + beeSpawnTargetY * beeSpawnTargetY); - beeSpawnTargetDist = beeAttackHoverSpeed / beeSpawnTargetDist; - - if (npc.velocity.X < beeSpawnTargetX) - { - npc.velocity.X += beeAttackHoverAccel; - if (npc.velocity.X < 0f && beeSpawnTargetX > 0f) - npc.velocity.X += beeAttackHoverAccel; - } - else if (npc.velocity.X > beeSpawnTargetX) - { - npc.velocity.X -= beeAttackHoverAccel; - if (npc.velocity.X > 0f && beeSpawnTargetX < 0f) - npc.velocity.X -= beeAttackHoverAccel; - } - if (npc.velocity.Y < beeSpawnTargetY) - { - npc.velocity.Y += beeAttackHoverAccel; - if (npc.velocity.Y < 0f && beeSpawnTargetY > 0f) - npc.velocity.Y += beeAttackHoverAccel; - } - else if (npc.velocity.Y > beeSpawnTargetY) - { - npc.velocity.Y -= beeAttackHoverAccel; - if (npc.velocity.Y > 0f && beeSpawnTargetY < 0f) - npc.velocity.Y -= beeAttackHoverAccel; - } - } + if (Vector2.Distance(beeSpawnLocation, hoverDestination) > 400f || !canHitTarget) + npc.SimpleFlyMovement(idealVelocity, beeAttackHoverAccel); else - npc.velocity *= (death ? 0.85f : 0.9f); + npc.velocity *= (death ? 0.8f : 0.85f); // Face the correct direction float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; @@ -621,32 +580,40 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Stinger phase else if (npc.ai[0] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + + // Direction + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + // Get target location and shoot from ass - Vector2 stingerSpawnLocation = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 stingerQueenBeeLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float stingerAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - stingerQueenBeeLocation.X; - float stingerAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - (phase4 ? 400f : phase2 ? 350f : 300f) - stingerQueenBeeLocation.Y; - float stingerAttackTargetDist = (float)Math.Sqrt(stingerAttackTargetX * stingerAttackTargetX + stingerAttackTargetY * stingerAttackTargetY); + float stingerAttackSpeed = 16f + enrageScale * 4f; + float stingerAttackAccel = phase6 ? 0.32f : 0.24f; + if (enrageScale > 0f) + stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.4f : 0.32f, phase6 ? 0.8f : 0.64f, enrageScale / maxEnrageScale); + + Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : phase4 ? 400f : phase2 ? 360f : 320f); + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * stingerAttackSpeed; npc.ai[1] += 1f; - int stingerAttackTimer = phase5 ? 45 : phase2 ? 30 : 20; - stingerAttackTimer -= (int)Math.Ceiling((phase5 ? 18f : phase2 ? 12f : 8f) * enrageScale); + int stingerAttackTimer = phase6 ? 40 : phase2 ? 30 : 20; + stingerAttackTimer -= (int)Math.Ceiling((phase6 ? 16f : phase2 ? 12f : 8f) * enrageScale); if (stingerAttackTimer < 5) stingerAttackTimer = 5; // Fire stingers - if (npc.ai[1] % stingerAttackTimer == (stingerAttackTimer - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (npc.ai[1] % stingerAttackTimer == (stingerAttackTimer - 1) && npc.Bottom.Y < Main.player[npc.target].Top.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - SoundEngine.PlaySound(SoundID.Item17, npc.position); + SoundEngine.PlaySound(SoundID.Item17, stingerSpawnLocation); if (Main.netMode != NetmodeID.MultiplayerClient) { - float stingerSpeed = 5f; - if (phase3) - stingerSpeed += 1f; - stingerSpeed += 2f * enrageScale; - - float stingerTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - stingerSpawnLocation.X; - float stingerTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - stingerSpawnLocation.Y; + float stingerSpeed = (phase3 ? 6f : 5f) + enrageScale; + float stingerTargetX = Main.player[npc.target].Center.X - stingerSpawnLocation.X; + float stingerTargetY = Main.player[npc.target].Center.Y - stingerSpawnLocation.Y; float stingerTargetDist = (float)Math.Sqrt(stingerTargetX * stingerTargetX + stingerTargetY * stingerTargetY); stingerTargetDist = stingerSpeed / stingerTargetDist; stingerTargetX *= stingerTargetDist; @@ -655,16 +622,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int type = Main.zenithWorld ? (phase3 ? ModContent.ProjectileType() : ProjectileID.FlamingWood) : ProjectileID.QueenBeeStinger; int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation, stingerVelocity, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); - Main.projectile[projectile].timeLeft = 600; + Main.projectile[projectile].timeLeft = 1200; Main.projectile[projectile].extraUpdates = 1; if (phase2) { - int numExtraStingers = death ? (phase5 ? 4 : 2) : (phase5 ? 2 : 1); + int numExtraStingers = death ? (phase6 ? 4 : 2) : (phase6 ? 2 : 1); for (int i = 0; i < numExtraStingers; i++) { - projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Main.rand.NextVector2CircularEdge(16f, 16f) * (i + 1), stingerVelocity * (0.75f * (i * 0.2f + 1)), type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); - Main.projectile[projectile].timeLeft = 600; + projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Main.rand.NextVector2CircularEdge(16f, 16f) * (i + 1), stingerVelocity * MathHelper.Lerp(0.75f, 1f, i / (float)numExtraStingers), type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); + Main.projectile[projectile].timeLeft = 1200; Main.projectile[projectile].extraUpdates = 1; } } @@ -672,77 +639,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Movement calculations - float stingerAttackAccel = phase5 ? 0.09375f : 0.075f; - stingerAttackAccel += 0.1f * enrageScale; - if (!Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - stingerAttackAccel = phase5 ? 0.125f : 0.1f; - if (enrageScale > 0f) - stingerAttackAccel = MathHelper.Lerp(phase5 ? 0.15625f : 0.125f, phase5 ? 0.3125f : 0.25f, enrageScale / maxEnrageScale); - - stingerQueenBeeLocation = stingerSpawnLocation; - stingerAttackTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - stingerQueenBeeLocation.X; - stingerAttackTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - stingerQueenBeeLocation.Y; - - if (npc.velocity.X < stingerAttackTargetX) - { - npc.velocity.X += stingerAttackAccel; - if (npc.velocity.X < 0f && stingerAttackTargetX > 0f) - npc.velocity.X += stingerAttackAccel; - } - else if (npc.velocity.X > stingerAttackTargetX) - { - npc.velocity.X -= stingerAttackAccel; - if (npc.velocity.X > 0f && stingerAttackTargetX < 0f) - npc.velocity.X -= stingerAttackAccel; - } - if (npc.velocity.Y < stingerAttackTargetY) - { - npc.velocity.Y += stingerAttackAccel; - if (npc.velocity.Y < 0f && stingerAttackTargetY > 0f) - npc.velocity.Y += stingerAttackAccel; - } - else if (npc.velocity.Y > stingerAttackTargetY) - { - npc.velocity.Y -= stingerAttackAccel; - if (npc.velocity.Y > 0f && stingerAttackTargetY < 0f) - npc.velocity.Y -= stingerAttackAccel; - } - } - else if (stingerAttackTargetDist > 100f) - { - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - if (npc.velocity.X < stingerAttackTargetX) - { - npc.velocity.X += stingerAttackAccel; - if (npc.velocity.X < 0f && stingerAttackTargetX > 0f) - npc.velocity.X += stingerAttackAccel * 2f; - } - else if (npc.velocity.X > stingerAttackTargetX) - { - npc.velocity.X -= stingerAttackAccel; - if (npc.velocity.X > 0f && stingerAttackTargetX < 0f) - npc.velocity.X -= stingerAttackAccel * 2f; - } - if (npc.velocity.Y < stingerAttackTargetY) - { - npc.velocity.Y += stingerAttackAccel; - if (npc.velocity.Y < 0f && stingerAttackTargetY > 0f) - npc.velocity.Y += stingerAttackAccel * 2f; - } - else if (npc.velocity.Y > stingerAttackTargetY) - { - npc.velocity.Y -= stingerAttackAccel; - if (npc.velocity.Y > 0f && stingerAttackTargetY < 0f) - npc.velocity.Y -= stingerAttackAccel * 2f; - } - } + if (Vector2.Distance(stingerSpawnLocation, hoverDestination) > 40f || !canHitTarget) + npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); // Go to a random phase - if (npc.ai[1] > stingerAttackTimer * 15f && !phase5) + float numStingerShots = phase6 ? 7f : phase2 ? 10f : 15f; + if (npc.ai[1] > stingerAttackTimer * numStingerShots) { npc.ai[0] = -1f; npc.ai[1] = 3f; @@ -752,6 +654,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[0] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.localAI[0] = 1f; float despawnVelMult = 14f; @@ -774,6 +679,83 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } + // Stinger arcs above the player, followed by a dash + else if (npc.ai[0] == 5f) + { + // Avoid cheap bullshit + npc.damage = 0; + + // Direction + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + // Get target location and shoot spreads from ass + float stingerAttackSpeed = 20f + enrageScale * 4f; + float stingerAttackAccel = phase6 ? 0.7f : 0.5f; + if (enrageScale > 0f) + stingerAttackAccel = MathHelper.Lerp(phase6 ? 0.9f : 0.7f, phase6 ? 2.4f : 1.8f, enrageScale / maxEnrageScale); + + int numStingerArcs = phase6 ? 3 : phase5 ? 2 : 1; + if (death) + numStingerArcs++; + + float phaseLimit = phase6 ? 180f : phase5 ? 150f : 120f; + if (death) + phaseLimit *= 1.5f; + + float stingerAttackTimer = (float)Math.Ceiling(phaseLimit / (numStingerArcs + 1)); + + float maxDistance = 480f; + float xLocationScale = MathHelper.Lerp(-maxDistance, maxDistance, npc.ai[1] / phaseLimit) * npc.ai[2]; + Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); + bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + Vector2 hoverDestination = Main.player[npc.target].Center + Vector2.UnitX * xLocationScale * (death ? 1.5f : 1.25f) - Vector2.UnitY * maxDistance; + Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * stingerAttackSpeed; + + // Fire stingers + bool canFireStingers = stingerSpawnLocation.Y < Main.player[npc.target].Top.Y - maxDistance * 0.8f || !canHitTarget; + if (canFireStingers) + { + npc.ai[1] += 1f; + if (npc.ai[1] % stingerAttackTimer == 0f && npc.ai[1] != 0f && npc.ai[1] != phaseLimit) + { + SoundEngine.PlaySound(SoundID.Item17, stingerSpawnLocation); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float stingerSpeed = (phase6 ? 5f : 4f) + enrageScale; + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * stingerSpeed; + int type = Main.zenithWorld ? ModContent.ProjectileType() : ProjectileID.QueenBeeStinger; + int numProj = phase6 ? 5 : phase5 ? 10 : 15; + int spread = phase6 ? 30 : phase5 ? 50 : 60; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Vector2.Normalize(perturbedSpeed) * 10f, perturbedSpeed, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); + Main.projectile[projectile].timeLeft = 1200; + Main.projectile[projectile].extraUpdates = 1; + + if (!Main.zenithWorld) + Main.projectile[projectile].tileCollide = false; + } + } + } + } + + // Movement calculations + npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); + + // Go to a random phase + if (npc.ai[1] >= phaseLimit) + { + npc.ai[0] = -1f; + npc.ai[1] = 4f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs index 8dbf151dbc..cfed6cf586 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs @@ -27,9 +27,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool phase3 = lifeRatio <= 0.4f; bool phase4 = lifeRatio <= 0.2f; - // Reset damage - npc.damage = npc.defDamage; - // Spawn settings if (npc.localAI[0] == 0f) { @@ -169,6 +166,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phase switch phase case 0: + // Avoid cheap bullshit + npc.damage = 0; + if (phase2) { QueenSlime_FlyMovement(npc); @@ -341,6 +341,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = 0f; if (npc.velocity.Y == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity.X *= 0.8f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -355,6 +358,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (!(npc.ai[1] >= 0f)) break; + // Set damage + npc.damage = npc.defDamage; + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); float speedMult = 1f; if (distanceBelowTarget > 0f) @@ -433,6 +439,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses case 4: case 6: + // Avoid cheap bullshit + npc.damage = 0; + npc.rotation *= 0.9f; npc.noTileCollide = true; npc.noGravity = true; @@ -525,6 +534,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses break; } + // Set damage + npc.damage = npc.defDamage; + npc.velocity.Y += bossRush ? 2f : death ? 1.75f : 1.5f; float slamVelocity = bossRush ? 15.99f : death ? 15.5f : 15f; if (Main.getGoodWorld) @@ -610,6 +622,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Fire spread of gel projectiles case 5: + // Avoid cheap bullshit + npc.damage = 0; + npc.rotation *= 0.9f; npc.noTileCollide = true; npc.noGravity = true; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 513b4127cc..86dc576935 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -11,6 +11,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { public static class SkeletronAI { + public const float HandSlapGateValue = 300f; + public const float HandSlapTelegraphTime = 120f; + public static bool BuffedSkeletronAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -22,8 +25,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Phases - bool respawnHands = lifeRatio < 0.33f; - bool phase2 = respawnHands || death; + + // Begin teleporting and firing spreads of skulls phase + bool phase2 = lifeRatio < 0.85f; + + // Begin using a more dangerous charge attack, similar to Dreadnautilus, rather than the regular spin charge and fire a spread of Chaos Balls at the end of it phase + bool phase3 = lifeRatio < 0.7f; + + // Spawn a new set of hands and fire skulls from hands at the start of each slap phase + bool respawnHands = lifeRatio < 0.5f; + + // Fire skulls during charge attack and spin in place while firing a random spread of homing skulls phase + bool phase4 = lifeRatio < 0.35f; + + // Rapid teleport and charge phase (the idle phase no longer occurs here) + bool phase5 = lifeRatio < 0.15f; // Set defense npc.defense = npc.defDefense; @@ -52,7 +68,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (respawnHands && calamityGlobalNPC.newAI[0] == 0f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { calamityGlobalNPC.newAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Roar with { Pitch = SoundID.Roar.Pitch - 0.25f }, npc.position); + SoundEngine.PlaySound(SoundID.Roar with { Pitch = SoundID.Roar.Pitch - 0.25f }, npc.Center); SpawnHands(); npc.netUpdate = true; @@ -61,13 +77,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses void SpawnHands() { - int skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + int skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); Main.npc[skeletronHand].ai[0] = -1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].target = npc.target; Main.npc[skeletronHand].netUpdate = true; - skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); Main.npc[skeletronHand].ai[0] = 1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; Main.npc[skeletronHand].ai[3] = 150f; @@ -77,7 +93,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn two additional hands with different attack timings if (death) { - skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); Main.npc[skeletronHand].ai[0] = -1f; Main.npc[skeletronHand].Calamity().newAI[0] = -1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; @@ -85,7 +101,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Main.npc[skeletronHand].target = npc.target; Main.npc[skeletronHand].netUpdate = true; - skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + skeletronHand = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); Main.npc[skeletronHand].ai[0] = 1f; Main.npc[skeletronHand].Calamity().newAI[0] = -1f; Main.npc[skeletronHand].ai[1] = npc.whoAmI; @@ -111,7 +127,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.dayTime && !bossRush && npc.ai[1] != 3f && npc.ai[1] != 2f) { npc.ai[1] = 2f; - SoundEngine.PlaySound(SoundID.Roar, npc.position); + SoundEngine.PlaySound(SoundID.Roar, npc.Center); } // Hand count @@ -131,39 +147,39 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses switch (numHandsAlive) { case 0: - numProj = Main.getGoodWorld ? 26 : death ? 8 : 6; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 180 : death ? 70 : 64); + numProj = Main.getGoodWorld ? 26 : death ? 16 : 12; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 180 : death ? 90 : 82); headSpinVelocityMult = bossRush ? 12f : 6f; break; case 1: - numProj = Main.getGoodWorld ? 20 : death ? 6 : 4; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 150 : death ? 58 : 52); + numProj = Main.getGoodWorld ? 20 : death ? 12 : 8; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 150 : death ? 76 : 68); headSpinVelocityMult = bossRush ? 10f : 5f; break; case 2: - numProj = Main.getGoodWorld ? 17 : death ? 5 : 3; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 140 : death ? 52 : 46); + numProj = Main.getGoodWorld ? 17 : death ? 10 : 6; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 140 : death ? 70 : 62); headSpinVelocityMult = bossRush ? 9f : 4.5f; break; case 3: - numProj = Main.getGoodWorld ? 14 : death ? 4 : 2; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 130 : death ? 46 : 40); + numProj = Main.getGoodWorld ? 14 : death ? 8 : 4; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 130 : death ? 64 : 56); headSpinVelocityMult = bossRush ? 8f : 4f; break; case 4: - numProj = Main.getGoodWorld ? 11 : death ? 3 : 2; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 120 : 40); + numProj = Main.getGoodWorld ? 11 : death ? 6 : 4; + spread = MathHelper.ToRadians(Main.getGoodWorld ? 120 : 56); headSpinVelocityMult = bossRush ? 7f : 3.5f; break; } - // Hand immunity + // Hand DR, scale DR up if the hands are still alive as Skeletron's HP lowers npc.chaseable = handsDead; - calamityGlobalNPC.DR = !handsDead ? 0.9999f : 0.05f; + calamityGlobalNPC.DR = !handsDead ? MathHelper.Lerp(0.5f, 0.9999f, respawnHands ? (0.5f - lifeRatio) / 0.5f : 2f - lifeRatio / 0.5f) : 0.05f; calamityGlobalNPC.unbreakableDR = !handsDead; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = !handsDead; @@ -175,7 +191,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.ai[3] = 0f; - SoundEngine.PlaySound(SoundID.Item66, npc.position); + SoundEngine.PlaySound(SoundID.Item66, npc.Center); // Fire magic bolt after teleport if (Main.netMode != NetmodeID.MultiplayerClient) @@ -223,7 +239,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // If hands are dead: 7 seconds // If hands are not dead: 14 seconds // If hands are dead in phase 2: 4.7 seconds - npc.ai[3] += 1f + (((phase2 && handsDead) || bossRush) ? 0.5f : 0f) - ((handsDead || bossRush) ? 0f : 0.5f); + npc.ai[3] += 1f + (((phase2 && handsDead) || bossRush || phase4) ? 0.5f : 0f) - ((handsDead || bossRush) ? 0f : 0.5f); // Dust to show teleport int ai3 = (int)npc.ai[3]; // 0 to 30, and -60 @@ -323,15 +339,15 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] % skullProjFrequency == 0f && calamityGlobalNPC.newAI[1] > 45f) { Vector2 skullFiringPos = npc.Center; - float skullProjTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - skullFiringPos.X; - float skullProjTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - skullFiringPos.Y; + float skullProjTargetX = Main.player[npc.target].Center.X - skullFiringPos.X; + float skullProjTargetY = Main.player[npc.target].Center.Y - skullFiringPos.Y; // Ozzatron: noticed this is unused. Leaving as-is for minimal touch. float skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); if (Collision.CanHit(skullFiringPos, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { float skullProjSpeed = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; - skullProjTargetX = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - skullFiringPos.X; - skullProjTargetY = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - skullFiringPos.Y; + skullProjTargetX = Main.player[npc.target].Center.X - skullFiringPos.X; + skullProjTargetY = Main.player[npc.target].Center.Y - skullFiringPos.Y; skullProjTargetDist = (float)Math.Sqrt(skullProjTargetX * skullProjTargetX + skullProjTargetY * skullProjTargetY); skullProjTargetDist = skullProjSpeed / skullProjTargetDist; skullProjTargetX *= skullProjTargetDist; @@ -357,12 +373,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Float above target if (npc.ai[1] == 0f) { - npc.damage = lifeRatio > 0.99f ? 0 : npc.defDamage; + // Avoid cheap bullshit + npc.damage = 0; calamityGlobalNPC.newAI[1] += 1f; float phaseChangeRateBoost = 3f * (1f - lifeRatio); npc.ai[2] += 1f + phaseChangeRateBoost; - if (npc.ai[2] >= 600f) + float chargePhaseGateValue = 600f; + bool canCharge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= 320f; // 20 tile distance + bool charge = npc.ai[2] >= chargePhaseGateValue && canCharge; + if (charge) { npc.ai[2] = 0f; npc.ai[1] = 1f; @@ -373,8 +393,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - npc.rotation = npc.velocity.X / 15f; - float headYAcceleration = 0.04f + (death ? 0.04f * (1f - lifeRatio) : 0f); float headYTopSpeed = 3.5f - (death ? 1.75f - lifeRatio : 0f); float headXAcceleration = 0.08f + (death ? 0.08f * (1f - lifeRatio) : 0f); @@ -382,9 +400,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.getGoodWorld) { headYAcceleration += 0.01f; - headYTopSpeed += 1f; + headYTopSpeed -= 1f; headXAcceleration += 0.05f; - headXTopSpeed += 2f; + headXTopSpeed -= 2f; } if (bossRush) { @@ -394,7 +412,30 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses headXTopSpeed *= 0.75f; } - if (npc.position.Y > Main.player[npc.target].position.Y - 250f) + float moveAwayGateValue = chargePhaseGateValue - (5f + phaseChangeRateBoost); + bool moveAwayBeforeCharge = npc.ai[2] >= moveAwayGateValue; + if (moveAwayBeforeCharge) + { + if (!canCharge) + { + float maxAcceleration = headXAcceleration + headYAcceleration + (npc.ai[2] - moveAwayGateValue) * 0.001f; + npc.velocity += Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * -maxAcceleration; + float maxVelocity = (headXTopSpeed + headYTopSpeed + (npc.ai[2] - moveAwayGateValue) * 0.01f) / 2f; + if (npc.velocity.Length() > maxVelocity) + { + npc.velocity.Normalize(); + npc.velocity *= maxVelocity; + } + } + + npc.rotation = npc.velocity.X / 15f; + + return false; + } + + npc.rotation = npc.velocity.X / 15f; + + if (npc.Top.Y > Main.player[npc.target].Top.Y - 250f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; @@ -402,7 +443,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y > headYTopSpeed) npc.velocity.Y = headYTopSpeed; } - else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) + else if (npc.Top.Y < Main.player[npc.target].Top.Y - 250f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; @@ -411,7 +452,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y = -headYTopSpeed; } - if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) + if (npc.Center.X > Main.player[npc.target].Center.X) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; @@ -420,7 +461,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.X = headXTopSpeed; } - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) + if (npc.Center.X < Main.player[npc.target].Center.X) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; @@ -433,6 +474,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spin charge else if (npc.ai[1] == 1f) { + // Set damage + npc.damage = npc.defDamage; + if (Main.getGoodWorld) { npc.reflectsProjectiles = true; @@ -494,7 +538,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] == 2f) - SoundEngine.PlaySound(SoundID.Roar, npc.position); + SoundEngine.PlaySound(SoundID.Roar, npc.Center); if (npc.ai[2] >= 300f) { @@ -533,9 +577,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } npc.rotation += npc.direction * 0.3f; - Vector2 headSpinPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float headSpinTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - headSpinPos.X; - float headSpinTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - headSpinPos.Y; + Vector2 headSpinPos = npc.Center; + float headSpinTargetX = Main.player[npc.target].Center.X - headSpinPos.X; + float headSpinTargetY = Main.player[npc.target].Center.Y - headSpinPos.Y; float headSpinTargetDist = (float)Math.Sqrt(headSpinTargetX * headSpinTargetX + headSpinTargetY * headSpinTargetY); // Increase speed while charging @@ -565,9 +609,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses calamityGlobalNPC.DR = 0.9999f; calamityGlobalNPC.unbreakableDR = true; npc.rotation += npc.direction * 0.3f; - Vector2 enrageSpinPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float enrageSpinTargetX = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - enrageSpinPos.X; - float enrageSpinTargetY = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - enrageSpinPos.Y; + Vector2 enrageSpinPos = npc.Center; + float enrageSpinTargetX = Main.player[npc.target].Center.X - enrageSpinPos.X; + float enrageSpinTargetY = Main.player[npc.target].Center.Y - enrageSpinPos.Y; float enrageSpinTargetDist = (float)Math.Sqrt(enrageSpinTargetX * enrageSpinTargetX + enrageSpinTargetY * enrageSpinTargetY); enrageSpinTargetDist = 8f / enrageSpinTargetDist; npc.velocity.X = enrageSpinTargetX * enrageSpinTargetDist; @@ -577,6 +621,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Despawn else if (npc.ai[1] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity.Y += 0.1f; if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.95f; @@ -673,9 +720,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float velocityMultiplier = MathHelper.Lerp(death ? 0.5f : 0.7f, 1f, skeletronLifeRatio); float velocityIncrement = MathHelper.Lerp(0.2f, death ? 0.6f : 0.45f, 1f - skeletronLifeRatio); - float handSwipeVelocity = MathHelper.Lerp(22f, death ? 33f : 27.5f, 1f - skeletronLifeRatio); + float handSwipeVelocity = MathHelper.Lerp(16f, death ? 28f : 22f, 1f - skeletronLifeRatio); if (npc.ai[2] == 0f || npc.ai[2] == 3f) { + // Avoid cheap bullshit + npc.damage = 0; + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) npc.timeLeft = 10; @@ -684,7 +734,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float maxX = (bossRush ? 4f : death ? 6f : 7f) * velocityMultiplier; float maxY = (bossRush ? 3f : death ? 4.5f : 5f) * velocityMultiplier; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f * yMultiplier) + if (npc.Top.Y > Main.npc[(int)npc.ai[1]].Top.Y - 100f * yMultiplier) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.94f; @@ -692,7 +742,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f * yMultiplier) + else if (npc.Top.Y < Main.npc[(int)npc.ai[1]].Top.Y - 100f * yMultiplier) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.94f; @@ -701,7 +751,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y = -maxY; } - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.94f; @@ -710,7 +760,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.X = maxX; } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.94f; @@ -721,19 +771,19 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { - npc.ai[3] += 1f; - float slapGateValue = 200f - MathHelper.Lerp(0f, death ? 140f : 70f, 1f - skeletronLifeRatio); + npc.ai[3] += MathHelper.Lerp(1f, death ? 3f : 2f, 1f - skeletronLifeRatio); + float slapGateValue = HandSlapGateValue; if (npc.ai[3] >= slapGateValue) { npc.ai[2] += 1f; - npc.ai[3] = 0f; + npc.ai[3] = slapGateValue; npc.netUpdate = true; } float maxX = (bossRush ? 4f : death ? 6f : 7f) * velocityMultiplier; float maxY = (bossRush ? 1f : death ? 2f : 2.5f) * velocityMultiplier; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f * yMultiplier) + if (npc.Top.Y > Main.npc[(int)npc.ai[1]].Top.Y + 230f * yMultiplier) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.92f; @@ -741,7 +791,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f * yMultiplier) + else if (npc.Top.Y < Main.npc[(int)npc.ai[1]].Top.Y + 230f * yMultiplier) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.92f; @@ -750,7 +800,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y = -maxY; } - if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) + if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.92f; @@ -759,7 +809,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.X = maxX; } - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0]) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.92f; @@ -769,18 +819,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } } - Vector2 handCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float handIdleXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handCurrentPos.X; - float handIdleYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handCurrentPos.Y; + Vector2 handCurrentPos = npc.Center; + float handIdleXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - handCurrentPos.X; + float handIdleYPos = Main.npc[(int)npc.ai[1]].Top.Y + 230f - handCurrentPos.Y; float handIdleDist = (float)Math.Sqrt(handIdleXPos * handIdleXPos + handIdleYPos * handIdleYPos); npc.rotation = (float)Math.Atan2(handIdleYPos, handIdleXPos) + MathHelper.PiOver2; return false; } if (npc.ai[2] == 1f) { - Vector2 handCurrentPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float handDrawbackXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handCurrentPosition.X; - float handDrawbackYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handCurrentPosition.Y; + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 handCurrentPosition = npc.Center; + float handDrawbackXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - handCurrentPosition.X; + float handDrawbackYPos = Main.npc[(int)npc.ai[1]].Top.Y + 230f - handCurrentPosition.Y; float handDrawbackDist = (float)Math.Sqrt(handDrawbackXPos * handDrawbackXPos + handDrawbackYPos * handDrawbackYPos); npc.rotation = (float)Math.Atan2(handDrawbackYPos, handDrawbackXPos) + MathHelper.PiOver2; npc.velocity.X *= 0.95f; @@ -791,13 +844,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.velocity.Y > 10f) npc.velocity.Y = 10f; - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + if (npc.Top.Y < Main.npc[(int)npc.ai[1]].Top.Y - 200f) { + // Set damage + npc.damage = npc.defDamage; + npc.TargetClosest(); npc.ai[2] = 2f; - handCurrentPosition = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - handDrawbackXPos = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - handCurrentPosition.X; - handDrawbackYPos = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - handCurrentPosition.Y; + handCurrentPosition = npc.Center; + handDrawbackXPos = Main.player[npc.target].Center.X - handCurrentPosition.X; + handDrawbackYPos = Main.player[npc.target].Center.Y - handCurrentPosition.Y; handDrawbackDist = (float)Math.Sqrt(handDrawbackXPos * handDrawbackXPos + handDrawbackYPos * handDrawbackYPos); handDrawbackDist = handSwipeVelocity / handDrawbackDist; npc.velocity.X = handDrawbackXPos * handDrawbackDist; @@ -807,17 +863,24 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.ai[2] == 2f) { - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || npc.velocity == Vector2.Zero) + // Set damage + npc.damage = npc.defDamage; + + if (npc.Top.Y > Main.player[npc.target].Top.Y || npc.velocity.Y < 0f || npc.velocity == Vector2.Zero) { npc.ai[2] = 3f; + npc.ai[3] = 0f; npc.netUpdate = true; } } else if (npc.ai[2] == 4f) { - Vector2 handStrikeCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float handStrikeXPos = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - handStrikeCurrentPos.X; - float handStrikeYPos = Main.npc[(int)npc.ai[1]].position.Y + 230f - handStrikeCurrentPos.Y; + // Avoid cheap bullshit + npc.damage = 0; + + Vector2 handStrikeCurrentPos = npc.Center; + float handStrikeXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - handStrikeCurrentPos.X; + float handStrikeYPos = Main.npc[(int)npc.ai[1]].Top.Y + 230f - handStrikeCurrentPos.Y; float handStrikeDist = (float)Math.Sqrt(handStrikeXPos * handStrikeXPos + handStrikeYPos * handStrikeYPos); npc.rotation = (float)Math.Atan2(handStrikeYPos, handStrikeXPos) + MathHelper.PiOver2; npc.velocity.Y *= 0.95f; @@ -828,13 +891,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.velocity.X > 14f) npc.velocity.X = 14f; - if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 500f) + if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) { + // Set damage + npc.damage = npc.defDamage; + npc.TargetClosest(); npc.ai[2] = 5f; - handStrikeCurrentPos = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - handStrikeXPos = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - handStrikeCurrentPos.X; - handStrikeYPos = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - handStrikeCurrentPos.Y; + handStrikeCurrentPos = npc.Center; + handStrikeXPos = Main.player[npc.target].Center.X - handStrikeCurrentPos.X; + handStrikeYPos = Main.player[npc.target].Center.Y - handStrikeCurrentPos.Y; handStrikeDist = (float)Math.Sqrt(handStrikeXPos * handStrikeXPos + handStrikeYPos * handStrikeYPos); handStrikeDist = handSwipeVelocity / handStrikeDist; npc.velocity.X = handStrikeXPos * handStrikeDist; @@ -842,9 +908,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } } - else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || npc.velocity == Vector2.Zero)) + else if (npc.ai[2] == 5f && ((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 == Vector2.Zero)) { + // Set damage + npc.damage = npc.defDamage; + npc.ai[2] = 0f; + npc.ai[3] = 0f; npc.netUpdate = true; } diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index 8d1c2edf8d..99f8eebcc7 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -156,7 +156,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.damage = 0; // Start other phases; if arms are dead, start with spin phase - if (phase2 || CalamityWorld.LegendaryMode) + if (phase2 || CalamityWorld.LegendaryMode || allArmsDead) { // Start spin phase after 1.5 seconds npc.ai[2] += phase3 ? 1.5f : 1f; @@ -282,8 +282,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 1f) { npc.defense *= 2; - npc.damage = npc.defDamage; - npc.damage *= 2; + npc.damage = npc.defDamage * 2; if (phase2 && Main.netMode != NetmodeID.MultiplayerClient) { @@ -680,12 +679,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Inflict 0 damage for 3 seconds after spawning bool dontAttack = npc.Calamity().newAI[2] < 180f; if (dontAttack) - { npc.Calamity().newAI[2] += 1f; - npc.damage = 0; - } - else - npc.damage = npc.defDamage; + + // Avoid cheap bullshit + npc.damage = 0; bool normalLaserRotation = npc.localAI[1] % 2f == 0f; @@ -913,12 +910,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Inflict 0 damage for 3 seconds after spawning bool dontAttack = npc.Calamity().newAI[2] < 180f; if (dontAttack) - { npc.Calamity().newAI[2] += 1f; - npc.damage = 0; - } - else - npc.damage = npc.defDamage; + + // Avoid cheap bullshit + npc.damage = 0; bool fireSlower = false; if (laserAlive) @@ -1174,12 +1169,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Inflict 0 damage for 3 seconds after spawning if (npc.Calamity().newAI[2] < 180f) - { npc.Calamity().newAI[2] += 1f; - npc.damage = 0; - } - else - npc.damage = npc.defDamage; + + // Avoid cheap bullshit + npc.damage = 0; // Return to the head if (npc.ai[2] == 99f) @@ -1332,6 +1325,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) { + // Set damage + npc.damage = npc.defDamage; + float chargeVelocity = bossRush ? 20f : 16f; if (!cannonAlive) chargeVelocity += 1.5f; @@ -1356,6 +1352,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge 4 times (more if arms are dead) else if (npc.ai[2] == 2f) { + // Set damage + npc.damage = npc.defDamage; + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) { float chargeAmt = 4f; @@ -1396,6 +1395,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 500f) { + // Set damage + npc.damage = npc.defDamage; + float chargeVelocity = bossRush ? 17.5f : 14f; if (!cannonAlive) chargeVelocity += 1.15f; @@ -1420,6 +1422,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge 4 times (more if arms are dead) else if (npc.ai[2] == 5f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 100f) { + // Set damage + npc.damage = npc.defDamage; + float chargeAmt = 4f; if (!cannonAlive) chargeAmt += 1f; @@ -1508,12 +1513,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Inflict 0 damage for 3 seconds after spawning if (npc.Calamity().newAI[2] < 180f) - { npc.Calamity().newAI[2] += 1f; - npc.damage = 0; - } - else - npc.damage = npc.defDamage; + + // Min saw damage + int reducedSetDamage = (int)(npc.defDamage * 0.5f); + + // Avoid cheap bullshit + npc.damage = reducedSetDamage; if (npc.ai[2] == 99f) { @@ -1654,6 +1660,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) { + // Set damage + npc.damage = npc.defDamage; + float chargeVelocity = bossRush ? 27.5f : 22f; if (!cannonAlive) chargeVelocity += 1.5f; @@ -1677,6 +1686,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[2] == 2f) { + // Set damage + npc.damage = npc.defDamage; + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) npc.ai[2] = 3f; } @@ -1685,6 +1697,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.ai[2] == 4f) { + // Set damage + npc.damage = npc.defDamage; + float chargeVelocity = bossRush ? 13.5f : 11f; if (!cannonAlive) chargeVelocity += 1.5f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs index 00c33bf5ac..66841e2168 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs @@ -448,6 +448,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.ai[1] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + float retinazerPhase1MaxSpeed = 8.25f; float retinazerPhase1Acceleration = 0.115f; retinazerPhase1MaxSpeed += 4f * enrageScale; @@ -584,6 +587,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 1f) { + // Set damage + npc.damage = npc.defDamage; + npc.rotation = retinazerHoverRotation; float retinazerChargeSpeed = 15f; retinazerChargeSpeed += 10f * enrageScale; @@ -603,18 +609,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.ai[1] == 2f) { + // Set damage + npc.damage = npc.defDamage; + npc.ai[2] += 1f; if (npc.ai[2] >= 25f) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity *= 0.96f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - { npc.velocity.X = 0f; - } if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - { npc.velocity.Y = 0f; - } } else npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; @@ -649,6 +657,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[0] == 1f || npc.ai[0] == 2f) { + // Avoid cheap bullshit + npc.damage = 0; + if (NPC.IsMechQueenUp) npc.reflectsProjectiles = true; @@ -717,7 +728,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.chaseable = !spazInPhase1; - npc.damage = (int)(npc.defDamage * 1.5); + int setDamage = (int)(npc.defDamage * 1.5); npc.defense = npc.defDefense + 10; calamityGlobalNPC.DR = spazInPhase1 ? 0.9999f : 0.2f; calamityGlobalNPC.unbreakableDR = spazInPhase1; @@ -727,6 +738,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + float retinazerPhase2MaxSpeed = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); float retinazerPhase2Accel = 0.175f + (death ? 0.05f * (0.7f - lifeRatio) : 0f); retinazerPhase2MaxSpeed += 4.5f * enrageScale; @@ -857,6 +871,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { if (npc.ai[1] == 1f) { + // Avoid cheap bullshit + npc.damage = 0; + int retinazerPhase2FaceDirection = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) retinazerPhase2FaceDirection = -1; @@ -962,6 +979,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge else if (npc.ai[1] == 2f) { + // Set damage + npc.damage = setDamage; + // Set rotation and velocity npc.rotation = retinazerHoverRotation; float retinazerPhase3ChargeSpeed = 22f + (death ? 8f * (0.7f - lifeRatio) : 0f); @@ -985,6 +1005,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 3f) { + // Set damage + npc.damage = setDamage; + npc.ai[2] += 1f; float chargeTime = spazAlive ? 45f : 30f; @@ -997,6 +1020,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Slow down if (npc.ai[2] >= chargeTime) { + // Avoid cheap bullshit + npc.damage = 0; + npc.velocity *= 0.93f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -1063,6 +1089,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Get in position for charge else if (npc.ai[1] == 4f) { + // Avoid cheap bullshit + npc.damage = 0; + int chargeLineUpDist = spazAlive ? 600 : 500; float chargeSpeed = 12f + (death ? 4f * (0.7f - lifeRatio) : 0f); float chargeAccel = 0.3f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); @@ -1275,6 +1304,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Cursed fireball phase if (npc.ai[1] == 0f) { + // Avoid cheap bullshit + npc.damage = 0; + // Velocity float spazmatismFireballMaxSpeed = 12f; float spazmatismFireballAccel = 0.4f; @@ -1408,6 +1440,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charging phase else if (npc.ai[1] == 1f) { + // Set damage + npc.damage = npc.defDamage; + // Rotation and velocity npc.rotation = spazmatismRotation; float spazmatismPhase1ChargeSpeed = 16f; @@ -1428,11 +1463,17 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else if (npc.ai[1] == 2f) { + // Set damage + npc.damage = npc.defDamage; + npc.ai[2] += 1f; float timeBeforeSlowDown = 12f; if (npc.ai[2] >= timeBeforeSlowDown) { + // Avoid cheap bullshit + npc.damage = 0; + // Slow down npc.velocity *= 0.9f; @@ -1483,6 +1524,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Transition phase else if (npc.ai[0] == 1f || npc.ai[0] == 2f) { + // Avoid cheap bullshit + npc.damage = 0; + if (NPC.IsMechQueenUp) npc.reflectsProjectiles = true; @@ -1557,7 +1601,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.chaseable = !retInPhase1; // Increase defense and damage - npc.damage = (int)(npc.defDamage * 1.5); + int setDamage = (int)(npc.defDamage * 1.5); + int reducedSetDamage = (int)(setDamage * 0.5f); npc.defense = npc.defDefense + 18; calamityGlobalNPC.DR = retInPhase1 ? 0.9999f : 0.2f; calamityGlobalNPC.unbreakableDR = retInPhase1; @@ -1569,6 +1614,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Shadowflamethrower phase if (npc.ai[1] == 0f) { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + float spazmatismFlamethrowerMaxSpeed = 6.2f + (death ? 2f * (0.7f - lifeRatio) : 0f); float spazmatismFlamethrowerAccel = 0.1f + (death ? 0.03f * (0.7f - lifeRatio) : 0f); spazmatismFlamethrowerMaxSpeed += 4f * enrageScale; @@ -1724,6 +1772,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Charge if (npc.ai[1] == 1f) { + // Set damage + npc.damage = setDamage; + // Play charge sound SoundEngine.PlaySound(SoundID.Roar, npc.position); @@ -1742,6 +1793,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[1] == 2f) { + // Set damage + npc.damage = setDamage; + npc.ai[2] += retAlive ? 1f : 1.25f; float chargeTime = 50f - (death ? 12f * (0.7f - lifeRatio) : 0f); @@ -1749,6 +1803,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Slow down if (npc.ai[2] >= chargeTime) { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + npc.velocity *= 0.93f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -1778,6 +1835,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Crazy charge else if (npc.ai[1] == 3f) { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + // Reset AI array and go to shadowflamethrower phase or fireball phase if ret is dead float secondFastCharge = 4f; if (npc.ai[3] >= (retAlive ? secondFastCharge : secondFastCharge + 1f)) @@ -1847,6 +1907,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Crazy charge else if (npc.ai[1] == 4f) { + // Set damage + npc.damage = setDamage; + if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.Roar, npc.position); @@ -1860,6 +1923,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Slow down if (npc.ai[2] >= spazmatismRetDeadChargeSpeed) { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + npc.velocity *= 0.93f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -1887,6 +1953,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Get in position for charge else if (npc.ai[1] == 5f) { + // Avoid cheap bullshit + npc.damage = reducedSetDamage; + float chargeLineUpDist = retAlive ? 600f : 500f; float chargeSpeed = 16f + (death ? 5f * (0.7f - lifeRatio) : 0f); float chargeAccel = 0.4f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); diff --git a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs index a904b3cf91..aa76475144 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs @@ -480,6 +480,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; + // Avoid cheap bullshit + npc.damage = 0; + // Despawn if (Main.wofNPCIndex < 0) { diff --git a/Particles/WaterFlavored.png b/Particles/WaterFlavored.png new file mode 100644 index 0000000000..6059e0e6e3 Binary files /dev/null and b/Particles/WaterFlavored.png differ diff --git a/Particles/WaterFlavoredParticle.cs b/Particles/WaterFlavoredParticle.cs new file mode 100644 index 0000000000..9923ea9156 --- /dev/null +++ b/Particles/WaterFlavoredParticle.cs @@ -0,0 +1,51 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class WaterFlavoredParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => false; + + public override string Texture => "CalamityMod/Particles/WaterFlavored"; + + public WaterFlavoredParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + } + + public override void Update() + { + Scale *= 0.93f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(0.65f, 1f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); + } + } +} diff --git a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs index 06aebb26f5..6d6b44df0f 100644 --- a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -73,6 +75,38 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual bool PreventTargettingUntilTargetHit => true; + /// + /// If , the minion will be considered grounded, this will turn on some features that are neccesary for grounded minions.
+ /// Defaults to . + ///
+ public virtual bool Grounded => false; + + /// + /// The speed at which the minion falls.
+ /// It'll take the absolute value of whatever you input, to ensure that it's on Terraria's coordinate system.
+ /// This is intended to use for grounded minions.
+ /// Defaults to 0.4f. + ///
+ public float Gravity + { + get => _gravity; + set => _gravity = MathF.Abs(value); + } + private float _gravity = 0.4f; + + /// + /// The max speed at which the minion falls.
+ /// It'll take the absolute value of whatever you input, to ensure that it's on Terraria's coordinate system.
+ /// This is intended to use for grounded minions.
+ /// Defaults to 20f. + ///
+ public float MaxGravity + { + get => _maxGravity; + set => _maxGravity = MathF.Abs(value); + } + private float _maxGravity = 20f; + /// /// The amount of animation frames this minion has.
/// Defaults to 1 frame. @@ -119,7 +153,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.penetrate = -1; Projectile.friendly = true; - Projectile.tileCollide = false; + Projectile.tileCollide = Grounded; Projectile.ignoreWater = true; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; @@ -141,6 +175,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles MinionAI(); } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + #region AI Methods /// @@ -189,6 +225,149 @@ namespace CalamityMod.Projectiles.BaseProjectiles Owner = Main.player[Projectile.owner]; ModdedOwner = Owner.Calamity(); Target = Owner.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || CalamityPlayer.areThereAnyDamnBosses); + + // When minions are grounded, they are affected by tiles, meaning they have a much limited movement. + // Pre-Hardmode minions are affected the most since they can't see through walls. + // In consequence, some targets that may seem valid, aren't detected due to this. + // If the minion hasn't detected any targets with the center being the player, we give them a second chance with the center being the minion itself. + // If there are bosses on the world, we don't do this check because if there wasn't any targets with tile X-Ray, this won't do anything. + if (Grounded && Target is null && PreHardmodeMinionTileVision && !CalamityPlayer.areThereAnyDamnBosses) + Target = Projectile.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, false); + } + + #endregion + + #region Grounded Minion Utilities + + /// + /// A quick method to apply gravity to grounded minions.
+ /// You can choose to not use it and make your own if a simple one does not fit your need. + ///
+ public void DoGravity() + { + float speedY = Projectile.velocity.Y; + if (speedY < _maxGravity) + speedY = MathF.Min(speedY + _gravity, _maxGravity); + Projectile.velocity.Y = speedY; + } + + /// + /// Checks whether there's a tile between two vectors vertically.
+ /// This method has many shorthand variants.
+ /// Useful for grounded minion behavior. + ///
+ /// The starter vector. Its X component will be the one used, so put here the vector from where you want to check. + /// The ending vector. + /// Whether you want to check for platforms when is below + /// Returns if there's a tile between and , the X coordinate being the one from ; otherwise . + public bool IsTileBetweenTwoVectorsVertically(Vector2 startVector, Vector2 endVector, bool platformCheckDownwards = false) + { + Point startPoint = CalamityUtils.ToSafeTileCoordinates(startVector); + Point endPoint = CalamityUtils.ToSafeTileCoordinates(endVector); + + if (endVector.Y > startVector.Y) + { + for (int coordY = endPoint.Y; coordY >= startPoint.Y; coordY--) + { + if (Main.tile[startPoint.X, coordY].IsTileSolidGround()) + return true; + } + } + else + { + for (int coordY = endPoint.Y; coordY <= startPoint.Y; coordY++) + { + if (platformCheckDownwards) + { + if (Main.tile[startPoint.X, coordY].IsTileSolidGround()) + return true; + } + else if (Main.tile[startPoint.X, coordY].IsTileSolid()) + return true; + } + } + + return false; + } + + public bool IsTileBetweenOwnerAndVectorVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Owner.Center, vector, platformCheckDownwards); + + public bool IsTileBetweenTargetAndVectorVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, vector, platformCheckDownwards); + + public bool IsTileBetweenVectorAndMinionVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(vector, Projectile.Center, platformCheckDownwards); + + public bool IsTileBetweenOwnerAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Owner.Center, Projectile.Center, platformCheckDownwards); + + public bool IsTileBetweenTargetAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, Projectile.Center, platformCheckDownwards); + + /// + /// Checks if the minion has a tile in front of him, at their left or right. + /// + /// The extra distance it'll check at the left, not all minions are perfectly sized 1 tile, so you'll need to tweak this. Defaults to 0. + /// The extra distance it'll check at the right, not all minions are perfectly sized 1 tile, so you'll need to tweak this. Defaults to 0. + /// if there's a tile at the left or right, otherwise + public bool IsMinionFacingTile(int leftFluff = 0, int rightFluff = 0) + { + Point topLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.TopLeft); + Point bottomLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft); + for (int coordY = topLeft.Y; coordY < bottomLeft.Y; coordY++) + { + if (Main.tile[topLeft.X - leftFluff, coordY].IsTileSolid()) + return true; + } + + Point topRight = CalamityUtils.ToSafeTileCoordinates(Projectile.TopRight); + Point bottomRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight); + for (int coordY = topRight.Y; coordY <= bottomRight.Y; coordY++) + { + if (Main.tile[topRight.X + rightFluff, coordY].IsTileSolid()) + return true; + } + + return false; + } + + /// + /// Checks whether the minion is standing on a tile or not. + /// + /// if the minion's standing on a tile, otherwise + public bool IsMinionStandingOnTile() + { + Point minionPointLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft); + Point minionPointRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight); + for (int coordX = minionPointLeft.X; coordX <= minionPointRight.X; coordX++) + { + if (Main.tile[coordX, minionPointLeft.Y].IsTileSolidGround()) + return true; + } + + return false; + } + + /// + /// Checks whether the minion is inside a tile or not.
+ /// It checks if there's tiles in the diagonals of the minion's hitbox. + ///
+ /// if there's a tile inside the minion, otherwise + public bool IsMinionInsideTile() + { + Point topLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.TopLeft); + Point bottomRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight); + for (int coordX = topLeft.X; coordX <= bottomRight.X; coordX++) + { + if (Main.tile[coordX, (int)Utils.Remap(coordX, topLeft.X, bottomRight.X, topLeft.Y, bottomRight.Y)].IsTileSolid()) + return true; + } + + Point topRight = CalamityUtils.ToSafeTileCoordinates(Projectile.TopRight); + Point bottomLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft); + for (int coordX = bottomLeft.X; coordX >= topRight.X; coordX--) + { + if (Main.tile[coordX, (int)Utils.Remap(coordX, bottomLeft.X, topRight.X, bottomLeft.Y, bottomRight.Y)].IsTileSolid()) + return true; + } + + return false; } #endregion diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 4ea6fb76cd..050a318c2d 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -178,17 +178,16 @@ namespace CalamityMod.Projectiles.Boss default: break; } - Color baseColor = new Color(red, green, blue, 255); + Color baseColor = new Color(red, green, blue, 0); - Color halfBaseColor = baseColor * 0.5f; - halfBaseColor.A = 0; + Color baseColor2 = baseColor; Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Vector2 halfTextureSize = drawTexture.Size() / 2f; - Color halfOfHalfBaseColor = halfBaseColor * 0.5f; + Color halfOfHalfBaseColor = baseColor2 * 0.5f; float timeLeftColorScale = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; Vector2 timeLeftDrawEffect = new Vector2(1f, 1.5f) * timeLeftColorScale; Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; - halfBaseColor *= timeLeftColorScale; + baseColor2 *= timeLeftColorScale; halfOfHalfBaseColor *= timeLeftColorScale; SpriteEffects spriteEffects = SpriteEffects.None; @@ -200,7 +199,7 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < Projectile.oldPos.Length; i++) { Vector2 drawPos = Projectile.oldPos[i] + projDirection; - Color baseColorAlpha = Projectile.GetAlpha(halfBaseColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); + Color baseColorAlpha = Projectile.GetAlpha(baseColor2) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, SpriteEffects.None, 0); Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, SpriteEffects.None, 0); @@ -210,8 +209,8 @@ namespace CalamityMod.Projectiles.Boss } } - Main.EntitySpriteDraw(drawTexture, projDirection, null, halfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, projDirection, null, halfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, projDirection, null, baseColor2, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, projDirection, null, baseColor2, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 286c536e13..662dc45f3c 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -32,6 +33,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + if (Projectile.velocity.Y > 0f) { if (Projectile.Opacity < 1f) @@ -67,12 +71,13 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.position.Y > Projectile.ai[1]) + if (Projectile.position.Y > Projectile.ai[1] && Projectile.velocity.Y > 0f) Projectile.tileCollide = true; Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); - Projectile.velocity.X *= 0.995f; + float xVelocityMultiplier = death ? 0.999f : expertMode ? 0.9975f : 0.995f; + Projectile.velocity.X *= xVelocityMultiplier; } public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; @@ -113,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 4; i++) { - int shroomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + int shroomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); Main.dust[shroomDust].velocity *= 1.5f; if (Main.rand.NextBool()) { @@ -123,10 +128,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 12; j++) { - int shroomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); + int shroomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); Main.dust[shroomDust2].noGravity = true; Main.dust[shroomDust2].velocity *= 2f; - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); } } } diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 2e82c649fd..70c13d723a 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Projectile.position.Y > Projectile.ai[1]) + if (Projectile.position.Y > Projectile.ai[1] && Projectile.velocity.Y > 0f) Projectile.tileCollide = true; Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); for (int i = 0; i < 4; i++) { - int shroomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + int shroomDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); Main.dust[shroomDust].velocity *= 1.5f; if (Main.rand.NextBool()) { @@ -131,10 +131,10 @@ namespace CalamityMod.Projectiles.Boss } for (int j = 0; j < 12; j++) { - int shroomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 3f); + int shroomDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); Main.dust[shroomDust2].noGravity = true; Main.dust[shroomDust2].velocity *= 2f; - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 2f); + Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 1.5f); } if (Main.zenithWorld && NPC.CountNPCS(NPCID.Crab) < 20 && Main.netMode != NetmodeID.MultiplayerClient) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 11077c752b..69e4ca6756 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -409,13 +409,41 @@ namespace CalamityMod.Projectiles return false; } + else if (projectile.type == ProjectileID.BloodShot) + { + if (projectile.localAI[0] == 0f) + { + SoundEngine.PlaySound(SoundID.Item17, projectile.Center); + projectile.localAI[0] = 1f; + for (int i = 0; i < 8; i++) + { + Dust blood1 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100)]; + blood1.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + projectile.velocity.SafeNormalize(Vector2.Zero) * 3f; + blood1.scale = 1.5f; + blood1.fadeIn = 1.7f; + blood1.position = projectile.Center; + } + } + + projectile.alpha = 0; + + Dust blood2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100)]; + blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; + blood2.scale = 1.2f; + blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + else if (projectile.type == ProjectileID.BloodNautilusShot) { if (projectile.localAI[0] == 0f) { SoundEngine.PlaySound(SoundID.Item171, projectile.Center); projectile.localAI[0] = 1f; - for (int num160 = 0; num160 < 8; num160++) + for (int i = 0; i < 8; i++) { Dust blood1 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); blood1.velocity = (Main.rand.NextFloatDirection() * MathHelper.Pi).ToRotationVector2() * 2f + projectile.velocity.SafeNormalize(Vector2.Zero) * 2f; @@ -425,26 +453,55 @@ namespace CalamityMod.Projectiles } } - projectile.alpha -= 20; - if (projectile.alpha < 0) - projectile.alpha = 0; + projectile.alpha = 0; - for (int num161 = 0; num161 < 2; num161++) - { - Dust blood2 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); - blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; - blood2.scale = 1.2f; - blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; - } + Dust blood2 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); + blood2.velocity = blood2.velocity / 4f + projectile.velocity / 2f; + blood2.scale = 1.2f; + blood2.position = projectile.Center + Main.rand.NextFloat() * projectile.velocity * 2f; - for (int num162 = 1; num162 < projectile.oldPos.Length && !(projectile.oldPos[num162] == Vector2.Zero); num162++) + for (int j = 1; j < projectile.oldPos.Length && !(projectile.oldPos[j] == Vector2.Zero); j++) { - if (Main.rand.Next(3) == 0) + if (Main.rand.NextBool(3)) { - Dust blood3 = Dust.NewDustDirect(projectile.oldPos[num162], projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); + Dust blood3 = Dust.NewDustDirect(projectile.oldPos[j], projectile.width, projectile.height, 5, projectile.velocity.X, projectile.velocity.Y, 100); blood3.velocity = blood3.velocity / 4f + projectile.velocity / 2f; blood3.scale = 1.2f; - blood3.position = projectile.oldPos[num162] + projectile.Size / 2f + Main.rand.NextFloat() * projectile.velocity * 2f; + blood3.position = projectile.oldPos[j] + projectile.Size / 2f + Main.rand.NextFloat() * projectile.velocity * 2f; + } + } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + + else if (projectile.type == ProjectileID.QueenBeeStinger) + { + if (projectile.ai[1] != 0f) + { + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; + } + + if (Main.rand.NextBool()) + Dust.NewDustDirect(projectile.position - projectile.velocity, projectile.width, projectile.height, 147, 0f, 0f, 0, default(Color), 0.9f).noGravity = true; + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + for (int num99 = 0; num99 < 20; num99++) + { + Dust dust3 = Dust.NewDustDirect(projectile.position - projectile.velocity, projectile.width, projectile.height, 147, 0f, 0f, 0, default(Color), 1.3f); + dust3.noGravity = true; + dust3.velocity += projectile.velocity * 0.75f; + } + + for (int num100 = 0; num100 < 10; num100++) + { + Dust dust4 = Dust.NewDustDirect(projectile.position - projectile.velocity, projectile.width, projectile.height, 147, 0f, 0f, 0, default(Color), 1.3f); + dust4.noGravity = true; + dust4.velocity *= 2f; } } @@ -500,6 +557,119 @@ namespace CalamityMod.Projectiles return false; } + else if (projectile.type == ProjectileID.CultistBossLightningOrb) + { + if (NPC.AnyNPCs(NPCID.CultistBoss)) + { + if (projectile.localAI[1] == 0f) + { + SoundEngine.PlaySound(SoundID.Item121, projectile.position); + projectile.localAI[1] = 1f; + } + + if (projectile.ai[0] < 180f) + { + projectile.alpha -= 5; + if (projectile.alpha < 0) + projectile.alpha = 0; + } + else + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + return false; + } + } + + ref float reference = ref projectile.ai[0]; + ref float reference46 = ref reference; + float num15 = reference; + reference46 = num15 + 1f; + + if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 180f && Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 2; + int[] array6 = new int[maxTargets]; + Vector2[] array7 = new Vector2[maxTargets]; + int num731 = 0; + float num732 = 2000f; + + for (int num733 = 0; num733 < Main.maxPlayers; num733++) + { + if (!Main.player[num733].active || Main.player[num733].dead) + continue; + + Vector2 center9 = Main.player[num733].Center; + float num734 = Vector2.Distance(center9, projectile.Center); + if (num734 < num732 && Collision.CanHit(projectile.Center, 1, 1, center9, 1, 1)) + { + array6[num731] = num733; + array7[num731] = center9; + int num34 = num731 + 1; + num731 = num34; + if (num34 >= array7.Length) + break; + } + } + + for (int num735 = 0; num735 < num731; num735++) + { + Vector2 vector52 = array7[num735] + Main.player[array6[num735]].velocity * 40f - projectile.Center; + float ai = Main.rand.Next(100); + Vector2 vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector53, 466, projectile.damage, 0f, Main.myPlayer, vector52.ToRotation(), ai); + } + } + + Lighting.AddLight(projectile.Center, 0.4f, 0.85f, 0.9f); + + if (++projectile.frameCounter >= 4) + { + projectile.frameCounter = 0; + if (++projectile.frame >= Main.projFrames[projectile.type]) + projectile.frame = 0; + } + + if (projectile.alpha >= 150 || !(projectile.ai[0] < 180f)) + return false; + + for (int num736 = 0; num736 < 1; num736++) + { + float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num737 < -0.5f) + num737 = -0.5f; + if (num737 > 0.5f) + num737 = 0.5f; + + Vector2 value40 = new Vector2(-projectile.width * 0.2f * projectile.scale, 0f).RotatedBy(num737 * MathHelper.TwoPi).RotatedBy(projectile.velocity.ToRotation()); + Dust zap = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, 226, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + zap.position = projectile.Center + value40; + zap.velocity = Vector2.Normalize(zap.position - projectile.Center) * 2f; + zap.noGravity = true; + } + + for (int num739 = 0; num739 < 1; num739++) + { + float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num740 < -0.5f) + num740 = -0.5f; + if (num740 > 0.5f) + num740 = 0.5f; + + Vector2 value41 = new Vector2(-projectile.width * 0.6f * projectile.scale, 0f).RotatedBy(num740 * MathHelper.TwoPi).RotatedBy(projectile.velocity.ToRotation()); + Dust zap = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, 226, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + zap.velocity = Vector2.Zero; + zap.position = projectile.Center + value41; + zap.noGravity = true; + } + + return false; + } + } + else if (projectile.type == ProjectileID.Starfury) { if (projectile.timeLeft > 75) @@ -553,7 +723,7 @@ namespace CalamityMod.Projectiles { float maxSpeed = 12f; int accelerationTime = 30; - + if (projectile.localAI[0] > 0f) projectile.localAI[0]--; @@ -1682,118 +1852,6 @@ namespace CalamityMod.Projectiles projectile.velocity *= 1.01f; } - else if (projectile.type == ProjectileID.CultistBossLightningOrb && BossRushEvent.BossRushActive) - { - if (NPC.AnyNPCs(NPCID.CultistBoss)) - { - if (projectile.localAI[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item121, projectile.position); - projectile.localAI[1] = 1f; - } - - if (projectile.ai[0] < 180f) - { - projectile.alpha -= 5; - if (projectile.alpha < 0) - projectile.alpha = 0; - } - else - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - projectile.Kill(); - return false; - } - } - - ref float reference = ref projectile.ai[0]; - ref float reference46 = ref reference; - float num15 = reference; - reference46 = num15 + 1f; - - if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 180f && Main.netMode != NetmodeID.MultiplayerClient) - { - int[] array6 = new int[5]; - Vector2[] array7 = new Vector2[5]; - int num731 = 0; - float num732 = 2000f; - - for (int num733 = 0; num733 < 255; num733++) - { - if (!Main.player[num733].active || Main.player[num733].dead) - continue; - - Vector2 center9 = Main.player[num733].Center; - float num734 = Vector2.Distance(center9, projectile.Center); - if (num734 < num732 && Collision.CanHit(projectile.Center, 1, 1, center9, 1, 1)) - { - array6[num731] = num733; - array7[num731] = center9; - int num34 = num731 + 1; - num731 = num34; - if (num34 >= array7.Length) - break; - } - } - - for (int num735 = 0; num735 < num731; num735++) - { - Vector2 vector52 = array7[num735] + Main.player[array6[num735]].velocity * 40f - projectile.Center; - float ai = Main.rand.Next(100); - Vector2 vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector53, 466, projectile.damage, 0f, Main.myPlayer, vector52.ToRotation(), ai); - } - } - - Lighting.AddLight(projectile.Center, 0.4f, 0.85f, 0.9f); - - if (++projectile.frameCounter >= 4) - { - projectile.frameCounter = 0; - if (++projectile.frame >= Main.projFrames[projectile.type]) - projectile.frame = 0; - } - - if (projectile.alpha >= 150 || !(projectile.ai[0] < 180f)) - return false; - - for (int num736 = 0; num736 < 1; num736++) - { - float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; - if (num737 < -0.5f) - num737 = -0.5f; - if (num737 > 0.5f) - num737 = 0.5f; - - Vector2 value40 = new Vector2(-projectile.width * 0.2f * projectile.scale, 0f).RotatedBy(num737 * MathHelper.TwoPi).RotatedBy(projectile.velocity.ToRotation()); - Dust zap = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, 226, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); - zap.position = projectile.Center + value40; - zap.velocity = Vector2.Normalize(zap.position - projectile.Center) * 2f; - zap.noGravity = true; - } - - for (int num739 = 0; num739 < 1; num739++) - { - float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; - if (num740 < -0.5f) - num740 = -0.5f; - if (num740 > 0.5f) - num740 = 0.5f; - - Vector2 value41 = new Vector2(-projectile.width * 0.6f * projectile.scale, 0f).RotatedBy(num740 * MathHelper.TwoPi).RotatedBy(projectile.velocity.ToRotation()); - Dust zap = Dust.NewDustDirect(projectile.Center - Vector2.One * 5f, 10, 10, 226, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); - zap.velocity = Vector2.Zero; - zap.position = projectile.Center + value41; - zap.noGravity = true; - } - - return false; - } - } - else if (projectile.type == ProjectileID.CultistBossIceMist) { if (projectile.localAI[1] == 0f) @@ -2936,6 +2994,9 @@ namespace CalamityMod.Projectiles return Color.Coral; } + if (projectile.type == ProjectileID.BloodNautilusShot) + return new Color(200, 0, 0, projectile.alpha); + if (projectile.type == ProjectileID.Stinger) return new Color(200, 200, 0, projectile.alpha); @@ -3085,14 +3146,15 @@ namespace CalamityMod.Projectiles { if (Main.netMode != NetmodeID.MultiplayerClient) { - int beeAmt = Main.rand.Next(2, 5); + int beeAmt = Main.rand.Next(2, 4); int availableAmountOfNPCsToSpawnUpToSlot = NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(beeAmt); for (int i = 0; i < availableAmountOfNPCsToSpawnUpToSlot; i++) { - int beeType = Main.rand.Next(210, 212); + int beeType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); int beeSpawn = NPC.NewNPC(projectile.GetSource_FromThis(), (int)projectile.Center.X, (int)projectile.Center.Y, beeType, 1); Main.npc[beeSpawn].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; Main.npc[beeSpawn].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; + Main.npc[beeSpawn].ai[3] = 1f; Main.npc[beeSpawn].netUpdate = true; } } diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 6273a0bc92..3afd006bb7 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles { ProjectileID.FairyQueenRangedItemShot, Do(PiercingExact(7), ExtraUpdatesExact(1)) }, // Eventide Convert { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(400)) }, { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2)) }, - { ProjectileID.Flames, Do(IDStaticIFrames(5)) }, // Flamethrower AND Elf Melter flames + { ProjectileID.Flames, Do(IDStaticIFrames(5)) }, // Flamethrower AND Elf Melter flames { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1)) }, { ProjectileID.FlowerPetal, Do(MaxUpdatesExact(4), LocalIFrames(10)) }, // Orichalcum armor { ProjectileID.FlowerPow, Do(ExtraUpdatesExact(1)) }, @@ -186,6 +186,7 @@ namespace CalamityMod.Projectiles { ProjectileID.StarWrath, Do(NoPiercing) }, { ProjectileID.Sunfury, Do(ExtraUpdatesExact(1)) }, { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(1)) }, // Beam Sword projectile + { ProjectileID.ThunderStaffShot, Do(PiercingExact(3)) }, //Thunder Zapper projectile { ProjectileID.TitaniumChainsaw, standardChainsawTweaks }, { ProjectileID.TitaniumDrill, standardDrillTweaks }, { ProjectileID.Trimarang, Do(ExtraUpdatesExact(1)) }, diff --git a/Projectiles/DraedonsArsenal/GaussFlux.cs b/Projectiles/DraedonsArsenal/GaussFlux.cs index 85077abc31..62f23c5416 100644 --- a/Projectiles/DraedonsArsenal/GaussFlux.cs +++ b/Projectiles/DraedonsArsenal/GaussFlux.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.penetrate = -1; Projectile.timeLeft = 180; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 15; } public override void AI() diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index 2a934766af..63f787867e 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const int LaserFireRateStealth = 16; public const int MaxLaserCountPerShot = 4; // This only applies to stealth strikes. public const float MaxTargetSearchDistance = 480f; - public const float MaxTargetSearchStealth = 720f; + public const float MaxTargetSearchStealth = 800f; public const float ReturnAccelerationFactor = 0.0012f; public const float ReturnMaxSpeed = 12f; diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs index d2966d80df..da52e29900 100644 --- a/Projectiles/Magic/DustProjectile.cs +++ b/Projectiles/Magic/DustProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.MaxUpdates = 4; Projectile.timeLeft = 30 * Projectile.MaxUpdates; // 30 effectively, 120 total Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 91c4648baf..e3ac8eedf6 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -3,6 +3,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using System; +using CalamityMod.Items.Weapons.Magic; namespace CalamityMod.Projectiles.Magic { @@ -19,24 +21,147 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.MagicMissile; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.alpha = 70; Projectile.penetrate = -1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 280; Projectile.DamageType = DamageClass.Magic; - AIType = ProjectileID.FlyingKnife; Projectile.coldDamage = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; } public override void AI() { - Projectile.rotation += 0.15f; + Player player = Main.player[Projectile.owner]; + if (player == null) + return; + if (!(player.channel && !player.noItems && !player.CCed)) + Projectile.Kill(); + if (Projectile.type != ModContent.ProjectileType() || + Main.player[Projectile.owner].HeldItem.type != ModContent.ItemType() || !Main.player[Projectile.owner].channel) + { + Projectile.Kill(); + return; + } + if (Projectile.ai[2] > 0) + { + Projectile.ai[2]--; + } + + // 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; + + Projectile.rotation += 0.2f; + if (Projectile.localAI[0] < 1f) + { + Projectile.localAI[0] += 0.002f; + } + else + { + Projectile.width = Projectile.height = 50; + } + Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true); + float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X; + float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y; + if (player.gravDir == -1f) + { + projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y; + } + if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f)) + { + projX = (float)player.direction; + projY = 0f; + } + projPos += new Vector2(projX, projY); + float speed = 30f; + float speedScale = 3f; + Vector2 vectorPos = Projectile.Center; + if (Vector2.Distance(projPos, vectorPos) < 90f) + { + speed = 10f; + speedScale = 1f; + } + if (Vector2.Distance(projPos, vectorPos) < 30f) + { + speed = 3f; + speedScale = 0.3f; + } + if (Vector2.Distance(projPos, vectorPos) < 10f) + { + speed = 1f; + speedScale = 0.1f; + } + float projectileX = projPos.X - vectorPos.X; + float projectileY = projPos.Y - vectorPos.Y; + float projectileAdjust = (float)Math.Sqrt((double)(projectileX * projectileX + projectileY * projectileY)); + projectileAdjust = speed / projectileAdjust; + projectileX *= projectileAdjust; + projectileY *= projectileAdjust; + if (Projectile.velocity.X < projectileX) + { + Projectile.velocity.X = Projectile.velocity.X + speedScale; + if (Projectile.velocity.X < 0f && projectileX > 0f) + { + Projectile.velocity.X = Projectile.velocity.X + speedScale; + } + } + else if (Projectile.velocity.X > projectileX) + { + Projectile.velocity.X = Projectile.velocity.X - speedScale; + if (Projectile.velocity.X > 0f && projectileX < 0f) + { + Projectile.velocity.X = Projectile.velocity.X - speedScale; + } + } + if (Projectile.velocity.Y < projectileY) + { + Projectile.velocity.Y = Projectile.velocity.Y + speedScale; + if (Projectile.velocity.Y < 0f && projectileY > 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y + speedScale; + } + } + else if (Projectile.velocity.Y > projectileY) + { + Projectile.velocity.Y = Projectile.velocity.Y - speedScale; + if (Projectile.velocity.Y > 0f && projectileY < 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y - speedScale; + } + } if (Main.rand.NextBool(5)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } + float pushForce = 0.15f; + 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 = 100f; + 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; + } + } } public override bool PreDraw(ref Color lightColor) @@ -52,12 +177,32 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } + if (Projectile.owner == Main.myPlayer) + { + for (int x = 1; x <= 2; x++) + { + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.5f + Main.rand.NextVector2Square(-4, 4), Mod.Find("CryoShieldGore" + Main.rand.Next(1, 5)).Type, 0.7f); + } + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 7; target.AddBuff(BuffID.Frostburn2, 180); + float randOffset = Main.rand.NextFloat(0, 2 * MathHelper.Pi); + // spawn mini stars on hit with a 4 second cooldown + if (Projectile.owner == Main.myPlayer && Projectile.ai[2] <= 0) + { + for (int i = 0; i < 3; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 3f + randOffset).ToRotationVector2() * 4f; + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + Main.projectile[p].DamageType = DamageClass.Magic; + } + SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); + // set the 4 second cooldown + Projectile.ai[2] = 240; + } } } } diff --git a/Projectiles/Magic/SnowflakeIceStar.cs b/Projectiles/Magic/SnowflakeIceStar.cs new file mode 100644 index 0000000000..a9632f9e07 --- /dev/null +++ b/Projectiles/Magic/SnowflakeIceStar.cs @@ -0,0 +1,86 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Magic +{ + public class SnowflakeIceStar : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/Typeless/KelvinCatalystStar"; + public new string LocalizationCategory => "Projectiles.Magic"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 300; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; + } + + public override void AI() + { + if (Projectile.ai[0] < 90f) + { + Projectile.ai[0] += 1f; + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y *= 0.98f; + } + else + { + CalamityUtils.HomeInOnNPC(Projectile, true, 500f, 12f, 20f); + } + + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.075f / 255f, Main.DiscoR * 0.1f / 255f, Main.DiscoR * 0.125f / 255f); + + if (Main.rand.NextBool(6)) + { + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.4f); + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].noGravity = true; + } + + Projectile.rotation += 0.25f; + } + + public override bool? CanDamage() + { + return Projectile.ai[0] >= 90f ? null : false; + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + Projectile.ExpandHitboxBy(24); + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) + { + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int icyDust = Dust.NewDust(rotate + faceDirection, 0, 0, 67, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f); + Main.dust[icyDust].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 60); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 60); + } +} diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs new file mode 100644 index 0000000000..de52d168b8 --- /dev/null +++ b/Projectiles/Magic/Teslabeam.cs @@ -0,0 +1,242 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.Enums; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Teslabeam : BaseLaserbeamProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public override Color LightCastColor => new Color(92, 144, 245); + public override float Lifetime => 18000f; + public override float MaxScale => 1f; + public override float MaxLaserLength => 1600f; //100 tiles + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/Projectiles/InvisibleProj", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/Projectiles/InvisibleProj", AssetRequestMode.ImmediateLoad).Value; + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/Projectiles/InvisibleProj", AssetRequestMode.ImmediateLoad).Value; + + List offsetPoints = new List(); + NPC Victim; + public float damageMultiplier = 1f; // a multiplier for how much damage the beam deals + public bool damageShouldDecay = false; // if this is true, the weapon's damage will decay if the grace period is over + public float decayGracePeriod = 0; // while the grace period is above 0, the weapon's damage won't decay + + public const float MaxDamageMultiplier = 5f; // the maximum damage multiplier + public const float GracePeriod = 10; // this controls the amount of frames that the grace period lasts for. It is combined with the beam's i frame cooldown + public const float DamagePerHit = 0.1f; // how much the damage multiplier increases for each enemy hit + public const float DamageDecayPerFrame = 0.01f; // how much the damage multiplier decreases if damage is decaying + public const float AimResponsiveness = 0.965f; // Last Prism is 0.92f. Lower makes the laser turn faster. + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 1; + } + + 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 = 6; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(damageMultiplier); + writer.Write(damageShouldDecay); + writer.Write(decayGracePeriod); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + damageMultiplier = reader.ReadSingle(); + decayGracePeriod = reader.ReadSingle(); + damageShouldDecay = reader.ReadBoolean(); + } + + 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 = Math.Sign(Projectile.velocity.X); + 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; + } + + Projectile.ai[2]++; + + // Play zap sounds idly + if (Projectile.ai[2] % 5 == 0) + { + SoundEngine.PlaySound(SoundID.DD2_LightningBugZap with { Pitch = 1.1f }, Projectile.position); + } + // If the weapon's target hasn't just been hit, tick down the grace period timer + if (decayGracePeriod > 0 && damageShouldDecay) + { + decayGracePeriod--; + } + + // If the grace period timer runs out, start decaying damage + if (damageShouldDecay && damageMultiplier > 1f && decayGracePeriod <= 0) + { + damageMultiplier = MathHelper.Max(damageMultiplier - DamageDecayPerFrame, 1f); + } + // Update the beam's damage + Projectile.damage = (int)MathHelper.Clamp(Projectile.originalDamage * damageMultiplier, 0, Projectile.originalDamage * MaxDamageMultiplier); + // After damage has been set, set the decay flag to true. If the beams hits the target, this will be set back to false, but if not, damage will start decaying in the next tick + damageShouldDecay = true; + + return true; + } + + public PrimitiveTrail LightningDrawer; + + public PrimitiveTrail LightningBackgroundDrawer; + internal float WidthFunction(float completionRatio) + { + return MathHelper.Clamp(completionRatio * 15, 1, 1.5f); + } + + internal Color ColorFunction(float completionRatio) + { + return new Color(174, 227, 244); // directly color picked from the source material + } + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 4f; + + internal Color BackgroundColorFunction(float completionRatio) + { + return new Color(92, 144, 245) * 0.6f; // directly color picked from the source material + } + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(); + if (LightningDrawer is null) + LightningDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:TeslaTrail"]); + if (LightningBackgroundDrawer is null) + LightningBackgroundDrawer = new PrimitiveTrail(BackgroundWidthFunction, BackgroundColorFunction, PrimitiveTrail.RigidPointRetreivalFunction, GameShaders.Misc["CalamityMod:TeslaTrail"]); + GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); + + // every 2 frames update the offsets are randomized. This is effectively control for the lightning's fps + if (Projectile.ai[2] % 2 == 0) + { + offsetPoints.Clear(); + for (int i = 0; i <= 75; i++) + { + Vector2 baseVec = Vector2.Zero; + float width = 16; + if (i > 0) + { + baseVec += Main.rand.NextVector2Square(-width, width); + } + offsetPoints.Add(Main.rand.NextVector2Square(-width, width)); + } + } + // do not try to draw the lightning if the offset list isn't filled yet or an index error will occur + if (offsetPoints.Count < 75) + return false; + + // the final list of points that will be used to draw the lightning which combines a series of points travelling up the beam with the random values from the offset list + List finalPoints = new List(); + for (int i = 0; i <= 75; i++) + { + Vector2 baseVec = Vector2.Lerp(Projectile.Center, Projectile.Center + Projectile.velocity * LaserLength, i / 73.5f); + float width = 16 + (i / 75 * 10); + if (i > 0) + { + baseVec += offsetPoints[i]; + } + finalPoints.Add(baseVec); + } + + LightningBackgroundDrawer.Draw(finalPoints, -Main.screenPosition, 75); + LightningDrawer.Draw(finalPoints, -Main.screenPosition, 75); + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + // 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; + + // Update CutTiles so the laser will cut tiles (like grass). + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = Projectile.velocity; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * LaserLength, Projectile.width + 16, DelegateMethods.CutTiles); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // if the beam's damage multiplier is at default value, the hit enemy becomes the beam's new target + if (damageMultiplier <= 1f) + { + Victim = target; + } + // if the beam hits its current target, disable damage decay for the frame, reset its grace period, and increase its damage + if (Victim == target) + { + damageShouldDecay = false; + decayGracePeriod = Projectile.idStaticNPCHitCooldown + GracePeriod; + if (damageMultiplier < MaxDamageMultiplier) + { + damageMultiplier = Math.Min(damageMultiplier + DamagePerHit, MaxDamageMultiplier); + } + } + target.AddBuff(BuffID.Electrified, 30); + } + } +} diff --git a/Projectiles/Magic/VeeringWindAirWave.cs b/Projectiles/Magic/VeeringWindAirWave.cs index c247a336ef..6708b7ebee 100644 --- a/Projectiles/Magic/VeeringWindAirWave.cs +++ b/Projectiles/Magic/VeeringWindAirWave.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = Projectile.height = 48; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.penetrate = -1; + Projectile.penetrate = 2; Projectile.extraUpdates = 1; Projectile.timeLeft = 45; Projectile.DamageType = DamageClass.Magic; @@ -37,6 +37,14 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.3f); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.5); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool PreDraw(ref Color lightColor) // Photoviscerator ball drawcode, slightly edited. { Texture2D lightTexture = ModContent.Request(Texture).Value; diff --git a/Projectiles/Magic/VeeringWindFrostWave.cs b/Projectiles/Magic/VeeringWindFrostWave.cs index 63232c64ff..5ca64bda1c 100644 --- a/Projectiles/Magic/VeeringWindFrostWave.cs +++ b/Projectiles/Magic/VeeringWindFrostWave.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = Projectile.height = 48; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.penetrate = -1; + Projectile.penetrate = 2; Projectile.timeLeft = 90; Projectile.DamageType = DamageClass.Magic; Projectile.usesIDStaticNPCImmunity = true; @@ -37,6 +37,14 @@ namespace CalamityMod.Projectiles.Magic Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3() * 0.6f); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.5); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool PreDraw(ref Color lightColor) // Photoviscerator ball drawcode, slightly edited. { Texture2D lightTexture = ModContent.Request(Texture).Value; diff --git a/Projectiles/Melee/AbyssBladeProjectile.cs b/Projectiles/Melee/AbyssBladeProjectile.cs new file mode 100644 index 0000000000..2c3f6ebbeb --- /dev/null +++ b/Projectiles/Melee/AbyssBladeProjectile.cs @@ -0,0 +1,256 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Humanizer; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class AbyssBladeProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/AbyssBlade"; + + public int Time = 0; + public int ChargeupTime = 25; + public int Lifetime = 300; + public int startDamage; + public bool setDamage = false; + public int dustType1 = 104; + public int dustType2 = 29; + public bool spinMode = true; + public Vector2 NPCDestination = new Vector2 (0, 0); + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); + + public Player Owner => Main.player[Projectile.owner]; + public SlotId SpinSoundSlot; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 80; + Projectile.height = 80; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 11; + } + + public override bool ShouldUpdatePosition() + { + return ChargeProgress >= 1; + } + + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (ChargeProgress < 1) + return false; + + return base.CanDamage(); + } + + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound) && SpinSound.IsPlaying) + SpinSound.Position = Projectile.Center; + + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Time++; + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = new Vector3(0.070f, 0.070f, 0.250f); + Lighting.AddLight(Projectile.Center, Light * 3); + + //Anticipation animation. Make the player look like theyre holding the depth crusher + if (ChargeProgress < 1) + { + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + Projectile.spriteDirection = Owner.direction; + Projectile.direction = Owner.direction; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -55f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + return; + } + + //Play the throw sound when the throw ACTUALLY BEGINS. + //Additionally, make the projectile collide and set its speed and velocity + if (Projectile.timeLeft == Lifetime) + { + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 20; + startDamage = Projectile.damage; + Projectile.spriteDirection = Projectile.direction; + SpinSoundSlot = SoundEngine.PlaySound(AbyssBlade.SpinSound, Projectile.Center); + Time = 0; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if (spinMode) + { + Projectile.rotation += (0.9f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Projectile.direction; + Projectile.spriteDirection = Projectile.direction; + + if (Projectile.velocity.Y < 25) + Projectile.velocity.Y += 0.42f; + + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.975f; + + Vector2 particlePosition = Projectile.Center + new Vector2(13.5f * Projectile.direction, 0) + Projectile.velocity * 0.5f; + if (Time % 3 == 0) + { + Particle Smear = new CircularSmearVFX(particlePosition, Color.DeepSkyBlue * Main.rand.NextFloat(0.78f, 0.85f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(0.8f, 0.9f)); + GeneralParticleHandler.SpawnParticle(Smear); + } + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 40f; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 3f); + dust.noGravity = true; + dust.scale = 1.8f; + } + + if (Collision.SolidCollision(Projectile.Center, 10, 10) && Time >= 2) + { + Projectile.extraUpdates = 2; + Projectile.rotation = 0; + spinMode = false; + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/CeramicImpact", 2) { Volume = 0.65f, PitchVariance = 0.3f}, Projectile.Center); + for (int i = 0; i < 3; i++) + { + GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.DodgerBlue, Color.MediumBlue, Main.rand.NextFloat(2.5f, 2.9f) - i * 0.55f, 14, Main.rand.NextFloat(-0.01f, 0.01f), 2.5f); + GeneralParticleHandler.SpawnParticle(sparker); + } + Projectile.penetrate = 1; + Projectile.damage = startDamage; + Time = 0; + + bool foundTarget = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(Projectile.GetSource_FromThis(), false)) + NPCDestination = Main.npc[i].Center + Main.npc[i].velocity * 5f; + + if (NPCDestination == new Vector2(0, 0)) + foundTarget = false; + else + foundTarget = true; + } + + if (!foundTarget) + { + Projectile.velocity = (-Projectile.velocity).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + else + { + Projectile.velocity = (NPCDestination - Projectile.Center).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + + for (int i = 0; i < 6; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, ((Projectile.velocity).SafeNormalize(Vector2.UnitX * Projectile.direction) * 5).RotatedByRandom(0.75f) * Main.rand.NextFloat(1.4f, 2.2f), ModContent.ProjectileType(), startDamage / 4, Projectile.knockBack / 4, Projectile.owner); + } + } + } + else + { + SpinSound?.Stop(); + + Projectile.rotation = (Projectile.velocity.ToRotation() + MathHelper.PiOver4 * (Projectile.direction == 1 ? 1 : 3)); + + if (Time > 9) + { + for (int i = 0; i < 6; i++) + { + Vector2 dustPos = Projectile.Center - Projectile.velocity * 3 + Main.rand.NextVector2Circular(15, 15); + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType2 : dustType1); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.3f, 1.6f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.7f); + } + } + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + SoundStyle HitSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine2") { Volume = 0.7f, PitchVariance = 0.3f }; + if (!spinMode) + { + SoundEngine.PlaySound(HitSound, Projectile.Center); + for (int i = 0; i < 30; i++) + { + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.1f, 1.8f); + dust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.7f); + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.93f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound)) + SpinSound?.Stop(); + + for (int i = 0; i < 40; i++) + { + float dustMulti = Main.rand.NextFloat(0.3f, 1.5f); + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.6f, 2.5f) - dustMulti; + dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; + } + } + } +} diff --git a/Projectiles/Melee/AbyssBladeSplitProjectile.cs b/Projectiles/Melee/AbyssBladeSplitProjectile.cs new file mode 100644 index 0000000000..bd533f5fbe --- /dev/null +++ b/Projectiles/Melee/AbyssBladeSplitProjectile.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class AbyssBladeSplitProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int Time = 0; + public int randTimer; + public int dustType1 = 104; + public int dustType2 = 29; + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Time++; + if (Time == 1) + { + randTimer = Main.rand.Next(240, 301); + Projectile.timeLeft = randTimer; + } + if (Time > 20 && Time < (randTimer - 70)) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 350f, MathHelper.Clamp(1f + Time * 0.075f, 1, 10), 20f); + } + else if (Time >= (randTimer - 70)) + { + if (Projectile.velocity.Y < 10) + Projectile.velocity.Y += 0.4f; + Projectile.velocity.X *= 0.97f; + } + if (Time % 2 == 0) + { + Color smokeColor = Color.MediumBlue; + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-0.2f, -0.6f), smokeColor, 30, Main.rand.NextFloat(0.45f, 0.6f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 3; i++) + { + Vector2 dustPos = Projectile.Center; + int dustType = Main.rand.NextBool(3) ? dustType1 : dustType2; + Dust dust = Dust.NewDustPerfect(dustPos, dustType); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.95f, 1.7f); + dust.velocity = new Vector2(0.5f, 0.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.1f); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.35f }, Projectile.Center); + } + } +} diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index 623d48f4b4..9f52f23313 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 60; Projectile.DamageType = DamageClass.Melee; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index 0ac82786cb..748cd58b84 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee ArkoftheCosmos sword = (Owner.HeldItem.ModItem as ArkoftheCosmos); if (sword != null) { - sword.Charge = 10f; + sword.Charge = ArkoftheCosmos.MaxCharge; sword.Combo = 0f; } SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index bd4cbec34a..536d9ad65b 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.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; @@ -122,5 +123,10 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index 5afc1be218..290edf95df 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee break; } } - int SPOUT = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f); + int SPOUT = Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)(projTileY * 16 + 8), (float)(projTileX * 16 - 32), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 3f, 7f); //First overload seems to deal with timing, second is segment amount Main.projectile[SPOUT].netUpdate = true; } } diff --git a/Projectiles/Melee/ChronoIcicleLarge.cs b/Projectiles/Melee/ChronoIcicleLarge.cs new file mode 100644 index 0000000000..da039e2f8a --- /dev/null +++ b/Projectiles/Melee/ChronoIcicleLarge.cs @@ -0,0 +1,148 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Buffs.StatDebuffs; +using System.Security.Policy; +using System; +using System.Diagnostics.Metrics; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChronoIcicleLarge : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public static int HomingSpeed = 16; + public static int IdleSpeedMax = 7; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.aiStyle = -1; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.coldDamage = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + } + + public override void AI() + { + Projectile.ai[1]++; + switch (Projectile.ai[0]) + { + // stay in an evenly spaced circle around the player, resembling the 12 ticks on a clock + case 0: + if (Projectile.velocity.Length() > 0.01f) + { + Projectile.velocity *= 0.001f; + } + bool isCounter = Projectile.ai[2] < 0; + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) + { + float shardNum = Math.Abs(Projectile.ai[2]) - 1; + float aivar = isCounter ? 1 - shardNum - 1 : shardNum; + Projectile.position = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * 160 - Projectile.Size / 2; + } + if (Projectile.ai[1] >= (12 - Math.Abs(Projectile.ai[2])) * 5 + 2) + { + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center); + for (int i = 0; i < 10; i++) + { + int dusttype = Main.rand.NextBool() ? 68 : 67; + if (Main.rand.NextBool(4)) + { + dusttype = 80; + } + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dusttype, dspeed.X, dspeed.Y, 50, default, 1.1f); + Main.dust[dust].noGravity = true; + } + Projectile.ai[0] = 1; + Projectile.ai[1] = 0; + } + break; + // jet out + case 1: + if (Projectile.velocity.Length() < IdleSpeedMax) + { + Projectile.velocity *= 3f; + } + if (Projectile.ai[1] > 20) + { + Projectile.ai[0] = 2; + } + break; + // home if possible + case 2: + // Set amount of extra updates. + if (Projectile.Calamity().defExtraUpdates == -1) + Projectile.Calamity().defExtraUpdates = Projectile.extraUpdates; + + Vector2 destination = Projectile.Center; + float maxDistance = 1400; + bool locatedTarget = false; + + // Find a target. + for (int i = 0; i < Main.maxNPCs; i++) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance)) + continue; + destination = Main.npc[i].Center; + locatedTarget = true; + break; + } + + if (locatedTarget) + { + // Increase amount of extra updates to greatly increase homing velocity. + Projectile.extraUpdates = Projectile.Calamity().defExtraUpdates + 1; + + // Home in on the target. + Vector2 homeDirection = (destination - Projectile.Center).SafeNormalize(Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 0.2f + homeDirection * HomingSpeed) / (0.2f + 1f); + } + else + { + // Set amount of extra updates to default amount. + Projectile.extraUpdates = Projectile.Calamity().defExtraUpdates; + if (Projectile.velocity.Length() < IdleSpeedMax) + { + Projectile.velocity *= 3f; + } + } + break; + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + target.AddBuff(ModContent.BuffType(), 60); + } + + public override void OnKill(int timeLeft) + { + for (int index1 = 0; index1 < 3; ++index1) + { + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + public override bool? CanHitNPC(NPC target) + { + // the icicles cannot hit while glued to the player + if (Projectile.ai[0] > 0) + return null; + else + return false; + } + } +} diff --git a/Projectiles/Melee/ChronoIcicleLarge.png b/Projectiles/Melee/ChronoIcicleLarge.png new file mode 100644 index 0000000000..ca612eb647 Binary files /dev/null and b/Projectiles/Melee/ChronoIcicleLarge.png differ diff --git a/Projectiles/Melee/ChronoIcicleSmall.cs b/Projectiles/Melee/ChronoIcicleSmall.cs new file mode 100644 index 0000000000..b4a228d3f2 --- /dev/null +++ b/Projectiles/Melee/ChronoIcicleSmall.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Buffs.StatDebuffs; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChronoIcicleSmall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.coldDamage = true; + } + + public override void AI() + { + Projectile.velocity.Y += 0.05f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item12.Volume * 0.7f }, Projectile.position); + target.AddBuff(ModContent.BuffType(), 30); + } + + public override void OnKill(int timeLeft) + { + for (int index1 = 0; index1 < 3; ++index1) + { + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + } +} diff --git a/Projectiles/Melee/ChronoIcicleSmall.png b/Projectiles/Melee/ChronoIcicleSmall.png new file mode 100644 index 0000000000..6e86a39a2c Binary files /dev/null and b/Projectiles/Melee/ChronoIcicleSmall.png differ diff --git a/Projectiles/Melee/ChronomancersScytheHoldout.cs b/Projectiles/Melee/ChronomancersScytheHoldout.cs new file mode 100644 index 0000000000..eaac8773dc --- /dev/null +++ b/Projectiles/Melee/ChronomancersScytheHoldout.cs @@ -0,0 +1,121 @@ +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChronomancersScytheHoldout : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public Player Owner => Main.player[Projectile.owner]; + public override string Texture => "CalamityMod/Items/Weapons/Melee/ChronomancersScythe"; + public static int ClockChance = 30; + + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.ownerHitCheck = true; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float collisionPoint = 0f; + float bladeLength = 130 * Projectile.scale; + float bladeWidth = 90 * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint); + } + + public override void AI() + { + Owner.ChangeDir((int)Projectile.ai[2]); + + Projectile.velocity = Vector2.Zero; + + Projectile.rotation += (2 * MathHelper.Pi / 60) * Projectile.ai[2]; + + UpdateOwnerVars(); + + Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; + + // once the scythe has completed a rotation, die + if ((Projectile.rotation > 2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4 && Projectile.ai[2] == 1) || (Projectile.rotation < -(2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4) && Projectile.ai[2] == -1)) + { + Projectile.Kill(); + } + + // spawn 12 clock hand icicles + Projectile.ai[0]++; + float HandInterval = 60 / 12; + if (Projectile.ai[0] >= HandInterval) + { + if (Projectile.owner == Main.myPlayer) + { + // Math is beautiful + float aivar = Projectile.ai[2] == -1 ? 1 - Projectile.ai[1] - 1 : Projectile.ai[1]; + Vector2 spawnPos = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * 160; + Vector2 rotationVector = spawnPos - Main.player[Projectile.owner].Center; + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, rotationVector * 5, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] * (Projectile.ai[1] + 1)); + Main.projectile[p].rotation = (spawnPos - Main.player[Projectile.owner].Center).ToRotation() + MathHelper.PiOver2; + } + Projectile.ai[1]++; + Projectile.ai[0] = 0; + } + } + + public void UpdateOwnerVars() + { + float rotOffset = Projectile.ai[2] == -1 ? 3 * MathHelper.Pi : MathHelper.PiOver2; + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - rotOffset); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + if (Main.rand.NextBool(ClockChance)) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2Circular(-2, 2), ModContent.ProjectileType(), 0, 0, Projectile.owner); + } + } + + //If we don't do that, the hit enemies get knocked back towards you if you hit them from the right?? + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // This would knock enemies away consistently, but i'm choosing to go with the other option + //hitDirection = Math.Sign(target.Center.X - Owner.Center.X); + + //Doing it this way lets the player choose if they want to knockback enemies towards them by pointing away from them + modifiers.HitDirectionOverride = Owner.direction; + } + + public override bool PreDraw(ref Color lightColor) + { + Owner.ChangeDir((int)Projectile.ai[2]); + + Texture2D scytheTexture = ModContent.Request(Texture).Value; + + Vector2 handleOrigin = Projectile.ai[2] == -1 ? new Vector2(scytheTexture.Width, scytheTexture.Height) : new Vector2(0, scytheTexture.Height); + float scytheRotation = Projectile.rotation; + Main.EntitySpriteDraw(scytheTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), scytheRotation, handleOrigin, Projectile.scale, Projectile.ai[2] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/Melee/ChronomancersScytheSwing.cs b/Projectiles/Melee/ChronomancersScytheSwing.cs new file mode 100644 index 0000000000..f894b99f8e --- /dev/null +++ b/Projectiles/Melee/ChronomancersScytheSwing.cs @@ -0,0 +1,130 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChronomancersScytheSwing : ModProjectile + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public static int IcicleSpeed = 24; + public static int IcicleVariance = 4; + public static int IcicleFrequency = 5; + public static float IcicleDamageMultiplier = 1.2f; + public static int ClockChance = 30; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 6; + } + + public override void SetDefaults() + { + Projectile.width = 148; + Projectile.height = 68; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.coldDamage = true; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + Projectile.damage = (int)(Owner.GetTotalDamage(Projectile.DamageType).ApplyTo(Projectile.originalDamage) * (1f + Utils.GetLerpValue(0f, 300f, Projectile.ai[1], true))); + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 1) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + Projectile.soundDelay--; + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); + Projectile.soundDelay = 24; + } + + if (Main.myPlayer == Projectile.owner) + { + if (Owner.channel && !Owner.noItems && !Owner.CCed) + { + float scaleFactor6 = 1f; + + if (Owner.ActiveItem().shoot == Projectile.type) + scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale; + + Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true); + slashDirection.Normalize(); + if (slashDirection.HasNaNs()) + slashDirection = Vector2.UnitX * (float)Owner.direction; + + slashDirection *= scaleFactor6; + if (slashDirection.X != Projectile.velocity.X || slashDirection.Y != Projectile.velocity.Y) + Projectile.netUpdate = true; + + Projectile.velocity = slashDirection; + } + else + Projectile.Kill(); + } + + Projectile.ai[0]++; + // rapidly fire icicles + if (Projectile.ai[0] % IcicleFrequency == 0) + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 velocity = Projectile.Center.DirectionTo(Main.MouseWorld) * IcicleSpeed + new Vector2(Main.rand.NextFloat(-IcicleVariance, IcicleVariance), Main.rand.NextFloat(-IcicleVariance, IcicleVariance)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * IcicleDamageMultiplier), Projectile.knockBack, Projectile.owner); + } + } + + Vector2 dustSpawn = Projectile.Center + Projectile.velocity * 3f; + Lighting.AddLight(dustSpawn, Color.LightBlue.R * 0.001f, Color.LightBlue.G * 0.001f, Color.LightBlue.B * 0.001f); + + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(dustSpawn - Projectile.Size * 0.5f, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X, Projectile.velocity.Y, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].position -= Projectile.velocity; + } + + Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size * 0.5f + Vector2.UnitX * 8 + Vector2.UnitY * 4; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.spriteDirection == 1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + if (Main.rand.NextBool(ClockChance)) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2Circular(-2, 2), ModContent.ProjectileType(), 0, 0, Projectile.owner); + } + } + } +} diff --git a/Projectiles/Melee/ChronomancersScytheSwing.png b/Projectiles/Melee/ChronomancersScytheSwing.png new file mode 100644 index 0000000000..134f00bf65 Binary files /dev/null and b/Projectiles/Melee/ChronomancersScytheSwing.png differ diff --git a/Projectiles/Melee/CosmicShivAura.cs b/Projectiles/Melee/CosmicShivAura.cs new file mode 100644 index 0000000000..d5ec0ec074 --- /dev/null +++ b/Projectiles/Melee/CosmicShivAura.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CosmicShivAura : ModProjectile + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public readonly int SwordsAverageDelay = 40; + public readonly int SwordsRandomOffset = 15; + public int CurrentSwordTimer; + public NPC target; + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 240; + } + + public override void OnSpawn(IEntitySource source) + { + if (Main.npc[(int)Projectile.ai[0]] is not null || Main.npc[(int)Projectile.ai[0]].active) + target = Main.npc[(int)Projectile.ai[0]]; // Convert target.whoAmI to object + } + + // ai[0] for ID of target to follow until the end of projectile's lifespan or the target cannot be found + // ai[1] for sword timer + public override void AI() + { + // Unexist with target + if (target is null || !target.active) { + Projectile.Kill(); + } + + Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; // Stay with target + + if (Projectile.ai[1] == CurrentSwordTimer) + { + Vector2 randomDirection = Main.rand.NextFloat(0, MathHelper.TwoPi).ToRotationVector2(); + randomDirection.Normalize(); + int randomDistance = Main.rand.Next(200, 426); + Vector2 spawnPos = Projectile.Center + (randomDirection * randomDistance); + Vector2 velocity = Vector2.Normalize(Projectile.Center - spawnPos) * Utils.GetLerpValue(-100, 426, randomDistance, clamped: true) * 20f; // Sword moves a bit slower if spawned closer, moves faster if spawned further + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.8f, Projectile.owner, randomDistance); + Projectile.ai[1] = 0; // Reset timer + CurrentSwordTimer = Main.rand.Next(SwordsAverageDelay - SwordsRandomOffset, SwordsAverageDelay + SwordsRandomOffset); // Determine when next sword will spawn + } + + Projectile.ai[1]++; + } + + // The aura itself should not do contact damage + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/CosmicShivBall.cs b/Projectiles/Melee/CosmicShivBall.cs deleted file mode 100644 index fcbf9b6d7a..0000000000 --- a/Projectiles/Melee/CosmicShivBall.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; - -namespace CalamityMod.Projectiles.Melee -{ - public class CosmicShivBall : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - // TODO -- Please for the love of god refactor this at some point. It is ancient. - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public NPC target = null; - public const float maxDistanceToTarget = 540f; - public bool initialized = false; - public float startingVelocityY = 0f; - public float randomAngleDelta = 0f; - public const float explosionDamageMultiplier = 1.5f; - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 220; - } - public override void AI() - { - if (!initialized) - { - target = Projectile.Center.ClosestNPCAt(maxDistanceToTarget); - startingVelocityY = Projectile.velocity.Y; - randomAngleDelta = Main.rand.NextFloat(0f, MathHelper.TwoPi); - initialized = true; - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - for (int i = 0; i < 3; i++) - { - int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 173, (float)(Projectile.direction * 2), 0f, 115, Color.White, 1.3f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].velocity *= 0f; - } - } - if (Projectile.localAI[0] % 30 == 0) // every 0.5 seconds - { - target = Projectile.Center.ClosestNPCAt(maxDistanceToTarget); - } - if (target != null) - { - float inertia = 35f; - float homingSpeed = 33.5f; - Vector2 idealVelocity = Projectile.SafeDirectionTo(target.Center, Vector2.UnitX) * homingSpeed; - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + idealVelocity) / inertia; - } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // for spawning the side beams - for (int i = 0; i < 2; i++) - { - int directionSign = Main.rand.NextBool().ToDirectionInt(); - Vector2 spawnPos = new Vector2(target.Center.X + directionSign * 650, Projectile.Center.Y + Main.rand.Next(-500, 501)); - Vector2 velocity = Vector2.Normalize(target.Center - spawnPos) * 30f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), Projectile.knockBack * 0.1f, Projectile.owner); - } - int starMax = Main.rand.Next(6, 11); // 6 to 10 stars - for (int i = -starMax / 2; i < starMax / 2; i++) - { - int ySpawnAdditive = Main.rand.Next(-40, 41); - Vector2 toSpawn = target.Center - new Vector2(0f, 800f + ySpawnAdditive).RotatedBy(MathHelper.ToRadians(i * 11f / starMax)); - Vector2 toTarget = Vector2.Normalize(target.Center - toSpawn) * 35f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), toSpawn, toTarget, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner); - } - target.AddBuff(ModContent.BuffType(), 60); - } - // pretty much entirely from the Oracle circular damage code - - private void CircularDamage(float radius) - { - if (Projectile.owner != Main.myPlayer) - return; - Player owner = Main.player[Projectile.owner]; - - for (int i = 0; i < Main.npc.Length; ++i) - { - NPC target = Main.npc[i]; - if (!target.active || target.dontTakeDamage || target.friendly) - continue; - - // Shock any valid target within range. Check all four corners of their hitbox. - float d1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); - float d2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); - float d3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); - float d4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); - float dist = MathHelper.Min(d1, d2); - dist = MathHelper.Min(dist, d3); - dist = MathHelper.Min(dist, d4); - - if (dist <= radius) - { - int damage = (int)(Projectile.damage * explosionDamageMultiplier); - bool crit = Main.rand.Next(100) <= owner.GetCritChance() + 4; - target.StrikeNPC(target.CalculateHitInfo(damage, 0, crit, 0)); - - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, i, damage, 0f, 0f, crit ? 1 : 0, 0, 0); - } - } - } - public override void OnKill(int timeLeft) - { - // mostly from AstralCrystal kill code - float rand2PI = Main.rand.NextFloat(MathHelper.TwoPi); - int petalCount = 5; - float speed = 12f; - float scale = Main.rand.NextFloat(1f, 1.35f); - for (float k = 0f; k < MathHelper.TwoPi; k += 0.05f) - { - Vector2 velocity = k.ToRotationVector2() * (2f + (float)(Math.Sin((double)(rand2PI + k * (float)petalCount)) + 1.0) * speed) * Main.rand.NextFloat(0.95f, 1.05f); - Dust dust = Dust.NewDustPerfect(Projectile.Center, 173, new Vector2?(velocity), 0, default, scale); - dust.customData = 0.025f; - } - CircularDamage(80f); - } - } -} diff --git a/Projectiles/Melee/CosmicShivBlade.cs b/Projectiles/Melee/CosmicShivBlade.cs index 092bf4affe..819f814bdb 100644 --- a/Projectiles/Melee/CosmicShivBlade.cs +++ b/Projectiles/Melee/CosmicShivBlade.cs @@ -1,99 +1,99 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { public class CosmicShivBlade : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public const int penetrateMax = 12; - public const float maxScale = 1.8f; - public bool initialized = false; - public float startYVelSign = 0f; + public Vector2 StartPosition = Vector2.Zero; + public int ColorIndex = 0; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() { Projectile.width = 42; Projectile.height = 42; Projectile.friendly = true; - Projectile.penetrate = penetrateMax; + Projectile.penetrate = 5; Projectile.tileCollide = false; - Projectile.timeLeft = 290; + Projectile.timeLeft = 6000; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 7; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 3; + Projectile.alpha = 0; + Projectile.scale = 1.2f; } + + public override void OnSpawn(IEntitySource source) + { + StartPosition = Projectile.position; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + ColorIndex = Main.rand.Next(0, CosmicShivTrail.DustColors.Count); + } + public override void AI() { - if (!initialized) - { - startYVelSign = (float)Math.Sign(Projectile.velocity.Y) * 0.35f; - initialized = true; - } - if (Projectile.penetrate == penetrateMax && Projectile.timeLeft < 245) - { - Projectile.velocity.Y -= startYVelSign; //arc on the X axis (the amount of pressure on this tiny detail made me want to tear my head off) - if (Math.Abs(Projectile.velocity.X) < 30f) - { - Projectile.velocity.X *= 1.04f; - } - } - if (Projectile.velocity.Length() != 0) - { - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.Pi / 4; - } - else - { - Projectile.rotation += MathHelper.Pi / 6f / (Projectile.scale * 2.5f); - } - Projectile.ai[0]++; - if (Projectile.ai[1] >= 0) - { - Projectile.ai[1]--; - if (Projectile.ai[1] == 0) - { - Projectile.velocity *= -0.9f; - } - } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + + if (Projectile.Distance(StartPosition) > Projectile.ai[0] * 2) + Projectile.Kill(); + + Lighting.AddLight(Projectile.Center, Projectile.GetAlpha(Color.White).ToVector3() * 0.2f); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - Projectile.scale += (maxScale - 1) / (float)penetrateMax; - Projectile.ai[1] = 5 + Main.rand.Next(-2, 3); target.AddBuff(ModContent.BuffType(), 120); } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Rectangle sourceRectangle = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = sourceRectangle.Size() / 2f; + float rotation = Projectile.rotation; + Color randomColor = Projectile.GetAlpha(lightColor); + + float scaleMult = 1.2f; + for (int i = 0; i < Projectile.oldPos.Length; i++) // Afterimages to make the blade look longer + { + Vector2 drawPos = Projectile.oldPos[i] + (Projectile.Size / 2f) - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + Color color = randomColor * ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color, rotation, origin, Projectile.scale * scaleMult, SpriteEffects.None, 0f); // Smaller, more visible layer + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color * 0.5f, rotation, origin, Projectile.scale * 1.6f * scaleMult, SpriteEffects.None, 0f); // Bigger, less visible layer + scaleMult *= 0.95f; + } + + return false; + } + public override void OnKill(int timeLeft) { - Vector2 randomCirclePointVector = Vector2.One.RotatedByRandom(MathHelper.ToRadians(32f)); - float lerpStart = (float)Main.rand.Next(12, 17); - float lerpEnd = (float)Main.rand.Next(3, 7); - for (float i = 0; i < 9f; ++i) + for (int i = 0; i < 6; i++) { - for (int j = 0; j < 2; ++j) - { - Vector2 randomCirclePointRotated = randomCirclePointVector.RotatedBy((j == 0 ? 1 : -1) * MathHelper.TwoPi / 18); - for (float k = 0f; k < 20f; ++k) - { - Vector2 randomCirclePointLerped = Vector2.Lerp(randomCirclePointVector, randomCirclePointRotated, k / 20f); - float lerpMultiplier = MathHelper.Lerp(lerpStart, lerpEnd, k / 20f) * 4f; - int dustIndex = Dust.NewDust(Projectile.Center, 0, 0, - 173, - 0f, 0f, 100, default, 1.1f); - Main.dust[dustIndex].velocity *= 0.1f; - Main.dust[dustIndex].noGravity = true; - Main.dust[dustIndex].velocity += randomCirclePointLerped * lerpMultiplier; - } - } - - randomCirclePointVector = randomCirclePointVector.RotatedBy(MathHelper.TwoPi / 9); + Dust dust = Dust.NewDustDirect(Projectile.Center, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 0, Projectile.GetAlpha(Color.Purple) * 0.4f, 1.5f); + dust.noGravity = true; } } - public override Color? GetAlpha(Color lightColor) + + public override Color? GetAlpha(Color lightColor) // Probably not the right way to use this function, but it works (hopefully) { - return new Color(124, Main.DiscoG, 255, Projectile.alpha); + Color color = CosmicShivTrail.DustColors[ColorIndex] * Projectile.Opacity; + color = Color.Lerp(color, Color.White, 0.6f); + color.A = 0; + return color; // Take random color from a list and make it more white } } } diff --git a/Projectiles/Melee/CosmicShivTrail.cs b/Projectiles/Melee/CosmicShivTrail.cs new file mode 100644 index 0000000000..ef2849fb43 --- /dev/null +++ b/Projectiles/Melee/CosmicShivTrail.cs @@ -0,0 +1,192 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class CosmicShivTrail : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public NPC target = null; + public const float MaxDistanceToTarget = 540f; + public const float ExplosionDamageMultiplier = 2f; + public const int FadeInTime = 12; + + public static List DustColors = new List + { + new Color(69, 69, 222), + new Color(99, 66, 212), + new Color(130, 64, 214), + new Color(154, 75, 219), + new Color(165, 62, 201) + }; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 15; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.timeLeft = 220; + Projectile.scale = 0.7f; + Projectile.Opacity = 0f; + Projectile.extraUpdates = 1; + } + + public override void AI() + { + int QuarterSpriteWidth = 48 / 3; + int QuarterSpriteHeight = 48 / 3; + + int QuarterProjWidth = Projectile.width / 3; + int QuarterProjHeight = Projectile.height / 3; + + DrawOriginOffsetX = 0; + DrawOffsetX = -(QuarterSpriteWidth - QuarterProjWidth); + DrawOriginOffsetY = -(QuarterSpriteHeight - QuarterProjHeight); + + + Lighting.AddLight(Projectile.Center, Projectile.GetAlpha(Color.White).ToVector3()); + + Projectile.rotation += Utils.GetLerpValue(-8f, 12f, Projectile.velocity.Length(), clamped: true); + + if (Projectile.ai[0] > 2f) // After two frames + { + Projectile.Opacity = Utils.GetLerpValue(2f, FadeInTime, Projectile.ai[0], clamped: true); // Fade in + + if (Main.rand.Next(0, 2) == 0) // Dust trail + { + float scale = Main.rand.NextFloat(1.6f, 2.1f); + Color randomColor = DustColors[Main.rand.Next(0, DustColors.Count)]; + Dust dust = Dust.NewDustDirect(Projectile.position, 1, 1, DustID.RainbowMk2, 0, 0, 255, randomColor * 0.6f, scale); + dust.noGravity = true; + } + } + + if (Projectile.ai[0] % 30 == 16) // every 0.25 seconds, starting 8 frames later (extraUpdates = 1 so the values are doubled) + { + target = Projectile.Center.ClosestNPCAt(MaxDistanceToTarget); + } + + if (target is not null) + { + Vector2 targetVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.Zero); + + float multiplier = Projectile.velocity.Length() < 4f ? Projectile.velocity.Length() + 1f : 1f; // Probably a better way to do this, but just a bandaid fix for if the trail velocity ends up being low + targetVelocity *= Projectile.velocity.Length() + multiplier; + + Projectile.velocity = Vector2.Lerp(Projectile.velocity, targetVelocity, 0.12f); + } + + // lifespan timer + Projectile.ai[0]++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Summons invisible aura that sticks to enemies, spawning blades + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, target.whoAmI); + target.AddBuff(ModContent.BuffType(), 60); + } + + // Very similar to CosmicShivBlade PreDraw + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Rectangle sourceRectangle = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = sourceRectangle.Size() / 2f; + float rotation = Projectile.rotation; + Color color = Projectile.GetAlpha(Color.White); + float scaleMult = 1f; + + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + Vector2 drawPos = Projectile.oldPos[i] + (Projectile.Size / 2f) - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + color *= ((float)(Projectile.oldPos.Length - (i / 4)) / (float)Projectile.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color * 0.4f, rotation * -1f, origin, Projectile.scale * 1.8f * scaleMult, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(sourceRectangle), color, rotation, origin, Projectile.scale * scaleMult, SpriteEffects.None, 0f); + scaleMult *= 0.9f; + } + + return false; + + } + + // Lots of trig here, use desmos to comprehend its full power + public override void OnKill(int timeLeft) + { + float rand2PI = Main.rand.NextFloat(0, MathHelper.TwoPi); // Random rotation offset + int rosePetalCount = Main.rand.Next(5, 8); + int bigWavyPetalCount = Main.rand.Next(7, 11); + int wavyPetalCount = Main.rand.Next(6, 10); + float speed = Main.rand.Next(6, 11); // Size + + int rand = Main.rand.Next(0, 10); // 10% chance rose, 10% chance big wavy shape, and 80% chance small undetail wavy shape + if (rand == 0) { + for (float k = 0f; k < MathHelper.TwoPi; k += 0.03f) + { + float scale = Main.rand.NextFloat(1.1f, 1.4f); + float randomWhitingValue = Main.rand.NextFloat(0.0f, 0.2f); + Color color = Color.Lerp(DustColors[Main.rand.Next(0, DustColors.Count)], Color.White, randomWhitingValue); + + Vector2 velocity = k.ToRotationVector2() * (2f + (float)(Math.Sin((double)(rand2PI + k * (float)rosePetalCount)) + 1.0) * speed) * Main.rand.NextFloat(0.95f, 1.05f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB, new Vector2?(velocity), 0, color, scale); + dust.noGravity = true; + dust.fadeIn = -1f; + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB, new Vector2?(velocity) * 0.75f, 0, color, scale); + dust2.noGravity = true; + dust2.fadeIn = -1f; + } + } else if (rand == 1) { + for (float k = 0f; k < MathHelper.TwoPi; k += 0.08f) + { + float scale = Main.rand.NextFloat(1.2f, 1.6f); + float randomWhitingValue = Main.rand.NextFloat(0.0f, 0.2f); + Color color = Color.Lerp(DustColors[Main.rand.Next(0, DustColors.Count)], Color.White, randomWhitingValue); + + Vector2 velocity = k.ToRotationVector2() * (float)(Math.Cos((double)(k * (float)bigWavyPetalCount) + rand2PI) + 5.1f) * speed / 4; + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB, new Vector2?(velocity), 0, color, scale); + dust.noGravity = true; + dust.fadeIn = -1f; + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB, new Vector2?(velocity) * 0.75f, 0, color, scale); + dust2.noGravity = true; + dust2.fadeIn = -1f; + } + } else { + for (float k = 0f; k < MathHelper.TwoPi; k += 0.2f) + { + float scale = Main.rand.NextFloat(1f, 1.2f); + float randomWhitingValue = Main.rand.NextFloat(0.5f, 0.7f); + Color color = Color.Lerp(DustColors[Main.rand.Next(0, DustColors.Count)], Color.White, randomWhitingValue); + + Vector2 velocity = k.ToRotationVector2() * (0.4f * (float)(Math.Sin((double)(k * (float)wavyPetalCount) + rand2PI) + 2.1f) * (speed / 2)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB, new Vector2?(velocity), 0, color * 0.3f, scale); + dust.noGravity = true; + dust.fadeIn = -1f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(238, 171, 255, 25) * Projectile.Opacity; + } + } +} diff --git a/Projectiles/Melee/GalaxyStar.png b/Projectiles/Melee/CosmicShivTrail.png similarity index 100% rename from Projectiles/Melee/GalaxyStar.png rename to Projectiles/Melee/CosmicShivTrail.png diff --git a/Projectiles/Melee/DepthCrusherProjectile.cs b/Projectiles/Melee/DepthCrusherProjectile.cs new file mode 100644 index 0000000000..0d407cb828 --- /dev/null +++ b/Projectiles/Melee/DepthCrusherProjectile.cs @@ -0,0 +1,206 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; +using Humanizer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class DepthCrusherProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/DepthCrusher"; + + public int ChargeupTime = 25; + public int Lifetime = 255; + public int startDamage; + public bool setDamage = false; + public int dustType1 = 104; + public int dustType2 = 96; + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 50; + Projectile.height = 50; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; + } + + public override bool ShouldUpdatePosition() + { + return ChargeProgress >= 1; + } + + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (ChargeProgress < 1) + return false; + + return base.CanDamage(); + } + + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = new Vector3(0.050f, 0.050f, 0.250f); + Lighting.AddLight(Projectile.Center, Light * 2); + + //Anticipation animation. Make the player look like theyre holding the depth crusher + if (ChargeProgress < 1) + { + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -45f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + return; + } + + //Play the throw sound when the throw ACTUALLY BEGINS. + //Additionally, make the projectile collide and set its speed and velocity + if (Projectile.timeLeft == Lifetime) + { + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; + startDamage = Projectile.damage; + Projectile.spriteDirection = Projectile.direction; + } + + Projectile.rotation += (0.4f * (MathF.Abs(Projectile.velocity.Y) * 0.2f + 0.6f)) * Projectile.direction; + if (Projectile.velocity.Y < 20) + Projectile.velocity.Y += Projectile.numHits >= 3 ? 0.7f : 0.4f; + if (Projectile.numHits >= 3) + { + Projectile.penetrate = -1; + if (!setDamage) + { + Projectile.damage = (int)(Projectile.damage * 0.2f); + setDamage = true; + } + } + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.975f; + + if (Collision.SolidCollision(Projectile.Center, 15, 15)) + { + Projectile.tileCollide = true; + } + else + Projectile.tileCollide = false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Projectile.timeLeft = 240; + if (!setDamage) + { + if (Projectile.velocity.Y > 0) + Projectile.velocity.Y = -9; + else + Projectile.velocity.Y = -7; + } + + for (int i = 0; i < 15; i++) + { + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.5f, 1.1f); + dust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f); + } + } + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 40; i++) + { + float dustMulti = Main.rand.NextFloat(0.3f, 1.5f); + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.6f, 2.5f) - dustMulti; + dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; + } + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + SoundStyle HitSound = new("CalamityMod/Sounds/Custom/AbyssGravelMine2") { Volume = 0.6f, PitchVariance = 0.3f }; + + Projectile.timeLeft = 240; + if (Projectile.numHits < 3) + { + Projectile.numHits++; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), startDamage / 4, Projectile.knockBack / 4, Projectile.owner); + + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X * 0.8f; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y * 0.8f; + } + SoundEngine.PlaySound(HitSound with { Pitch = 0.15f }, Projectile.Center); + for (int i = 0; i < 25; i++) + { + float dustMulti = Main.rand.NextFloat(0.3f, 1.5f); + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.6f, 2.5f) - dustMulti; + dust.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; + } + } + else + { + SoundEngine.PlaySound(HitSound, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -5).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType(), startDamage / 4, Projectile.knockBack / 4, Projectile.owner); + } + Projectile.Kill(); + } + + return false; + } + } +} diff --git a/Projectiles/Melee/DepthCrusherSplitProjectile.cs b/Projectiles/Melee/DepthCrusherSplitProjectile.cs new file mode 100644 index 0000000000..5c2b6ef338 --- /dev/null +++ b/Projectiles/Melee/DepthCrusherSplitProjectile.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class DepthCrusherSplitProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int Time = 0; + public int randTimer; + public int dustType1 = 104; + public int dustType2 = 96; + public override void SetDefaults() + { + Projectile.width = 10; + Projectile.height = 10; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.ignoreWater = true; + } + + public override void AI() + { + Time++; + if (Time == 1) + { + randTimer = Main.rand.Next(200, 261); + Projectile.timeLeft = randTimer; + } + if (Time > 20 && Time < (randTimer - 70)) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 280f, MathHelper.Clamp(1f + Time * 0.06f, 1, 10), 20f); + } + else if (Time >= (randTimer - 70)) + { + if (Projectile.velocity.Y < 10) + Projectile.velocity.Y += 0.4f; + Projectile.velocity.X *= 0.97f; + } + if (Time % 2 == 0) + { + Color smokeColor = Color.MediumBlue; + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-0.2f, -0.6f), smokeColor, 30, Main.rand.NextFloat(0.35f, 0.5f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 3; i++) + { + Vector2 dustPos = Projectile.Center; + int dustType = Main.rand.NextBool(3) ? dustType1 : dustType2; + Dust dust = Dust.NewDustPerfect(dustPos, dustType); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.5f); + dust.velocity = new Vector2(0.5f, 0.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.1f); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.35f }, Projectile.Center); + } + } +} diff --git a/Projectiles/Melee/GalaxyStar.cs b/Projectiles/Melee/GalaxyStar.cs deleted file mode 100644 index 6fffa74c23..0000000000 --- a/Projectiles/Melee/GalaxyStar.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Audio; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxyStar : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public bool madeCoolMagicSound = false; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 42; - Projectile.height = 42; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 160; - Projectile.extraUpdates = 2; - } - public override void AI() - { - Lighting.AddLight(Projectile.Center, 1f, 1f, 1f); - if (!madeCoolMagicSound) - { - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); // Starfury sound - madeCoolMagicSound = true; - } - Projectile.ai[0]++; - if (Projectile.ai[0] % 5 == 0) - { - for (int i = 0; i < Main.rand.Next(2, 4); i++) //2-3 stars - { - Vector2 randVector = Vector2.One.RotatedByRandom(Math.PI * 2.0) * 0.7f; - Dust.NewDust(Projectile.Center, 4, 4, 58, randVector.X, randVector.Y, 0, default, 1f); - } - } - Projectile.rotation += Projectile.velocity.Length() / 19f; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - } -} diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs deleted file mode 100644 index bd0cb4164d..0000000000 --- a/Projectiles/Melee/NeptuneOrb.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -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.Melee -{ - public class NeptuneOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/DepthOrb"; - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.Beam; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.timeLeft = 300; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0f, 0f, 1f); - if (Projectile.timeLeft % 20 == 19 && Projectile.owner == Main.myPlayer) - { - int splitDamage = Projectile.damage / 2; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), splitDamage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); - Main.dust[waterDust].noGravity = true; - Main.dust[waterDust].velocity *= 0.5f; - Main.dust[waterDust].velocity += Projectile.velocity * 0.1f; - } - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > 295) - return false; - - 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 Color? GetAlpha(Color lightColor) - { - return new Color(50, 50, 255, Projectile.alpha); - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, 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 dustIndex = 0; dustIndex <= 30; dustIndex++) - { - float rando1 = (float)Main.rand.Next(-10, 11); - float rando2 = (float)Main.rand.Next(-10, 11); - float rando3 = (float)Main.rand.Next(3, 9); - float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjuster = rando3 / randoAdjuster; - rando1 *= randoAdjuster; - rando2 *= randoAdjuster; - int killWatery = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 1.2f); - Dust dust = Main.dust[killWatery]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = rando1; - dust.velocity.Y = rando2; - } - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Melee/NeptunesBountyProjectile.cs b/Projectiles/Melee/NeptunesBountyProjectile.cs new file mode 100644 index 0000000000..2dee9b2a16 --- /dev/null +++ b/Projectiles/Melee/NeptunesBountyProjectile.cs @@ -0,0 +1,316 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using ReLogic.Utilities; +using static CalamityMod.CalamityUtils; +using CalamityMod.Buffs.StatBuffs; + +namespace CalamityMod.Projectiles.Melee +{ + public class NeptunesBountyProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/NeptunesBounty"; + + public int Time = 0; + public int ChargeupTime = 25; + public int Lifetime = 300; + public int startDamage; + public bool setDamage = false; + public int dustType1 = 103; + public int dustType2 = 172; + public bool spinMode = false; // Initial spinning + public bool spinMode2 = false; // After falling happens spin effect + public Vector2 NPCDestination = new Vector2(0, 0); + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); + + public Player Owner => Main.player[Projectile.owner]; + public SlotId SpinSoundSlot; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 135; + Projectile.height = 135; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 11; + } + + public override bool ShouldUpdatePosition() + { + return ChargeProgress >= 1; + } + + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (ChargeProgress < 1) + return false; + + return base.CanDamage(); + } + + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound) && SpinSound.IsPlaying) + SpinSound.Position = Projectile.Center; + + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Time++; + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = spinMode2 ? new Vector3(0.200f, 0.200f, 0.255f) : new Vector3(0.070f, 0.070f, 0.250f); + Lighting.AddLight(Projectile.Center, Light * 4); + + //Anticipation animation. Make the player look like theyre holding the depth crusher + if (ChargeProgress < 1) + { + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + Projectile.spriteDirection = Owner.direction; + Projectile.direction = Owner.direction; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -90f * Owner.gravDir + new Vector2(Owner.direction == 1 ? 10 : 3, 0); + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + return; + } + + //Play the throw sound when the throw ACTUALLY BEGINS. + //Additionally, make the projectile collide and set its speed and velocity + if (Projectile.timeLeft == Lifetime) + { + Projectile.netUpdate = true; + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 12f; + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 28; + startDamage = Projectile.damage; + Projectile.spriteDirection = Projectile.direction; + SpinSoundSlot = SoundEngine.PlaySound(NeptunesBounty.SpinSound, Projectile.Center); + Time = 0; + spinMode = true; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if (Time >= 75 && !spinMode2 && Projectile.velocity.Y >= 22) + { + Projectile.extraUpdates = 3; + + SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/VividClarityBeamAppear") { Volume = 0.65f, PitchVariance = 0.3f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.15f }, Projectile.Center); + + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.01f, 0.9f, 22); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DodgerBlue, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.01f, 0.83f, 15); + GeneralParticleHandler.SpawnParticle(pulse2); + + Projectile.damage = startDamage; + Time = 0; + + bool foundTarget = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(Projectile.GetSource_FromThis(), false)) + NPCDestination = Main.npc[i].Center + Main.npc[i].velocity * 5f; + + if (NPCDestination == new Vector2(0, 0)) + foundTarget = false; + else + foundTarget = true; + } + + if (!foundTarget) + { + Projectile.velocity = (-Projectile.velocity).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + else + { + Projectile.velocity = (NPCDestination - Projectile.Center).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + + SpinSound?.Stop(); + + spinMode2 = true; + } + + if (spinMode) + { + if (!spinMode2) + { + if (Projectile.velocity.Y < 22) + Projectile.velocity.Y += 0.42f; + + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.975f; + + Vector2 particlePosition = Projectile.Center + new Vector2(13.5f * Projectile.direction, 0) + Projectile.velocity * 0.5f; + if (Time % 3 == 0) + { + Particle Smear = new CircularSmearVFX(particlePosition, Color.DeepSkyBlue * Main.rand.NextFloat(0.78f, 0.85f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(1.2f, 1.3f)); + GeneralParticleHandler.SpawnParticle(Smear); + } + + if (playerDist < 1400f) + { + for (int i = 0; i < 2; i++) + { + Vector2 linePos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 75f; + SparkleParticle spark = new SparkleParticle(linePos, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * Main.rand.NextFloat(5f, 12f), Color.DodgerBlue * 0.35f, Color.DarkBlue * 0.75f, Main.rand.NextFloat(0.15f, 0.4f), Main.rand.Next(7, 16), Main.rand.NextFloat(-8, 8), 0.2f, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + if (Time % 7 == 0) + { + Vector2 velDirection = new Vector2(80, 80).RotatedByRandom(100); + Vector2 location = Projectile.Center + velDirection; + Vector2 velocity; + bool foundTarget = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(Projectile.GetSource_FromThis(), false)) + NPCDestination = Main.npc[i].Center + Main.npc[i].velocity * 5f; + + if (NPCDestination == new Vector2(0, 0)) + foundTarget = false; + else + foundTarget = true; + } + + if (!foundTarget) + { + velocity = velDirection.SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + else + { + velocity = (NPCDestination - location).SafeNormalize(Vector2.UnitX * Projectile.direction) * 25; + } + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), location, velocity, ModContent.ProjectileType(), startDamage / 6, Projectile.knockBack / 4, Projectile.owner); + } + + } + else + { + if (Time == 1) + SpinSoundSlot = SoundEngine.PlaySound(NeptunesBounty.SpinSound with { Pitch = 0.2f }, Projectile.Center); + + Vector2 particlePosition2 = Projectile.Center + new Vector2(13.5f * Projectile.direction, 0) + Projectile.velocity * 0.5f; + if (Time % 2 == 0) + { + Particle Smear2 = new CircularSmearVFX(particlePosition2, Color.Aqua * Main.rand.NextFloat(0.78f, 0.85f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(1.2f, 1.3f)); + GeneralParticleHandler.SpawnParticle(Smear2); + } + + if (playerDist < 1400f) + { + for (int i = 0; i < 2; i++) + { + Vector2 linePos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 75f; + SparkleParticle spark = new SparkleParticle(linePos, (i * MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * Main.rand.NextFloat(5f, 12f), Color.Aqua * 0.35f, Color.DodgerBlue * 0.75f, Main.rand.NextFloat(0.15f, 0.4f), Main.rand.Next(7, 16), Main.rand.NextFloat(-8, 8), 0.2f, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + Projectile.spriteDirection = Projectile.direction; + + Projectile.rotation += (0.9f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Projectile.direction; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + + SoundStyle HitSound = new("CalamityMod/Sounds/Item/SarosDiskThrow", 3) { Volume = 0.55f, Pitch = -0.8f }; + if (spinMode2) + { + for (int i = 0; i < 4; i++) + { + AltSparkParticle spark = new AltSparkParticle(target.Center, (Projectile.velocity * 0.1f) * (i + 1), false, 15, 4f - i * 0.35f, Color.Aqua * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 4; i++) + { + AltSparkParticle spark = new AltSparkParticle(target.Center, (-Projectile.velocity * 0.15f) * (i + 1), false, 15, 4f - i * 0.6f, Color.Aqua * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i <= 20; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center + Main.rand.NextVector2Circular(9, 9), Main.rand.NextBool() ? 307 : 180, Projectile.velocity * Main.rand.NextFloat(0.1f, 1.2f), 0, default, Main.rand.NextFloat(0.9f, 1.45f)); + dust.noGravity = true; + Dust dust2 = Dust.NewDustPerfect(target.Center + Main.rand.NextVector2Circular(9, 9), Main.rand.NextBool() ? 307 : 180, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1.2f), 0, default, Main.rand.NextFloat(0.9f, 1.45f)); + dust2.noGravity = true; + } + SoundEngine.PlaySound(HitSound, Projectile.Center); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.65f, Pitch = -0.5f }, Projectile.Center); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.93f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound)) + SpinSound?.Stop(); + + for (int i = 0; i < 40; i++) + { + float dustMulti = Main.rand.NextFloat(0.3f, 1.5f); + Vector2 dustPos = Projectile.Center; + Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? dustType1 : dustType2); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.6f, 2.5f) - dustMulti; + dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * dustMulti; + } + } + public override bool PreDraw(ref Color lightColor) + { + if (spinMode2) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Aqua * 0.6f, 1); + } + return true; + } + } +} diff --git a/Projectiles/Melee/NeptunesBountySplitProjectile.cs b/Projectiles/Melee/NeptunesBountySplitProjectile.cs new file mode 100644 index 0000000000..6308993b7f --- /dev/null +++ b/Projectiles/Melee/NeptunesBountySplitProjectile.cs @@ -0,0 +1,84 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class NeptunesBountySplitProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int Time = 0; + public int randTimer; + public int dustType1 = 80; + public int dustType2 = 172; + public int spreadDust = 0; + public Color WaterColor = Main.rand.NextBool() ? Color.DodgerBlue : Color.DeepSkyBlue; + public Player Owner => Main.player[Projectile.owner]; + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 85; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Time++; + Projectile.velocity *= 0.98f; + + if (Projectile.timeLeft % 2 == 0 && Time > 3f && playerDist < 1400f) + { + Color smokeColor = Color.RoyalBlue; + Particle smoke = new HeavySmokeParticle(Projectile.Center - Projectile.velocity, Projectile.velocity * Main.rand.NextFloat(-0.2f, -0.6f), smokeColor * 0.65f, 15, Main.rand.NextFloat(0.4f, 0.55f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), false, required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3 + spreadDust, 3 + spreadDust), Main.rand.NextBool(3) ? dustType1 : dustType2, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.65f), 0, default, Main.rand.NextFloat(0.4f, 1.2f) + Time * 0.009f); + dust.noGravity = true; + if (dust.type == dustType1) + dust.alpha = 180; + + if (Projectile.timeLeft == 20) + { + WaterFlavoredParticle spark = new WaterFlavoredParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 25, 0.85f + Time * 0.013f, WaterColor * 0.35f); + GeneralParticleHandler.SpawnParticle(spark); + } + else if (Projectile.timeLeft > 20) + { + WaterFlavoredParticle spark = new WaterFlavoredParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 2, 0.85f + Time * 0.013f, WaterColor * 0.35f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.timeLeft < 20) + { + Time -= 5; + spreadDust += 2; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 240); + + SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.35f }, Projectile.Center); + } + } +} diff --git a/Projectiles/Melee/Shortswords/CosmicShivProj.cs b/Projectiles/Melee/Shortswords/CosmicShivProj.cs index 6ca1318dc8..b9c48c514c 100644 --- a/Projectiles/Melee/Shortswords/CosmicShivProj.cs +++ b/Projectiles/Melee/Shortswords/CosmicShivProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -14,6 +14,8 @@ namespace CalamityMod.Projectiles.Melee.Shortswords { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/CosmicShiv"; + public bool MeleeEffect = false; + public int NumHits = 0; public override void SetDefaults() { @@ -29,12 +31,12 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Projectile.hide = true; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = -1; } public override Action EffectBeforePullback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 3f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); }; public override void SetVisualOffsets() @@ -50,31 +52,64 @@ namespace CalamityMod.Projectiles.Melee.Shortswords DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); } - public override void ExtraBehavior() - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173); - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - 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; + OnHitEffect(); + + if (NumHits < 3) { // Just to avoid insanity from stacking so many super dummies or hitting many worm segments at once + // 2x bonus for true melee hits (spawns an additional aura plus the one aura from the cosmic shiv ball) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, target.whoAmI); + NumHits++; } - target.AddBuff(ModContent.BuffType(), 120); + + target.AddBuff(ModContent.BuffType(), 240); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - for (int k = 0; k < 36; k++) + OnHitEffect(); + + target.AddBuff(ModContent.BuffType(), 240); + } + + public void OnHitEffect() + { + float rand2PI = Main.rand.NextFloat(MathHelper.TwoPi); // Random rotation offset + int petalCount = Main.rand.Next(5, 8); // Number of star points + float speed = Main.rand.Next(18, 24); // Size of star + + // Bool check so it only performs this effect once per strike, at a 50% chance + if (!MeleeEffect && Main.rand.NextBool()) { - 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 (float k = 0f; k < MathHelper.TwoPi; k += 0.08f) + { + float scale = Main.rand.NextFloat(1.5f, 1.9f); + float randomWhitingValue = Main.rand.NextFloat(0.0f, 0.2f); + Color color = Color.Lerp(CosmicShivTrail.DustColors[Main.rand.Next(0, CosmicShivTrail.DustColors.Count)], Color.White, randomWhitingValue); // Just for even more variety in colors idk + Vector2 velocity = StarPolarEquation(petalCount, k, rand2PI) * speed * 2f; + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB, velocity, 0, color, scale); + dust.noGravity = true; + dust.fadeIn = -1f; // I don't know if this does anything but it looks like the dust fades out faster with this + + Vector2 velocity2 = StarPolarEquation(petalCount, k - 0.04f, rand2PI) * speed * 2 * 0.9f; // Inner star + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB, velocity2, 0, color, scale); + dust2.noGravity = true; + dust2.fadeIn = -1f; + } } - target.AddBuff(ModContent.BuffType(), 120); + } + + public Vector2 StarPolarEquation(int pointCount, float angle, float offset) // For OnHitNPC(), Thanks Dominic + { + // There should be a star point that looks directly upward. However, that isn't the case for odd star counts with the equation below. + // To address this, a -90 degree rotation is performed. + // Refer to desmos to view the resulting shape this creates. It's basically a black box of trig otherwise. + float sqrt3 = 1.732051f; + float numerator = MathF.Cos(MathHelper.Pi * (pointCount + 1f) / pointCount); + float starAdjustedAngle = MathF.Asin(MathF.Cos(pointCount * angle + offset)) * 2f; + float denominator = MathF.Cos((starAdjustedAngle + MathHelper.PiOver2 * pointCount) / (pointCount * 2f)); + Vector2 result = angle.ToRotationVector2() * numerator / denominator / sqrt3; + return result; } } } diff --git a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs index 4c385d792f..a1e399dcd5 100644 --- a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs +++ b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs @@ -48,11 +48,6 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric); } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.CritDamage *= 0.5f; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { var source = Projectile.GetSource_FromThis(); diff --git a/Projectiles/Melee/VirulentBeeWave.cs b/Projectiles/Melee/VirulentBeeWave.cs index 88f7151f7e..0aff6e2c52 100644 --- a/Projectiles/Melee/VirulentBeeWave.cs +++ b/Projectiles/Melee/VirulentBeeWave.cs @@ -30,6 +30,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 3; Projectile.timeLeft = 150; Projectile.alpha = 100; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() @@ -118,11 +120,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 8; - target.AddBuff(ModContent.BuffType(), 180); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/VirulentWave.cs b/Projectiles/Melee/VirulentWave.cs index 1771f4e595..4f8ce857f1 100644 --- a/Projectiles/Melee/VirulentWave.cs +++ b/Projectiles/Melee/VirulentWave.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 3; Projectile.timeLeft = 150; Projectile.alpha = 100; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -102,12 +104,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // TODO -- Why are there so many incorrectly programmed i-frame sets - target.immune[Projectile.owner] = 5; - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index 78e7229a52..add4f4388f 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -78,7 +78,12 @@ namespace CalamityMod.Projectiles.Ranged // For the sake of bonus damage, life regen time caps at 3600, aka 60 seconds. This is its natural cap in vanilla. int regenTimeForCalc = (int)MathHelper.Clamp(owner.lifeRegenTime, 0f, 3600f); - return (int)(regenDamageRatio * regenTimeForCalc); + + int finalDamageBoost = (int)(regenDamageRatio * regenTimeForCalc); + // Damage boost has a cap of 25 to prevent it from getting too crazy. + if (finalDamageBoost > 25) + finalDamageBoost = 25; + return finalDamageBoost; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/RicoshotCoin.cs b/Projectiles/Ranged/RicoshotCoin.cs index e5f0e988df..e22cb7d341 100644 --- a/Projectiles/Ranged/RicoshotCoin.cs +++ b/Projectiles/Ranged/RicoshotCoin.cs @@ -269,8 +269,8 @@ namespace CalamityMod.Projectiles.Ranged // https://www.desmos.com/calculator/ngfg5fc9ds int numUpdatesPassed = CoinLifetime - Projectile.timeLeft; float x = Math.Clamp((float)numUpdatesPassed / CritDelayTime, 0f, 2f); // interpolant for the crit delay sheen - float sheenFunction = Math.Min(MathF.Pow(x + 0.1f, 6f), MathF.Pow(x - 2.1f, 6f)); - float sheenOpacity = Math.Clamp(sheenFunction, 0f, 1f); + float sheenFunction = Math.Min(MathF.Pow(x + 0.1f, 10f), MathF.Pow(x - 2.1f, 10f)); + float sheenOpacity = Math.Clamp(sheenFunction, 0f, 2f); // oh BOY another end begin boy if (sheenOpacity > 0f) @@ -293,7 +293,7 @@ namespace CalamityMod.Projectiles.Ranged }; Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity * 0.3f, MathHelper.PiOver2, bloomTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity * 0.7f, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index db2e6c3e55..8535f59f7b 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 107, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Main.myPlayer); + (int)(Projectile.damage * 0.66), Projectile.knockBack * 0.5f, Main.myPlayer); } } } diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index a37f5e7ca3..a99357db02 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 180; + Projectile.tileCollide = false; Projectile.light = 0.15f; Projectile.extraUpdates = 1; AIType = ProjectileID.WoodenArrowFriendly; @@ -62,11 +63,5 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 120); } - - public override void OnKill(int timeLeft) - { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } } } diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index fd719dc7e1..790423f127 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -1,7 +1,10 @@ using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Sounds; 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.Rogue @@ -16,13 +19,31 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 30; Projectile.height = 30; Projectile.friendly = true; - Projectile.penetrate = 4; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; + Projectile.penetrate = 3; Projectile.timeLeft = 600; - AIType = ProjectileID.Shuriken; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + float rotation = (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.025f; + Projectile.rotation += rotation * Projectile.direction; + + if (Projectile.Calamity().stealthStrike && Main.rand.NextBool(3)) + { + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 226, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + } + + if (Projectile.timeLeft < 570 && !Projectile.Calamity().stealthStrike) + { + Projectile.velocity.X *= 0.96f; + Projectile.velocity.Y += 0.35f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + return; } public override bool PreDraw(ref Color lightColor) @@ -34,11 +55,23 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.75f); + if (Projectile.damage < 1) + { + Projectile.damage = 1; + } OnHitEffects(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.75f); + if (Projectile.damage < 1) + { + Projectile.damage = 1; + } OnHitEffects(); } @@ -46,11 +79,25 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) { + // Stolen from Twisting Thunder, the old "lightning" effect was so puny -CIT + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Projectile.position); var source = Projectile.GetSource_FromThis(); - for (int n = 0; n < 3; n++) + for (int n = 0; n < 4; n++) { - Projectile lightning = CalamityUtils.ProjectileRain(source, Projectile.Center, 400f, 100f, -800f, -500f, 8f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - lightning.ai[0] = Main.rand.Next(2); + Vector2 spawnPoint = new Vector2(Projectile.Center.X + (float)Main.rand.Next(-20, 21), Projectile.Center.Y - (float)Main.rand.Next(700, 801)); + float randomVelocity = Main.rand.NextFloat() - 0.5f; + Vector2 fireTo = new Vector2(spawnPoint.X + 20f * randomVelocity, spawnPoint.Y + 900); + Vector2 ai0 = fireTo - spawnPoint; + float ai = (float)Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(0.31415)) * 9f; + int proj = Projectile.NewProjectile(source, spawnPoint.X, spawnPoint.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, Projectile.damage, Projectile.knockBack, Projectile.owner, ai0.ToRotation(), ai); + Main.projectile[proj].extraUpdates += 14; + Main.projectile[proj].friendly = true; + Main.projectile[proj].hostile = false; + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].penetrate = 3; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = -1; } } } diff --git a/Projectiles/Rogue/DeepWounderProjectile.cs b/Projectiles/Rogue/DeepWounderProjectile.cs index 292745e84a..4c90a70238 100644 --- a/Projectiles/Rogue/DeepWounderProjectile.cs +++ b/Projectiles/Rogue/DeepWounderProjectile.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = -1; + Projectile.penetrate = 3; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; @@ -48,7 +48,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(), (int)(Projectile.damage * 0.1f), 1, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spriteCenter, waterVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.05f), 1, Projectile.owner, 0, 0); } } } diff --git a/Projectiles/Rogue/EnchantedAxe2.cs b/Projectiles/Rogue/EnchantedAxe2.cs index 1a8fa6263d..b06c478dfc 100644 --- a/Projectiles/Rogue/EnchantedAxe2.cs +++ b/Projectiles/Rogue/EnchantedAxe2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, new Color(255, 255, 255, 128), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, new Color(192, 192, 255, 128), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Rogue/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index 0a767cc9f1..2e10b88268 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[Main.myPlayer]; if (Projectile.Calamity().stealthStrike) - player.AddBuff(BuffID.Honey, 300); + player.AddBuff(BuffID.Honey, 600); SpawnProjectiles(); } @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[Main.myPlayer]; if (Projectile.Calamity().stealthStrike) - player.AddBuff(BuffID.Honey, 300); + player.AddBuff(BuffID.Honey, 600); SpawnProjectiles(); } diff --git a/Projectiles/Rogue/SubductionFlameburst.cs b/Projectiles/Rogue/SubductionFlameburst.cs index f079f74046..ba5385247b 100644 --- a/Projectiles/Rogue/SubductionFlameburst.cs +++ b/Projectiles/Rogue/SubductionFlameburst.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 15; } public override void AI() @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 240); - target.AddBuff(BuffID.Daybreak, 420); + target.AddBuff(BuffID.Daybreak, 240); } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 300); diff --git a/Projectiles/Rogue/SubductionSlicerProj.cs b/Projectiles/Rogue/SubductionSlicerProj.cs index db21d0ec09..6521f3259f 100644 --- a/Projectiles/Rogue/SubductionSlicerProj.cs +++ b/Projectiles/Rogue/SubductionSlicerProj.cs @@ -19,13 +19,15 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = -1; + Projectile.penetrate = 5; Projectile.aiStyle = ProjAIStyleID.Boomerang; Projectile.extraUpdates = 1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 360; Projectile.alpha = 55; AIType = ProjectileID.WoodenBoomerang; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; } public override void AI() @@ -52,7 +54,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 6; target.AddBuff(BuffID.OnFire3, 240); OnHitEffects(target.Center); } @@ -67,17 +68,14 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].DamageType = RogueDamageClass.Instance; if (Projectile.Calamity().stealthStrike && Projectile.localAI[0] <= 0f) { - Point result; - if (WorldUtils.Find(Projectile.Top.ToTileCoordinates(), Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out result)) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 2f, Projectile.owner, 1f); - Projectile.localAI[0] = 30f; - } + Vector2 spawnPos = new Vector2(position.X, position.Y + 30); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), 2f, Projectile.owner, 1f); + Projectile.localAI[0] = 300f; // DO NOT. } } } diff --git a/Projectiles/Summon/BlackDragonBody.cs b/Projectiles/Summon/BlackDragonBody.cs index 2e15054f6a..12311c77a4 100644 --- a/Projectiles/Summon/BlackDragonBody.cs +++ b/Projectiles/Summon/BlackDragonBody.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 180; - Projectile.idStaticNPCHitCooldown = 6; Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; Projectile.tileCollide = false; Projectile.extraUpdates = 0; Projectile.aiStyle = -1; diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index bc18a45de9..db0fd7141c 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -77,17 +77,17 @@ namespace CalamityMod.Projectiles.Summon public void FollowState() { - // If the minion starts to get far, force the minion to go to you. - if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner)) + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, 1200f)) { - Projectile.velocity = (Projectile.velocity + Projectile.SafeDirectionTo(Owner.Center)) * 0.9f; + Projectile.Center = Owner.Center; SyncVariables(); } - // Teleport to the owner if sufficiently far away. - else if (!Projectile.WithinRange(Owner.Center, 1200f)) + // If the minion starts to get far, force the minion to go to you. + else if (!Projectile.WithinRange(Owner.Center, AncientIceChunk.MaxDistanceFromOwner)) { - Projectile.Center = Owner.Center; + Projectile.velocity = (Projectile.velocity + Projectile.SafeDirectionTo(Owner.Center)) * 0.9f; SyncVariables(); } diff --git a/Projectiles/Summon/MiniGuardianRock.cs b/Projectiles/Summon/MiniGuardianRock.cs index 6e5299604a..81e690343a 100644 --- a/Projectiles/Summon/MiniGuardianRock.cs +++ b/Projectiles/Summon/MiniGuardianRock.cs @@ -115,6 +115,14 @@ namespace CalamityMod.Projectiles.Summon drawPos -= new Vector2(texture.Width, texture.Height) * Projectile.scale / 2f; drawPos += drawOrigin * Projectile.scale + new Vector2(0f, Projectile.gfxOffY); Rectangle frame = new Rectangle(0, 0, texture.Width, texture.Height); + float ownerDist = Projectile.Center.Distance(Owner.Center); + float lerpVal = Utils.GetLerpValue(psc ? 72 : 42, psc ? 87 : 57, ownerDist, true); + float mult = MathHelper.Lerp(0.35f, 0.42f, lerpVal); + if ((psc && ownerDist > 87f) || (!psc && ownerDist > 57f)) + { + lerpVal = Utils.GetLerpValue(psc ? 87 : 57, psc ? 150 : 120, ownerDist, true); + mult = MathHelper.Lerp(0.42f, 1f, lerpVal); + } if (CalamityConfig.Instance.Afterimages && Projectile.ai[0] >= 1f) //handle afterimages manually since the utility broke it and didn't render correctly { for (int i = 0; i < Projectile.oldPos.Length; ++i) @@ -122,12 +130,12 @@ namespace CalamityMod.Projectiles.Summon drawPos = Projectile.oldPos[i] + (Projectile.Size / 2f) - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. Color color = Projectile.GetAlpha(lightColor) * ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, frame, color, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, drawPos, frame, color * mult, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); } } else { - Main.spriteBatch.Draw(texture, drawPos, frame, Color.White, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(texture, drawPos, frame, Color.White * mult, Projectile.rotation, drawOrigin, Projectile.scale, SpriteEffects.None, 0f); } return false; diff --git a/Projectiles/Summon/Umbrella/MagicHat.cs b/Projectiles/Summon/Umbrella/MagicHat.cs index 5e927bf8c7..c8deed8247 100644 --- a/Projectiles/Summon/Umbrella/MagicHat.cs +++ b/Projectiles/Summon/Umbrella/MagicHat.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -137,7 +138,21 @@ namespace CalamityMod.Projectiles.Summon.Umbrella 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); + if (player.dye[0].dye > 0) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); + var dyeShader = GameShaders.Armor.GetShaderFromItemId(player.dye[0].type); + dyeShader.Apply(); + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + } + else + { + Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + } + return false; } } diff --git a/Projectiles/Summon/WhiteDragonBody.cs b/Projectiles/Summon/WhiteDragonBody.cs index 9bf9753853..c6a8aaf533 100644 --- a/Projectiles/Summon/WhiteDragonBody.cs +++ b/Projectiles/Summon/WhiteDragonBody.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { - Main.projPet[Projectile.type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() @@ -25,8 +26,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 180; - Projectile.idStaticNPCHitCooldown = 6; Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; Projectile.tileCollide = false; Projectile.extraUpdates = 0; Projectile.aiStyle = -1; diff --git a/Projectiles/Typeless/ChronoClock.cs b/Projectiles/Typeless/ChronoClock.cs new file mode 100644 index 0000000000..9cb856799d --- /dev/null +++ b/Projectiles/Typeless/ChronoClock.cs @@ -0,0 +1,104 @@ +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ChronoClock : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 8; + + } + + public override void SetDefaults() + { + Projectile.width = 28; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.velocity *= 0.98f; + Player player = Main.player[Projectile.owner]; + // if the player touches a clock, they get the Haste buff and their haste level increases to a maximum of 3 + // this kills the clock + if (player.getRect().Intersects(Projectile.getRect())) + { + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 60); + if (player.Calamity().hasteLevel < 3) + { + player.Calamity().hasteLevel++; + player.Calamity().hasteCounter = 0; // reset the haste countdown + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact with { Volume = 2 }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Particle sparkle = new SnowflakeSparkle(Projectile.Center, (Main.rand.NextVector2CircularEdge(100, 100)).SafeNormalize(Vector2.Zero) * 4, Color.LightBlue, Color.LightSkyBlue, Main.rand.NextFloat(0.1f, 0.6f), 60); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + else + { + // reset the haste countdown if haste level is maxed out + player.Calamity().hasteCounter = 0; + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact with { Volume = 0.2f, Pitch = 1.4f }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Particle sparkle = new SnowflakeSparkle(Projectile.Center, (Main.rand.NextVector2CircularEdge(100, 100)).SafeNormalize(Vector2.Zero) * 2, Color.LightBlue, Color.LightSkyBlue, Main.rand.NextFloat(0.04f, 0.3f), 30); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + Projectile.Kill(); + } + } + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) + { + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame % 2 == 0) + Projectile.netUpdate = true; + } + if (Projectile.frame > 7) + { + Projectile.frame = 0; + } + if (Main.rand.NextBool(5)) + { + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + public override void OnKill(int timeLeft) + { + for (int index1 = 0; index1 < 3; ++index1) + { + int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 76); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + public override bool? CanHitNPC(NPC target) + { + return false; + } + } +} diff --git a/Projectiles/Typeless/ChronoClock.png b/Projectiles/Typeless/ChronoClock.png new file mode 100644 index 0000000000..1eded5eaf8 Binary files /dev/null and b/Projectiles/Typeless/ChronoClock.png differ diff --git a/Projectiles/Typeless/GodSlayerBlaze.cs b/Projectiles/Typeless/HideOfAstrumDeusExplosion.cs similarity index 85% rename from Projectiles/Typeless/GodSlayerBlaze.cs rename to Projectiles/Typeless/HideOfAstrumDeusExplosion.cs index 0a85c77b34..b341e5bdf7 100644 --- a/Projectiles/Typeless/GodSlayerBlaze.cs +++ b/Projectiles/Typeless/HideOfAstrumDeusExplosion.cs @@ -6,7 +6,7 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class GodSlayerBlaze : ModProjectile, ILocalizedModType + public class HideOfAstrumDeusExplosion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -73,18 +73,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.ai[1] == 1f) - target.AddBuff(ModContent.BuffType(), 300); - else - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if (Projectile.ai[1] == 1f) - target.AddBuff(ModContent.BuffType(), 300); - else - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index 25d26d9fb9..13260b9d00 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -1,4 +1,5 @@ using CalamityMod.DataStructures; +using CalamityMod.Items.Accessories; using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -23,7 +24,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = duration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.scale = 1.2f; + Projectile.scale = 1.2f; } public override void AI() @@ -94,7 +95,7 @@ namespace CalamityMod.Projectiles.Typeless // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback if (CalamityGlobalNPC.ShouldAffectNPC(target)) { - float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); + float knockbackMultiplier = SandCloak.KnockbackStrength * MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); Vector2 trueKnockback = target.Center - Projectile.Center; trueKnockback.Normalize(); target.velocity = trueKnockback * knockbackMultiplier; diff --git a/Sounds/Custom/CeramicImpact1.ogg b/Sounds/Custom/CeramicImpact1.ogg new file mode 100644 index 0000000000..ae987d8567 Binary files /dev/null and b/Sounds/Custom/CeramicImpact1.ogg differ diff --git a/Sounds/Custom/CeramicImpact2.ogg b/Sounds/Custom/CeramicImpact2.ogg new file mode 100644 index 0000000000..6b18fdf64c Binary files /dev/null and b/Sounds/Custom/CeramicImpact2.ogg differ diff --git a/Sounds/Custom/StormlionIdle.ogg b/Sounds/Custom/StormlionIdle.ogg new file mode 100644 index 0000000000..b8fc5bfb3f Binary files /dev/null and b/Sounds/Custom/StormlionIdle.ogg differ diff --git a/Sounds/Item/SpinningWoosh.ogg b/Sounds/Item/SpinningWoosh.ogg new file mode 100644 index 0000000000..95da93e645 Binary files /dev/null and b/Sounds/Item/SpinningWoosh.ogg differ diff --git a/Sounds/NPCHit/StormlionHit.ogg b/Sounds/NPCHit/StormlionHit.ogg new file mode 100644 index 0000000000..c9afa9d613 Binary files /dev/null and b/Sounds/NPCHit/StormlionHit.ogg differ diff --git a/Sounds/NPCKilled/StormlionDeath.ogg b/Sounds/NPCKilled/StormlionDeath.ogg new file mode 100644 index 0000000000..b0fba67652 Binary files /dev/null and b/Sounds/NPCKilled/StormlionDeath.ogg differ diff --git a/Tiles/Abyss/HydrothermalCrateTile.cs b/Tiles/Abyss/HydrothermalCrateTile.cs new file mode 100644 index 0000000000..adcc4b8153 --- /dev/null +++ b/Tiles/Abyss/HydrothermalCrateTile.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Fishing.SulphurCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss +{ + public class HydrothermalCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(150, 109, 26), CalamityUtils.GetItemName()); + DustType = 127; + } + + public override bool CreateDust(int i, int j, ref int type) + { + if (Main.rand.NextBool()) + type = 44; + else + type = 127; + + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Abyss/HydrothermalCrateTile.png b/Tiles/Abyss/HydrothermalCrateTile.png new file mode 100644 index 0000000000..3cadf65ba9 Binary files /dev/null and b/Tiles/Abyss/HydrothermalCrateTile.png differ diff --git a/Tiles/Astral/MonolithCrateTile.cs b/Tiles/Astral/MonolithCrateTile.cs new file mode 100644 index 0000000000..0041748d77 --- /dev/null +++ b/Tiles/Astral/MonolithCrateTile.cs @@ -0,0 +1,46 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Fishing.AstralCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Astral +{ + public class MonolithCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(110, 45, 117), CalamityUtils.GetItemName()); + DustType = ModContent.DustType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + if (Main.rand.NextBool()) + { + type = ModContent.DustType(); + } + else + { + type = ModContent.DustType(); + } + return true; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Astral/MonolithCrateTile.png b/Tiles/Astral/MonolithCrateTile.png new file mode 100644 index 0000000000..a01c24e2fa Binary files /dev/null and b/Tiles/Astral/MonolithCrateTile.png differ diff --git a/Tiles/Crags/SlagCrateTile.cs b/Tiles/Crags/SlagCrateTile.cs new file mode 100644 index 0000000000..91d81f3e22 --- /dev/null +++ b/Tiles/Crags/SlagCrateTile.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Crags +{ + public class SlagCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(189, 152, 43), CalamityUtils.GetItemName()); + DustType = 60; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Crags/SlagCrateTile.png b/Tiles/Crags/SlagCrateTile.png new file mode 100644 index 0000000000..4236282747 Binary files /dev/null and b/Tiles/Crags/SlagCrateTile.png differ diff --git a/Tiles/GiantPlanteraBulb.cs b/Tiles/GiantPlanteraBulb.cs index 171a5f4c0f..1447ff1d43 100644 --- a/Tiles/GiantPlanteraBulb.cs +++ b/Tiles/GiantPlanteraBulb.cs @@ -52,8 +52,8 @@ namespace CalamityMod.Tiles TileObjectData.addTile(Type); // Adds two map entries for the bulb, first is for Pre-Hardmode, and the latter is for Hardmode. - AddMapEntry(new Color(107, 125, 33)); - AddMapEntry(new Color(243, 82, 171)); + AddMapEntry(new Color(107, 125, 33), CalamityUtils.GetText("Tiles.GiantBulb")); + AddMapEntry(new Color(243, 82, 171), CalamityUtils.GetText("Tiles.GiantBulb")); AnimationFrameHeight = 90; MineResist = 3f; diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 661874ac55..a2b3727e1b 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -84,6 +84,9 @@ namespace CalamityMod.Tiles case 4: npc = NPCType(); break; + case 5: + npc = NPCType(); + break; case 6: npc = NPCType(); break; diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 690cfa1810..be12dd0acd 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/SunkenSea/SunkenCrateTile.cs b/Tiles/SunkenSea/EutrophicCrateTile.cs similarity index 87% rename from Tiles/SunkenSea/SunkenCrateTile.cs rename to Tiles/SunkenSea/EutrophicCrateTile.cs index f58da7bf9b..380baf60d4 100644 --- a/Tiles/SunkenSea/SunkenCrateTile.cs +++ b/Tiles/SunkenSea/EutrophicCrateTile.cs @@ -1,14 +1,13 @@ using CalamityMod.Items.Fishing.SunkenSeaCatches; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea { - public class SunkenCrateTile : ModTile + [LegacyName("SunkenCrateTile")] + public class EutrophicCrateTile : ModTile { public override void SetStaticDefaults() { @@ -22,7 +21,7 @@ namespace CalamityMod.Tiles.SunkenSea TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); - AddMapEntry(new Color(106, 218, 230), CalamityUtils.GetItemName()); + AddMapEntry(new Color(106, 218, 230), CalamityUtils.GetItemName()); DustType = 253; } diff --git a/Tiles/SunkenSea/EutrophicCrateTile.png b/Tiles/SunkenSea/EutrophicCrateTile.png new file mode 100644 index 0000000000..e1565ea85d Binary files /dev/null and b/Tiles/SunkenSea/EutrophicCrateTile.png differ diff --git a/Tiles/SunkenSea/PrismCrateTile.cs b/Tiles/SunkenSea/PrismCrateTile.cs new file mode 100644 index 0000000000..6895b56eaa --- /dev/null +++ b/Tiles/SunkenSea/PrismCrateTile.cs @@ -0,0 +1,32 @@ +using CalamityMod.Items.Fishing.SunkenSeaCatches; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class PrismCrateTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolidTop[Type] = true; + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileTable[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(145, 240, 255), CalamityUtils.GetItemName()); + DustType = 253; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/SunkenSea/PrismCrateTile.png b/Tiles/SunkenSea/PrismCrateTile.png new file mode 100644 index 0000000000..509f060b9a Binary files /dev/null and b/Tiles/SunkenSea/PrismCrateTile.png differ diff --git a/Tiles/SunkenSea/SunkenCrateTile.png b/Tiles/SunkenSea/SunkenCrateTile.png deleted file mode 100644 index 7bff36134e..0000000000 Binary files a/Tiles/SunkenSea/SunkenCrateTile.png and /dev/null differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 043ab72835..9b4d5f6e0f 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -810,6 +810,8 @@ namespace CalamityMod var edits = new Dictionary, Action>(128) { { Vanilla(ItemID.EnchantedBoomerang), Disable }, // Calamity adds its own recipe + { Vanilla(ItemID.MiniNukeI), Disable }, + { Vanilla(ItemID.MiniNukeII), Disable }, // Make various things cheaper (sorted by progression) { Vanilla(ItemID.Leather), ChangeIngredientStack(ItemID.RottenChunk, 2) }, @@ -825,6 +827,7 @@ namespace CalamityMod { Vanilla(ItemID.TrueExcalibur), ChangeIngredientStack(ItemID.ChlorophyteBar, 12) }, // Tier lock various items to a higher tier (sorted by progression) + { Vanilla(ItemID.Trimarang), AddIngredient(ModContent.ItemType(), 5) }, { Vanilla(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType(), 3) }, { r => r.HasResult(ItemID.HorseshoeBundle) && !r.HasIngredient(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType(), 3) }, { Vanilla(ItemID.NightsEdge), AddIngredient(ModContent.ItemType(), 5) }, @@ -1431,7 +1434,7 @@ namespace CalamityMod // Enchanted Boomerang r = Recipe.Create(ItemID.EnchantedBoomerang); r.AddIngredient(ItemID.WoodenBoomerang); - r.AddIngredient(ModContent.ItemType(), 6); + r.AddIngredient(ItemID.FallenStar, 6); r.AddRecipeGroup(AnyGoldBar, 8); r.AddTile(TileID.Anvils); r.Register(); @@ -1948,6 +1951,22 @@ namespace CalamityMod r.AddIngredient(ItemID.SoulofSight); r.Register(); r.DisableDecraft(); + + // Tiershift Mini Nuke 1s to post Moon Lord. + r = Recipe.Create(ItemID.MiniNukeI, 333); + r.AddIngredient(ItemID.RocketIII, 333); + r.AddIngredient(ItemID.LunarBar); + r.AddTile(TileID.LunarCraftingStation); + r.Register(); + r.DisableDecraft(); + + // Tiershift Mini Nuke 2s to post Moon Lord. + r = Recipe.Create(ItemID.MiniNukeII, 333); + r.AddIngredient(ItemID.RocketIV, 333); + r.AddIngredient(ItemID.LunarBar); + r.AddTile(TileID.LunarCraftingStation); + r.Register(); + r.DisableDecraft(); } #endregion diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 5ce9c2e0bf..8b48a9cf0a 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -286,7 +286,8 @@ namespace CalamityMod /// Adds all the common potions for fishing crates, alongside scaling mana and regen potions ///
/// The ILoot interface for the loot table. - public static void AddCratePotionRules(this ILoot loot) + /// Whether or not the crate is considered a hardmode crate. + public static void AddCratePotionRules(this ILoot loot, bool hardMode = true) { loot.Add(ItemID.ObsidianSkinPotion, 10, 1, 3); loot.Add(ItemID.SwiftnessPotion, 10, 1, 3); @@ -311,14 +312,23 @@ namespace CalamityMod var lcrRegularPotion = new LeadingConditionRule(If(() => NPC.downedBoss3)); // Actually chain all the LCRs together - lcrSupremePotion.Add(supremePots); - lcrSupremePotion.OnFailedConditions(lcrSuperPotion); - lcrSuperPotion.Add(superPots); - lcrSuperPotion.OnFailedConditions(lcrGreaterPotion); - lcrGreaterPotion.Add(greaterPots); - lcrGreaterPotion.OnFailedConditions(lcrRegularPotion); + // Greater potions upwards are only chained if the crate is marked as Hardmode + if (hardMode) + { + lcrSupremePotion.Add(supremePots); + lcrSupremePotion.OnFailedConditions(lcrSuperPotion); + lcrSuperPotion.Add(superPots); + lcrSuperPotion.OnFailedConditions(lcrGreaterPotion); + lcrGreaterPotion.Add(greaterPots); + lcrGreaterPotion.OnFailedConditions(lcrRegularPotion); + } lcrRegularPotion.Add(regularPots); lcrRegularPotion.OnFailedConditions(lesserPots); + // Add the chain starting from regular potions if marked as a Pre-Hardmode crate + if (!hardMode) + { + loot.Add(lcrRegularPotion); + } } #endregion diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index d57e7c20de..1c928b725a 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -343,6 +343,7 @@ namespace CalamityMod { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, + { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, diff --git a/Walls/WulfrumPlatingWall.cs b/Walls/WulfrumPlatingWall.cs new file mode 100644 index 0000000000..de6d2eee81 --- /dev/null +++ b/Walls/WulfrumPlatingWall.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class WulfrumPlatingWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(83, 92, 62)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 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 PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Texture2D sprite =TextureAssets.Wall[Type].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/WulfrumPlatingWall.png b/Walls/WulfrumPlatingWall.png new file mode 100644 index 0000000000..fb98b5631b Binary files /dev/null and b/Walls/WulfrumPlatingWall.png differ diff --git a/build.txt b/build.txt index cf7f77ec52..f696702666 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 2.0.3.008 +version = 2.0.3.009 displayName = Calamity Mod homepage = https://discord.gg/calamity buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, .github\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes, Effects\Compiler\* diff --git a/en-US.hjson b/en-US.hjson new file mode 100644 index 0000000000..b06ff7286d --- /dev/null +++ b/en-US.hjson @@ -0,0 +1 @@ +Mods.CalamityMod.Projectiles.CosmicShivAura.DisplayName: Cosmic Shiv Aura