diff --git a/Buffs/Summon/AmphibiansGuitarBuff.png b/Buffs/Summon/AmphibiansGuitarBuff.png index 84a4ca48ad..268bea27e2 100644 Binary files a/Buffs/Summon/AmphibiansGuitarBuff.png and b/Buffs/Summon/AmphibiansGuitarBuff.png differ diff --git a/Items/Weapons/Summon/AmphibiansGuitar.cs b/Items/Weapons/Summon/AmphibiansGuitar.cs index 047275ad85..b8c0fb4949 100644 --- a/Items/Weapons/Summon/AmphibiansGuitar.cs +++ b/Items/Weapons/Summon/AmphibiansGuitar.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 20; + Item.damage = 200; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); @@ -35,7 +35,8 @@ namespace CalamityMod.Items.Weapons.Summon AddIngredient(ItemID.Frog). AddIngredient(3). AddIngredient(8). - AddTile(ItemID.MythrilAnvil); + AddTile(TileID.MythrilAnvil). + Register(); } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 4d364cf26f..1885c3fe59 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -907,7 +907,8 @@ AmphibiansGuitar: { DisplayName: Amphibian's Guitar Tooltip: ''' - Summons up to 8 guitars that spin around the target and shoot them down. + Summons up to 8 guitars that spin around you and shoot notes at the target, ocasianally firing spread shots +If all 8 guitars are present some notes become empowered dealing extra damage "I'll show you suffering!" ''' } diff --git a/Particles/GlowSquareParticleBig.png b/Particles/GlowSquareParticleBig.png new file mode 100644 index 0000000000..0237e9c524 Binary files /dev/null and b/Particles/GlowSquareParticleBig.png differ diff --git a/Projectiles/Summon/AmphibiansGuitarHoldout.cs b/Projectiles/Summon/AmphibiansGuitarHoldout.cs index 6f20899da9..1bae99776a 100644 --- a/Projectiles/Summon/AmphibiansGuitarHoldout.cs +++ b/Projectiles/Summon/AmphibiansGuitarHoldout.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.Localization; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { SpawnTimer++; - if (SpawnTimer > 15f && Owner.ownedProjectileCounts[MinionType] < 8) + if (SpawnTimer > 19f && Owner.ownedProjectileCounts[MinionType] < 8) { Projectile.NewProjectileDirect( Projectile.GetSource_FromThis(), diff --git a/Projectiles/Summon/AmphibiansGuitarMinion.cs b/Projectiles/Summon/AmphibiansGuitarMinion.cs index 14bf98f26d..3f2c37ed7e 100644 --- a/Projectiles/Summon/AmphibiansGuitarMinion.cs +++ b/Projectiles/Summon/AmphibiansGuitarMinion.cs @@ -1,9 +1,15 @@ -using CalamityMod.Buffs.Summon; +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent; +using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Summon @@ -25,13 +31,17 @@ namespace CalamityMod.Projectiles.Summon get => (int)Projectile.ai[0]; set => Projectile.ai[0] = MathHelper.Clamp(value, 0, 7); } + public float rotSpeed = 1; + public int time = 0; + public int shootCount = 0; + private float IntendedRotationAngle => MathHelper.TwoPi / (Owner == null ? 1f : MathHelper.Clamp(Owner.ownedProjectileCounts[Type], 1f, 8f)) * Projectile.ai[0] + Main.GlobalTimeWrappedHourly * 2.4f; - private float IntendedRotationAngle => MathHelper.TwoPi / (Owner == null ? 1f : MathHelper.Clamp(Owner.ownedProjectileCounts[Type], 1f, 8f)) * Projectile.ai[0] + Main.GlobalTimeWrappedHourly * 1.8f; - - private Vector2 RotationPosition => Target == null ? Owner.MountedCenter : Target.Center; + // Position is same for targeting and non targeting but is left open to be changed because they may want it changed + private Vector2 RotationPosition => Target == null ? Owner.MountedCenter : Owner.MountedCenter; private ref float ShootTimer => ref Projectile.ai[1]; + public Color useColor = Color.White; public override void SetDefaults() { base.SetDefaults(); @@ -40,37 +50,103 @@ namespace CalamityMod.Projectiles.Summon public override void MinionAI() { + Projectile.rotation = IntendedRotationAngle; + float sine = MathHelper.Clamp(Math.Abs((float)Math.Sin(Main.GlobalTimeWrappedHourly * 5f / MathHelper.Pi)), 0f, 1f); + rotSpeed = sine; + if (Projectile.ai[2] == 0f) { - ShootTimer = Main.rand.NextFloat(60); + // Pitch matches the song if played with proper timing + SoundStyle sound = new("CalamityMod/Sounds/Item/AmphibiansGuitarSummon"); + SoundEngine.PlaySound(sound with { Volume = 0.8f, Pitch = ((Projectile.ai[0] == 2 || Projectile.ai[0] == 5) ? -0.15f : 0f) }, Projectile.Center); + + ShootTimer = Projectile.ai[0] * 10; Projectile.ai[2]++; Projectile.netUpdate = true; Projectile.netSpam = 0; } - Vector2 intendedPosition = RotationPosition - Vector2.UnitY.RotatedBy(IntendedRotationAngle) * (Target == null ? 100f : (Target.Size.Length() / 2f) + 100f); - Projectile.Center = Vector2.Lerp(Projectile.Center, intendedPosition, Utils.Remap(Projectile.DistanceSQ(intendedPosition), 6400f, 0f, 0.1f, 0.4f)); + Vector2 intendedPosition = RotationPosition - Vector2.UnitY.RotatedBy(IntendedRotationAngle) * (Target == null ? 100f : (Target.Size.Length() / 2f) + (600f - 350 * rotSpeed)); + Projectile.Center = Vector2.Lerp(Projectile.Center, intendedPosition, Utils.Remap(Projectile.DistanceSQ(intendedPosition), 6400f, 0f, 0.1f, 0.3f)); if (Target != null) { - if (ShootTimer > 60f && Main.myPlayer == Projectile.owner) + bool bigShot = shootCount % 3 == 0; + if (ShootTimer > 80f && Main.myPlayer == Projectile.owner) { - Projectile.NewProjectileDirect( + if (bigShot) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/Evernote"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 10 }, Projectile.Center); + } + else + { + SoundStyle fireSmall = new("CalamityMod/Sounds/Item/WulfrumProsthesisShoot"); + SoundEngine.PlaySound(fireSmall with { Volume = 0.3f, Pitch = Main.rand.NextFloat(0.6f, 0.7f) }, Projectile.Center); + } + + + for (int i = 0; i < (bigShot ? 3 : 1); i++) + { + float rot = i == 1 ? -0.25f : i == 2 ? 0.25f : 0; + Projectile.NewProjectileDirect( Projectile.GetSource_FromThis(), Projectile.Center, - CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, 12f), + CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, 18f * (1 - Math.Abs(rot))).RotatedBy(rot), ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, - ai0: (Main.rand.NextBool(2) && Owner.ownedProjectileCounts[Type] == 8).ToInt()); - ShootTimer = 0f; + ai0: (Main.rand.NextBool(2) && Owner.ownedProjectileCounts[Type] == 8).ToInt(), + Main.rand.Next(0, 4 + 1), + (bigShot ? 5 : 0)); + } + if (bigShot) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, useColor, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.01f, 0.09f, 17); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + shootCount++; + ShootTimer = 0; Projectile.netUpdate = true; Projectile.netSpam = 0; } + if (ShootTimer < 10) + Projectile.Center -= Utils.DirectionTo(Projectile.Center, Target.Center) * 10; - ShootTimer += Main.rand.NextBool(60) ? 2f : 1f; + float rate = Main.GlobalTimeWrappedHourly * 2; + List eColors = new List() + { + Color.Red, + Color.Cyan, + Color.Goldenrod, + Color.Magenta, + Color.Lime + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + useColor = Color.Lerp(Color.White, Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), 0.7f); + + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(70, 70), ModContent.DustType(), (Utils.DirectionTo(Projectile.Center, intendedPosition) * -9).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 1f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.75f, 1.25f); + dust.color = useColor; + dust.noLightEmittence = true; + } + else + { + Particle spark = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(70, 70), (Utils.DirectionTo(Projectile.Center, intendedPosition) * -9).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 1f), false, 7, Main.rand.NextFloat(0.5f, 0.8f), useColor, true, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + ShootTimer += 1; } + time++; } public override bool? CanDamage() => false; @@ -79,12 +155,15 @@ namespace CalamityMod.Projectiles.Summon { Texture2D texture = TextureAssets.Projectile[Type].Value; Rectangle frame = texture.Frame(horizontalFrames: 8, frameX: GuitarSprite); + + Projectile.DrawProjectileWithBackglow(useColor with { A = 0 }, lightColor, Target == null ? 0 : 8, texture, frame); + Main.EntitySpriteDraw( texture, Projectile.Center - Main.screenPosition, frame, Color.White, - IntendedRotationAngle, + Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Summon/AmphibiansGuitarProjectile.cs b/Projectiles/Summon/AmphibiansGuitarProjectile.cs index 12963a805e..471a50ef54 100644 --- a/Projectiles/Summon/AmphibiansGuitarProjectile.cs +++ b/Projectiles/Summon/AmphibiansGuitarProjectile.cs @@ -1,6 +1,13 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using CalamityMod.Dusts; +using Terraria.Audio; namespace CalamityMod.Projectiles.Summon { @@ -11,19 +18,108 @@ namespace CalamityMod.Projectiles.Summon public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public bool IsHatNote => Projectile.ai[0] != 0f; - - public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Type] = true; + public Color noteColor = Color.White; + public int time = 0; + public NPC targeted; + public override void SetStaticDefaults() + { + ProjectileID.Sets.MinionShot[Type] = true; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } public override void SetDefaults() { - Projectile.width = Projectile.height = 32; - Projectile.timeLeft = 300; - Projectile.localNPCHitCooldown = 10; + Projectile.width = 54; + Projectile.height = 44; + Projectile.timeLeft = 150; + Projectile.localNPCHitCooldown = 20; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; } + public override void AI() + { + if (time == 0) + { + if (IsHatNote) + Projectile.penetrate = 1; + if (Projectile.ai[2] == 5) + Projectile.extraUpdates = 1; + } + Projectile.scale = 1.6f * Utils.GetLerpValue(-5, 20, time, true); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (time % 10 == 0) + { + if (Projectile.ai[1] < 4) + Projectile.ai[1]++; + else + Projectile.ai[1] = 0; + } + Color chooseColor = Projectile.ai[1] switch + { + 0 => Color.Red, + 1 => Color.Cyan, + 2 => Color.Goldenrod, + 3 => Color.Magenta, + _ => Color.Lime, + }; + if (time == 0) + noteColor = chooseColor; + else + noteColor = Color.Lerp(noteColor, chooseColor, 0.07f); + Lighting.AddLight(Projectile.Center, noteColor.ToVector3() * 0.5f); + if (time % 3 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(40, 40), ModContent.DustType(), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.5f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.35f); + dust.color = noteColor; + dust.noLightEmittence = true; + } + if (Projectile.ai[2] == 5 && time % 2 == 0) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 8, 0.065f, noteColor * 0.75f, new Vector2(1, 0.3f), true, false, 1f); + GeneralParticleHandler.SpawnParticle(spark); + } + + time++; + } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= IsHatNote ? 1.5f : 1f; + public override void OnKill(int timeLeft) + { + if (IsHatNote) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.8f, Pitch = -0.5f }, Projectile.Center); + } + for (int i = 0; i <= (IsHatNote ? 8 : 4); i++) + { + Particle spark = new SparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(IsHatNote ? 100 : 0.5f) * Main.rand.NextFloat(0.4f, 1.3f), false, 15, 1.2f, noteColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request("CalamityMod/Projectiles/Summon/Evernote"); + Asset tex2 = ModContent.Request("CalamityMod/Projectiles/Summon/EvernoteWall"); + Asset glow = ModContent.Request("CalamityMod/Particles/Light"); + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], noteColor with { A = 0 } * 0.4f, 1, tex.Value, true, true); + + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, noteColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.9f * Utils.GetLerpValue(-5, 20, time, true), 1) * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.Lerp(Color.White, noteColor, 0.15f) with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.9f * Utils.GetLerpValue(-5, 20, time, true), 1) * Projectile.scale * 0.88f, SpriteEffects.None); + + if (IsHatNote) + { + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(tex2.Value, generalDrawPos, null, noteColor with { A = 0 }, Main.GlobalTimeWrappedHourly * 7.3f + i * 2, tex2.Size() * 0.5f, Projectile.scale * (0.7f + i * 0.7f) * 0.9f, SpriteEffects.None); + } + return false; + } } } diff --git a/Projectiles/Summon/Evernote.png b/Projectiles/Summon/Evernote.png new file mode 100644 index 0000000000..3a90244254 Binary files /dev/null and b/Projectiles/Summon/Evernote.png differ diff --git a/Projectiles/Summon/EvernoteWall.png b/Projectiles/Summon/EvernoteWall.png new file mode 100644 index 0000000000..f42fc3b140 Binary files /dev/null and b/Projectiles/Summon/EvernoteWall.png differ diff --git a/Sounds/Item/AmphibiansGuitarSummon.ogg b/Sounds/Item/AmphibiansGuitarSummon.ogg new file mode 100644 index 0000000000..64c015e905 Binary files /dev/null and b/Sounds/Item/AmphibiansGuitarSummon.ogg differ diff --git a/Sounds/Item/Evernote.ogg b/Sounds/Item/Evernote.ogg new file mode 100644 index 0000000000..e1c921d2cd Binary files /dev/null and b/Sounds/Item/Evernote.ogg differ