diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index a8fb418509..c52f69b225 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.width = 28; Item.height = 20; Item.damage = 17; - Item.shootSpeed = 12f; + Item.shootSpeed = 15f; Item.shoot = ModContent.ProjectileType(); Item.useTime = Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Particles/HeavySmoke.cs b/Particles/HeavySmoke.cs index 57726c58d5..a7fa2365ef 100644 --- a/Particles/HeavySmoke.cs +++ b/Particles/HeavySmoke.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Particles private float Spin; private bool StrongVisual; private bool Glowing; - private bool AffectedByLight = false; private float HueShift; static int FrameAmount = 6; diff --git a/Particles/Particle.cs b/Particles/Particle.cs index 1867364dcd..41665cfd2d 100644 --- a/Particles/Particle.cs +++ b/Particles/Particle.cs @@ -49,6 +49,11 @@ namespace CalamityMod.Particles public float Rotation; public float Scale; + /// + /// Whether your particle is affected by light levels. + /// + public bool AffectedByLight = false; + public virtual int FrameVariants => 1; public int Variant = 0; public virtual string Texture => ""; @@ -78,6 +83,7 @@ namespace CalamityMod.Particles /// public virtual bool UseHalfTransparency => false; + /// /// Removes the particle from the handler /// diff --git a/Particles/PointParticle.cs b/Particles/PointParticle.cs index 083c4ef296..c5e44842b0 100644 --- a/Particles/PointParticle.cs +++ b/Particles/PointParticle.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Particles public override string Texture => "CalamityMod/Particles/PointParticle"; - public PointParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool AddativeBlend = true) + public PointParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool AddativeBlend = true, bool affectedByLight = false) { Position = relativePosition; Velocity = velocity; @@ -26,12 +26,17 @@ namespace CalamityMod.Particles Lifetime = lifetime; Color = InitialColor = color; UseAltVisual = AddativeBlend; + AffectedByLight = affectedByLight; } public override void Update() { Scale *= 0.95f; Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + if (AffectedByLight) + { + Color = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGBA(Color); + } Velocity *= 0.95f; if (Velocity.Length() < 12f && AffectedByGravity) { diff --git a/Particles/SmallSmokeParticle.cs b/Particles/SmallSmokeParticle.cs index 46a4c0ac3c..9e8372083e 100644 --- a/Particles/SmallSmokeParticle.cs +++ b/Particles/SmallSmokeParticle.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Particles private Color ColorFire; private Color ColorFade; private float Spin; - private bool AffectedByLight = false; public SmallSmokeParticle(Vector2 position, Vector2 velocity, Color colorFire, Color colorFade, float scale, float opacity, float rotationSpeed = 0f, bool affectedByLight = false) { diff --git a/Particles/SparkParticle.cs b/Particles/SparkParticle.cs index c5ab3c42a5..cdaf34e436 100644 --- a/Particles/SparkParticle.cs +++ b/Particles/SparkParticle.cs @@ -10,7 +10,6 @@ namespace CalamityMod.Particles { public Color InitialColor; public bool AffectedByGravity; - public bool AffectedByLight = false; public bool FadeIn = false; public float FadeInScale = 0f; public override bool SetLifetime => true; diff --git a/Projectiles/Ranged/GildedGathererHarpoon.cs b/Projectiles/Ranged/GildedGathererHarpoon.cs index 166ff8f492..7bfac65d94 100644 --- a/Projectiles/Ranged/GildedGathererHarpoon.cs +++ b/Projectiles/Ranged/GildedGathererHarpoon.cs @@ -32,24 +32,24 @@ namespace CalamityMod.Projectiles.Ranged public NPC npcToTarget = null; public Vector2 latchOffset; public Vector2 mousePos; - public override Vector2 SpriteOrigin => new(4,4); + public override Vector2 SpriteOrigin => new(4, 7); public override int AssignedItemID => ModContent.ItemType(); - public int DamageOverTime => 12; + public int DamageOverTime => 24; + public int DoTDelay => 10; public int AirblastDamageMax => 50; public int AirblastDamageMin => 10; - public int DoTDelay => 5; public override void SetDefaults() { base.SetDefaults(); - Projectile.width = 16; - Projectile.height = 16; + Projectile.width = 42; + Projectile.height = 14; Projectile.penetrate = -1; - Projectile.height = 6; Projectile.DamageType = DamageClass.Ranged; Projectile.aiStyle = -1; Projectile.friendly = true; + Projectile.hide = true; } public override void OnSpawn(IEntitySource source) { @@ -124,10 +124,6 @@ namespace CalamityMod.Projectiles.Ranged } base.OnHitNPC(target, hit, damageDone); } - public Vector2 ArmOffset() - { - return new Vector2(0, -6f * Main.player[Projectile.owner].direction).RotatedBy(Projectile.rotation); - } public override void UseStyle() { DrawUnconditionally = true; @@ -263,7 +259,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.direction = Math.Sign(mousePos.X - player.Center.X); player.direction = Projectile.direction; player.itemAnimation = 2; - Offset = ArmOffset(); break; } case 1: @@ -355,10 +350,10 @@ namespace CalamityMod.Projectiles.Ranged for (float i = 0; i < LinePositions.Count; i++) { - LinePositions[(int)i] = Vector2.Lerp(LinePositions[(int)i], Vector2.Lerp(AbsolutePosition + new Vector2(0, 6), player.Center + ArmOffset(), (i / (float)LinePositions.Count)), + LinePositions[(int)i] = Vector2.Lerp(LinePositions[(int)i], Vector2.Lerp(AbsolutePosition + new Vector2(0, 6), player.Center, (i / (float)LinePositions.Count)), MathHelper.Clamp(CalamityUtils.CircInEasing(i / (float)LinePositions.Count, 1), 0f, 1f) ); - LinePositions[(int)i] = Vector2.Lerp(LinePositions[(int)i], Vector2.Lerp(AbsolutePosition + new Vector2(0, 6), player.Center + ArmOffset(), (i / (float)LinePositions.Count)), + LinePositions[(int)i] = Vector2.Lerp(LinePositions[(int)i], Vector2.Lerp(AbsolutePosition + new Vector2(0, 6), player.Center, (i / (float)LinePositions.Count)), MathHelper.Lerp(1f,0f,CalamityUtils.CircOutEasing(i / (float)LinePositions.Count, 1)) ); } @@ -375,10 +370,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), lightColor, Projectile.rotation, new Vector2(12, 6), 1f, spriteEffects); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, spriteEffects != SpriteEffects.None ? 4 : 0), tex.Frame(), lightColor, Projectile.rotation, new Vector2(12, 6), 1f, spriteEffects); } return false; } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindNPCsAndTiles.Add(index); + } public override void ResetStyle() { @@ -391,14 +390,12 @@ namespace CalamityMod.Projectiles.Ranged if (poss.Count > 0) { poss[0] = AbsolutePosition + new Vector2(0, 6); + poss[1] = AbsolutePosition + new Vector2(0, 6); if (poss.Count > 1) { - poss[poss.Count - 1] = Main.player[Projectile.owner].Center + ArmOffset(); - } - if (poss.Count > 2) - { - poss[poss.Count - 2] = Main.player[Projectile.owner].Center + ArmOffset(); + poss[poss.Count - 1] = Main.player[Projectile.owner].Center; + poss[poss.Count - 2] = Vector2.Lerp(poss[poss.Count - 2], Main.player[Projectile.owner].Center, 0.99f); } } @@ -411,12 +408,15 @@ namespace CalamityMod.Projectiles.Ranged poss[i] = vec2; } + Asset tex = ModContent.Request("CalamityMod/Projectiles/Ranged/GildedGathererHarpoon_Line"); + + GameShaders.Misc["CalamityMod:PrimitiveTexture"].SetShaderTexture(tex); + + GameShaders.Misc["CalamityMod:PrimitiveTexture"].Shader.Parameters["uPrimitiveSize"].SetValue(tex.Width()); + PrimitiveRenderer.RenderTrail(poss, new PrimitiveSettings(W => { return 3f; }, - C => { return Lighting.GetColor((poss[Math.Clamp((int)((float)C * (float)poss.Count), 0, poss.Count)] / 16).ToPoint()).MultiplyRGB(new Color(50, 55, 85)); }, - null, false, true)); - PrimitiveRenderer.RenderTrail(poss, new PrimitiveSettings(W => { return 1f; }, - C => { return Lighting.GetColor((poss[Math.Clamp((int)((float)C * (float)poss.Count), 0, poss.Count)] / 16).ToPoint()).MultiplyRGB(new Color(155, 200, 255)); }, - null, false, true)); + C => { return Lighting.GetColor((poss[Math.Clamp((int)((float)C * (float)poss.Count), 0, poss.Count)] / 16).ToPoint()); }, + null, false, true, GameShaders.Misc["CalamityMod:PrimitiveTexture"])); } } } diff --git a/Projectiles/Ranged/GildedGathererHarpoon.png b/Projectiles/Ranged/GildedGathererHarpoon.png index 0c0b0cb8d4..bec4ab83be 100644 Binary files a/Projectiles/Ranged/GildedGathererHarpoon.png and b/Projectiles/Ranged/GildedGathererHarpoon.png differ diff --git a/Projectiles/Ranged/GildedGathererHarpoon_Line.png b/Projectiles/Ranged/GildedGathererHarpoon_Line.png new file mode 100644 index 0000000000..6eb2f9cdeb Binary files /dev/null and b/Projectiles/Ranged/GildedGathererHarpoon_Line.png differ diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index 5406504bad..3dbb582d25 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -1,4 +1,7 @@ -using CalamityMod.Items.Weapons.Rogue; +using System.Diagnostics; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -14,6 +17,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { Projectile.width = 19; + Projectile.aiStyle = -1; Projectile.height = 19; Projectile.friendly = true; Projectile.DamageType = RogueDamageClass.Instance; @@ -21,9 +25,14 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + Projectile.ai[0] = Projectile.Calamity().stealthStrike ? 1 : 0; + if (Main.rand.NextBool(3)) GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(12), 0).RotatedBy(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(Main.rand.NextFloat(-20, 20))), false, 10, Projectile.ai[0] == 1 ? 0.4f : 0.3f, Projectile.ai[0] == 1 ? Color.OrangeRed : Color.SaddleBrown, false)); + + Projectile.ai[1]++; //Constant rotation and gravity Projectile.rotation += 0.4f * Projectile.direction; - Projectile.velocity.Y = Projectile.velocity.Y + 0.3f; + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y = Projectile.velocity.Y + MathHelper.Clamp(Projectile.ai[1] / 40, 0, 0.6f); if (Projectile.velocity.Y > 16f) { Projectile.velocity.Y = 16f; @@ -37,35 +46,39 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { + Projectile.ai[0] = Projectile.Calamity().stealthStrike ? 1 : 0; SoundEngine.PlaySound(SoundID.Item50, Projectile.position); + SoundEngine.PlaySound(SoundID.Dig.WithPitchOffset(Main.rand.NextFloat(0.5f, 1f)), Projectile.position); + SoundEngine.PlaySound(SoundID.Dig.WithPitchOffset(Main.rand.NextFloat(-1f, -0.5f)), Projectile.position); //Dust on impact int dust_splash = 0; while (dust_splash < 9) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f); + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Projectile.ai[0] == 1 ? 1.2f : 0.6f, Projectile.ai[0] == 1 ? Color.OrangeRed : Color.SaddleBrown, false)); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, 0f, 0f, 0, default, 0.5f); dust_splash += 1; } // This only triggers if stealth is full if (Projectile.ai[0] == 1) { + dust_splash = 0; + while (dust_splash < 9) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(24), 0).RotatedByRandom(MathHelper.TwoPi), false, 6, 0.6f, Color.SaddleBrown, false)); + GeneralParticleHandler.SpawnParticle(new SmallSmokeParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), Color.SaddleBrown, Color.SaddleBrown, Main.rand.NextFloat(1f, 1.5f), 150, affectedByLight: true)); + dust_splash += 1; + } int split = 0; while (split < 5) { //Calculate the velocity of the projectile - float shardspeedX = -Projectile.velocity.X * Main.rand.NextFloat(.1f, .15f) + Main.rand.NextFloat(-3f, 3f); - float shardspeedY = -Projectile.velocity.Y * Main.rand.NextFloat(.5f, .9f) + Main.rand.NextFloat(-6f, -3f); - //Prevents the projectile speed from being too low - if (shardspeedX < 1f && shardspeedX > -1f) - { - shardspeedX += -Projectile.velocity.X; - } - if (shardspeedY > -3f) - { - shardspeedY += -Projectile.velocity.Y; - } + Vector2 shardspeed = new Vector2(Main.rand.Next(3, 8), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)); + Vector2 speedAdd = -Projectile.velocity; + speedAdd.Normalize(); + shardspeed += speedAdd * 9; //Spawn the projectile - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X + shardspeedX, Projectile.position.Y + shardspeedY, shardspeedX, shardspeedY, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position + shardspeed, shardspeed, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 2f, Projectile.owner); split += 1; } } diff --git a/Projectiles/Rogue/BrickFragment.cs b/Projectiles/Rogue/BrickFragment.cs index 47b929df0f..7b3f9a1da4 100644 --- a/Projectiles/Rogue/BrickFragment.cs +++ b/Projectiles/Rogue/BrickFragment.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -15,14 +17,17 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.friendly = true; Projectile.width = 16; + Projectile.scale = Main.rand.NextFloat(0.4f, 0.8f); Projectile.height = 16; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { + Projectile.ai[0]++; //Rotation and gravity - Projectile.rotation += 0.6f * Projectile.direction; - Projectile.velocity.Y = Projectile.velocity.Y + 0.27f; + Projectile.rotation += MathHelper.ToRadians(3f) * Projectile.direction; + Projectile.velocity.Y = Projectile.velocity.Y + 0.27f + MathHelper.Clamp(Projectile.ai[0] / 40, 0, 0.5f); + Projectile.velocity.X *= 0.97f; if (Projectile.velocity.Y > 16f) { Projectile.velocity.Y = 16f; @@ -31,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + SoundEngine.PlaySound(SoundID.Dig.WithPitchOffset(Main.rand.NextFloat(0.5f)).WithVolumeScale(0.6f), Projectile.position); //Dust effect int splash = 0; while (splash < 4) @@ -39,6 +44,13 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.10f, 150, default, 0.9f); splash += 1; } + int dust_splash = 0; + while (dust_splash < 9) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(8), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, 0.4f, Color.SaddleBrown, false)); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Copper, 0f, 0f, 0, default, 0.5f); + dust_splash += 1; + } } } }