From 6b3cb93b8eca83f8e5e2e0652692630606aaac7a Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Sat, 15 Jan 2022 04:03:57 +0100 Subject: [PATCH] Spinning harder --- Particles/CircularSmearVFX.cs | 8 --- Particles/LineVFX.cs | 47 +++++++++++++++ Particles/ThickEndedLine.png | Bin 0 -> 2030 bytes Particles/ThinEndedLine.png | Bin 0 -> 2011 bytes .../Melee/TrueBiomeBladeProjectiles.cs | 57 ++++++++++++++++-- 5 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 Particles/LineVFX.cs create mode 100644 Particles/ThickEndedLine.png create mode 100644 Particles/ThinEndedLine.png diff --git a/Particles/CircularSmearVFX.cs b/Particles/CircularSmearVFX.cs index e890ba908c..28ae240cc5 100644 --- a/Particles/CircularSmearVFX.cs +++ b/Particles/CircularSmearVFX.cs @@ -10,7 +10,6 @@ namespace CalamityMod.Particles { public override string Texture => "CalamityMod/Particles/CircularSmear"; public override bool UseAdditiveBlend => true; - public override bool UseCustomDraw => false; public override bool SetLifetime => true; public float opacity; @@ -24,12 +23,5 @@ namespace CalamityMod.Particles Rotation = rotation; Lifetime = 2; } - - public override void CustomDraw(SpriteBatch spriteBatch) - { - Texture2D tex = GeneralParticleHandler.GetTexture(Type); - - spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity * 0.5f, 0, tex.Size()/2f, Scale, SpriteEffects.None, 0); - } } } diff --git a/Particles/LineVFX.cs b/Particles/LineVFX.cs new file mode 100644 index 0000000000..1589c0a522 --- /dev/null +++ b/Particles/LineVFX.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class LineVFX : Particle + { + public override string Texture => "CalamityMod/Particles/ThinEndedLine"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + + public override bool SetLifetime => true; + public float opacity; + public Vector2 LineVector; + public bool Concave; + + public LineVFX(Vector2 startPoint, Vector2 lineVector, float thickness, Color color, bool concave = false) + { + Position = startPoint; + LineVector = lineVector; + Scale = thickness; + Color = color; + Concave = concave; + Velocity = Vector2.Zero; + Rotation = 0; + Lifetime = 2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex; + if (Concave) + tex = ModContent.GetTexture("CalamityMod/Particles/ThickEndedLine"); //THICC :wearty: weary: :weary : oogogg;... ooog... that line be lookin' mighty fine... :hot: + else + tex = GeneralParticleHandler.GetTexture(Type); + + float rot = LineVector.ToRotation() + MathHelper.PiOver2; + Vector2 origin = new Vector2(tex.Width/2f, tex.Height); + Vector2 scale = new Vector2(Scale, LineVector.Length() / tex.Height); + + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, rot, origin, scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/ThickEndedLine.png b/Particles/ThickEndedLine.png new file mode 100644 index 0000000000000000000000000000000000000000..3ed82b15778b9e700c3c1a92bd57a93e94d24019 GIT binary patch literal 2030 zcmVPx+s7XXYRCt{2T+50aM-Yteu6bGh3xQ5Xu>T_j0->vJ24kOWF!-*E5C{bN9?1yw zDe~^j^uvd(*vX8|>e(5g%WmbRHmke3Ybqljm6g5C&gqDL|JioC-ChcR zW&8P@_M}6#@Li ztf*VDVHgH`U00sGxo`Lp6Xo;uy~mKKq`$8sfPa*9%IMr6?HKhB!_Wi3<>jS&(dW;f z9e;6gF?(Id^Z9+>_x3$Rh9WSSXZZUn0=QDDTP4XVPl>c`yU%U+BPQDS{r<>2_A+nx zJ4&{rBB10~sZ(6puIp0fDe+xyI{;{!rpbH@0Po(t`wak6N(lg7ym;}~+(cC8-@kwV zhkgHkzu!fzNJs!Tk6^la1sv@V03VC&cqnI^SvtZW4uAe ztSzVrpl)_Bl%VwME+R_uG8mkog^O*aaF}u(k73Z=v2w zy+}oXN}3Ypic!+kaq=b7=MBT~T{b`^Yjl2_+t4eh7c1>uDgtyxnx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Line.png new file mode 100644 index 0000000000000000000000000000000000000000..c954f46b96fa75d1d8efa179a36c9886d1366931 GIT binary patch literal 2011 zcmV<12PF83P)Px+l}SWFRCt{2TwAW&HV{3cWXndngYF@~T|{;f1PBmh2?YxDuRwt=AqWs4Kz5Nm zBt`bnC8XE3Ui~nSHFHeL*G|6f<^0f;D2diNGaL?wszL}Y08~{~;V2>2YZ$4jDo9yL zyDHPZN}d1w`SZWF{^G@pU*Tl}fN7doj+yfV0F2`}xRY~xy?(U!4S3?xnBPPcv7BNV z?0Ja-iV z^SRMukpWH9SbLPR{u2O1AWw)+)704WRaN!&dbY3YnoMvurZ7N}BNOVn*73fPc8&oC z`CzX%)*bdbm9}kHfJ2T5*R~!)7~*k`5^56=>%FayE2*f zRjX9H1f!C+;jAM~(*m>38yi4I5c$T|&G8NZhG8JW%HScMA6&n$ePfSJs_l0B3os*3 zU9ao9k>dfFtu@~u+mRteh~qlTj~_q&b4|xyy?S*A%(_1e1Fd%#j}HLQ_kC~c!!Y#r zI#UkPuGjzoXjJD}H=}? z0o8d$vT2%is$J7GD|?&>n0nIsZ?{`lzrVkC^|o!dfJ4^#13cdMeFwPF2C)v?j<~iu`)L zZezW*?JhCk`Sa(l{^iRT06^Du0M7jY_52Qp!|ow}&>%k9`<&tn54p)>md5!0Itz3N zUP9g+-^A+{J;6(&3{dNy(|wH}u>VBd#2(9B05~$hd2H&-^Nr<@r?plapdO@(9;WV7 zcwhDP6?qd8n(Xt<{C|wkqbEt5S8M>_*99E%T2hxeD>S2ns~d(mPx4wJqfBhkfu-vP zs{6w*u-~2S2S)*}9~1@{WYzksACQa#=;*-m?c2A1+Xw0VUq#QqdGqEkTYvZN-ETnN zvm>%O2A|deWF4b0Ky84|4$XRj+5&of>OtP*`(Ny+Sa*ZC#xk4K@xJf%|CO~t;K+a^ z@@Kk|i5)8PELErP?(P;lqUXPU{p#w8=O;%g?RO%lsW8CG*%+Ph3-rzAnDU@JfLn$A zU}Q+2n_Ht?C`&v5FcBd|Fqh+#IG@ZDc=qhs4|Qz4Uc0(JH#b@>^fw81VZcKh((`(3 zQW!vAnxdH*Dv9%&(>npc_wV0-sAGpiI=r8V?z*`_uAhlqV*rH#vklPbDc_hzQT5I1 zY)rGZf0pq6`rJ!QRMG!e7{DJnozh5)#@Z6OH$8B^-mkv>CEs7K*PI|-FHi<1`kDNH zg#jk2dMT?anT=&~ak^OEv<`4d7#&{dhsz$*|BY%Xzm!{1D4z?(qBf z?|%p8SmNu~um4=?i0b@@4ggd5n}0>U~+MsA91bF570eBiCJFK)6-J( z3d$%D9#m0Xf1cQD_4c!Gurmkftp#{>>=YyJ+{5XF#>tY~0@AT&|7o1l8{e zT-rsh^6AqjHyL>O@}=8Akjnr~WP}oNjQ}O1+s0!pnWDgPWytyPlpF&5ZUD2rPaakD z_^SD0j@BGLDfLJ@h(v|0mCY{{cte(nn9BHYorA002ovPDHLkV1m!``-=bo literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/TrueBiomeBladeProjectiles.cs b/Projectiles/Melee/TrueBiomeBladeProjectiles.cs index 94da220b7d..89d0b05634 100644 --- a/Projectiles/Melee/TrueBiomeBladeProjectiles.cs +++ b/Projectiles/Melee/TrueBiomeBladeProjectiles.cs @@ -48,7 +48,11 @@ namespace CalamityMod.Projectiles.Melee public float maxEmpowermentBoost = 2f; public float throwTimer => throwOutTime - projectile.timeLeft; + + public float AngleReset = 0f; + public bool CanDirectFire = true; public Particle smear; + public Particle sightLine; public NPC lastTarget; public override void SetStaticDefaults() @@ -144,6 +148,7 @@ namespace CalamityMod.Projectiles.Melee else if (rotation > MathHelper.PiOver2 - MathHelper.PiOver4 && rotation < MathHelper.PiOver2 + MathHelper.PiOver4 && hasMadeSound == 0f) { + CanDirectFire = true; hasMadeSound = 1f; Main.PlaySound(SoundID.Item71); } @@ -152,7 +157,7 @@ namespace CalamityMod.Projectiles.Melee if (Empowerment / maxEmpowerment >= 0.5) { - if ((Empowerment + OverEmpowerment) % (40 + (int)(40 * (1 - Empowerment / maxEmpowerment))) == 9) + if ((Empowerment + OverEmpowerment) % 30 == 29) { Vector2 shotDirection = Main.rand.NextVector2CircularEdge(15f, 15f); if (lastTarget != null && lastTarget.active) //If you've got an actual target, angle your shots towards them @@ -182,6 +187,35 @@ namespace CalamityMod.Projectiles.Melee smear.Color = currentColor; } + if (sightLine == null) + { + sightLine = new LineVFX(Owner.Center, Owner.DirectionTo(Main.MouseWorld), 0.2f, Color.HotPink, true); + GeneralParticleHandler.SpawnParticle(sightLine); + } + else + { + sightLine.Position = Owner.Center; + (sightLine as LineVFX).LineVector = Owner.DirectionTo(Main.MouseWorld) * projectile.scale * 1.88f * 78f; + sightLine.Scale = 0.2f; + sightLine.Time = 0; + sightLine.Color = currentColor * 0.7f; + } + + float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi; + float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.DirectionTo(Main.MouseWorld).ToRotation()) + MathHelper.Pi; + float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted)); + + if (CanDirectFire && deltaAngleShoot < 0.1f) + { + Particle Blink = new GenericSparkle(Owner.Center + Owner.DirectionTo(Main.MouseWorld) * projectile.scale * 1.88f * 78f, Owner.velocity, Color.White, currentColor, 3f, 10, 0.1f, 3f); + GeneralParticleHandler.SpawnParticle(Blink); + + Projectile.NewProjectile(Owner.Center, Owner.DirectionTo(Main.MouseWorld) * 15f, ProjectileType(), (int)(projectile.damage * 0.5f), 0f, Owner.whoAmI); + CanDirectFire = false; + AngleReset = Owner.DirectionTo(Main.MouseWorld).ToRotation(); + } + + if (Main.rand.NextBool()) { float maxDistance = projectile.scale * 1.9f * 78f; @@ -255,6 +289,8 @@ namespace CalamityMod.Projectiles.Melee { if (smear != null) smear.Kill(); + if (sightLine != null) + sightLine.Kill(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -371,7 +407,7 @@ namespace CalamityMod.Projectiles.Melee { public NPC target; public Player Owner => Main.player[projectile.owner]; - public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_PurityProjection"; + public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam"; public override void SetStaticDefaults() { @@ -408,10 +444,10 @@ namespace CalamityMod.Projectiles.Melee } } - else if ((projectile.Center - target.Center).Length() >= (projectile.Center + projectile.velocity - target.Center).Length() && CalamityUtils.AngleBetween(projectile.velocity, target.Center - projectile.Center) < MathHelper.PiOver2 * 1.5f) //Home in + else if ((projectile.Center - target.Center).Length() >= (projectile.Center + projectile.velocity - target.Center).Length() && CalamityUtils.AngleBetween(projectile.velocity, target.Center - projectile.Center) < MathHelper.PiOver4) //Home in { projectile.timeLeft = 70; //Remain alive - float angularTurnSpeed = MathHelper.ToRadians(MathHelper.Lerp(25, 10.5f, MathHelper.Clamp(projectile.Distance(target.Center) / 10f, 0f, 1f))); + float angularTurnSpeed = MathHelper.ToRadians(MathHelper.Lerp(15, 2.5f, MathHelper.Clamp(projectile.Distance(target.Center) / 10f, 0f, 1f))); float idealDirection = projectile.AngleTo(target.Center); float updatedDirection = projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); projectile.velocity = updatedDirection.ToRotationVector2() * projectile.velocity.Length(); @@ -430,6 +466,17 @@ namespace CalamityMod.Projectiles.Melee return false; DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + + spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Texture2D tex = Main.projectileTexture[projectile.type]; + + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTime * 2f)), projectile.rotation, tex.Size() * 0.5f, 1f, 0f, 0f); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + return false; } @@ -450,6 +497,8 @@ namespace CalamityMod.Projectiles.Melee int debuffTime = 90; target.AddBuff(BuffType(), debuffTime); } + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTime * 2f)); } //Mercurial tides