diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index e4dd69596e..584f4db806 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -137,7 +137,7 @@ namespace CalamityMod.Items.Weapons.Melee case Attunement.Marine: AttunementInfo.name = "Gesture for the Drowned"; AttunementInfo.function_description = "Shoot out two water balls at your sides. On ground contact the water balls will turn into small waves that ride along the ground"; - AttunementInfo.function_extra = "If used while submerged, or if the waves contact water, the waves will expand and move much faster"; + AttunementInfo.function_extra = "If used while submerged, or if the waves contact water, the waves will turn into bigger and faster ones"; AttunementInfo.color = new Color(98, 225, 255); break; default: diff --git a/Particles/WaterGlob.png b/Particles/WaterGlob.png index 56f3b81a66..73ba7bee0c 100644 Binary files a/Particles/WaterGlob.png and b/Particles/WaterGlob.png differ diff --git a/Projectiles/Melee/MendedBiomeBladeProjectiles.cs b/Projectiles/Melee/MendedBiomeBladeProjectiles.cs index 28d3a2a964..39d115eaf0 100644 --- a/Projectiles/Melee/MendedBiomeBladeProjectiles.cs +++ b/Projectiles/Melee/MendedBiomeBladeProjectiles.cs @@ -2320,9 +2320,11 @@ namespace CalamityMod.Projectiles.Melee var splash = new LegacySoundStyle(SoundID.Splash, 0).WithPitchVariance(Main.rand.NextFloat()); Main.PlaySound(splash, projectile.Center); - Projectile.NewProjectile(Owner.Center, direction * 0.1f + Owner.velocity , ProjectileType(), projectile.damage, 0, Owner.whoAmI); - Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Projectile proj = Projectile.NewProjectileDirect(Owner.Center, direction * 0.1f + Owner.velocity , ProjectileType(), projectile.damage, 0, Owner.whoAmI); + + + Particle Sparkle = new CritSpark(projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.CornflowerBlue : Color.DodgerBlue, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } @@ -2361,14 +2363,17 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned"; Vector2 direction = Vector2.Zero; public Player Owner => Main.player[projectile.owner]; - public ref float HasLanded => ref projectile.ai[0]; //Charge + public ref float HasLanded => ref projectile.ai[0]; //Is the orb in the air or is it on the ground? + public ref float TimeSinceLanding => ref projectile.ai[1]; //How long has it been on the ground for public float Timer => MaxTime - projectile.timeLeft; - public const float MaxTime = 200f; - public Particle[] FoamParticles = new Particle[5]; - + public const float MaxTime = 160f; + public float groundOffset; public bool BounceX => projectile.oldPosition.X == projectile.position.X; + public bool WaterMode = false; + public float scaleX => 1 + 0.2f * (1f + -(float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f; + public float scaleY => (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); public override void SetStaticDefaults() { @@ -2376,7 +2381,6 @@ namespace CalamityMod.Projectiles.Melee ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; ProjectileID.Sets.TrailingMode[projectile.type] = 2; - Main.projFrames[projectile.type] = 3; } @@ -2394,11 +2398,27 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) { + if (WaterMode) + { + return true; + } HasLanded = 1f; projectile.velocity.Y = -4f; return false; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (TimeSinceLanding < 10 && !WaterMode) + return base.Colliding(projHitbox, targetHitbox); + float collisionPoint = 0f; + if (!WaterMode) + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Bottom, projectile.Bottom - (Vector2.UnitY * scaleY * 110), scaleX * 40, ref collisionPoint); + + float halfLenght = 66f * projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + Vector2.Normalize(projectile.velocity.RotatedBy(MathHelper.PiOver2)) * halfLenght, projectile.Center - Vector2.Normalize(projectile.velocity.RotatedBy(MathHelper.PiOver2)) * halfLenght, 40f, ref collisionPoint); + } + public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) { drawCacheProjsBehindNPCsAndTiles.Add(index); @@ -2406,50 +2426,113 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - - if (FoamParticles[0] == null) + if (Collision.WetCollision(projectile.position, projectile.width, projectile.height)) { - for (int i = 0; i < 5; i++) + WaterMode = true; + projectile.velocity.Y *= 0.33f; + } + else if (WaterMode) + { + projectile.Kill(); + } + + if (WaterMode) + { + projectile.velocity *= 1.02f; + projectile.scale *= 1.01f; + projectile.timeLeft--; + + for (int i = 0; i <= 4; i++) { - Vector2 rot = projectile.velocity.RotatedByRandom(MathHelper.Pi).RotatedBy(-MathHelper.PiOver2); - Particle foam = new SeaFoamParticle(projectile.Center + rot, projectile.velocity, Color.LightSlateGray, Color.CornflowerBlue, Main.rand.NextFloat(0f, 0.5f), 150f, 0.1f); - GeneralParticleHandler.SpawnParticle(foam); - FoamParticles[i] = foam; + Dust waterTrail = Main.dust[Dust.NewDust(projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 23, 0, DustID.Water, -3.7f * Math.Sign(projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + waterTrail.fadeIn = 3f; + } + + Dust foamDust = Main.dust[Dust.NewDust(projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 9, 0, 16, 2.7f * Math.Sign(projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; + foamDust.noGravity = true; + + return; + } + + if (HasLanded == 1f) + { + TimeSinceLanding++; + + groundOffset = -1; + //Check 7 tiles under the projectile for solid ground + for (float i = 0; i < 7; i += 0.5f) + { + Vector2 positionToCheck = projectile.position; + if (Main.tile[(int)(positionToCheck.X / 16), (int)((positionToCheck.Y / 16) + 1 * i)].IsTileSolidGround() && groundOffset == -1) + { + groundOffset = i * 16; + break; + } + } + //If no ground has been found, go back to the airborne state + if (groundOffset == -1) + { + HasLanded = 0f; + TimeSinceLanding = 0f; + } + + if (TimeSinceLanding > 10) + { + //Trailing water!! Dust spam!!! + Dust waterTrail = Main.dust[Dust.NewDust(projectile.Top + Vector2.UnitY * groundOffset, 23, 0, DustID.Water, -3.7f * Math.Sign(projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + waterTrail.fadeIn = 3f; + waterTrail = Main.dust[Dust.NewDust(projectile.TopRight + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * projectile.velocity.X * 4f, 23, 0, DustID.Water, -3.7f * Math.Sign(projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + waterTrail.fadeIn = 3f; + waterTrail = Main.dust[Dust.NewDust(projectile.TopLeft + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * projectile.velocity.X * 4f, 23, 0, DustID.Water, -3.7f * Math.Sign(projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; + waterTrail.fadeIn = 3f; + + + Dust foamDust = Main.dust[Dust.NewDust(projectile.Top + Vector2.UnitY * groundOffset + Vector2.UnitX * 16 * Math.Sign(projectile.velocity.X), 9, 0, 16, 2.7f * Math.Sign(projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; + foamDust.noGravity = true; + + //Foam + float height = scaleY * 100f; + Vector2 origin = projectile.Top + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(projectile.width / 4f, projectile.height / 4f) - (Vector2.UnitY * height); + Particle foamSmall = new FakeGlowDust(origin, projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(1f, 2f), 25, 0.1f, bigSize : true ,gravity: (-projectile.velocity + Vector2.UnitY) * 0.1f); + GeneralParticleHandler.SpawnParticle(foamSmall); + + if (Main.rand.Next(5) == 0) + { + Particle foamLarge = new MediumMistParticle(origin, projectile.velocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); + GeneralParticleHandler.SpawnParticle(foamLarge); + } } } - if (projectile.timeLeft % 2 == 0) + else { - int index = (projectile.timeLeft / 2) % 5; - Particle foam = FoamParticles[index]; - Vector2 rotation = (Vector2.UnitX).RotatedByRandom(MathHelper.PiOver2).RotatedBy(-MathHelper.PiOver4) * 16f; - rotation.X *= Math.Sign(projectile.velocity.X); - foam.Position = projectile.Center + rotation; - foam.Velocity = (-Vector2.UnitY * 5f).RotatedBy(MathHelper.PiOver4 * Math.Sign(projectile.velocity.X)) + new Vector2(projectile.velocity.X * -0.6f, 0f); - //foam.Velocity = Vector2.Zero; - (foam as SeaFoamParticle).Opacity = 150; + Particle foamSmall = new FakeGlowDust(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2f, projectile.height / 2f), projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(0.2f, 2f), 25, 0.1f, gravity: (-projectile.velocity + Vector2.UnitY) * 0.1f); + GeneralParticleHandler.SpawnParticle(foamSmall); + + if (Main.rand.NextBool()) + { + Particle blob = new WaterGlobParticle(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2f, projectile.height / 2f), projectile.velocity / 2f, Main.rand.NextFloat(0.2f, 2f), 0.1f); + GeneralParticleHandler.SpawnParticle(blob); + } + } projectile.rotation += 0.1f * ((projectile.velocity.X > 0) ? 1f : -1f); - if (Main.rand.NextBool()) - { - Particle blob = new WaterGlobParticle(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2f, projectile.height / 2f), projectile.velocity / 2f, Main.rand.NextFloat(0.2f, 2f), 0.1f); - GeneralParticleHandler.SpawnParticle(blob); - } - Particle foamSmall = new FakeGlowDust(projectile.Center + Main.rand.NextVector2Circular(projectile.width / 2f, projectile.height / 2f), projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(0.2f, 2f), 25, 0.1f, gravity: (-projectile.velocity + Vector2.UnitY) * 0.1f); - GeneralParticleHandler.SpawnParticle(foamSmall); - if (projectile.velocity.Y < 15f) { projectile.velocity.Y += 0.3f; } - if (Math.Abs(projectile.velocity.X) < 5f) + if (Math.Abs(projectile.velocity.X) < 8) { projectile.velocity.X += 0.3f * ((projectile.velocity.X > 0) ? 1f : -1f); } + else + { + projectile.velocity.X = Math.Sign(projectile.velocity.X) * 8; + } if (BounceX) { @@ -2458,34 +2541,41 @@ namespace CalamityMod.Projectiles.Melee } projectile.frameCounter++; - if (projectile.frameCounter % 10 == 0) + if (projectile.frameCounter % 6 == 0) projectile.frame = (projectile.frame + 1) % 3; } + public override void Kill(int timeLeft) + { + var splash = new LegacySoundStyle(SoundID.Splash, 0).WithPitchVariance(Main.rand.NextFloat()); + Main.PlaySound(splash, projectile.Center); + + for (int i = 0; i < 4; i++) + { + Particle foamLarge = new MediumMistParticle(projectile.Center + Main.rand.NextVector2Circular(projectile.width, projectile.height), projectile.oldVelocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); + GeneralParticleHandler.SpawnParticle(foamLarge); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - bool balled = (HasLanded == 0f); - float? lowestGroundBelow = null; + if (BounceX) + return false; - if (!balled) + if (WaterMode) { - for (int i = 0; i < 5; i++) - { - Vector2 positionToCheck = projectile.Center; - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16) + 1 * i].IsTileSolidGround() && lowestGroundBelow == null) - { - lowestGroundBelow = i * 16; - break; - } - } - if (lowestGroundBelow == null) - { - balled = true; - HasLanded = 0f; - } + Texture2D wave = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave"); + float drawRotation = projectile.velocity.ToRotation() + MathHelper.Pi ; + Vector2 drawOrigin = new Vector2(wave.Width/2f, wave.Height / 2f); + Vector2 drawOffset = projectile.Center - Main.screenPosition; + + spriteBatch.Draw(wave, drawOffset - projectile.velocity, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.2f, drawRotation, drawOrigin, projectile.scale - 0.2f, 0f, 0f); + spriteBatch.Draw(wave, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.5f, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + return false; } - if(!balled) + + if (HasLanded == 1f && TimeSinceLanding > 10f) { Texture2D wave = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave"); Rectangle frame = new Rectangle(0, 0 + 110 * projectile.frame, 40, 110); @@ -2494,14 +2584,27 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, frame.Height); - Vector2 drawOffset = projectile.Center + Vector2.UnitY * (float)lowestGroundBelow - Main.screenPosition; + Vector2 drawOffset; //Wobble - Vector2 Scale = new Vector2(0.5f + 0.5f * (float)Math.Sin(Timer * 0.1), 0.5f + 0.5f * (1 - (float)Math.Sin(Timer * 0.1))); + Vector2 Scale; - SpriteEffects flip = projectile.velocity.X < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects flip = projectile.velocity.X > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + for (int i = 2; i >= 0; i--) + { + drawOffset = projectile.position + Vector2.UnitY * groundOffset + Vector2.UnitY / 2f - Main.screenPosition; + drawOffset -= Vector2.UnitX * 10f * i * Math.Sign(projectile.velocity.X); + float ScaleYAlter = (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f + 0.2 * i)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + Scale = new Vector2(scaleX, ScaleYAlter - 0.05f * i); + float slightfade = 1f - 0.24f * i; + Color darkenedColor = Color.Lerp(lightColor, Color.Black, i * 0.15f); + + spriteBatch.Draw(wave, drawOffset, frame, darkenedColor * MathHelper.Clamp(TimeSinceLanding / 30f, 0f, 1f) * slightfade, drawRotation, drawOrigin, Scale, flip, 0f); + } + + - spriteBatch.Draw(wave, drawOffset, frame, lightColor, drawRotation, drawOrigin, Scale, flip, 0f); return false; } @@ -2512,7 +2615,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = projectile.Size / 2f; Vector2 drawOffset = projectile.Center - Main.screenPosition; - spriteBatch.Draw(ball, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f); + spriteBatch.Draw(ball, drawOffset, null, lightColor * MathHelper.Clamp(1 - TimeSinceLanding / 10f, 0f, 1f), drawRotation, drawOrigin, projectile.scale, 0f, 0f); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png new file mode 100644 index 0000000000..30a5b3e99e Binary files /dev/null and b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png differ diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png index 7b27acc5bb..db336bf69b 100644 Binary files a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png and b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png differ