diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 95a5c492d3..3ed5d4cfe3 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Arrow; Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() => new Vector2(-14f, 0f); + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() < 0.25f; public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { Texture2D texture; diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index 4f81f42ffc..f8d4b99893 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,7 +1,9 @@ -using CalamityMod.Projectiles.Rogue; +using System; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,32 +12,41 @@ namespace CalamityMod.Items.Weapons.Rogue { public class MoltenAmputator : RogueWeapon { - public const float Speed = 21f; - + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } public override void SetDefaults() { Item.width = 60; Item.height = 60; - Item.damage = 166; + Item.damage = 766; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = 18; + Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; + Item.useTime = 35; Item.knockBack = 9f; - Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = Speed; + Item.shootSpeed = 17; Item.DamageType = RogueDamageClass.Instance; } - + public override bool AltFunctionUse(Player player) => true; public override float StealthDamageMultiplier => 1.07f; + public override float UseSpeedMultiplier(Player player) + { + if (player.altFunctionUse == 2) + return 2f; + else + return 1; + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + /* if (player.Calamity().StealthStrikeAvailable()) { int ss = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); @@ -43,7 +54,42 @@ namespace CalamityMod.Items.Weapons.Rogue Main.projectile[ss].Calamity().stealthStrike = true; return false; } - return true; + */ + if (player.altFunctionUse == 2) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == type) + { + projectile.ai[2] = 5; + } + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/StygianCatch"); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.7f, -0.8f) }, position); + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.4f, 0.65f) }, position); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, 0); + } + return false; + } + public override void UseItemFrame(Player player) + { + if (player.altFunctionUse == 2) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += -0.39f * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 3fd92e6737..a9115edbb2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -1300,6 +1300,7 @@ TelluricGlare: { Rapidly fires volleys of arrows Every other arrow is converted into radiant arrows Converts wooden arrows into colossal radiant arrows which pierce and deal increased damage + 75% chance to save ammo ''' } diff --git a/Particles/CircularSmearFire1.png b/Particles/CircularSmearFire1.png new file mode 100644 index 0000000000..7ef6e9aa75 Binary files /dev/null and b/Particles/CircularSmearFire1.png differ diff --git a/Particles/CircularSmearFire2.png b/Particles/CircularSmearFire2.png new file mode 100644 index 0000000000..a5a6eba215 Binary files /dev/null and b/Particles/CircularSmearFire2.png differ diff --git a/Particles/CircularSmearFire3.png b/Particles/CircularSmearFire3.png new file mode 100644 index 0000000000..aaacdbedd4 Binary files /dev/null and b/Particles/CircularSmearFire3.png differ diff --git a/Particles/ProvidenceMarkParticle.png b/Particles/ProvidenceMarkParticle.png new file mode 100644 index 0000000000..13f25406f5 Binary files /dev/null and b/Particles/ProvidenceMarkParticle.png differ diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index 430b80ac5f..b30246158b 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -119,14 +119,10 @@ namespace CalamityMod.Projectiles.Ranged RestrictLifetime(); target.AddBuff(ModContent.BuffType(), 180); - //SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.4f, Volume = 0.5f }, Projectile.Center); - SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ProvidenceHurt"); - SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = 0.5f }, Projectile.Center); - // Explode into a bunch of holy fire. for (int i = 0; i < 3; i++) { - LineParticle spark2 = new LineParticle(Projectile.Center + Main.rand.NextVector2Circular(13, 13), Projectile.velocity * Main.rand.NextFloat(0.5f, 1.8f), false, 12, 1.1f, colorAlt ? (Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod) : (Main.rand.NextBool(5) ? Color.Goldenrod : Color.DarkGoldenrod)); + LineParticle spark2 = new LineParticle(Projectile.Center + Main.rand.NextVector2Circular(13, 13), Projectile.velocity * Main.rand.NextFloat(0.5f, 2.1f), false, 12, 1.1f, colorAlt ? (Main.rand.NextBool(5) ? Color.Khaki : Color.Goldenrod) : (Main.rand.NextBool(5) ? Color.Goldenrod : Color.DarkGoldenrod)); GeneralParticleHandler.SpawnParticle(spark2); } } diff --git a/Projectiles/Rogue/MoltenAmputatorProj.cs b/Projectiles/Rogue/MoltenAmputatorProj.cs index 4abfdf3453..5ce1e8c5fc 100644 --- a/Projectiles/Rogue/MoltenAmputatorProj.cs +++ b/Projectiles/Rogue/MoltenAmputatorProj.cs @@ -1,6 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using Microsoft.VisualBasic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,8 +18,14 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/MoltenAmputator"; - private const int FramesBeforeReturning = 15; - private const int FramesPerBlob = 8; + + public int time = 0; + public Vector2 squash = new Vector2(1, 1); + public float fakeRot = 0; + public int returnTime = 300; + public bool pulled = false; + public bool returning = false; + public int direction = 0; public override void SetStaticDefaults() { @@ -30,17 +42,12 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; - Projectile.timeLeft = 180; + Projectile.localNPCHitCooldown = 3 * Projectile.MaxUpdates; + Projectile.timeLeft = 900; + Projectile.extraUpdates = 2; Projectile.DamageType = RogueDamageClass.Instance; } - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - private void SpawnBlobs(int blobCount) { for (int i = 0; i < blobCount; i++) @@ -55,11 +62,29 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, iAmSpeed.X, iAmSpeed.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner, 0f, 0f); } } - - // Manually implemented boomerang AI copied from Ghoulish Gouger - // TODO -- this should be a utils function public override void AI() { + Player Owner = Main.player[Projectile.owner]; + + fakeRot += 0.13f * direction; + Projectile.rotation = (Projectile.velocity.ToRotation()) + MathHelper.PiOver2; + + float x = MathHelper.Clamp(Utils.GetLerpValue(16, 2, Projectile.velocity.Length(), true), 0.3f, 1); + float y = 1; + squash = new Vector2(x, y); + + Projectile.frameCounter++; + if (Projectile.frameCounter > 4) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 7) + { + Projectile.frame = 0; + } + /* + // Stealth strikes constantly spawn molten blobs. if (Projectile.Calamity().stealthStrike) { @@ -76,96 +101,99 @@ namespace CalamityMod.Projectiles.Rogue } } } - + */ // Frame 1, pick a direction for the scythe. This direction isn't changed from that point on - if (Projectile.ai[0] == 0f) - Projectile.spriteDirection = Projectile.direction; + if (direction == 0f) + { + direction = (Utils.DirectionTo(Projectile.Center, Owner.Calamity().mouseWorld).X > 0 ? 1 : -1); + } + + if (time >= returnTime && Projectile.ai[2] == 5) + pulled = true; + else + Projectile.ai[2] = 0; // Boomerang glows orange - Lighting.AddLight(Projectile.Center, 0.65f, 0.45f, 0f); + Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 1.5f); // Boomerang noises if (Projectile.soundDelay == 0) { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); + Projectile.soundDelay = 7 * Projectile.MaxUpdates; + SoundStyle sound = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(sound, Projectile.Center); } // Main boomerang logic. projectile.ai[0] is a frame counter. Projectile.ai[0] += 1f; // On the first returning frame, send a net update. - if (Projectile.ai[0] == FramesBeforeReturning) + if (time == returnTime) Projectile.netUpdate = true; // Once returning, use boomerang return AI. - if (Projectile.ai[0] >= FramesBeforeReturning) + if (time >= returnTime) { - float returnSpeed = MoltenAmputator.Speed * 2f; - float acceleration = 1.15f; - - Player owner = Main.player[Projectile.owner]; - Vector2 delta = owner.Center - Projectile.Center; - float dx = delta.X; - float dy = delta.Y; - - // If the boomerang is excessively far away, destroy it. - float dist = delta.Length(); - if (dist > 3000f) - Projectile.Kill(); - - // Homing vector math (the boomerang homes in on the player using rather ugly code) - dist = returnSpeed / dist; - dx *= dist; - dy *= dist; - - // X/Y specific boomerang return code. This is what gives them their unique flight path. - if (Projectile.velocity.X < dx) - { - Projectile.velocity.X = Projectile.velocity.X + acceleration; - if (Projectile.velocity.X < 0f && dx > 0f) - { - Projectile.velocity.X = Projectile.velocity.X + acceleration; - } - } - else if (Projectile.velocity.X > dx) - { - Projectile.velocity.X = Projectile.velocity.X - acceleration; - if (Projectile.velocity.X > 0f && dx < 0f) - { - Projectile.velocity.X = Projectile.velocity.X - acceleration; - } - } - if (Projectile.velocity.Y < dy) - { - Projectile.velocity.Y = Projectile.velocity.Y + acceleration; - if (Projectile.velocity.Y < 0f && dy > 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y + acceleration; - } - } - else if (Projectile.velocity.Y > dy) - { - Projectile.velocity.Y = Projectile.velocity.Y - acceleration; - if (Projectile.velocity.Y > 0f && dy < 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y - acceleration; - } - } + Vector2 moveToTrackingPos = (Owner.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 3 + (8 * Utils.GetLerpValue(returnTime * 1.2f, returnTime * 1.5f, time, true))) + Projectile.velocity += moveToTrackingPos * (0.02f + (4 * Utils.GetLerpValue(returnTime * 1.2f, returnTime * 2.5f, time, true))); + else + Projectile.velocity *= 0.95f; // Destroy the boomerang when it returns to the player. if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) + if (Projectile.Hitbox.Intersects(Owner.Hitbox)) Projectile.Kill(); } + else + Projectile.velocity *= (time > returnTime * 0.4f ? 0.9f : 0.982f); - // Rotate the scythe as it flies. - float spin = Projectile.spriteDirection <= 0 ? -1f : 1f; - Projectile.rotation += spin * 0.38f; + if (Main.rand.NextBool()) + { + int numParts = 2; + for (int i = 0; i < numParts; i++) + { + float fade = (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true) * 3 + 1) * squash.X; + + float rot = fakeRot + (MathHelper.TwoPi * i / numParts); + Vector2 vel = (Utils.MoveTowards(-Projectile.velocity, new Vector2(0, -130).RotatedBy(rot).RotatedBy(-1.3f * direction), (Utils.GetLerpValue(5, 2, Projectile.velocity.Length(), true)))); + + if (Main.rand.NextBool(6)) + { + Particle spark2 = new CustomSpark(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), vel.RotatedByRandom(0.4f) * fade, "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.3f), Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)), new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + else + { + Particle spark = new CustomSpark(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), vel.RotatedByRandom(0.4f) * fade, "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(0.75f, 0.82f), Main.rand.NextBool(4) ? Color.Khaki : Color.Orange, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.3f, 0.4f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Main.rand.NextBool(6)) + { + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : 267); + dust2.noGravity = (dust2.type == 278 ? false : true); + dust2.scale = dust2.type == 278 ? 0.95f : 1.2f; + dust2.color = Color.Lerp(Color.Orchid, Color.White, Main.rand.NextFloat(0, 0.7f)); + dust2.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + else + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -70 * squash.X).RotatedBy(rot), Main.rand.NextBool(4) ? 278 : 267); + dust.noGravity = (dust.type == 278 ? false : true); + dust.scale = dust.type == 278 ? 0.75f : 0.9f; + dust.color = Main.rand.NextBool(4) ? Color.Khaki : Color.Goldenrod; + dust.velocity = (vel * 2).RotatedByRandom(0.4f) * fade; + } + } + } + + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + /* target.AddBuff(ModContent.BuffType(), 180); if (Projectile.owner == Main.myPlayer) { @@ -177,21 +205,28 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } + */ } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(ModContent.BuffType(), 180); - if (Projectile.owner == Main.myPlayer) + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation; + float fade = Utils.GetLerpValue(4, 2, Projectile.velocity.Length(), true); + + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearFire2"); + Asset p2 = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); + for (int i = 0; i < 3; i++) { - int blobCount = Projectile.Calamity().stealthStrike ? 4 : 2; - SpawnBlobs(blobCount); - } - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - for (int k = 0; k < 10; k++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.CopperCoin, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Main.EntitySpriteDraw(p2.Value, drawPosition, null, Color.Orchid with { A = 0 } * 0.25f * fade, fakeRot * (Main.rand.NextFloat(1.5f, 1.55f) * (i * 0.5f + 0.2f)), p2.Size() * 0.5f, 1.1f * Main.rand.NextFloat(0.8f, 1.15f) * fade, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, drawPosition, null, Color.Orange with { A = 0 } * 0.35f * fade, fakeRot * (Main.rand.NextFloat(1.1f, 1.15f) * (i * 0.5f + 0.2f)), p.Size() * 0.5f, 0.9f * fade, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); } + + Asset tex3 = ModContent.Request("CalamityMod/Projectiles/Rogue/MoltenAmputatorSHIT"); + Rectangle frame = tex3.Frame(1, 8, 0, Projectile.frame); + Vector2 rotationPoint = frame.Size() * 0.5f; + Main.EntitySpriteDraw(tex3.Value, drawPosition, frame, lightColor, drawRotation, rotationPoint, squash * Projectile.scale, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + //Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * fade, lightColor, 5.5f * fade, tex3.Value, frame, direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, squash * Projectile.scale); + return false; } } } diff --git a/Projectiles/Rogue/MoltenAmputatorSHIT.png b/Projectiles/Rogue/MoltenAmputatorSHIT.png new file mode 100644 index 0000000000..25e897d76d Binary files /dev/null and b/Projectiles/Rogue/MoltenAmputatorSHIT.png differ diff --git a/Sounds/Item/SwooshMid.ogg b/Sounds/Item/SwooshMid.ogg new file mode 100644 index 0000000000..79a8433dfb Binary files /dev/null and b/Sounds/Item/SwooshMid.ogg differ