diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 5863cd7e62..a9a3d4fdf8 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 3.5f; Item.value = Item.sellPrice(copper: 28); - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0.1f; Item.ammo = AmmoID.Arrow; Item.rare = ModContent.RarityType(); } diff --git a/Items/Ammo/VanquisherArrow.png b/Items/Ammo/VanquisherArrow.png index 2f3dbd1a2a..17d51653cd 100644 Binary files a/Items/Ammo/VanquisherArrow.png and b/Items/Ammo/VanquisherArrow.png differ diff --git a/Items/Ammo/VanquisherArrowGlow.png b/Items/Ammo/VanquisherArrowGlow.png index aa85107a6c..0db572e079 100644 Binary files a/Items/Ammo/VanquisherArrowGlow.png and b/Items/Ammo/VanquisherArrowGlow.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index 7f08807b21..b646219398 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -157,15 +157,16 @@ TerraArrow: { TerraBullet: { DisplayName: Terra Bullet - Tooltip: Explodes and splits into homing terra shards on death + Tooltip: Explodes and splits into homing terra shards on impact } VanquisherArrow: { DisplayName: Vanquisher Arrow Tooltip: ''' - Pierces through tiles - Spawns extra homing arrows as it travels + Powerful arrows forged with cosmic steel + Pierces through tiles and homes in on enemies + Creates a large explosion upon experation ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 47bef8b12a..5163c929cd 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -245,3 +245,4 @@ DragonsBreathFlames.DisplayName: Draconic Flames DragonsBreathMag.DisplayName: Dragons Breath Cartridge FlakKrakenProjectile.DisplayName: Flak Kraken FlakToxicannonProjectile.DisplayName: Flak Toxicannon +VanquisherArrowProj.DisplayName: Vanquisher Arrow Proj diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 5210f77e32..36f1b3817c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -121,7 +121,6 @@ SulphurousSandBallGun.DisplayName: Sulphurous Sand TarraEnergy.DisplayName: Tarra Energy TarragonAura.DisplayName: Tarragon Aura TeslaAura.DisplayName: Tesla's Electricity -VanquisherArrowSplit.DisplayName: Arrow VerstaltiteBobber.DisplayName: Verstaltite Bobber VoidFieldGenerator.DisplayName: Void Field Generator WaterConvertor.DisplayName: Water Convertor diff --git a/Particles/GlowOrbParticle.cs b/Particles/GlowOrbParticle.cs index e1ca805c00..a506c3941f 100644 --- a/Particles/GlowOrbParticle.cs +++ b/Particles/GlowOrbParticle.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Particles public bool UseAltVisual = true; public float fadeOut = 1; public bool imporant; + public bool glowCenter; public override bool SetLifetime => true; public override bool UseCustomDraw => true; public override bool UseAdditiveBlend => UseAltVisual; @@ -20,7 +21,7 @@ namespace CalamityMod.Particles public override string Texture => "CalamityMod/Particles/GlowOrbParticle"; - public GlowOrbParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool AddativeBlend = true, bool needed = false) + public GlowOrbParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool AddativeBlend = true, bool needed = false, bool GlowCenter = true) { Position = relativePosition; Velocity = velocity; @@ -30,6 +31,7 @@ namespace CalamityMod.Particles Color = InitialColor = color; UseAltVisual = AddativeBlend; imporant = needed; + glowCenter = GlowCenter; } public override void Update() @@ -52,7 +54,8 @@ namespace CalamityMod.Particles Texture2D texture = ModContent.Request(Texture).Value; spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White * fadeOut, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.5f, 0.5f), 0, 0f); + if (glowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White * fadeOut, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.5f, 0.5f), 0, 0f); } } } diff --git a/Particles/PlasmaExplosion.cs b/Particles/PlasmaExplosion.cs new file mode 100644 index 0000000000..3da9261e3c --- /dev/null +++ b/Particles/PlasmaExplosion.cs @@ -0,0 +1,55 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class PlasmaExplosion : Particle + { + public override string Texture => "CalamityMod/Particles/PlasmaExplosion"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private float OriginalScale; + private float FinalScale; + private float opacity; + private Vector2 Squish; + private Color BaseColor; + + public PlasmaExplosion(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime) + { + Position = position; + Velocity = velocity; + BaseColor = color; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Squish = squish; + Rotation = rotation; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + + Color = BaseColor * opacity; + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + Velocity *= 0.95f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + } + + } +} diff --git a/Particles/PlasmaExplosion.png b/Particles/PlasmaExplosion.png new file mode 100644 index 0000000000..508c8eb5cb Binary files /dev/null and b/Particles/PlasmaExplosion.png differ diff --git a/Projectiles/Ranged/ElysianArrowRain.cs b/Projectiles/Ranged/ElysianArrowRain.cs index 41aecb335c..8dae78814a 100644 --- a/Projectiles/Ranged/ElysianArrowRain.cs +++ b/Projectiles/Ranged/ElysianArrowRain.cs @@ -55,13 +55,13 @@ namespace CalamityMod.Projectiles.Ranged altSpawn = Projectile.Center; if (Projectile.timeLeft <= 5) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(9, 9) - Projectile.velocity * 2, Main.rand.NextBool() ? 262 : 87, Projectile.velocity * Main.rand.NextFloat(0.1f, 0.95f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(9, 9) - Projectile.velocity * 5, Main.rand.NextBool() ? 262 : 87, (Projectile.velocity * 30) * Main.rand.NextFloat(0.1f, 0.95f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.9f, 1.45f); dust.alpha = 235; } - if (Projectile.timeLeft <= 13) - Projectile.velocity *= 0.985f; + if (Projectile.timeLeft <= 80) + Projectile.velocity *= 0.96f; } public override void OnHitPlayer(Player target, Player.HurtInfo info) { @@ -71,13 +71,13 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 90); - Projectile.timeLeft = 13; + Projectile.timeLeft = 80; } private float PrimitiveWidthFunction(float completionRatio) { float arrowheadCutoff = 0.36f; - float width = 34f; + float width = 24f; float minHeadWidth = 0.03f; float maxHeadWidth = width; if (completionRatio <= arrowheadCutoff) @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); Vector2 overallOffset = Projectile.Size * 0.5f - Main.screenPosition; overallOffset += Projectile.velocity * 1.4f; - TrailDrawer.Draw(Projectile.oldPos, overallOffset, 92); // 58 + TrailDrawer.Draw(Projectile.oldPos, overallOffset, 10); // 58 return false; } diff --git a/Projectiles/Ranged/VanquisherArrowMain.cs b/Projectiles/Ranged/VanquisherArrowMain.cs deleted file mode 100644 index 34a818aada..0000000000 --- a/Projectiles/Ranged/VanquisherArrowMain.cs +++ /dev/null @@ -1,67 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class VanquisherArrowMain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Items/Ammo/VanquisherArrow"; - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.tileCollide = false; - Projectile.arrow = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 90; - Projectile.extraUpdates = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (Projectile.timeLeft % 45 == 0) - { - if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 6) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.25f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); - } - } - - public override void PostDraw(Color lightColor) - { - Color color = Color.White; - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - color = new Color(b2, b2, b2, a2); - } - Rectangle frame = new Rectangle(0, 0, ModContent.Request(Texture).Value.Width, ModContent.Request(Texture).Value.Height); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); - } - return new Color(255, 255, 255, 100); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Ranged/VanquisherArrowProj.cs b/Projectiles/Ranged/VanquisherArrowProj.cs new file mode 100644 index 0000000000..c7cbc1d332 --- /dev/null +++ b/Projectiles/Ranged/VanquisherArrowProj.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Ammo; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class VanquisherArrowProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Items/Ammo/VanquisherArrow"; + public ref float Time => ref Projectile.ai[0]; + public ref float ProjectileSpeed => ref Projectile.ai[1]; + public bool Phase2 = false; + public float HomingTime = 0; + public Color MainColor; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 22; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.tileCollide = false; + Projectile.arrow = true; + Projectile.penetrate = 2; + Projectile.timeLeft = 1200; + Projectile.extraUpdates = 8; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15 * Projectile.extraUpdates; + } + + public override void AI() + { + if (Time == 0) + { + Projectile.velocity *= 0.4f; + ProjectileSpeed = 30; + MainColor = Main.rand.NextBool() ? Color.Cyan : Color.Magenta; + } + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + + if (Time > 4f && Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 226 : 272, -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.8f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.15f, 0.35f); + } + + + NPC target = Projectile.Center.ClosestNPCAt(65); + + if (target != null) + { + //Projectile.velocity = Projectile.velocity.RotatedByRandom(0.1f); + Phase2 = true; + HomingTime = 1; + } + + if (HomingTime == 1) + CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 12, 200f); + + Time++; + } + + public override void PostDraw(Color lightColor) + { + Color color = Color.White; + Rectangle frame = new Rectangle(0, 0, ModContent.Request(Texture).Value.Width, ModContent.Request(Texture).Value.Height); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); + } + + public override Color? GetAlpha(Color lightColor) + { + return lightColor; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.damage > 1 && Projectile.numHits < 1) + Projectile.damage = (int)(Projectile.damage * 0.6f); + + target.AddBuff(ModContent.BuffType(), 180); + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Particle pulse = new Particles.PlasmaExplosion(Projectile.Center + Main.rand.NextVector2Circular(60, 60), Vector2.Zero, Main.rand.NextBool() ? Color.Magenta : Color.Cyan, new Vector2(1f, 1f), Main.rand.NextFloat(-2f, 2f), 0f, Main.rand.NextFloat(0.05f, 0.065f), 15); + GeneralParticleHandler.SpawnParticle(pulse); + } + if (Projectile.owner == Main.myPlayer) + { + Projectile.damage = (int)(Projectile.damage * 0.4f); + Projectile.penetrate = -1; + Projectile.ExpandHitboxBy(170); + Projectile.Damage(); + } + SoundStyle onKill = new("CalamityMod/Sounds/Item/ScorpioHit"); + SoundEngine.PlaySound(onKill with { Volume = 0.25f, Pitch = 0.1f, PitchVariance = 0.3f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_FlameburstTowerShot with { Volume = 0.8f, Pitch = -0.5f, PitchVariance = 0.3f }, Projectile.Center); + + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; + if (Time > 6) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], MainColor * 0.3f, 1, texture); + return true; + } + } +} diff --git a/Projectiles/Typeless/VanquisherArrowSplit.cs b/Projectiles/Typeless/VanquisherArrowSplit.cs deleted file mode 100644 index 4a88fefe27..0000000000 --- a/Projectiles/Typeless/VanquisherArrowSplit.cs +++ /dev/null @@ -1,63 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class VanquisherArrowSplit : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Items/Ammo/VanquisherArrow"; - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - Projectile.friendly = true; - Projectile.arrow = true; - Projectile.timeLeft = 90; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - } - - public override void PostDraw(Color lightColor) - { - if (Projectile.timeLeft < 90) - { - Vector2 origin = new Vector2(0f, 0f); - Color color = Color.White; - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - color = new Color(b2, b2, b2, a2); - } - Texture2D baseTexture = ModContent.Request(Texture).Value; - Rectangle frame = new Rectangle(0, 0, baseTexture.Width, baseTexture.Height); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (Projectile.timeLeft < 85) - { - byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * (b2 / 255f)); - return new Color(b2, b2, b2, a2); - } - return new Color(0, 0, 0, 0); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); - } -}