diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 8800eb5c2f..4742e420dc 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -11,24 +11,28 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.width = 34; - Item.height = 42; - Item.damage = 64; + Item.width = 109; + Item.height = 128; + Item.damage = 285; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 20; + // Due to the amazing sound engine, having more than one of these on screen will cause audio bugs! + // Therefore this thing has to be absurdly slow (Not that I've ever complained about that before) + Item.useAnimation = Item.useTime = 115; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 1f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 12f; Item.autoReuse = true; - Item.maxStack = 1; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 6f; Item.DamageType = RogueDamageClass.Instance; } - + public override float StealthDamageMultiplier => 0.65f; + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) @@ -43,15 +47,14 @@ namespace CalamityMod.Items.Weapons.Rogue } return false; } - + public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.HolyWater, 10). - AddIngredient(ItemID.HallowedBar, 12). - AddIngredient(ItemID.SoulofFright, 6). - AddIngredient(ItemID.SoulofMight, 6). - AddIngredient(ItemID.SoulofSight, 6). + AddIngredient(ItemID.HallowedBar, 20). + AddIngredient(ItemID.SoulofFright, 3). + AddIngredient(ItemID.SoulofMight, 3). + AddIngredient(ItemID.SoulofSight, 3). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Weapons/Rogue/Exorcism.png b/Items/Weapons/Rogue/Exorcism.png index 0011f65c8d..c595d31a28 100644 Binary files a/Items/Weapons/Rogue/Exorcism.png and b/Items/Weapons/Rogue/Exorcism.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index cb6faaa7bf..53a394cc6b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -413,8 +413,10 @@ Exorcism: { DisplayName: Exorcism Tooltip: ''' - Throws a hallowed cross which explodes into a flash of light that damages nearby enemies - Stealth strikes create larger flashes and rain stars infused with holy light + Throws a gigantic hallowed cross to the heavens, which will fall at your cursor a moment later + Enemies hit as it falls are impaled and repeatedly seared with holy light + Upon experation a cross shaped explosion is created + Stealth strikes twirl and throw the cross, ending in a stronger explosion at your cursor ''' } diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index b962f42ec4..c74a6fa126 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -375,13 +375,13 @@ FAP: { Stylist3: I love it when {0}'s hands get sticky from all that... wax. Stylist3Alt: "{0} and I will be building wax figures tonight. And no, there's nothing weird about that." Day1: I'm literally balls drunk off my sass right now, what do you want? - Day1Alt: A nice day for a walk in the woods, don't you think? Anyway, what do you need? + Day1Alt: A nice day for a walk in the woods, don't you think? Anyway, what do you need? Day2: I'm either laughing because I'm drunk or because I've lost my mind, probably both. - Day2Alt: Some people ask me whether it's 'unicorn', 'pegacorn', 'alicorn', 'pegasus'... whatever, all of them are appropriate. + Day2Alt: Some people ask me whether it's 'unicorn', 'pegacorn', 'alicorn', 'pegasus'... whatever, all of them are appropriate. Day3: When I'm drunk I'm way happier... at least until the talking worms start to appear. - Day3Alt: Did you know that certain worms can speak? Neither did I, until I flew to outer space. + Day3Alt: Did you know that certain worms can speak? Neither did I, until I flew to outer space. Day4: I should go fishing... while drunk, and jump into the ocean to spare myself {0}'s annoying naivety... - Day4Alt: I may be a 'hater' and a 'gatekeeper', but I'm also Dionysus' favorite princess, and the most fabulous girl in the world. + Day4Alt: I may be a 'hater' and a 'gatekeeper', but I'm also Dionysus' favorite princess, and the most fabulous girl in the world. DayStylist1: "{0} helped me learn to accept my past. It's been rough, but I think I'm on the right track now." DayStylist2: Might go out for a jog later with {0}. Nice day for it. DayDrunk1: I drink to forget certain... things. What things, you might ask? Well, the point is to forget them, isn't it? diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 45362a6559..275aa51dbc 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -103,7 +103,6 @@ ExecutionersBladeProj.DisplayName: Executioner's Blade ExecutionersBladeStealthProj.DisplayName: Executioner's Blade ExorcismProj.DisplayName: Exorcism ExorcismShockwave.DisplayName: Exorcism Shockwave -ExorcismStar.DisplayName: Exorcism Star FantasyTalismanProj.DisplayName: Talisman FantasyTalismanStealth.DisplayName: Talisman FeatherKnifeProjectile.DisplayName: Feather Knife diff --git a/Particles/BloomLineSoftEdge.png b/Particles/BloomLineSoftEdge.png new file mode 100644 index 0000000000..dc89fb2a82 Binary files /dev/null and b/Particles/BloomLineSoftEdge.png differ diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 6757dae3cb..2ff632ba34 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -1,8 +1,15 @@ -using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; -using Terraria.ID; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -12,105 +19,412 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/Exorcism"; + public ref float time => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + + public bool flung = false; // If the projectile has entered the thrown state. + public bool hitTiles => Projectile.ai[1] == -5; // In post hit tiles state + public bool inSky => Projectile.ai[1] == 5; // After being thrown, waiting to come down state + public bool falling => Projectile.ai[1] == 10; // Falling from the sky state + public int fallTime = 55; // Time spend in the sky + public NPC targeted; // Target impaled into + public Vector2 impaleDist; // Distance from impaled target's center + public int hitRate = 60; // How fast the cross burns with holy light + public float randpitch = 0; // Some random pitch for the looping sound + public bool stealth => Projectile.Calamity().stealthStrike; + public Vector2 storedStealthVel; // stored velocity for the boomerang turn around + public Vector2 crossCenter => Projectile.Center + (Vector2.UnitY * -11).RotatedBy(Projectile.rotation); // The center of the cross + + public Color mainColor = Color.Gold; + public SlotId AudSlot; public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 25; + Projectile.height = 80; Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.alpha = 0; - Projectile.penetrate = 1; - Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.extraUpdates = 1; } - + public override bool ShouldUpdatePosition() => flung && !inSky && !hitTiles && (impaleDist == Vector2.Zero || stealth); + public override bool? CanDamage() => ((flung && !inSky && !hitTiles && impaleDist == Vector2.Zero) ? null : false); public override void AI() { - Projectile.velocity.Y += 0.1f; - Projectile.rotation += 0.05f * Projectile.direction; - - // Dust Effects - Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(Projectile.rotation); - Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(Projectile.rotation); - - float minSpeed = 1.5f; - float maxSpeed = 5f; - float minScale = 0.8f; - float maxScale = 1.4f; - - int dustType = 175; - int dustCount = (int)(5 * (Projectile.ai[0])); - - for (int i = 0; i < dustCount; i++) + if (!flung && time == 0) + randpitch = Main.rand.NextFloat(-0.1f, 0.1f); + if (flung) { - int left = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[left].noGravity = true; - Main.dust[left].position = Projectile.Center; - Main.dust[left].velocity = dustLeft * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); + if (hitTiles) + { + holySound(); + if (Projectile.timeLeft > 300) + Projectile.timeLeft = 300; + } + else if (inSky) + { + Projectile.Center = new Vector2(Owner.ClampedMouseWorld().X, Owner.Center.Y) + new Vector2(0, -700); + Projectile.Opacity = 0; + Projectile.extraUpdates = 0; + Projectile.timeLeft++; + fallTime--; + if (fallTime <= 0) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.Opacity = 1; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld) * 7; + Projectile.numHits = 0; + Projectile.extraUpdates = 25; + Projectile.ai[1] = 10; + } + if (fallTime == 10) + { + for (int i = 0; i < 2; i++) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MissileNearing"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = 0.8f, MaxInstances = 2 }, Projectile.Center); + } + } + } + else if (falling) + { + if (Projectile.numHits == 0) + { + Projectile.timeLeft++; + if (Projectile.Center.Y + 80 > Owner.Calamity().mouseWorld.Y && Collision.SolidCollision(Projectile.Center, 20, 20)) + { + Projectile.extraUpdates = 3; + Projectile.ai[1] = -5; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit2"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0f, 0.1f) }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + SoundEngine.PlaySound(sound2 with { Volume = 0.7f, Pitch = -0.3f }, Projectile.Center); + } - int right = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[right].noGravity = true; - Main.dust[right].position = Projectile.Center; - Main.dust[right].velocity = dustRight * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - int up = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[up].noGravity = true; - Main.dust[up].position = Projectile.Center; - Main.dust[up].velocity = dustUp * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); + float squash = Utils.GetLerpValue(1, 3, Projectile.velocity.Length(), true); + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35, Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 43, 0.4f, mainColor * 0.4f * squash, new Vector2(1 - 0.15f * squash, 1f), true, false, shrinkSpeed: 0.07f * squash); + GeneralParticleHandler.SpawnParticle(trail); + } + else + { + Projectile.extraUpdates = 3; + Projectile.Center = targeted.Center + impaleDist; + if (stealth) + Projectile.rotation += (0.08f - hitRate * 0.001f) * Projectile.direction * 0.3f; - int down = Dust.NewDust(Projectile.Center, 1, 1, dustType, 0f, 0f); - Main.dust[down].noGravity = true; - Main.dust[down].position = Projectile.Center; - Main.dust[down].velocity = dustDown * Main.rand.NextFloat(minSpeed, maxSpeed) + Projectile.velocity; - Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); + holySound(); + + if (time >= hitRate) + { + impaleDist.Y *= 0.93f; + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), targeted.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * Utils.Remap(hitRate, 50, 5, 0.05f, 0.1f)), 0f, Owner.whoAmI, targeted.whoAmI, 1f); + strike.ArmorPenetration = 30; + strike.DamageType = RogueDamageClass.Instance; + if (hitRate > 10) + hitRate -= 10; + time = 0; + } + } + } + else // State before it enters the sky + { + if (stealth) + { + if (Projectile.timeLeft > 240) + Projectile.rotation += 0.07f * Projectile.direction; + + if (time > 80) + { + if (Projectile.velocity.Length() < storedStealthVel.Length()) + Projectile.velocity += Utils.DirectionTo(Projectile.Center, Owner.Center) * 0.1f; + Projectile.velocity *= 0.99f; + if (time == 180) // Reset iframes when it starts to come back + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + } + if (Projectile.timeLeft <= 240) + { + impaleDist = Vector2.One; // This is so the projectile stops dealing damage + Projectile.extraUpdates = 3; + float endLerp = Utils.GetLerpValue(240, 90, Projectile.timeLeft, true); + Vector2 endPos = Vector2.Lerp((Owner.Center + Vector2.UnitY * (-50 - 90 * endLerp)), Owner.ClampedMouseWorld(), (float)Math.Pow(endLerp, 5)); + Projectile.velocity = (endPos - Projectile.Center) / 25; + Projectile.rotation = Utils.AngleLerp(Projectile.rotation, 0, endLerp); + } + } + else + storedStealthVel = -Projectile.velocity * 1.1f; + + if (Projectile.timeLeft > 240) + { + int numParts = 2; + for (int i = 0; i < numParts; i++) + { + float fade = (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true) * 3 + 1); + + float rot = Projectile.rotation + (MathHelper.TwoPi * i / numParts); + Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * Projectile.direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); + + if (time % 5 == 0) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust2.noGravity = (dust2.type == 278 ? false : true); + dust2.scale = (dust2.type == 278 ? 0.95f : 1.2f) * 0.6f; + dust2.color = Color.Red; + dust2.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + if (time % 2 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : ModContent.DustType()); + dust.noGravity = (dust.type == 278 ? false : true); + dust.scale = (dust.type == 278 ? 0.75f : 0.9f) * 0.6f; + dust.color = Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod; + dust.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + } + } + + holySound(); + } + else + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (time >= 120) + Projectile.ai[1] = 5; + if (time % 6 == 0 && time > 12) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35 + Main.rand.NextVector2Circular(10, 10), -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, 13, 0.2f, mainColor * 0.6f, new Vector2(0.6f, 1f), true, false, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + } + } + else + { + Vector2 projToSky = Utils.DirectionTo(Projectile.Center, new Vector2(MathHelper.Lerp(Owner.ClampedMouseWorld().X, Owner.Center.X, 0.35f), Owner.Center.Y) + new Vector2(0, -500)); + Projectile.velocity = projToSky; + float completion = time / (Owner.HeldItem.useAnimation * 0.7f); // The completion of the throw animation. + if (completion >= 1) // The moment of being thrown. + { + Projectile.Center = Owner.Center; + Projectile.extraUpdates = stealth ? 9 : 6; + if (stealth) + Projectile.timeLeft = 560; + Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + float speed = 9; + Projectile.velocity = (stealth ? velocity : projToSky) * speed; + time = -1; + SoundStyle w = new("CalamityMod/Sounds/Item/SwooshMid"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(w with { Volume = 1f, Pitch = -0.4f + 0.2f * i, MaxInstances = 6 }, Projectile.Center); + + flung = true; + } + else + { + Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X); + float crossRot = 0; + // All the annoying to make rotation and placement code for the throw animation. + if (completion >= 0.7f) + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7); + crossRot = MathHelper.ToRadians(MathHelper.Lerp(-45, 130f, completionLerp) * Owner.direction); + } + else + { + float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + crossRot = MathHelper.ToRadians(MathHelper.Lerp(120, -45f, completionLerp) * Owner.direction); + } + crossRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation(); + Vector2 crossPos = Owner.MountedCenter + new Vector2(0, -24 * Owner.direction).RotatedBy(crossRot); + float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2); + + Projectile.Center = crossPos; + if (stealth) + Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.Pow(completion, 3) * 12 * Owner.direction; + else + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation() - MathHelper.ToRadians(90)); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, crossRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0))); + } + } + time++; + if (!inSky) + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.5f); + if (targeted != null && ((targeted.life <= 0 && targeted.realLife == -1) || targeted.lifeMax == 1)) + Projectile.Kill(); + } + public void holySound() + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var holy) && holy.IsPlaying) + { + holy.Position = Projectile.Center; + holy.Pitch = Utils.Remap(Projectile.timeLeft, 300, 0, -0.4f + randpitch, (stealth ? -0.15f : -0.3f) + randpitch); + holy.Volume = Utils.Remap(Projectile.timeLeft, 300, 0, 0f, 0.5f) * 100; + } + else if (Projectile.timeLeft > 1) + { + SoundStyle choir = new("CalamityMod/Sounds/Item/HolyLoop"); + AudSlot = SoundEngine.PlaySound(choir with { Volume = 0.01f, Pitch = 0 }, Projectile.Center); } } - + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if ((!falling || Projectile.numHits != 0) && !stealth) + modifiers.SourceDamage *= 0.1f; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - // Stars - if (Projectile.Calamity().stealthStrike) + bool onKill = ((target.life <= 0 && target.realLife == -1) || target.lifeMax == 1); + if (!onKill && (falling || stealth)) { - for (int i = 0; i < 6; i++) + if (stealth) { - Vector2 pos = new Vector2(Projectile.Center.X + (float)Projectile.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 starVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(pos, target, 30f, 2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, starVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); + + } + else + { + time = 0; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit4"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0.15f, 0.25f) }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(sound2 with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.1f, 0f) }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 5.5f; + Projectile.timeLeft = 300; + targeted = target; + impaleDist = (Projectile.Center - targeted.Center); + } + } + else + Projectile.numHits--; + } + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(AudSlot, out var holy)) + { + holy?.Stop(); + } + if (stealth) + { + SoundStyle soundBurst = new("CalamityMod/Sounds/Item/HolyBurst"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(soundBurst with { Volume = 0.8f, Pitch = 0.2f * i, MaxInstances = 3 }, Projectile.Center); + SoundStyle soundExplosion = new("CalamityMod/Sounds/Item/HolyColliderProjectileHit"); + SoundEngine.PlaySound(soundExplosion with { Volume = 0.65f, Pitch = 0.6f}, Projectile.Center); + + Projectile crossBurst = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), crossCenter, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Owner.whoAmI); + crossBurst.Calamity().stealthStrike = true; + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 24; y++) + { + bool red = Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(0.7f, 1); + float placementVariance = 35; + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * Main.rand.NextFloat(y * 1.2f, y * 1.5f) * (i == 0 ? 1.7f : 1) * variance; + Vector2 fxPos = crossCenter + Main.rand.NextVector2CircularEdge(placementVariance - variance * placementVariance, placementVariance - variance * placementVariance); + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), fxVel * 1.7f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.scale = (red ? 1.4f : 1.2f) * Main.rand.NextFloat(0.7f, 0.9f); + dust.color = red ? Color.Red : mainColor; + if (y % 2 == 0) + { + Particle spark = new GlowSparkParticle(fxPos, fxVel, false, 24, 0.065f, Main.rand.NextBool() ? Color.Khaki : mainColor, new Vector2(0.8f, 0.3f), true, false, 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + Vector2 fxVel2 = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * (i == 0 ? 1.7f : 1); + Particle bigCross = new CustomSpark(crossCenter + fxVel2 * 145, fxVel2, "CalamityMod/Particles/BloomLineFade", false, 15, 0.15f, mainColor, new Vector2(1.8f, 1.2f), true, true, 0, false, false, 0.8f, 0.8f, 0.8f); + GeneralParticleHandler.SpawnParticle(bigCross); + } + } + else + { + SoundStyle soundBurst = new("CalamityMod/Sounds/Item/HolyBurst"); + SoundEngine.PlaySound(soundBurst with { Volume = 1f, Pitch = 0 }, Projectile.Center); + Projectile crossBurst = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), crossCenter, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 0f, Owner.whoAmI); + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 14; y++) + { + bool red = Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(0.7f, 1); + float placementVariance = 27; + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i) * Main.rand.NextFloat(y * 0.8f, y) * (i == 0 ? 1.7f : 1) * variance; + Vector2 fxPos = crossCenter + Main.rand.NextVector2CircularEdge(placementVariance - variance * placementVariance, placementVariance - variance * placementVariance); + Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType(), fxVel * 1.5f, 0, default, Main.rand.NextFloat(1.2f, 1.6f)); + dust.noGravity = true; + dust.scale = (red ? 1.2f : 1) * Main.rand.NextFloat(0.7f, 0.9f); + dust.color = red ? Color.Red : mainColor; + if (y % 2 == 0) + { + Particle spark = new GlowSparkParticle(fxPos, fxVel, false, 18, 0.05f, Main.rand.NextBool() ? Color.Khaki : mainColor, new Vector2(0.8f, 0.3f), true, false, 0.6f); + GeneralParticleHandler.SpawnParticle(spark); + } + } } } } - + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (Projectile.Calamity().stealthStrike) + return CalamityUtils.CircularHitboxCollision(Projectile.Center, 40, targetHitbox); + else + return base.Colliding(projHitbox, targetHitbox); + } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + float glowUp = (1 + Utils.GetLerpValue(250, 0, Projectile.timeLeft, true)); + float throwCompletion = flung ? 1 : (float)Math.Pow(Math.Min(time / (Owner.HeldItem.useAnimation * 0.7f), 1), 5); + Color glowColor = Color.Lerp(mainColor, Color.Khaki, glowUp - 1); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Asset glowBlade = ModContent.Request("CalamityMod/Particles/BloomLineFade"); + Asset woosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + if (hitTiles || falling || stealth) + { + for (int i = 0; i < 25; i++) + { + Vector2 drawPos = Projectile.Center; + Color auraColor = glowColor with { A = 0 } * 0.05f * glowUp; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * glowUp * 2; + Main.EntitySpriteDraw(tex, drawPos - Main.screenPosition + drawOffset + Main.rand.NextVector2Circular(6, 6) * (1 - glowUp), null, auraColor with { A = 0 } * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + if (stealth) + { + for (int i = 0; i < 4; i++) + { + Vector2 fxVel = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * i).RotatedBy(Projectile.rotation) * (i == 0 ? 1.2f : 1) * 50 * throwCompletion; + Vector2 fxPos = crossCenter + fxVel; + + if (i == 0 && Projectile.timeLeft > 240) + { + Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, Color.Khaki with { A = 0 } * 0.1f, fxVel.ToRotation() + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.37f * throwCompletion, SpriteEffects.None, 0); + Main.EntitySpriteDraw(woosh.Value, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * 0.15f, fxVel.ToRotation() - 1.3f * Projectile.direction + Projectile.rotation + Main.GlobalTimeWrappedHourly * Projectile.direction * 27, woosh.Size() / 2f, Projectile.scale * 0.32f * throwCompletion, SpriteEffects.None, 0); + } + + for (int y = 0; y < 2; y++) + Main.EntitySpriteDraw(glowBlade.Value, fxPos - Main.screenPosition, null, (y != 0 ? Color.White : mainColor) with { A = 0 }, fxVel.ToRotation() + MathHelper.PiOver2, glowBlade.Size() / 2f, new Vector2(0.3f, 1.3f * throwCompletion * glowUp) * Projectile.scale * (y != 0 ? 0.015f : 0.04f), SpriteEffects.None, 0); + } + } + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White with { A = 0 }, lightColor, (2 - glowUp)) * (inSky ? 0 : 1), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + return false; } - - public override bool OnTileCollide(Vector2 oldVelocity) + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.Center); - Projectile.Kill(); - return true; - } - - public override void OnKill(int timeLeft) - { - //Crystal smash sound - SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); - // Light burst - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0, Projectile.owner, Projectile.ai[0], 0); - Main.projectile[p].rotation = Projectile.rotation; - if (Projectile.Calamity().stealthStrike) - Main.projectile[p].Calamity().stealthStrike = true; + overPlayers.Add(index); } } } diff --git a/Projectiles/Rogue/ExorcismShockwave.cs b/Projectiles/Rogue/ExorcismShockwave.cs index 03b4e58e09..55dc3c14b8 100644 --- a/Projectiles/Rogue/ExorcismShockwave.cs +++ b/Projectiles/Rogue/ExorcismShockwave.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -8,116 +9,38 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public static float Radius = 100; - public static float RadiusStealth = 200; - public override void SetDefaults() { - Projectile.width = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); - Projectile.height = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); + Projectile.width = 5; + Projectile.height = 5; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 9; + Projectile.timeLeft = 14; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.DamageType = RogueDamageClass.Instance; } - - public override void AI() + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.timeLeft >= 5) - { - Projectile.alpha = (int)((1 - Projectile.ai[0]) * 255f); + float minMult = 0.35f; + int hitsToMinMult = 15; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; - // Blast wave should be brighter on stealth strikes - int numDust = (int)(40 * Projectile.ai[0]) + 10; - - for (int i = 0; i < numDust; i++) - { - // Dust Type - int dustToUse = Main.rand.Next(0, 3); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 175; - break; - case 1: - dustType = 229; - break; - case 2: - dustType = 263; - break; - } - - // Shockwave - Vector2 circleVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - circleVelocity.Normalize(); - circleVelocity *= (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius) / 10f; - - int circle = Dust.NewDust(Projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 1.5f); - Main.dust[circle].noGravity = true; - } - - // Cross - Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); - Vector2 dustUp = (new Vector2(0, -1)).RotatedBy(Projectile.rotation); - Vector2 dustDown = (new Vector2(0, 1) * 2f).RotatedBy(Projectile.rotation); - - int dustScale = 7; - Vector2 dustPos = Projectile.Center - new Vector2((dustScale - 1) * 0.5f, (dustScale - 1) * 0.5f); - - float minSpeed = 0f; - float maxSpeed = 5f; - float minScale = 1.9f; - float maxScale = 2.1f; - int dustCount = (int)(5 * Projectile.ai[0]); - - for (int i = 0; i < dustCount; i++) - { - // Dust Type - int dustToUse = Main.rand.Next(0, 3); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 175; - break; - case 1: - dustType = 229; - break; - case 2: - dustType = 263; - break; - } - - int left = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[left].noGravity = true; - Main.dust[left].velocity = dustLeft * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); - - int right = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[right].noGravity = true; - Main.dust[right].velocity = dustRight * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); - - int up = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[up].noGravity = true; - Main.dust[up].velocity = dustUp * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); - - int down = Dust.NewDust(dustPos, dustScale, dustScale, dustType, 0f, 0f); - Main.dust[down].noGravity = true; - Main.dust[down].velocity = dustDown * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); - } - } + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center) - Vector2.UnitY; + float launchPower = (Projectile.Calamity().stealthStrike ? 4f : 1) * 10; + target.MoveNPC(launchVel, launchPower, true); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float crossSize = (Projectile.Calamity().stealthStrike ? 4f : 1) * 130; + float crosThickness = (Projectile.Calamity().stealthStrike ? 4f : 1) * 25; + float _ = float.NaN; + bool horizontalHit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.UnitX * crossSize, Projectile.Center + Vector2.UnitX * crossSize, crosThickness, ref _); + bool verticalHit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.UnitY * crossSize, Projectile.Center + Vector2.UnitY * crossSize * 1.7f, crosThickness, ref _); + return (horizontalHit || verticalHit); } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius), targetHitbox); } } diff --git a/Projectiles/Rogue/ExorcismStar.cs b/Projectiles/Rogue/ExorcismStar.cs deleted file mode 100644 index 81f3637e11..0000000000 --- a/Projectiles/Rogue/ExorcismStar.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ExorcismStar : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 4; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 32; - Projectile.height = 32; - Projectile.alpha = 50; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = 300; - Projectile.MaxUpdates = 2; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 20 + Main.rand.Next(40); - if (Main.rand.NextBool(5)) - SoundEngine.PlaySound(SoundID.Item9, Projectile.position); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); - - public override Color? GetAlpha(Color lightColor) => new Color(250, 200, 45, Projectile.alpha); - - public override bool PreDraw(ref Color lightColor) - { - Projectile.DrawStarTrail(Color.DarkGoldenrod, Color.Gold); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Rogue/ExorcismStar.png b/Projectiles/Rogue/ExorcismStar.png deleted file mode 100644 index e31c55bba6..0000000000 Binary files a/Projectiles/Rogue/ExorcismStar.png and /dev/null differ diff --git a/Sounds/Item/HolyBurst.ogg b/Sounds/Item/HolyBurst.ogg new file mode 100644 index 0000000000..d98119c2fa Binary files /dev/null and b/Sounds/Item/HolyBurst.ogg differ diff --git a/Sounds/Item/HolyLoop.ogg b/Sounds/Item/HolyLoop.ogg new file mode 100644 index 0000000000..191e4f1bc8 Binary files /dev/null and b/Sounds/Item/HolyLoop.ogg differ