From 765f5f7852938d1ea91847476ca4bed4ae20c9fd Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Mon, 10 Jan 2022 15:45:32 +0100 Subject: [PATCH] Workin --- Items/Weapons/Melee/TrueBiomeBlade.cs | 2 +- Particles/SeaFoam.png | Bin 0 -> 830 bytes Particles/SeaFoamParticle.cs | 41 ++++++++++++++++++ .../Melee/MendedBiomeBladeProjectiles.cs | 16 +++++-- 4 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 Particles/SeaFoam.png create mode 100644 Particles/SeaFoamParticle.cs diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index ff7a67e074..1309b8abdd 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Items.Weapons.Melee AttunementInfo.name = "The One Beyond's Abhorrence"; AttunementInfo.function_description = "Hold LMB to charge up a star-piercing sword thrust, and release to unleash the devastating blow"; AttunementInfo.function_extra = "Striking the ground will create an impact so powerful, massive otherwordly monoliths will rise up from the earth"; - AttunementInfo.color = new Color(136, 133, 23); + AttunementInfo.color = new Color(91, 73, 196); break; case Attunement.Marine: AttunementInfo.name = "Gesture for the Drowned"; diff --git a/Particles/SeaFoam.png b/Particles/SeaFoam.png new file mode 100644 index 0000000000000000000000000000000000000000..22129adf9c2a6e44bd4b86d24806a327345c60a1 GIT binary patch literal 830 zcmV-E1Ht@>P)Px%_(?=TRA_$;p4E2YDA?PieGV^gh-JpC8XujVtuTy6Xg7Qy$%3yyQ$(1dOqP;Di%_I0A4HVg#su0tGRIYH%{!Ai0miXrhO4N{YsaP^?kala zdJcO&p927l<7hqzjUu_xH=))g@U9!jF*}OWDB`*S!W;Y&E=AtvDjIO+kuODdyIlZ) zzVFSo?p#FS?RFagU>JrZZ_y|+={2wJC7LMq$YVs_EPZ#3c+e&+OVQKULXX3SCDx&Y?+Na_7=trDgEW)Ylo*4%E1 zCcNDeg6E3})QXrH(`#YLCCJ1IXN=_5z9uj5Nyy(|8D&*5;?a;#IAf%kM>d;HliOIk z?@U9jNb;c zjwY#VdFvX@6P{YrdPbm8q{c%NTAhPsI!4X@h){A17VD3E0w08x?h-8-2mk;807*qo IM6N<$g45xN)c^nh literal 0 HcmV?d00001 diff --git a/Particles/SeaFoamParticle.cs b/Particles/SeaFoamParticle.cs new file mode 100644 index 0000000000..e1290cb487 --- /dev/null +++ b/Particles/SeaFoamParticle.cs @@ -0,0 +1,41 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + + +namespace CalamityMod.Particles { + public class SeaFoamParticle : Particle + { + public override string Texture => "CalamityMod/Particles/SeaFoam"; + public override int FrameVariants => 3; + public override bool UseAdditiveBlend => true; + + + private float Opacity; + private Color ColorStart; + private Color ColorFade; + private float Spin; + + public SeaFoamParticle(Vector2 position, Vector2 velocity, Color colorStart, Color colorFade, float scale, float opacity, float rotationSpeed = 1f) + { + Position = position; + Velocity = velocity; + ColorStart = colorStart; + ColorFade = colorFade; + Scale = scale; + Opacity = opacity; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Spin = rotationSpeed; + Variant = Main.rand.Next(3); + } + + public override void Update() + { + + Opacity--; + + Color = Color.Lerp(ColorStart, ColorFade, MathHelper.Clamp((float)((255 -Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); + } + } +} \ No newline at end of file diff --git a/Projectiles/Melee/MendedBiomeBladeProjectiles.cs b/Projectiles/Melee/MendedBiomeBladeProjectiles.cs index 2172fa052d..38ec50c54a 100644 --- a/Projectiles/Melee/MendedBiomeBladeProjectiles.cs +++ b/Projectiles/Melee/MendedBiomeBladeProjectiles.cs @@ -1537,9 +1537,9 @@ namespace CalamityMod.Projectiles.Melee public ref float CurrentState => ref projectile.ai[0]; public Player Owner => Main.player[projectile.owner]; private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed; - public const float throwOutTime = 40f; - public const float throwOutDistance = 240f; - public const float maxEmpowerment = 1.7f; + public float throwOutTime = 60f; + public float throwOutDistance = 440f; //Turn these into constants when im doine tweakin em + public float maxEmpowerment = 1.7f; public float Empowerment => (projectile.scale - 1f) / (maxEmpowerment - 1f); public override void SetStaticDefaults() @@ -1567,11 +1567,18 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint); } + + public CurveSegment launch = new CurveSegment(EasingType.SineInOut, 0f, 0f, 1f, 4); + public CurveSegment hold = new CurveSegment(EasingType.Linear, 0.65f, 1f, 0f); + public CurveSegment retract = new CurveSegment(EasingType.PolyInOut, 0.8f, 1f, -1.05f, 3); + internal float ThrowCurve() => PiecewiseAnimation((throwOutTime - projectile.timeLeft) / throwOutTime, new CurveSegment[] { launch , hold, retract}); + public override void AI() { if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao { Main.PlaySound(SoundID.Item90, projectile.Center); + projectile.velocity = Vector2.Zero; direction = Owner.DirectionTo(Main.MouseWorld); direction.Normalize(); initialized = true; @@ -1600,6 +1607,7 @@ namespace CalamityMod.Projectiles.Melee projectile.scale = maxEmpowerment; direction = direction.RotatedBy((Empowerment) * MathHelper.PiOver4 * 0.25); + direction.Normalize(); projectile.rotation = direction.ToRotation(); projectile.Center = Owner.Center + (direction * projectile.scale * 10); projectile.timeLeft = (int)throwOutTime + 1; @@ -1607,7 +1615,7 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState == 1f) { - projectile.Center = Owner.Center + (direction * projectile.scale * 10) + ( direction * throwOutDistance * (float)Math.Sin(projectile.timeLeft / throwOutTime * MathHelper.Pi)); + projectile.Center = Owner.Center + (direction * projectile.scale * 10) + ( direction * throwOutDistance * ThrowCurve()); } //Make the owner look like theyre holding the sword bla bla