From c3b11ce65f5efd2ccc3aa99b39671afee61eda9e Mon Sep 17 00:00:00 2001 From: GinYuH Date: Thu, 7 Jul 2022 20:37:25 -0700 Subject: [PATCH] thank you iban --- Items/Accessories/QuiverofNihility.cs | 2 +- Particles/VoidGeneratorParticleSet.cs | 63 ++++++++++++++++++++++ Projectiles/Typeless/VoidFieldGenerator.cs | 17 +++--- 3 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 Particles/VoidGeneratorParticleSet.cs diff --git a/Items/Accessories/QuiverofNihility.cs b/Items/Accessories/QuiverofNihility.cs index a4f7f44f8a..f766a0bcae 100644 --- a/Items/Accessories/QuiverofNihility.cs +++ b/Items/Accessories/QuiverofNihility.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { SacrificeTotal = 1; DisplayName.SetDefault("Quiver of Nihility"); - Tooltip.SetDefault("Summons a ring of four void fields to orbit you\n"+"Arrows that pass through these fields gain a boost in speed"); + Tooltip.SetDefault("Summons a ring of four void fields to orbit you\n"+"Arrows that pass through these fields gain 20% more damage and double the speed"); } public override void SetDefaults() diff --git a/Particles/VoidGeneratorParticleSet.cs b/Particles/VoidGeneratorParticleSet.cs new file mode 100644 index 0000000000..df0fb8b313 --- /dev/null +++ b/Particles/VoidGeneratorParticleSet.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + //This is basically just the Stream Gouge set with a couple very minor differences for now + public class VoidGeneratorParticleSet : BaseFusableParticleSet + { + public override float BorderSize => 3f; + public override bool BorderShouldBeSolid => false; + public override Color BorderColor => Color.Lerp(Color.Purple, Color.Black, 0.75f) * 0.85f; + public override FusableParticleRenderLayer RenderLayer => FusableParticleRenderLayer.OverNPCsBeforeProjectiles; + + public override List BackgroundShaders => new List() + { + GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader, + }; + public override List BackgroundTextures => new List() + { + ModContent.Request("CalamityMod/ExtraTextures/ParticleBackgrounds/StreamGougeLayer").Value, + }; + public override FusableParticle SpawnParticle(Vector2 center, float sizeStrength) + { + Particles.Add(new FusableParticle(center, sizeStrength)); + return Particles.Last(); + } + + public override void UpdateBehavior(FusableParticle particle) + { + particle.Size = MathHelper.Clamp(particle.Size - 25f, 0f, 200f) * 0.98f; + } + + public override void PrepareOptionalShaderData(Effect effect, int index) + { + switch (index) + { + // Background. + case 0: + Vector2 offset = Vector2.UnitX * Main.GlobalTimeWrappedHourly * 0.045f; + effect.Parameters["generalBackgroundOffset"].SetValue(offset); + effect.Parameters["upscaleFactor"].SetValue(Vector2.One * -0.3f); + break; + } + } + + public override void DrawParticles() + { + Texture2D fusableParticleBase = ModContent.Request("CalamityMod/ExtraTextures/FusableParticleBase").Value; + foreach (FusableParticle particle in Particles) + { + Vector2 drawPosition = particle.Center - Main.screenPosition; + Vector2 origin = fusableParticleBase.Size() * 0.5f; + Vector2 scale = Vector2.One * particle.Size / fusableParticleBase.Size(); + Main.spriteBatch.Draw(fusableParticleBase, drawPosition, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0f); + } + } + } +} diff --git a/Projectiles/Typeless/VoidFieldGenerator.cs b/Projectiles/Typeless/VoidFieldGenerator.cs index a4e01df101..3226575885 100644 --- a/Projectiles/Typeless/VoidFieldGenerator.cs +++ b/Projectiles/Typeless/VoidFieldGenerator.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Typeless { public bool start = true; int auratimer = 0; + public BaseFusableParticleSet.FusableParticle voidaura; public override void SetStaticDefaults() { @@ -84,12 +85,16 @@ namespace CalamityMod.Projectiles.Typeless } } - float offsetX = Projectile.Center.X + Main.rand.Next(-10, 11); - float offsetY = Projectile.Center.Y + Main.rand.Next(-10, 11); - auratimer++; - BloomRing aura = new BloomRing(new Vector2(offsetX, offsetY), Vector2.Zero, Color.Purple, 1f, 5); - FusableParticleManager.GetParticleSetByType()?.SpawnParticle(new Vector2(offsetX, offsetY), 500); - GeneralParticleHandler.SpawnParticle(aura); + if (voidaura == null) + { + voidaura = FusableParticleManager.GetParticleSetByType()?.SpawnParticle(Projectile.Center, 500); + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + } + else + { + voidaura.Center = Projectile.Center; + voidaura.Size = 500; + } } } }