From a80f8106b630e395e4bbebad9be211214760fcc5 Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 12 Jul 2022 16:51:36 -0500 Subject: [PATCH] ANIME slash for Exoblade --- Effects/ExobladeSlashShader.fx | 2 +- Effects/ExobladeSlashShader.xnb | Bin 4072 -> 4088 bytes Projectiles/Melee/Exobeam.cs | 69 ++++++++------------ Projectiles/Melee/Exobeam.png | Bin 894 -> 769 bytes Projectiles/Melee/ExobeamSlash.cs | 77 +++++++++++++++++++++++ Projectiles/Melee/ExobeamSlash.png | Bin 0 -> 4535 bytes Projectiles/Melee/ExobeamSlashCreator.cs | 52 +++++++++++++++ Projectiles/Melee/ExobladeProj.cs | 18 ++++-- 8 files changed, 171 insertions(+), 47 deletions(-) create mode 100644 Projectiles/Melee/ExobeamSlash.cs create mode 100644 Projectiles/Melee/ExobeamSlash.png create mode 100644 Projectiles/Melee/ExobeamSlashCreator.cs diff --git a/Effects/ExobladeSlashShader.fx b/Effects/ExobladeSlashShader.fx index 66ba42b214..45044b6323 100644 --- a/Effects/ExobladeSlashShader.fx +++ b/Effects/ExobladeSlashShader.fx @@ -66,7 +66,7 @@ float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 float noise = tex2D(uImage1, noiseCoords).r; float noise2 = pow(tex2D(uImage1, noiseCoords * 2.2).r, 1.6); float noise3 = pow(tex2D(uImage1, noiseCoords * 1.1).r, 1.3); - float opacity = noise * pow(saturate((1 - coords.x) - noise * coords.x * 0.45), 0.8); + float opacity = noise * pow(saturate((1 - coords.x) - noise * coords.y * 0.54), 3); // Fade to the second primary color. color = lerp(color, float4(uColor, 1), noise2); diff --git a/Effects/ExobladeSlashShader.xnb b/Effects/ExobladeSlashShader.xnb index 2b150ad514e5b6be3ec7476645e9e0af2d9c6a7e..65fc72dd88bf04f9e0681161721c28c15f8504da 100644 GIT binary patch delta 471 zcmYjNJxc>Y6r6XLWY2tf7z+!Fh+-uoR%#JX1PdEKiUmRIkXBMydVfG9Y_Jo~!X{ma zKOhzsLekg#CY07S#^b#E9R_G~>c z&HRGtH>mZKRSY>g*J0&3}rmh093`rQWr=B>26Wk>CHwl0R1NwJNT@`8|W Q__WwWvx}m;=d(BR3kWb?2mk;8 delta 451 zcmYLGze@u#6#ib)-ktSqvAQ|5Ae|J%t&3g}oD_>gK>vY5aCC6Z;HZeCxC!T=L#LKH z>fqpZ_eTh&ba8TVt1r2$LWaEe{S5hOOdI~m(cWd5rg#1Wb%syxBmi?JHmG5G;(|OA z$SuOCEng&EjlR5FX?m5_O&_%+OT$i%_)5E@Xr1n|l49{P!AJ{G&%J~PXJl#CGidOj0~XYky2IL&dhA4aDEtN#6< z17_I_4wGOdSh>I)>kKRxvnn)o%VW*VX_}5x%G1nSxK6(L4DZ`R7AIVXxd9s}&5tVX zGi{B9dkh$x>AZ{!Hs4FF0~-Kfknih`!=)dsPxDW!xP&T73Rg-nZoLULE;MGHGTrJL K|H*mvhJFF_tY4D= diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 6b86724f37..151efb8843 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -4,31 +4,33 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using CalamityMod.Items.Weapons.Typeless; namespace CalamityMod.Projectiles.Melee { public class Exobeam : ModProjectile { - private int counter = 0; - public override void SetStaticDefaults() { - DisplayName.SetDefault("Beam"); - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + DisplayName.SetDefault("Exobeam"); + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - Projectile.width = 16; - Projectile.height = 16; + Projectile.width = 106; + Projectile.height = 106; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.penetrate = 1; Projectile.extraUpdates = 1; Projectile.alpha = 255; Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; Projectile.light = 1f; } @@ -37,22 +39,35 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.localAI[1] == 0f) { SoundEngine.PlaySound(SoundID.Item60, Projectile.position); - Projectile.localAI[1] += 1f; + Projectile.localAI[1] = 1f; } // Aim very, very quickly at targets. NPC potentialTarget = Projectile.Center.ClosestNPCAt(1600f, false); if (potentialTarget != null) { - Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * (Projectile.velocity.Length() + 2f); - Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.1f); + Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * (Projectile.velocity.Length() + 3.5f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealVelocity, 0.08f); + } + + // Dissipate if colliding with tiles. + if (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + { + Projectile.Opacity -= 0.08f; + if (Projectile.Opacity <= 0f) + Projectile.Kill(); } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; + Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity + 0.1f, 0f, 1f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + SoundEngine.PlaySound(YanmeisKnife.HitSound, target.Center); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromAI(), target.Center, Projectile.velocity * 0.1f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, target.whoAmI); + target.ExoDebuffs(); } @@ -61,45 +76,15 @@ namespace CalamityMod.Projectiles.Melee target.ExoDebuffs(); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(0, 255, 255, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => Color.White with { A = 0 } * Projectile.Opacity; public override bool PreDraw(ref Color lightColor) { if (Projectile.timeLeft > 595) return false; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 4); return false; } - - public override void Kill(int timeLeft) - { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 192; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); - for (int num193 = 0; num193 < 3; num193++) - { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - } - for (int num194 = 0; num194 < 30; num194++) - { - int num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } } } diff --git a/Projectiles/Melee/Exobeam.png b/Projectiles/Melee/Exobeam.png index b35841741be8a54566dd12b96311492a91122188..78bd48076fd2e5ed34db3c12d1ba10c6b688ff7b 100644 GIT binary patch literal 769 zcmV+c1OEJpP)Px#1ZP1_K>z@;j|==^1poj5Bv4FLMKzXeMae=sVQG|$d`7XyG4;pl|1LFUl>YzB zFhprHK2iVx0J1QaPXGV_40KXXQ~&?}|NsC0|NsC0021HM&Hw-a32;bRa{vGi!vFvd z!vV){sAK>D0!~RpK~!i%-PqA`f-n?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^5#I!H-lH1t!2i7{E761>tdUlAI%{(4AIUeLZXFk7daz1mV ze$Mk&18d5b^L%F}DxelX79ZW@vBi33c$i# zD|YN7Y60-Tk=qedPnf{pYx8fsn1@@zW%`%z(DU0~n~&J)20{rHST_KGjQ2W{62HHE zugg4$slB{r?hDoo-iNj0%e<(7S^&0O_q{GL&nq;4uhc6^-?vs`-@wDv2-fd{7*w*7&PKv4m;08lBj)sF-oT_Qi%IZ%2;*Exd#zGdJHUB})Sy%Eld zP DisplayName.SetDefault("Exobeam Slash"); + + public override void SetDefaults() + { + Projectile.width = 512; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.Opacity = 1f; + Projectile.timeLeft = 35; + Projectile.MaxUpdates = 2; + Projectile.scale = 0.75f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Opacity = Projectile.timeLeft / 35f; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + } + + public override bool ShouldUpdatePosition() => true; + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.Cyan, Color.Lime, Projectile.identity / 7f % 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > 33) + return false; + + Main.spriteBatch.SetBlendState(BlendState.Additive); + + Texture2D texture = ModContent.Request(Texture).Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = texture.Size() * 0.5f; + Vector2 scale = new Vector2(1f, 0.75f) * Projectile.scale; + Vector2 bloomScale = Projectile.Size / bloomTexture.Size() * new Vector2(1f, 2f); + Vector2 bloomOrigin = bloomTexture.Size() * 0.5f; + Main.spriteBatch.Draw(bloomTexture, drawPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, bloomOrigin, bloomScale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, scale, 0, 0f); + Main.spriteBatch.Draw(texture, drawPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, origin, scale * new Vector2(1f, 0.6f), 0, 0f); + + Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + } +} diff --git a/Projectiles/Melee/ExobeamSlash.png b/Projectiles/Melee/ExobeamSlash.png new file mode 100644 index 0000000000000000000000000000000000000000..ab9cfc8e8f0f05cb703774894616e72c73cd9a17 GIT binary patch literal 4535 zcmZvgS5%V;(}3R)kPbnL^sWKvAiZOx2vS#yR6zx)OGio!i1e5M0xpO|1;M4nprC@G zD1^`v>0JmlG^vRJ^0~MF`JZ#9UCf-hn3;>ow70e3WD{ls0D#lV66Od141ZiekmcMT zo#T7$;vWNwbhI!7>IOvD{{)QwrZ-Fh0Ec2fxy|$^X8qgJEfN5@zWyg5e!1%i0N}B) zf|>pm=e1R8RVezAC#|`}@CTo!!6bWa5|c!y|1M{TOoo0)l8I8Vp&PjW1vA}SmVrML z#-)i4Zv55CEPaU)QFG~xSo7~TKJEW!HRE(d`^qNY{6qR_Zqp-Mkp=s$Yf$I#yx(dI z-h1!$i@HqfmTW!PbNo~|%eZ0#QKg>*LPrXpG~1r?5j8JpFSok*sc0H}NunKTb#rp+ zUsV9KQdzhnB2yGHfxSqRs9cuJeX`e+>h+5bg(PkB`ZB)s^z<%fX6Eoxp?V2CBu@|F zk>64K3raI{v@rEJzxob4fn)<}qbr#ZW4Mn#L1h=kB_xi;#l`a)MP}yb!~OyS#Io6e z&H({n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fuu02?xRpy}#e?|r7xpsji#@Ic zk+>@P^VpI!ebI?m5m zIH85-A3J^^e`4~dCKEp!+ zv#XokHyvY>yYa@%Yv==T7<6b*F@t$ox;#94EZ5B6k6+yl=-cu<X}a99 z=(11ZIAh5(%OvvySwEFWi7G(-POXF5T_d8L3QK*tu4~Xp?$Ym48<1g>%x_0=5jl}N zJCs6ODdv9 zAo#Jk#z%gHxd$`8@>Cs#Rdp}bc?Pc`WM>B74~1C!(%95|~|MqDa1TFtd* zSho=2;gs-@Yhh@ty$AG>7j5lI!;o@TF?JiW!6{6*4oJxeXyr(`m3IVa%8c?|OTIhm z=$jvA;#F_@6c5TeoWFj7$7)n^Hd9H)5I#W7aB!y`PC$&flazsxM3spkbvz1L@2wKy zs({mbhi49gp1WLPcdPQX4R*3T8NW9kP&_@g=f_y;A z{7Z9HZ!7>g$Aqw7S;{?VA_r4o6U#qGhkWApS2$z&r}==$vx~+b$>{ar=NJE!mX9gj zd3!sHq}6_@gGKOt)XcE%O2ojj5MGN$vpWv!(Z2G3F!0>mI^}ll37U^*MKu0-wg6Vw LY+-d~J}LhL%^99{ literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/ExobeamSlashCreator.cs b/Projectiles/Melee/ExobeamSlashCreator.cs new file mode 100644 index 0000000000..6547f5074c --- /dev/null +++ b/Projectiles/Melee/ExobeamSlashCreator.cs @@ -0,0 +1,52 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ExobeamSlashCreator : ModProjectile + { + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anime Sword Effect"); + } + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 45; + Projectile.MaxUpdates = 2; + } + + public override void AI() + { + if (Main.myPlayer == Projectile.owner && Projectile.timeLeft % 20 == 19) + { + float maxOffset = Target.width * 0.4f; + if (maxOffset > 300f) + maxOffset = 300f; + Vector2 baseDirection = Vector2.UnitX; + if (Projectile.timeLeft <= 20) + baseDirection = -Vector2.UnitY; + + Vector2 spawnOffset = baseDirection.RotatedBy(Main.rand.NextFloatDirection() * 0.63f).SafeNormalize(Vector2.UnitY); + spawnOffset *= Main.rand.NextFloatDirection() * maxOffset; + Vector2 sliceVelocity = spawnOffset.SafeNormalize(Vector2.UnitY) * 0.1f; + + Projectile.NewProjectile(Projectile.GetSource_FromAI(), Target.Center + spawnOffset, sliceVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index 8b9047b06b..d5c403ee82 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using CalamityMod.DataStructures; using System.Linq; using static CalamityMod.CalamityUtils; +using CalamityMod.Sounds; namespace CalamityMod.Projectiles.Melee { @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee public const float StartingSwingRotation = -0.72f; public const float EndingSwingRotation = StartingSwingRotation + MathHelper.TwoPi - 0.33f; - // Starts at 0.125 and reels back. + // Starts at 0.27 and reels back. public static CurveSegment Anticipation => new(EasingType.PolyInOut, 0f, 0.27f, -0.27f); public static CurveSegment SlashWait => new(EasingType.Linear, 0.37f, 0f, 0f); @@ -54,6 +55,7 @@ namespace CalamityMod.Projectiles.Melee // After reeling back, a powerful slash happens. public static CurveSegment Slash => new(EasingType.PolyOut, 0.51f, 0f, 1f); + // Manual easing code handles this, due to a 0-1 clamp within the piecewise curve function generator. public static CurveSegment HoldBladeInPlace => new(EasingType.Linear, 0.7f, 1f, 0f); public override string Texture => "CalamityMod/Items/Weapons/Melee/Exoblade"; @@ -146,7 +148,13 @@ namespace CalamityMod.Projectiles.Melee { // Decide the swing direction. if (Owner.itemAnimation == Owner.itemAnimationMax) + { + Direction = Owner.direction; SwingDirection = 1f; + } + + if (Owner.itemAnimation == (int)(Owner.itemAnimationMax * 0.6)) + SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound, Projectile.Center); float exactSwingCompletion = 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; float directionalSwingCompletion = exactSwingCompletion; @@ -163,7 +171,9 @@ namespace CalamityMod.Projectiles.Melee // Decide the swing direction. Projectile.rotation = MathHelper.Lerp(StartingSwingRotation, EndingSwingRotation, swingCompletion); - Projectile.rotation = Projectile.rotation.AngleLerp(MathHelper.Lerp(StartingSwingRotation, EndingSwingRotation, 0.27f), Utils.GetLerpValue(0.8f, 1f, directionalSwingCompletion, true)); + + float returnToAnticiation = (float)Math.Pow(Utils.GetLerpValue(0.8f, 0.9f, directionalSwingCompletion, true), 2D); + Projectile.rotation = Projectile.rotation.AngleLerp(MathHelper.Lerp(StartingSwingRotation, EndingSwingRotation, 0.27f), returnToAnticiation); Projectile.rotation = Projectile.rotation * Direction - MathHelper.PiOver4; if (Direction == -1) Projectile.rotation -= MathHelper.PiOver2; @@ -177,7 +187,7 @@ namespace CalamityMod.Projectiles.Melee // Create a bunch of homing beams. int beamShootRate = Projectile.MaxUpdates * 2; - if (Main.myPlayer == Projectile.owner && Projectile.timeLeft % beamShootRate == 0 && swingCompletion > 0.2f && swingCompletion < 0.9f) + if (Main.myPlayer == Projectile.owner && Projectile.timeLeft % beamShootRate == 0 && swingCompletion > 0.3f && swingCompletion < 0.9f) { int boltDamage = Projectile.damage / 2; Vector2 boltVelocity = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2(); @@ -223,7 +233,7 @@ namespace CalamityMod.Projectiles.Melee { List result = new(); - for (int i = 0; i < Owner.itemAnimationMax; i++) + for (int i = 0; i < Owner.itemAnimationMax * 0.45; i++) { if (Projectile.oldRot[i] == 0f) continue;