From 90c31b565fccfc6c43b32f4e9be2debfd6fc6fb2 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:07:45 -0700 Subject: [PATCH] significantly less messy --- Items/Weapons/Melee/DeathsAscension.cs | 6 +++ ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 5 +- .../Melee/DeathsAscensionProjectile.cs | 10 +--- Projectiles/Melee/DeathsAscensionRift.cs | 50 +++++++++++++++---- Projectiles/Melee/DeathsAscensionSwing.cs | 4 +- 5 files changed, 51 insertions(+), 24 deletions(-) diff --git a/Items/Weapons/Melee/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs index 9377704d1e..91a171a7fc 100644 --- a/Items/Weapons/Melee/DeathsAscension.cs +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -86,6 +86,12 @@ namespace CalamityMod.Items.Weapons.Melee float SpeedY = velocity.Y + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.125f), knockback, player.whoAmI); } + + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) + p.ai[0] = 1f; + } } else { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 317205b112..05b3656b63 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -337,9 +337,10 @@ DeathsAscension: { DisplayName: Death's Ascension Tooltip: ''' - Performs powerful soul-infused swings that create rifts on enemy hits which spew out swirls of scythes - Up to 4 rifts can exist at once + Performs powerful soul-infused swings that create up to 4 rifts on enemy hits Press to launch a barrage of homing scythes + All active rifts will fire scythes along with you + Rift scythes orbit the rift when enemies are near and home when enemies are far 'It feels just right in your grip... [c/660066:But the hands that wield it are not yours'] ''' diff --git a/Projectiles/Melee/DeathsAscensionProjectile.cs b/Projectiles/Melee/DeathsAscensionProjectile.cs index 1ca641787a..029d9b6c7c 100644 --- a/Projectiles/Melee/DeathsAscensionProjectile.cs +++ b/Projectiles/Melee/DeathsAscensionProjectile.cs @@ -50,15 +50,7 @@ namespace CalamityMod.Projectiles.Melee } else { - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(0.05f) * Projectile.velocity.Length(); - Projectile.ai[2]--; - } - - // Rift scythes cant pierce once when they start homing - if (Projectile.ai[2] == 1) - { - Projectile.penetrate = 1; - Projectile.localNPCHitCooldown = 1; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(0.1f) * 20; } } diff --git a/Projectiles/Melee/DeathsAscensionRift.cs b/Projectiles/Melee/DeathsAscensionRift.cs index b2c905a2e0..c6d07715b4 100644 --- a/Projectiles/Melee/DeathsAscensionRift.cs +++ b/Projectiles/Melee/DeathsAscensionRift.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.CalPlayer; using CalamityMod.Graphics.Metaballs; using Microsoft.Xna.Framework; +using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -23,9 +24,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 50; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 600; + Projectile.timeLeft = 300; Projectile.penetrate = -1; Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() @@ -36,24 +39,49 @@ namespace CalamityMod.Projectiles.Melee float offset = i * 5; float sizeRandomness = MathHelper.Lerp(10, 0, (float)(i / (float)ballAmt)); float positionRandomness = 20; - float scale = (MathHelper.Lerp(90, 10, (float)(i / (float)ballAmt)) + Main.rand.NextFloat(-sizeRandomness, sizeRandomness)) * Utils.GetLerpValue(600, 590, Projectile.timeLeft, true); ; + float scale = (MathHelper.Lerp(90, 10, (float)(i / (float)ballAmt)) + Main.rand.NextFloat(-sizeRandomness, sizeRandomness)) * Utils.GetLerpValue(300, 290, Projectile.timeLeft, true); ; StreamGougeMetaball.SpawnParticle(Projectile.Center + Vector2.UnitY * (offset + Main.rand.NextFloat(-positionRandomness, positionRandomness)) , Vector2.Zero, scale); StreamGougeMetaball.SpawnParticle(Projectile.Center + Vector2.UnitY * -(offset + Main.rand.NextFloat(-positionRandomness, positionRandomness)), Vector2.Zero, scale); } - - if (Projectile.ai[0]++ % 60 == 0) + // When the weapon is swung fire scythes from the rift + if (Projectile.ai[0] >= 1) { SoundEngine.PlaySound(SoundID.Item104 with { Pitch = 0.4f }, Projectile.Center); SoundEngine.PlaySound(SoundID.Item71 with { Pitch = -0.4f }, Projectile.Center); - int scytheAmt = 4; - float speed = 30; - for (int i = 0; i < scytheAmt; i++) + + // If an enemy is close enough, do orbital scythes + NPC n = CalamityUtils.ClosestNPCAt(Projectile.Center, 320, true, true); + if (n != null) { - Vector2 scytheVelocity = Vector2.UnitY.RotatedBy(MathHelper.Lerp(0, 3 * MathHelper.PiOver2, (float)(i / (float)(scytheAmt - 1))) + Projectile.ai[1]) * speed; - int revolveTime = 70; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, scytheVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), Projectile.knockBack, Projectile.owner, ai2: revolveTime); - Main.projectile[p].penetrate = -1; + int scytheAmt = 4; + float speed = 30; + for (int i = 0; i < scytheAmt; i++) + { + Vector2 scytheVelocity = Vector2.UnitY.RotatedBy(MathHelper.Lerp(0, 3 * MathHelper.PiOver2, (float)(i / (float)(scytheAmt - 1))) + Projectile.ai[1]) * speed; + if (Projectile.owner == Main.myPlayer) + { + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, scytheVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.125f), Projectile.knockBack, Projectile.owner, ai2: 1); + Main.projectile[p].penetrate = -1; + Main.projectile[p].timeLeft = 65; + } + } } + // Otherwise shoot at the cursor + else + { + Vector2 direction = Projectile.Center.DirectionTo(Main.MouseWorld) * 12; + int spreadfactor = 9; + for (int index = 0; index < 4; ++index) + { + float SpeedX = direction.X + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); + float SpeedY = direction.Y + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); if (Projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.125f), Projectile.knockBack, Projectile.owner); + + } + } + } + Projectile.ai[0] = 0; } Projectile.ai[1] += 0.1f; diff --git a/Projectiles/Melee/DeathsAscensionSwing.cs b/Projectiles/Melee/DeathsAscensionSwing.cs index 377fd0c2ed..3be2c1b32f 100644 --- a/Projectiles/Melee/DeathsAscensionSwing.cs +++ b/Projectiles/Melee/DeathsAscensionSwing.cs @@ -171,9 +171,9 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.ai[2] <= 0 && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 4) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center + Main.rand.NextVector2Circular(48, 48), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center + Main.rand.NextVector2Circular(48, 48), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai1: Main.rand.NextFloat(0, 3f)); SoundEngine.PlaySound(SoundID.Item165 with { Pitch = -1 }, Projectile.Center); - Projectile.ai[2] = 20; + Projectile.ai[2] = 40; float screenShakePower = 3 * Utils.GetLerpValue(1300f, 0f, target.Distance(Main.LocalPlayer.Center), true); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower;