From 064c8239bd52c1bacebf95123bb13d9af6ea3064 Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Sat, 4 Jun 2022 06:08:39 +0200 Subject: [PATCH] Polish --- Projectiles/Magic/CoralSpoutHoldout.cs | 31 +++++++++++++++----------- Projectiles/Magic/ManaChargedCoral.cs | 6 +++-- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Projectiles/Magic/CoralSpoutHoldout.cs b/Projectiles/Magic/CoralSpoutHoldout.cs index 5c7bae2030..e3cba9e9f3 100644 --- a/Projectiles/Magic/CoralSpoutHoldout.cs +++ b/Projectiles/Magic/CoralSpoutHoldout.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic public ref float Charge => ref Projectile.ai[0]; public float ChargeProgress => MathHelper.Clamp(Charge, 0, MaxCharge) / MaxCharge; public float FullChargeProgress => MathHelper.Clamp(Charge, 0, MaxCharge * 1.5f) / (MaxCharge * 1.5f); - public float Spread => MathHelper.PiOver2 * (1 - ChargeProgress * 0.95f); + public float Spread => MathHelper.PiOver2 * (1 - (float)Math.Pow(ChargeProgress, 1.5) * 0.95f); public Player Owner => Main.player[Projectile.owner]; @@ -66,16 +66,6 @@ namespace CalamityMod.Projectiles.Magic float pointingRotation = (Owner.Calamity().mouseWorld - Owner.Center).ToRotation(); Projectile.Center = Owner.Center + pointingRotation.ToRotationVector2() * 40f; - for (int i = -1; i <= 1; i += 2) - { - float angle = pointingRotation + (Spread / 2f) * i; - for (int j = 0; j < 10; j++) - { - Dust waterDust = Dust.NewDustPerfect(Owner.Center + angle.ToRotationVector2() * j * 40f, 33, Vector2.Zero, 100, default, 0.9f); - waterDust.noGravity = true; - } - } - if (Projectile.soundDelay <= 0) { SoundEngine.PlaySound(CoralSpout.ChargeSound with { Pitch = 0.5f * ChargeProgress}, Owner.Center); @@ -92,7 +82,22 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(ref Color lightColor) { - return base.PreDraw(ref lightColor); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/DeathstareBeam").Value; + + for (int i = -1; i <= 1; i += 2) + { + float angle = (Owner.Center - Owner.Calamity().mouseWorld).ToRotation() + (Spread / 2f) * i - MathHelper.PiOver2; + Vector2 scale = new Vector2(0.2f, 1f) * 3f; + Main.EntitySpriteDraw(texture, Owner.Center - Main.screenPosition, null, Color.DodgerBlue * 0.5f * (float)Math.Sqrt(ChargeProgress), angle, new Vector2(texture.Width / 2f, texture.Height), scale, 0, 0); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + return false; } public override void Kill(int timeLeft) @@ -101,7 +106,7 @@ namespace CalamityMod.Projectiles.Magic if (FullChargeProgress < 1) { - SoundEngine.PlaySound(SoundID.Item167 with { Volume = SoundID.Item167.Volume * 0.4f }, Owner.Center); + SoundEngine.PlaySound(SoundID.Item167 with { Volume = SoundID.Item167.Volume * 0.4f + 0.2f * ChargeProgress }, Owner.Center); for (int i = 0; i < ShotProjectiles; i++) diff --git a/Projectiles/Magic/ManaChargedCoral.cs b/Projectiles/Magic/ManaChargedCoral.cs index 362a7ec6f0..4bd52ac3f4 100644 --- a/Projectiles/Magic/ManaChargedCoral.cs +++ b/Projectiles/Magic/ManaChargedCoral.cs @@ -171,9 +171,11 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(SoundID.Item28 with { Volume = SoundID.Item28.Volume * 0.8f }, Projectile.Center); - Owner.statMana += 80; + //To reach full mana, it needs to have stayed at least half the time needed. If you just one shot an enemy with it, you'll only get 10 mana + int manaGained = Math.Max(10, (int)Math.Floor(80 * Math.Clamp(ManaCharge * 2f / FullMana, 0f, 1f))); + Owner.statMana += manaGained; if (Main.myPlayer == Owner.whoAmI) - Owner.ManaEffect(80); + Owner.ManaEffect(manaGained); if (Owner.statMana > Owner.statManaMax2) Owner.statMana = Owner.statManaMax2;