diff --git a/Items/Weapons/Magic/AlphaDraconis.cs b/Items/Weapons/Magic/AlphaDraconis.cs index 7a02f177f2..31040aebfb 100644 --- a/Items/Weapons/Magic/AlphaDraconis.cs +++ b/Items/Weapons/Magic/AlphaDraconis.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Magic Projectile.NewProjectile(source, player.Center + new Vector2(-125,-100), -Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } - var mousePos = player.Calamity().mouseWorld + new Vector2(player.direction * -64); + var mousePos = player.Calamity().mouseWorld; var dir = player.DirectionTo(mousePos); for (var i = 0; i < 3; i++) Projectile.NewProjectile(source, new Vector2(mousePos.X,player.Center.Y) + new Vector2(Main.rand.Next(500, 1300) * -player.direction, Main.rand.Next(-800,-600)), Vector2.UnitX * player.direction * velocity.Length(), type, damage, knockback, player.whoAmI, mousePos.X, mousePos.Y); diff --git a/Projectiles/Magic/AlphaDraconisStar.cs b/Projectiles/Magic/AlphaDraconisStar.cs index 31ffa37012..394505f1fd 100644 --- a/Projectiles/Magic/AlphaDraconisStar.cs +++ b/Projectiles/Magic/AlphaDraconisStar.cs @@ -39,7 +39,28 @@ namespace CalamityMod.Projectiles.Magic float velLength = Projectile.velocity.Length(); if (Projectile.ai[2] == 0) { - Projectile.velocity += Projectile.DirectionTo(goalPos) * 0.15f; + float maxDist = 57600; //240^2 + NPC target = null; + foreach (var item in Main.ActiveNPCs) + { + if (item.CanBeChasedBy(item) && item.DistanceSQ(goalPos) < maxDist) + { + maxDist = item.DistanceSQ(goalPos); + target = item; + } + } + if (target != null) + { + goalPos = target.Center; + Projectile.ai[0] = goalPos.X; + Projectile.ai[1] = goalPos.Y; + Projectile.Calamity().HomingTarget = target.whoAmI; + } else + { + Projectile.Calamity().HomingTarget = -1; + } + + Projectile.velocity += Projectile.DirectionTo(goalPos); Projectile.velocity.Normalize(); if (Projectile.velocity.HasNaNs()) Projectile.velocity = Vector2.UnitY; @@ -51,6 +72,7 @@ namespace CalamityMod.Projectiles.Magic } else { + Projectile.Calamity().HomingTarget = -1; Projectile.velocity *= 0.98f; if (Projectile.velocity.Length() < 1 && Projectile.ai[2] == 1) Projectile.Kill(); @@ -59,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation += 0.05f; Projectile.scale = MathHelper.Min(Projectile.scale + 0.02f, 1); Player closestPlayer = null; - float closestDis = 200; + float closestDis = 320; foreach (var player in Main.ActivePlayers) { var dis = Projectile.Distance(player.Center); @@ -86,11 +108,15 @@ namespace CalamityMod.Projectiles.Magic { if (Projectile.ai[2] == 0) { - if (Main.rand.NextFloat() <= 0.4f) //40% chance to become pick-up-able stars + if (Main.rand.NextFloat() <= 0.5f) //50% chance to become pick-up-able stars + { Projectile.ai[2] = 2; + Projectile.timeLeft = 600 * Projectile.MaxUpdates; + } else Projectile.ai[2] = 1; Projectile.velocity *= Main.rand.NextFloat(0.9f, 1.1f); + Projectile.netUpdate = true; } } diff --git a/Projectiles/Magic/DracoConstellation.cs b/Projectiles/Magic/DracoConstellation.cs index 9a6c04023b..21373ae996 100644 --- a/Projectiles/Magic/DracoConstellation.cs +++ b/Projectiles/Magic/DracoConstellation.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Systems.Graphic.PixelationSystem; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -99,22 +98,27 @@ namespace CalamityMod.Projectiles.Magic Segments.Add(new(this, 0.1560f, MathHelper.TwoPi * 0.9f)); Segments.Add(new(this, 0.1458f, MathHelper.TwoPi * 0.85f)); Segments.Add(new(this, 0.0733f, MathHelper.TwoPi * 0.9f)); - }; + } + ; if (Projectile.timeLeft <= 240 && Projectile.timeLeft > 60) { Projectile.timeLeft++; NPC target = null; - if (Main.player[Projectile.owner].HasMinionAttackTargetNPC) + if (Projectile.ai[2] > 0) + { + target = Main.npc[(int)Projectile.ai[2]]; + } + else if (Main.player[Projectile.owner].HasMinionAttackTargetNPC) { target = Main.npc[Main.player[Projectile.owner].MinionAttackTargetNPC]; } - float targetDistance = 800; - if (target == null || Projectile.localNPCImmunity[target.whoAmI] > 0 || target.dontTakeDamage) + float targetDistance = 1600; + if (target == null || !target.CanBeChasedBy(Projectile)) target = null; if (target == null) foreach (var item in Main.ActiveNPCs) { - if (item.dontTakeDamage || Projectile.localNPCImmunity[item.whoAmI] > 0 || item.Distance(Main.player[Projectile.owner].Center) > 1200) + if (!item.CanBeChasedBy(Projectile) || Projectile.localNPCImmunity[item.whoAmI] > 0 || item.Distance(Main.player[Projectile.owner].Center) > 1200) continue; var dis = Projectile.Distance(item.Center); if (dis < targetDistance) @@ -127,11 +131,16 @@ namespace CalamityMod.Projectiles.Magic { float velLength = Projectile.velocity.Length(); Projectile.velocity += Projectile.DirectionTo(target.Center) * 0.5f; + Projectile.ai[2] = target.whoAmI + 1; } - else if (Projectile.Distance(Main.player[Projectile.owner].Center) > 300) + else { - float velLength = Projectile.velocity.Length(); - Projectile.velocity += Projectile.DirectionTo(Main.player[Projectile.owner].Center) * 0.5f; + Projectile.ai[2] = 0; + if (Projectile.Distance(Main.player[Projectile.owner].Center) > 300) + { + float velLength = Projectile.velocity.Length(); + Projectile.velocity += Projectile.DirectionTo(Main.player[Projectile.owner].Center) * 0.5f; + } } if (Projectile.velocity.Length() > 5) Projectile.velocity *= 0.98f; @@ -197,44 +206,41 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(ref Color lightColor) { - PixelationManager.AddPixelatedDrawer(drawLayer: Enums.GeneralDrawLayer.AfterProjectiles, defaultBlendState: BlendState.Additive, drawAction: (matrix) => + var tex = TextureAssets.Projectile[Type].Value; + var connectioncolor = Color.SkyBlue * ((MathF.Sin(Main.GlobalTimeWrappedHourly) + 1) * 0.125f + 0.75f); + for (var i = 0; i < Segments.Count; i++) { - var tex = TextureAssets.Projectile[Type].Value; - var connectioncolor = Color.SkyBlue * ((MathF.Sin(Main.GlobalTimeWrappedHourly) + 1) * 0.125f + 0.75f); - for (var i = 0; i < Segments.Count; i++) - { - if (i == 0) - { - CalamityUtils.DrawLineBetter(Main.spriteBatch, Projectile.Center, Segments[i].Center, connectioncolor, 2 * Projectile.scale); - } - if (Segments.IndexInRange(i + 1)) - { - var nextSegment = Segments[i + 1]; - CalamityUtils.DrawLineBetter(Main.spriteBatch, Segments[i].Center, nextSegment.Center, connectioncolor, 2 * Projectile.scale); - } - Main.spriteBatch.Draw(GetGlowTex(), Segments[i].Center - Main.screenPosition, null, Color.SkyBlue, 0, GetGlowTex().Size() * 0.5f, 0.2f * Projectile.scale, SpriteEffects.None, 0); + if (i == 0) + { + CalamityUtils.DrawLineBetter(Main.spriteBatch, Projectile.Center, Segments[i].Center, connectioncolor, 2 * Projectile.scale); + } + if (Segments.IndexInRange(i + 1)) + { + var nextSegment = Segments[i + 1]; + CalamityUtils.DrawLineBetter(Main.spriteBatch, Segments[i].Center, nextSegment.Center, connectioncolor, 2 * Projectile.scale); + } + Main.spriteBatch.Draw(GetGlowTex(), Segments[i].Center - Main.screenPosition, null, Color.SkyBlue, 0, GetGlowTex().Size() * 0.5f, 0.2f * Projectile.scale, SpriteEffects.None, 0); - Main.spriteBatch.Draw(tex, Segments[i].Center - Main.screenPosition, null, Color.White, 0 * Segments[i].followDistance * 5f * Main.GlobalTimeWrappedHourly, tex.Size() * 0.5f, 0.75f * Projectile.scale, SpriteEffects.None, 0); - } - void DrawHeadStar(Vector2 offsetPercentage) - { - Main.spriteBatch.Draw(GetGlowTex(), Projectile.Center + offsetPercentage.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength - Main.screenPosition, null, Color.SkyBlue, 0, GetGlowTex().Size() * 0.5f, 0.2f * Projectile.scale, SpriteEffects.None, 0); - Main.spriteBatch.Draw(tex, Projectile.Center + offsetPercentage.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength - Main.screenPosition, null, Color.White, 0 * Math.Abs(offsetPercentage.X) * 5f * Main.GlobalTimeWrappedHourly, tex.Size() * 0.5f, 0.75f * Projectile.scale, SpriteEffects.None, 0); - } - void connectOffsets(Vector2 offset1, Vector2 offset2) - { - CalamityUtils.DrawLineBetter(Main.spriteBatch, Projectile.Center + offset1.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength, Projectile.Center + offset2.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength, connectioncolor, 2 * Projectile.scale); + Main.spriteBatch.Draw(tex, Segments[i].Center - Main.screenPosition, null, Color.White, 0 * Segments[i].followDistance * 5f * Main.GlobalTimeWrappedHourly, tex.Size() * 0.5f, 0.75f * Projectile.scale, SpriteEffects.None, 0); + } + void DrawHeadStar(Vector2 offsetPercentage) + { + Main.spriteBatch.Draw(GetGlowTex(), Projectile.Center + offsetPercentage.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength - Main.screenPosition, null, Color.SkyBlue, 0, GetGlowTex().Size() * 0.5f, 0.2f * Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(tex, Projectile.Center + offsetPercentage.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength - Main.screenPosition, null, Color.White, 0 * Math.Abs(offsetPercentage.X) * 5f * Main.GlobalTimeWrappedHourly, tex.Size() * 0.5f, 0.75f * Projectile.scale, SpriteEffects.None, 0); + } + void connectOffsets(Vector2 offset1, Vector2 offset2) + { + CalamityUtils.DrawLineBetter(Main.spriteBatch, Projectile.Center + offset1.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength, Projectile.Center + offset2.RotatedBy(Projectile.rotation - MathHelper.PiOver2) * TailLength, connectioncolor, 2 * Projectile.scale); - } - connectOffsets(new(), new(-0.0425f, 0.0637f)); - connectOffsets(new(), new(0.0307f, 0.0418f)); - connectOffsets(new(-0.0425f, 0.0637f), new(0.0168f, 0.0791f)); - connectOffsets(new(0.0307f, 0.0418f), new(0.0168f, 0.0791f)); - DrawHeadStar(new()); - DrawHeadStar(new(-0.0425f, 0.0637f)); - DrawHeadStar(new(0.0307f, 0.0418f)); - DrawHeadStar(new(0.0168f, 0.0791f)); - }); + } + connectOffsets(new(), new(-0.0425f, 0.0637f)); + connectOffsets(new(), new(0.0307f, 0.0418f)); + connectOffsets(new(-0.0425f, 0.0637f), new(0.0168f, 0.0791f)); + connectOffsets(new(0.0307f, 0.0418f), new(0.0168f, 0.0791f)); + DrawHeadStar(new()); + DrawHeadStar(new(-0.0425f, 0.0637f)); + DrawHeadStar(new(0.0307f, 0.0418f)); + DrawHeadStar(new(0.0168f, 0.0791f)); return false; } diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 432b216102..272788dddc 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -102,8 +102,8 @@ namespace CalamityMod.Projectiles.Summon offset.X *= Projectile.spriteDirection; var star = new BloomParticle(SiriusPos + offset * Projectile.scale - (Owner.oldVelocity * Math.Clamp(offset.Length() * 0.001f,0,1) ), Vector2.Zero, Color.SkyBlue * ((Owner.miscCounter + flashOffset) % flashMod < 5 ? 0.75f : 1f), 2*SiriusScale * intensity, 2*SiriusScale * intensity, 2, false); var star2 = new CustomSpark(SiriusPos + offset * Projectile.scale - (Owner.oldVelocity * Math.Clamp(offset.Length() * 0.001f, 0, 1)), Vector2.UnitX.RotatedBy(MathHelper.Pi * (Owner.miscCounter/300f)) * 0.1f, "CalamityMod/Particles/Sparkle", false, 2, 10*SiriusScale * intensity, Color.SkyBlue, Vector2.One); - GeneralParticleHandler.SpawnParticle(star,true,Enums.GeneralDrawLayer.AfterProjectiles); - GeneralParticleHandler.SpawnParticle(star2, true, Enums.GeneralDrawLayer.AfterProjectiles); + GeneralParticleHandler.SpawnParticle(star,false,Enums.GeneralDrawLayer.AfterProjectiles); + GeneralParticleHandler.SpawnParticle(star2, false, Enums.GeneralDrawLayer.AfterProjectiles); } SpawnStar(0,new Vector2(0f, 0f), 1.5f, 0,300); //Sirius SpawnStar(2, new Vector2(-118f, 217f), 0.75f, 40); //bottom @@ -238,8 +238,6 @@ namespace CalamityMod.Projectiles.Summon var color = Color.SkyBlue * 0.75f * ((MathF.Sin(Main.GlobalTimeWrappedHourly) + 1) * 0.25f + 0.5f); CalamityUtils.DrawLineBetter(Main.spriteBatch, SiriusPos+point1 * Projectile.scale - (Owner.oldVelocity * Math.Clamp(point1.Length() * 0.001f, 0, 1)), SiriusPos+point2* Projectile.scale - (Owner.oldVelocity * Math.Clamp(point2.Length() * 0.001f, 0, 1)), color, 2f); } - PixelationManager.AddPixelatedDrawer(drawLayer: Enums.GeneralDrawLayer.AfterProjectiles, drawAction: (matrix) => - { ConnectStars(4, new Vector2(0f, 0f), new Vector2(119f, 32f)); //Sirius - Front Foot ConnectStars(2, new Vector2(0f, 0f), new Vector2(-118f, 217f)); //Sirius - Bottom @@ -253,7 +251,6 @@ namespace CalamityMod.Projectiles.Summon ConnectStars(8, new Vector2(-62f, 11f), new Vector2(-101f, -23f)); // Neck - Head ConnectStars(8, new Vector2(-101f, -23f), new Vector2(-50f, -103f)); // Head - Nose ConnectStars(7, new Vector2(-50f, -103f), new Vector2(-62f, 11f)); // Nose - Neck - }); return false; } #endregion