diff --git a/Items/Ammo/HyperiusBullet.cs b/Items/Ammo/HyperiusBullet.cs index 135be89269..3fd7557773 100644 --- a/Items/Ammo/HyperiusBullet.cs +++ b/Items/Ammo/HyperiusBullet.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,20 +9,18 @@ namespace CalamityMod.Items.Ammo { public class HyperiusBullet : ModItem, ILocalizedModType { + public static float overflowEfficency = 1.15f; // Multiplier applied to overflow damage done by other damage sources + public static readonly SoundStyle hit = new("CalamityMod/Sounds/Item/HyperiusOverflow"); public new string LocalizationCategory => "Items.Ammo"; - - public static int SplitBulletBonusDamage = 16; - public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; } - public override void SetDefaults() { Item.width = 24; Item.height = 30; - Item.damage = 13; + Item.damage = 8; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; @@ -35,8 +34,8 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.MusketBall, 150). + CreateRecipe(333). + AddIngredient(ItemID.MusketBall, 333). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index c2527eb132..c076fe6817 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -7,6 +7,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; @@ -906,6 +907,31 @@ namespace CalamityMod.Items } #endregion + public override void OnHitNPC(Item item, Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + // Hyperius Overflow + if (target.Calamity().hyperiusMarked) + { + int damage = 0; + if (target.Calamity().hyperiusDamage < damageDone) + damage = damageDone - target.Calamity().hyperiusDamage; + else + damage = damageDone; + target.Calamity().hyperiusDamage -= damage; + + // Spawn overflow hit + Projectile overflow = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * HyperiusBullet.overflowEfficency), 0, player.whoAmI, target.whoAmI); + overflow.DamageType = item.DamageType; + overflow.ArmorPenetration = item.ArmorPenetration; // Takes the armor pen from what did the hit + + if (target.Calamity().hyperiusDamage <= 0) + { + target.Calamity().hyperiusDamage = 0; + target.Calamity().hyperiusMarked = false; + } + } + } + #region Armor Set Changes public override string IsArmorSet(Item head, Item body, Item legs) { diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 67845293c8..bd82b8169e 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1599,6 +1599,12 @@ YoungDukeBuff: { } // Misc + +HyperiusCollapse: { + DisplayName: Hyperius Collapse + Description: You should never see this... +} + PopoBuff: { DisplayName: Popo Description: You are a snowman now! diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index 31f7ee1828..69bc72edca 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -99,7 +99,14 @@ HolyFireBullet: { HyperiusBullet: { DisplayName: Hyperius Bullet - Tooltip: Dazzling multicolor bullets that split into swirling lights on impact + Tooltip: + ''' + Dazzling multicolor bullets that split into swirling lights on impact + Damage that would be dealt from the bullets is instead stored on the target + As more damage is stored, it will begin to overflow, slowly releasing and damaging the enemy + Attacks from sources other than Hyperius Bullets will release some of the charge + Releasing charge in this way deals 15% more damage + ''' } IcicleArrow: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index f6af7b2cf0..055c2e0367 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -107,7 +107,7 @@ HydraHead.DisplayName: Hydra Head HydraHeadLaunch.DisplayName: Hydra Head HydrasBlood.DisplayName: Hydra's Blood HyperiusBulletProj.DisplayName: Hyperius Bullet -HyperiusSplit.DisplayName: Hyperius Bad Time +HyperiusSplit.DisplayName: Hyperius Fragment IcicleArrowProj.DisplayName: Icicle Arrow HailstormBulletProj.DisplayName: Hailstorm Bullet HallowPointRoundProj.DisplayName: Hallow-Point Round diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 2d02702f5b..31c9d81b13 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -78,6 +78,8 @@ HydrothermalSmoke.DisplayName: Smoke HydrothermicFlare.DisplayName: Hydrothermic Flare HydrothermicFlareRogue.DisplayName: Hydrothermic Flare HydrothermicSphere.DisplayName: Hydrothermic Sphere +HyperiusDamage.DisplayName: Hyperius Overflow +HyperiusBleed.DisplayName: Hyperius Bleed JewelSpike.DisplayName: Spike KelvinCatalystStar.DisplayName: Kelvin Catalyst Star LeviAmberDash.DisplayName: Riptide Slam diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 49fce582e0..b1c9aeadbb 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -72,7 +72,9 @@ using CalamityMod.UI; using CalamityMod.UI.DebuffSystem; using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; +using Microsoft.Build.Evaluation; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Operations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoMod.Utils; @@ -350,6 +352,13 @@ namespace CalamityMod.NPCs public int laserBurnTimer = 0; public int laserBurnStacks = 0; + public bool hyperiusMarked = false; + public int hyperiusDamage = 0; + public static int hyperiusOverflowTime = 100; + public int hyperiusOverflowTimer = hyperiusOverflowTime; + public static float hyperiusLifePercentThreshold = 0.07f; // The % of max life the damage stacks must reach before they start to overflow + public int hyperiusFxTimer = 0; + /// /// Tracks the strength of Calamity's cursor effect; increments by 2 on every frame.
/// If this value reaches , the enemy is afflicted with True Vulnerability Hex. @@ -616,6 +625,15 @@ namespace CalamityMod.NPCs myClone.veriumDoomTimer = veriumDoomTimer; myClone.veriumDoomStacks = veriumDoomStacks; myClone.veriumDoomMarked = veriumDoomMarked; + myClone.laserBurnDamage = laserBurnDamage; + myClone.laserBurnMarked = laserBurnMarked; + myClone.laserBurnStacks = laserBurnStacks; + myClone.laserBurnTimer = laserBurnTimer; + myClone.laserBurnType = laserBurnType; + myClone.hyperiusDamage = hyperiusDamage; + myClone.hyperiusMarked = hyperiusMarked; + myClone.hyperiusOverflowTimer = hyperiusOverflowTimer; + myClone.hyperiusFxTimer = hyperiusFxTimer; myClone.cursorFocus = cursorFocus; myClone.demonSwordImpales = demonSwordImpales; myClone.impalePacketTimer = impalePacketTimer; @@ -5868,6 +5886,45 @@ namespace CalamityMod.NPCs spark.penetrate = 3; } } + if (hyperiusMarked) + { + if (hyperiusFxTimer < 20) + hyperiusFxTimer++; + else if (hyperiusFxTimer > 20) + hyperiusFxTimer = (int)Utils.Lerp(hyperiusFxTimer, 20, 0.2f); + + float threshold = ((float)(hyperiusDamage) / (float)(npc.lifeMax)); + int overflowSpeed = (int)Utils.Remap(threshold, hyperiusLifePercentThreshold, 0.35f, 1, 34); + if (threshold > hyperiusLifePercentThreshold) // If the stored damage is greater than the life % cap of the target's max health, rapily deal a % of the stored damage to the enemy to drain it + { + bool enemyIsNotArmored = (npc.defense < 1000 && !unbreakableDR && DR <= 0.9f && !npc.dontTakeDamage && !npc.immortal); + if (enemyIsNotArmored) + hyperiusOverflowTimer -= overflowSpeed; + if (hyperiusOverflowTimer <= 0) + { + hyperiusOverflowTimer = hyperiusOverflowTime; + + float damagePercent = 0.07f; // The % of stacks drained when you're over the cap + int damage = (int)Math.Max((int)((float)(hyperiusDamage) * damagePercent), 1); + hyperiusDamage -= damage; + + // Spawn "bleed" hit + // Uses a seperate projectile so that the hit takes defense and DR into account + Projectile overflow = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), damage, 0, -1, npc.whoAmI); + overflow.DamageType = DamageClass.Ranged; + if (hyperiusFxTimer >= 20) + hyperiusFxTimer = 35; + + if (hyperiusDamage <= 0) + { + hyperiusDamage = 0; + hyperiusMarked = false; + } + } + } + } + else if (hyperiusFxTimer > 0) + hyperiusFxTimer--; if ((laserBurnTimer <= 0 || laserBurnDamage >= npc.life * 1.5f) && laserBurnMarked && laserBurnType > 0) { @@ -6589,6 +6646,25 @@ namespace CalamityMod.NPCs { CombatText.NewText(npc.Hitbox, Color.Gray, damagedone, hit.Crit); } + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + float rate = (Main.GlobalTimeWrappedHourly * 3f); + List eColors = new List() + { + Color.Yellow, + Color.Magenta, + Color.Red, + Color.Cyan, + Color.Lime + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + CombatText.NewText(npc.Hitbox, usedColor, damagedone, hit.Crit, true); + } + } public override void OnHitByItem(NPC npc, Player player, Item item, NPC.HitInfo hit, int damagedone) @@ -7375,9 +7451,69 @@ namespace CalamityMod.NPCs if (heavybleeding > 0) HeavyBleeding.DrawEffects(npc, ref drawColor); + if (hyperiusFxTimer > 0) + { + float rate = (Main.GlobalTimeWrappedHourly * 5); + List eColors = new List() + { + Color.Yellow, + Color.Magenta, + Color.Red, + Color.Cyan, + Color.Lime + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Texture2D tex2 = Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D sparkle = Request("CalamityMod/Particles/BloomLineSoftEdge").Value; + Vector2 drawPosition = npc.Center - Main.screenPosition; + float drawRotation = npc.rotation + (npc.spriteDirection == -1 ? MathHelper.Pi : 0f); + + float power = (float)(Math.Pow(Utils.GetLerpValue(0, 20, hyperiusFxTimer, true), 3)) * MathHelper.Lerp(Math.Max(npc.height, npc.width) / 100, 1.4f, 0.5f); + for (int i = 0; i < 4; i++) + { + float iMult = (1 + 0.25f * i); + Main.EntitySpriteDraw(tex2, drawPosition, null, Color.Lerp(usedColor, Color.White, i * 0.1f) with { A = 0 } * 0.6f, Main.rand.NextFloat(-5f, 5f), tex2.Size() * 0.5f, new Vector2(1f, 0.8f) * 0.35f * Main.rand.NextFloat(0.9f, 1.1f) * iMult * power * (Utils.GetLerpValue(0, 20, hyperiusFxTimer)), SpriteEffects.None); + + for (int b = -1; b <= 1; b += 2) + { + float uncappedSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 8f / MathHelper.Pi); + float sine = MathHelper.Lerp(Math.Abs(uncappedSine), 0.75f, 0.75f); + Vector2 scale = new Vector2((0.25f / iMult) + (0.7f * (1 - sine)), 1.1f * sine * iMult) * power * 0.05f; + float rotation = MathHelper.PiOver4 * b * uncappedSine; + Main.EntitySpriteDraw(sparkle, drawPosition, null, Color.Lerp(usedColor, Color.White, i * 0.1f) with { A = 0 }, rotation, sparkle.Size() * 0.5f, scale, SpriteEffects.None); + } + } + } + if (laceration > 0) Laceration.DrawEffects(npc, ref drawColor); + if (laserBurnTimer > 0) + { + int particleChance = Math.Max(3, 10 - (laserBurnStacks / 3)); + if (laserBurnTimer % particleChance == 0) + { + Vector2 randPosition = new Vector2(npc.position.X + Main.rand.Next(0, npc.width), npc.position.Y + Main.rand.Next(0, npc.height)); + + Dust dust = Dust.NewDustPerfect(randPosition, Effects.ArsenalEffects.ArsenalLaserDust); + dust.velocity = ((Vector2.UnitX * 3 * (laserBurnStacks * 0.03f)).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1f)) + npc.velocity * 0.5f; + dust.scale = Main.rand.NextFloat(0.55f, 0.7f) + laserBurnStacks * 0.01f; + dust.noGravity = true; + dust.color = Color.Red; + dust.fadeIn = laserBurnStacks * 0.3f; + } + if (laserBurnType == 0) + { + Main.NewText("No Burn Type Set", Color.OrangeRed); + laserBurnMarked = false; + laserBurnTimer = 0; + } + } + // These draw effects do not include Miracle Blight's shader if (miracleBlight > 0) MiracleBlight.DrawEffects(npc, ref drawColor); @@ -7421,28 +7557,6 @@ namespace CalamityMod.NPCs } } - if (laserBurnTimer > 0) - { - int particleChance = Math.Max(3, 10 - (laserBurnStacks / 3)); - if (laserBurnTimer % particleChance == 0) - { - Vector2 randPosition = new Vector2(npc.position.X + Main.rand.Next(0, npc.width), npc.position.Y + Main.rand.Next(0, npc.height)); - - Dust dust = Dust.NewDustPerfect(randPosition, Effects.ArsenalEffects.ArsenalLaserDust); - dust.velocity = ((Vector2.UnitX * 3 * (laserBurnStacks * 0.03f)).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1f)) + npc.velocity * 0.5f; - dust.scale = Main.rand.NextFloat(0.55f, 0.7f) + laserBurnStacks * 0.01f; - dust.noGravity = true; - dust.color = Color.Red; - dust.fadeIn = laserBurnStacks * 0.3f; - } - if (laserBurnType == 0) - { - Main.NewText("No Burn Type Set", Color.OrangeRed); - laserBurnMarked = false; - laserBurnTimer = 0; - } - } - if (voidfrost > 0) Voidfrost.DrawEffects(npc, ref drawColor); diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs index ee6649cf23..cebbf59dee 100644 --- a/Particles/CustomPulse.cs +++ b/Particles/CustomPulse.cs @@ -56,7 +56,20 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { Texture2D tex = ModContent.Request(NewTexture).Value; - spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(tex.Size().X / joke.Size().X, tex.Size().Y / joke.Size().Y, 0.5f)); + Main.NewText(scaleMult); + tex = joke; + UseAltVisual = true; + } + } + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish * scaleMult, SpriteEffects.None, 0); } } diff --git a/Particles/CustomSpark.cs b/Particles/CustomSpark.cs index eec7780240..568fddfbe1 100644 --- a/Particles/CustomSpark.cs +++ b/Particles/CustomSpark.cs @@ -91,6 +91,19 @@ namespace CalamityMod.Particles Vector2 scale = Stretch * Scale; Texture2D texture = ModContent.Request(NewTexture).Value; + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + AltVisual = true; + } + } + Color col = Color; if (AffectedByLight) @@ -98,9 +111,9 @@ namespace CalamityMod.Particles col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); } - spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); if (GlowCenter) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } } } diff --git a/Particles/GlowSparkParticle.cs b/Particles/GlowSparkParticle.cs index 7e81b9a9c4..c2f7729ba3 100644 --- a/Particles/GlowSparkParticle.cs +++ b/Particles/GlowSparkParticle.cs @@ -66,9 +66,21 @@ namespace CalamityMod.Particles Vector2 scale = Squash * Scale; Texture2D texture = ModContent.Request(Texture).Value; - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + } + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * scaleMult, 0, 0f); if (Glowing) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.White, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f) * scaleMult, 0, 0f); } } } diff --git a/Particles/MammothParticle.png b/Particles/MammothParticle.png new file mode 100644 index 0000000000..7d4f3fbb7f Binary files /dev/null and b/Particles/MammothParticle.png differ diff --git a/Particles/VelChangingSpark .cs b/Particles/VelChangingSpark .cs index f917530522..6329ef2c06 100644 --- a/Particles/VelChangingSpark .cs +++ b/Particles/VelChangingSpark .cs @@ -96,9 +96,22 @@ namespace CalamityMod.Particles col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); } - spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + AltVisual = true; + } + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale * scaleMult, 0, 0f); if (GlowCenter) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f), Rotation, texture.Size() * 0.5f, scale * 0.8f, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * 0.8f * scaleMult, 0, 0f); } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 707183fea6..a4f081f82a 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -12,6 +12,7 @@ using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; @@ -4221,11 +4222,33 @@ namespace CalamityMod.Projectiles #region On Hit NPC public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { + // Hyperius Overflow + if (projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && target.Calamity().hyperiusMarked) + { + int damage = 0; + if (target.Calamity().hyperiusDamage < damageDone) + damage = damageDone - target.Calamity().hyperiusDamage; + else + damage = damageDone; + target.Calamity().hyperiusDamage -= damage; + + // Spawn overflow hit + Projectile overflow = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(damage * HyperiusBullet.overflowEfficency), 0, projectile.owner, target.whoAmI); + overflow.DamageType = projectile.DamageType; + overflow.ArmorPenetration = projectile.ArmorPenetration; // Takes the armor pen from what did the hit + + if (target.Calamity().hyperiusDamage <= 0) + { + target.Calamity().hyperiusDamage = 0; + target.Calamity().hyperiusMarked = false; + } + } + // Implementation of shared static iframes. // If this projectile does not use static iframes, or is not registered to share them, then do nothing. if (!projectile.usesIDStaticNPCImmunity || !SharedStaticIFrames.Includes(projectile.type)) return; - + // Get the set of shared static iframe projectile types. // If it's empty, then do nothing. IList sharedWithProjectiles = SharedStaticIFrames.GetSharedStaticIFrames(projectile.type); diff --git a/Projectiles/DraedonsArsenal/GaussRailgunBigShot.cs b/Projectiles/DraedonsArsenal/GaussRailgunBigShot.cs index 9d521ae495..e8e1efbb11 100644 --- a/Projectiles/DraedonsArsenal/GaussRailgunBigShot.cs +++ b/Projectiles/DraedonsArsenal/GaussRailgunBigShot.cs @@ -78,10 +78,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.numHits--; modifiers.SetCrit(); + Player Owner = Main.player[Projectile.owner]; + float critDamage = Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f; float minMult = 0.25f; int hitsToMinMult = 7; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult; + modifiers.SourceDamage *= damageMult + critDamage; Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); float launchPower = 20; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index c6715aca3f..4ea805ae55 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -63,24 +63,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Time++; - if (Time == 5) + if (Time == 5 && !Projectile.Calamity().stealthStrike) Projectile.tileCollide = true; if (Time < 100 && Time > 10 && Projectile.Calamity().stealthStrike) Projectile.velocity = Projectile.velocity.RotatedBy(-0.029f * Projectile.ai[2]); - if (false) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.rotation.ToRotationVector2() * 5, Effects.ArsenalEffects.ArsenalLaserDust); - dust.velocity = Vector2.One.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.1f, 0.2f); - dust.scale = Main.rand.NextFloat(0.35f, 0.8f); - dust.noGravity = true; - dust.color = Color.Red; - dust.fadeIn = 10; - dust.noLight = true; - dust.noLightEmittence = true; - } - - if (!ReturningToPlayer) { if (Time >= 55f) diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index c1f057a06d..3dbd357902 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Magic public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public int time = 0; public int direction = 0; + public Vector2 lastPos; public override void SetDefaults() { Projectile.width = 16; @@ -44,6 +45,7 @@ namespace CalamityMod.Projectiles.Magic if (time == 0) { direction = Main.rand.NextBool() ? 1 : -1; + lastPos = Projectile.Center; } if (time > 3) @@ -51,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic if (time > 3 && targetDist < 1400) { - Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.3f, false, (int)(15 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)), 0.07f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), Color.Chartreuse, new Vector2(1, 0.7f), false, true); + Particle spark = new GlowSparkParticle(Projectile.Center, Utils.DirectionTo(Projectile.Center, lastPos), false, (int)(15 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)), 0.07f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), Color.Chartreuse, new Vector2(1, 1.4f), false, true); GeneralParticleHandler.SpawnParticle(spark); if (Main.rand.NextBool((int)(MathHelper.Clamp((1 - Projectile.ai[2]) * 5, 1, 15)))) @@ -64,6 +66,7 @@ namespace CalamityMod.Projectiles.Magic } } time++; + lastPos = Projectile.Center; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index f9fc98014c..c795a6aa14 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -418,10 +418,11 @@ namespace CalamityMod.Projectiles.Melee if (chargedSwing) modifiers.SetCrit(); + float critDamage = Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f; float minMult = 0.25f; int hitsToMinMult = 10; float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (chargedSwing ? 3f * (GFBMulti) : 1) * damageMult; + modifiers.SourceDamage *= (chargedSwing ? (3f * (GFBMulti) + critDamage) : 1) * damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 5bf58ceb15..084f5a7ab9 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -1,7 +1,11 @@ using System; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -18,36 +22,38 @@ namespace CalamityMod.Projectiles.Ranged public bool dustWave = false; public float variance = 0.8f; public Vector2 lastPos; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - + public int slowdownTime = 7; + public bool tileTouched = false; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = 15; + Projectile.height = 15; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.timeLeft = 1200; - Projectile.extraUpdates = 7; + Projectile.extraUpdates = 25; + Projectile.tileCollide = false; AIType = ProjectileID.Bullet; Projectile.ignoreWater = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, slowdownTime * Projectile.extraUpdates, Projectile.timeLeft, true), 1); if (currentColor == Color.Black) { + slowdownTime = Main.rand.Next(6, 9 + 1); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 20; variance = Main.rand.NextFloat(0.7f, 1f); - dustWave = Main.rand.NextBool(); + dustAngle = Main.rand.NextFloat(-0.43f, 0.43f); + dustWave = Math.Sign(dustAngle) == 1; Projectile.scale = 1.5f; Projectile.velocity *= 0.3f; lastPos = Projectile.velocity; @@ -80,85 +86,86 @@ namespace CalamityMod.Projectiles.Ranged } dustAngle += (growing ? 0.07f * variance : -0.07f * variance); - Projectile.localAI[0] += 1f; - Vector2 orbPos = Projectile.Center + (Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f - Projectile.velocity * 5); - if (Projectile.localAI[0] > 12f && targetDist < 1200f) + if (Collision.SolidCollision(Projectile.Center, 4, 4) && !tileTouched && Projectile.numHits == 0) { - CustomSpark orb = new CustomSpark(orbPos, Utils.DirectionTo(lastPos, orbPos), "CalamityMod/Particles/BloomCircle", false, 5, (0.55f + MathF.Abs(dustAngle * 0.65f)) * 0.2f, currentColor, new Vector2(1 + MathF.Abs(dustAngle * 0.6f), 1), true, true, 0, false, false, 0.8f - MathF.Abs(dustAngle * 0.7f), 0.7f, 0.8f); + tileTouched = true; + OnHitEffects(null); + } + if (Projectile.numHits > 0 || tileTouched) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5 * Math.Max(timeleftFade, 0.01f); + if (Projectile.timeLeft > slowdownTime * Projectile.extraUpdates) + Projectile.timeLeft = slowdownTime * Projectile.extraUpdates; + } + + Projectile.ai[2]++; + Vector2 orbPos = Projectile.Center + (Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f - Projectile.velocity * 5); + if (Projectile.ai[2] > 15 && targetDist < 1200f) + { + CustomSpark orb = new CustomSpark(orbPos - Utils.DirectionTo(lastPos, orbPos) * timeleftFade, Utils.DirectionTo(lastPos, orbPos) * 0.1f, "CalamityMod/Particles/BloomCircle", false, 5, (0.55f + MathF.Abs(dustAngle * 0.65f)) * 0.15f * timeleftFade, currentColor, new Vector2(1 - MathF.Abs(dustAngle * 0.2f), 2 - (1 - MathF.Abs(dustAngle))), true, true, 0, false, false, 0.8f - MathF.Abs(dustAngle * 0.6f), 0.7f, 0.8f); GeneralParticleHandler.SpawnParticle(orb); - if (Main.rand.NextBool(7)) + if (Main.rand.NextBool(8)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.8f, 1.3f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.9f, 1.8f)); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * timeleftFade; dust.color = currentColor; dust.noLightEmittence = true; + dust.fadeIn = 1.4f; } } lastPos = orbPos; } - - // This projectile is always fullbright. - public override Color? GetAlpha(Color lightColor) + public override bool? CanHitNPC(NPC target) { - return currentColor; + return (Projectile.numHits > 0 ? false : null); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + CalamityGlobalNPC modNPC = target.Calamity(); + if (!modNPC.hyperiusMarked) + modNPC.hyperiusMarked = true; + + Player Owner = Main.player[Projectile.owner]; + // Hits can crit and the collapse damage will take that into account + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Projectile.DamageType); + modNPC.hyperiusDamage += Math.Max(Projectile.damage * (crit ? 2 : 1) - 1, 1); + + modifiers.DisableCrit(); + Projectile.damage = 1; + modifiers.HideCombatText(); + + OnHitEffects(target); + } + private void OnHitEffects(NPC target) + { + if (Projectile.owner == Main.myPlayer) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ShadowboltWallHit") with { Volume = 0.25f, Pitch = Main.rand.NextFloat(0.6f, 1f), MaxInstances = -1 }, Projectile.Center); + for (int b = 0; b < 2; b++) + { + Vector2 velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7 * (tileTouched ? -1 : 1)).RotatedByRandom(0.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)Math.Max(Projectile.originalDamage * 0.05f, 1), 0, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + } + } + } public override bool PreDraw(ref Color lightColor) { - if (Projectile.localAI[0] > 25f) + Asset orb = ModContent.Request("CalamityMod/Particles/GlowSpark"); + int startTime = 9; + int endTime = 35; + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, slowdownTime * Projectile.extraUpdates, Projectile.timeLeft, true), 1); + + for (int i = 0; i < 4; i++) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + Vector2 squash = new Vector2(Utils.Remap(Projectile.ai[2], startTime, endTime, 0.2f, 0.6f + i * 0.2f), Utils.Remap(Projectile.ai[2], startTime, endTime, 1f, 3f - i * 0.4f)); + Color orbColor = Color.Lerp(currentColor, Color.White, i * 0.2f) with { A = 0 } * 0.9f; + Vector2 scale = Projectile.scale * timeleftFade * squash * (0.05f - i * 0.008f) * 0.3f; + Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition + Projectile.velocity * i * 1.3f, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); } return false; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.owner == Main.myPlayer) - { - for (int b = 0; b < 3; b++) - { - Vector2 vel = (-oldVelocity.SafeNormalize(Vector2.UnitX) * 5); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel.RotatedByRandom(0.5f) * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); - } - } - return true; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - OnHitEffects(target.Center); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - OnHitEffects(target.Center); - } - - private void OnHitEffects(Vector2 targetPos) - { - if (Projectile.owner == Main.myPlayer) - { - for (int b = 0; b < 3; b++) - { - Vector2 velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5).RotatedByRandom(0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack * 2f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ShadowboltWallHit") with { Volume = 0.25f, Pitch = Main.rand.NextFloat(0.6f, 1f), MaxInstances = -1 }, Projectile.Center); - for (int b = 0; b < 4; b++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.7f, 1.4f); - dust.color = currentColor; - dust.noLightEmittence = true; - } - } } } diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index a6605021e9..97dd241aa7 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -1,4 +1,7 @@ -using CalamityMod.Items.Ammo; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Ammo; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,11 +19,7 @@ namespace CalamityMod.Projectiles.Ranged private int rotDirection = 1; private float rotIntensity; private bool rotPhase2 = false; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 20; - ProjectileID.Sets.TrailingMode[Type] = 2; - } + public bool photosen = CalamityClientConfig.Instance.Photosensitivity; public override void SetDefaults() { Projectile.width = 12; @@ -29,11 +28,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; - Projectile.penetrate = 2; + Projectile.penetrate = 4; Projectile.timeLeft = 500; Projectile.extraUpdates = 4; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.extraUpdates; + Projectile.localNPCHitCooldown = -1; Projectile.alpha = 255; Projectile.ignoreWater = true; AIType = ProjectileID.Bullet; @@ -42,65 +41,82 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Projectile.localAI[0]++; + int trailLifetime = 8; if (currentColor == Color.Black) { + Player Owner = Main.player[Projectile.owner]; + Projectile.scale = 0.015f; Projectile.alpha = 255; rotDirection = Main.rand.NextBool() ? 1 : -1; - rotIntensity = Main.rand.NextFloat(0.5f, 1.5f); + rotIntensity = Main.rand.NextFloat(0.3f, 1.1f); Projectile.timeLeft = Main.rand.Next(250, 300 + 1); switch (Projectile.ai[2]) { case 4: // Yellow shot - currentColor = Color.Yellow * 0.65f; + currentColor = Color.Yellow; break; case 3: // Magenta shot - currentColor = Color.Magenta * 0.65f; + currentColor = Color.Magenta; break; case 2: // Red shot - currentColor = Color.Red * 0.65f; + currentColor = Color.Red; break; case 1: // Blue shot - currentColor = Color.Cyan * 0.65f; + currentColor = Color.Cyan; break; default: // Green shot - currentColor = Color.Lime * 0.65f; + currentColor = Color.Lime; break; } } + if (Projectile.localAI[0] > 4 && Projectile.localAI[0] % 2 == 0 && !photosen) + { + Particle trail = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9, -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, trailLifetime, 0.15f, currentColor, new Vector2(0.8f, 1.3f), true, true, shrinkSpeed: 0.6f / rotIntensity, glowCenterScale: 0.8f, glowOpacity: 0.7f); + GeneralParticleHandler.SpawnParticle(trail); + } + if (Projectile.timeLeft == 180) rotPhase2 = true; if (rotPhase2) { - rotIntensity *= 1.001f; - Projectile.velocity *= 0.997f; - Projectile.velocity = Projectile.velocity.RotatedBy(-0.025f * rotIntensity * rotDirection); + rotIntensity *= 1.003f; + Projectile.velocity *= 0.995f; + Projectile.velocity = Projectile.velocity.RotatedBy(-0.04f * rotIntensity * rotDirection); } else { - Projectile.velocity = Projectile.velocity.RotatedBy(0.015f * rotIntensity * rotDirection); + Projectile.velocity = Projectile.velocity.RotatedBy(0.02f * rotIntensity * rotDirection); } } public override void OnKill(int timeLeft) { - for (int b = 0; b < 2; b++) - { - GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), false, 5, Main.rand.NextFloat(0.35f, 0.45f), currentColor, true, true); - GeneralParticleHandler.SpawnParticle(orb); - } + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12, targetHitbox); public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Lerp(currentColor, Color.White, 0.15f) with { A = 0 }, 1, texture, true, true); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, currentColor with { A = 0 } * (photosen ? 0.4f : 1), Projectile.rotation, texture.Size() * 0.5f, new Vector2(0.9f, 1.5f) * Projectile.scale, SpriteEffects.None); return false; } - public override bool? CanDamage() => Projectile.localAI[0] < 20 ? false : null; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + CalamityGlobalNPC modNPC = target.Calamity(); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage.Flat += HyperiusBullet.SplitBulletBonusDamage; + if (!modNPC.hyperiusMarked) + modNPC.hyperiusMarked = true; + + Player Owner = Main.player[Projectile.owner]; + // Hits can crit and the collapse damage will take that into account + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Projectile.DamageType); + modNPC.hyperiusDamage += Math.Max(Projectile.damage * (crit ? 2 : 1) - 1, 1); + + modifiers.DisableCrit(); + Projectile.damage = 1; + modifiers.HideCombatText(); + } } } diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 10ffcec20c..f15ce7e8f6 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -339,72 +339,74 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (!stuckInTarget && canStick) + if (!target.Calamity().pacified) { - for (int i = 0; i <= 8; i++) + if (!stuckInTarget && canStick) { - Vector2 sparkVelocity = Projectile.velocity * 0.5f; - - float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); - Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); - Particle spark1 = new LineParticle(Projectile.Center, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); - GeneralParticleHandler.SpawnParticle(spark1); - - float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); - Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); - Particle spark2 = new LineParticle(Projectile.Center, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? bColor : Color.Green); - GeneralParticleHandler.SpawnParticle(spark2); - - Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, sparkvelocity2, 100, default, Main.rand.NextFloat(0.8f, 1.4f)); - dust.noGravity = true; - } - - time = 1; - collideWithTiles = false; - canDamage = false; - placementDistance = -Vector2.Distance(target.Center, Projectile.Center); - placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - placementCenter = placementVelocity * (placementDistance * 0.01f); - chosenTarget = target; - stuckInTarget = true; - canStick = false; - storedVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Zero; - SoundStyle sound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); - SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); - - if (pullCheckValid) - { - chosenTarget.velocity += storedVelocity * (strongEnemy ? 0.3f : 1.5f); - hasLatchedTarget = true; - if ((chosenTarget.lifeMax >= Projectile.damage * 28f) || chosenTarget.boss) - strongEnemy = true; - SoundStyle sound5 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); - SoundEngine.PlaySound(sound5 with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); - if (strongEnemy) + for (int i = 0; i <= 8; i++) { - SoundStyle sound8 = new("CalamityMod/Sounds/Item/MetalEcho"); - SoundEngine.PlaySound(sound8 with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.8f, 0.9f) }, Projectile.Center); + Vector2 sparkVelocity = Projectile.velocity * 0.5f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(Projectile.Center, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); + Particle spark2 = new LineParticle(Projectile.Center, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, sparkvelocity2, 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; } + + time = 1; + collideWithTiles = false; + canDamage = false; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + canStick = false; + storedVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + SoundStyle sound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + + if (pullCheckValid) + { + chosenTarget.velocity += storedVelocity * (strongEnemy ? 0.3f : 1.5f); + hasLatchedTarget = true; + if ((chosenTarget.lifeMax >= Projectile.damage * 28f) || chosenTarget.boss) + strongEnemy = true; + SoundStyle sound5 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(sound5 with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + if (strongEnemy) + { + SoundStyle sound8 = new("CalamityMod/Sounds/Item/MetalEcho"); + SoundEngine.PlaySound(sound8 with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.8f, 0.9f) }, Projectile.Center); + } + } + else + normalHit = true; } - else - normalHit = true; - } - bool hitTarget = chosenTarget != null && target == chosenTarget; - modifiers.SourceDamage *= hitTarget ? (ripped ? 2 : Projectile.numHits < 1 ? 0.01f : 1) : 0.2f; - if (hitTarget && pullingTarget) - { - chosenTarget.velocity = -storedVelocity * 3; - modifiers.SetInstantKill(); - } + bool hitTarget = chosenTarget != null && target == chosenTarget; + modifiers.SourceDamage *= hitTarget ? (ripped ? 2 : Projectile.numHits < 1 ? 0.01f : 1) : 0.2f; + if (hitTarget && pullingTarget) + { + chosenTarget.velocity = -storedVelocity * 3; + modifiers.SetInstantKill(); + } - if (!pullCheckValid) - target.AddBuff(ModContent.BuffType(), 180); + if (!pullCheckValid) + target.AddBuff(ModContent.BuffType(), 180); + } } public override bool? CanDamage() => canDamage ? null : false; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 25 * (!spawnPullBlood ? 4 : 1), targetHitbox); - public override bool PreDraw(ref Color lightColor) { Player Owner = Main.player[Projectile.owner]; diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 86102bdd3f..1dea82d896 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -344,9 +344,9 @@ namespace CalamityMod.Projectiles.Rogue searchedTarget.active = false; } - SoundStyle gfb = new("CalamityMod/Sounds/Item/HolyBurst"); - for (int i = 0; i < 7; i++) - SoundEngine.PlaySound(gfb with { Volume = 1f, Pitch = 0.2f * i, MaxInstances = 7 }, Projectile.Center); + SoundStyle gong = new("CalamityMod/Sounds/Custom/GFB/Jesus"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(gong with { Volume = 1f, MaxInstances = 2 }, Projectile.Center); } else { diff --git a/Projectiles/Typeless/HyperiusBleed.cs b/Projectiles/Typeless/HyperiusBleed.cs new file mode 100644 index 0000000000..173f4a5787 --- /dev/null +++ b/Projectiles/Typeless/HyperiusBleed.cs @@ -0,0 +1,20 @@ +using CalamityMod.Items.Ammo; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HyperiusBleed : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Player Owner = Main.player[Projectile.owner]; + + modifiers.HideCombatText(); // Has special combat text + + SoundEngine.PlaySound(HyperiusBullet.hit with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f), MaxInstances = 10 }, Projectile.Center); + } + } +} diff --git a/Projectiles/Typeless/HyperiusDamage.cs b/Projectiles/Typeless/HyperiusDamage.cs new file mode 100644 index 0000000000..bb700a296e --- /dev/null +++ b/Projectiles/Typeless/HyperiusDamage.cs @@ -0,0 +1,22 @@ +using CalamityMod.Items.Ammo; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HyperiusDamage : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Player Owner = Main.player[Projectile.owner]; + + modifiers.HideCombatText(); // Has special combat text + modifiers.SourceDamage *= 0; + modifiers.FinalDamage.Flat = Projectile.damage; // Always does the exact damage of the hit so that it doesn't double scale with defense and dr + + SoundEngine.PlaySound(HyperiusBullet.hit with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f), MaxInstances = 10 }, Projectile.Center); + } + } +} diff --git a/Sounds/Custom/GFB/Jesus.ogg b/Sounds/Custom/GFB/Jesus.ogg new file mode 100644 index 0000000000..4cc26fb6f7 Binary files /dev/null and b/Sounds/Custom/GFB/Jesus.ogg differ diff --git a/Sounds/Item/HyperiusOverflow.ogg b/Sounds/Item/HyperiusOverflow.ogg new file mode 100644 index 0000000000..772d253f6a Binary files /dev/null and b/Sounds/Item/HyperiusOverflow.ogg differ diff --git a/Sounds/Item/MagicBlast.ogg b/Sounds/Item/MagicBlast.ogg new file mode 100644 index 0000000000..e8e088d672 Binary files /dev/null and b/Sounds/Item/MagicBlast.ogg differ