This commit is contained in:
mountaindrew10 committed 2025-05-10 02:35:12 -05:00
commit 09a5d6597b
11 files changed
+398 -53

No files matched your search

+1
View File
@@ -956,6 +956,7 @@ namespace CalamityMod.CalPlayer
public bool sPauldronVisual = false;
public bool XykVisualsBlue = false;
public bool XykVisualsOrange = false;
public Color XykFXColor = Color.Black;
public bool manaOverloader = false;
/// <summary> Used for allowing Calamity slimes to be affected by Royal Gel. </summary>
public bool royalGel = false;
+59 -35
View File
@@ -225,6 +225,42 @@ namespace CalamityMod.CalPlayer
if (WulfrumHat.PowerModeEngaged(Player, out _))
Player.moveSpeed *= 0.8f;
if ((XykVisualsBlue || XykVisualsOrange))
{
bool Orange = XykVisualsOrange;
Color effectColor = Orange ? Color.Gold : Color.DodgerBlue;
float rate = Main.GlobalTimeWrappedHourly * 12;
List<Color> eColors = new List<Color>()
{
Orange ? new Color(248, 117, 52) : Color.DodgerBlue,
Orange ? Color.Gold : Color.Cyan,
Orange ? Color.Orange : Color.RoyalBlue
};
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
effectColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
bool rageOrAdren = (Player.Calamity().rageModeActive || Player.Calamity().adrenalineModeActive);
bool rageAndAdren = (Player.Calamity().rageModeActive && Player.Calamity().adrenalineModeActive);
Color attemptColor = (rageAndAdren ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) : Player.Calamity().adrenalineModeActive ? Color.MediumSpringGreen : Player.Calamity().rageModeActive ? Color.Crimson : effectColor);
XykFXColor = Color.Lerp(XykFXColor, attemptColor, rageOrAdren ? 0.05f : 0.25f);
int maxWingPieces = 7;
int numOfActiveWings = 0;
foreach (Projectile p in Main.ActiveProjectiles)
if (p.type == ModContent.ProjectileType<XykWings>() && p.owner == Player.whoAmI && p.ai[1] == 0)
numOfActiveWings++;
bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && !(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0;
if (spawnWings)
{
int wingCount = numOfActiveWings;
Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType<XykWings>(), 0, 0f, Player.whoAmI, wingCount);
}
}
// First Frame dash effects
bool dashStart = (Player.dashDelay == -1 && IsFirstDashFrame);
int dir = MathF.Sign(Player.velocity.X);
@@ -363,20 +399,6 @@ namespace CalamityMod.CalPlayer
if (XykVisualsBlue || XykVisualsOrange)
{
bool Orange = XykVisualsOrange;
Color effectColor = Orange ? Color.Gold : Color.DodgerBlue;
float rate = Main.GlobalTimeWrappedHourly * 22;
List<Color> eColors = new List<Color>()
{
Orange ? Color.OrangeRed : Color.DodgerBlue,
Orange ? Color.Gold : Color.Cyan,
Orange ? Color.Orange : Color.RoyalBlue
};
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
effectColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
if (dashStart)
{
@@ -384,18 +406,18 @@ namespace CalamityMod.CalPlayer
SoundEngine.PlaySound(dash with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0f, 0.2f) + (Orange ? 0 : 0.2f) }, Player.Center);
if (Orange)
{
Particle spark1 = new CustomPulse(Player.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0.45f, 0.25f, 47);
Particle spark1 = new CustomPulse(Player.Center, Vector2.Zero, XykFXColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0.45f, 0.25f, 47);
GeneralParticleHandler.SpawnParticle(spark1);
Particle spark2 = new CustomPulse(Player.Center, Vector2.Zero, effectColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0, 0.8f, 17);
Particle spark2 = new CustomPulse(Player.Center, Vector2.Zero, XykFXColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, MathHelper.PiOver4, 0, 0.8f, 17);
GeneralParticleHandler.SpawnParticle(spark2);
}
else
{
Particle spark1 = new CustomPulse(Player.Center, Player.velocity * 0.3f, effectColor, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Player.velocity.ToRotation(), 0, 1f, 24);
Particle spark1 = new CustomPulse(Player.Center, Player.velocity * 0.3f, XykFXColor, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1f), Player.velocity.ToRotation(), 0, 1f, 24);
GeneralParticleHandler.SpawnParticle(spark1);
Particle spark2 = new CustomPulse(Player.Center, Player.velocity * 0.5f, effectColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), Player.velocity.ToRotation(), 0, 0.75f, 17);
Particle spark2 = new CustomPulse(Player.Center, Player.velocity * 0.5f, XykFXColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), Player.velocity.ToRotation(), 0, 0.75f, 17);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
@@ -407,33 +429,35 @@ namespace CalamityMod.CalPlayer
if (!Orange)
{
float sine = (float)Math.Sin(Player.miscCounter * 0.875f / MathHelper.Pi);
for (int i = -1; i <= 1; i += 2)
{
Vector2 offset = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 18f * i;
Vector2 offset = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 17f;
Particle spark1 = new GlowSparkParticle(Player.Center + offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, false, 25, 0.04f * sparkscale1, effectColor * 0.9f, new Vector2(0.8f, 0.3f), true, false, 0.4f);
GeneralParticleHandler.SpawnParticle(spark1);
Particle spark2 = new GlowSparkParticle(Player.Center - offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, false, 25, 0.04f * sparkscale1, effectColor * 0.9f, new Vector2(1, 0.3f), true, false, 0.4f);
GeneralParticleHandler.SpawnParticle(spark2);
Particle spark1 = new CustomSpark(Player.Center + offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, "CalamityMod/Particles/BloomCircle", false, 15, 0.3f * sparkscale1, XykFXColor * 0.85f, new Vector2(0.9f, 1.4f), true, true, 0, shrinkSpeed: 0.2f, glowOpacity: 0.85f);
GeneralParticleHandler.SpawnParticle(spark1);
}
}
else
{
float sparkscale2 = MathF.Min(Player.velocity.X * dir * 0.07f, 1.1f);
Vector2 SparkVelocity2 = Player.velocity.RotatedBy(dir * 2.5f, default) * 0.1f - Player.velocity / 2f;
Particle spark = new LineParticle(Player.Center + (Player.velocity.SafeNormalize(Vector2.UnitX) * 15).RotatedBy(2f * dir) * 1.5f, SparkVelocity2, false, 10, sparkscale2, effectColor);
GeneralParticleHandler.SpawnParticle(spark);
Vector2 SparkVelocity3 = Player.velocity.RotatedBy(dir * -2.5f, default) * 0.1f - Player.velocity / 2f;
Particle spark2 = new LineParticle(Player.Center + (Player.velocity.SafeNormalize(Vector2.UnitX) * 15).RotatedBy(-2f * dir) * 1.5f, SparkVelocity3, false, 10, sparkscale2, effectColor);
GeneralParticleHandler.SpawnParticle(spark2);
for (int i = -1; i <= 1; i += 2)
{
Vector2 offset = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * 17f * i;
Particle spark1 = new CustomSpark(Player.Center + offset + SparkVelocity1, SparkVelocity1 * 2 * sparkscale1, "CalamityMod/Particles/BloomCircle", false, 20, 0.4f * sparkscale1, XykFXColor * 0.95f, new Vector2(0.3f, 1.2f), true, true, 0, shrinkSpeed: 0.2f, glowOpacity: 0.95f);
GeneralParticleHandler.SpawnParticle(spark1);
}
}
for (int i = 0; i < 2; i++)
{
Dust dust = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20, 30) + SparkVelocity1, 267, SparkVelocity1 * Main.rand.NextFloat(0.5f, 3f) * sparkscale1, 0, default, Main.rand.NextFloat(0.7f, 1.1f) * sparkscale1);
bool altDust = Main.rand.NextBool(3);
Dust dust = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20, 30) + SparkVelocity1, altDust ? (Orange ? ModContent.DustType<SquareDust>() : ModContent.DustType<SquashDustHollow>()) : ModContent.DustType<SquashDust>(), SparkVelocity1 * Main.rand.NextFloat(0.5f, 3f) * sparkscale1, 0, default, Main.rand.NextFloat(1.5f, 1.9f) * sparkscale1);
dust.noGravity = true;
dust.color = effectColor;
Dust dust2 = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20, 30) + SparkVelocity1, 10, SparkVelocity1 * Main.rand.NextFloat(0.5f, 3f) * sparkscale1, 0, default, Main.rand.NextFloat(0.9f, 1.4f) * sparkscale1);
dust2.noGravity = true;
dust.color = XykFXColor;
dust.fadeIn = altDust ? 0 : 2;
if (altDust)
dust.scale *= 0.5f;
}
}
}
@@ -19,6 +19,7 @@ namespace CalamityMod.Items.Accessories.Vanity
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs", EquipType.Legs, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this);
}
}
@@ -89,6 +90,7 @@ namespace CalamityMod.Items.Accessories.Vanity
Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head);
Player.wings = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Wings);
}
}
@@ -19,6 +19,7 @@ namespace CalamityMod.Items.Accessories.Vanity
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head2", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body2", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs2", EquipType.Legs, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this);
}
}
@@ -89,6 +90,7 @@ namespace CalamityMod.Items.Accessories.Vanity
Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head);
Player.wings = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Wings);
}
}
+3 -3
View File
@@ -224,10 +224,10 @@ namespace CalamityMod.Items
stats[(int)VanillaWingID.BetsyWings].DownHoverSpeedOverride = 10.8f;
stats[(int)VanillaWingID.BetsyWings].DownHoverAccelerationMult = 10.8f;
// (Celestial Starboard) 4.5 -> 2.75 acceleration multiplier, 16 -> 11.6 hover stats
// (Celestial Starboard) 4.5 -> 2.75 acceleration multiplier, 16 -> 12 hover stats
stats[(int)VanillaWingID.LongRainbowTrailWings].AccRunAccelerationMult = 2.75f;
stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverSpeedOverride = 11.6f;
stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverAccelerationMult = 11.6f;
stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverSpeedOverride = 12f;
stats[(int)VanillaWingID.LongRainbowTrailWings].DownHoverAccelerationMult = 12f;
#endregion
}
@@ -157,3 +157,4 @@ YanmeisKnifeSlash.DisplayName: Yanmei's Knife
YellowLabSeeker.DisplayName: Seeking Mechanism
VoidofExtinctionCrit.DisplayName: Void of Extinction Crit
XykDeathAnim.DisplayName: Xyk Death Animation
XykWings.DisplayName: Xyk Wings
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

+2 -15
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Typeless
public new string LocalizationCategory => "Projectiles.Typeless";
public ref float time => ref Projectile.ai[0];
public int endTime = 25;
public override string Texture => "CalamityMod/Items/LabFinders/RedSeekingMechanism";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
@@ -39,20 +39,7 @@ namespace CalamityMod.Projectiles.Typeless
{
Player Owner = Main.player[Projectile.owner];
bool Orange = Owner.Calamity().XykVisualsOrange;
Color effectColor = Orange ? Color.Gold : Color.DodgerBlue;
float rate = Main.GlobalTimeWrappedHourly * 22;
List<Color> eColors = new List<Color>()
{
Orange ? Color.OrangeRed : Color.DodgerBlue,
Orange ? Color.Gold : Color.Cyan,
Orange ? Color.Orange : Color.RoyalBlue
};
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
effectColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
Color effectColor = Owner.Calamity().XykFXColor;
if (time == 0)
{
+328
View File
@@ -0,0 +1,328 @@
using System;
using System.Collections.Generic;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class XykWings : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public Player Owner => Main.player[Projectile.owner];
public CalamityPlayer moddedOwner => Owner.Calamity();
public Color drawColor => Owner.Calamity().XykFXColor;
public int time = 0;
public int flightTimer = 0;
public float wingFlapHeight = 0;
public Vector2 expectedWingPosition1;
public Vector2 expectedWingPosition2;
public Vector2 WingVel1;
public Vector2 WingVel2;
public float backWingRot = 0;
public int lastDir = 0;
public float spawnFade = 0;
public float spawnFadePow => (Projectile.ai[1] == 5 ? 1 - (float)Math.Pow(spawnFade, 4) : (float)Math.Pow(spawnFade, 4));
public int deathFadeTimer = 0;
public bool iAmTopWing = false;
public Vector2 playerCenterPoint;
public int groundTime = 0;
public int dashTimer = 0;
public bool doDashEffect = true;
public float dashfx = 0;
public int timeFalling = 0;
public bool BreakApart = false;
public ref float wingNum => ref Projectile.ai[0];
public override void SetDefaults()
{
Projectile.width = Projectile.height = 1;
Projectile.ignoreWater = true;
Projectile.timeLeft = 300;
Projectile.tileCollide = false;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.scale = 0;
}
public override void AI()
{
float intendedScale = 0.85f;
float spawnAnimTime = 12 + wingNum;
if (time == 0)
{
expectedWingPosition1 = Owner.Center;
expectedWingPosition2 = Owner.Center;
playerCenterPoint = Owner.MountedCenter;
}
if (time <= spawnAnimTime)
{
spawnFade = Utils.GetLerpValue(0, spawnAnimTime, time, true);
Projectile.scale = intendedScale * Math.Min(spawnFade + 0.5f, 1);
if (time == spawnAnimTime)
{
Projectile.scale = 1.6f;
}
}
else if (Projectile.ai[1] == 0)
Projectile.scale = MathHelper.Lerp(Projectile.scale, intendedScale, 0.08f);
if (moddedOwner.XykVisualsBlue || moddedOwner.XykVisualsOrange)
Projectile.timeLeft++;
else
Projectile.Kill();
if (Owner.dead)
Projectile.Kill();
playerCenterPoint = Owner.MountedCenter;
if (Owner.wingTime == Owner.wingTimeMax && Owner.velocity.Y == 0 && Owner.dashDelay != -1)
groundTime++;
else
groundTime = 0;
if (((groundTime >= 180 || Owner.wingTime <= 0) && wingNum == checkActiveWings() - 1) || Projectile.ai[1] == 5)
{
if (Projectile.ai[1] == 0)
{
iAmTopWing = true;
foreach (Projectile p in Main.ActiveProjectiles)
if (p.type == ModContent.ProjectileType<XykWings>() && p.owner == Owner.whoAmI && p.ai[1] == 0)
p.ai[1] = 5;
return;
}
if (deathFadeTimer == 0)
BreakApart = Owner.wingTime <= 0;
if (BreakApart)
{
Projectile.extraUpdates = 1;
int startTime = (int)(6 * (wingNum + 1));
if (deathFadeTimer == startTime)
{
WingVel1 = Vector2.UnitX * -Main.rand.NextFloat(4f, 7f) * lastDir + Vector2.UnitY.RotatedByRandom(0.3f) * -Main.rand.NextFloat(5, 7);
WingVel2 = Vector2.UnitX * Main.rand.NextFloat(4f, 7f) * lastDir + Vector2.UnitY.RotatedByRandom(0.3f) * -Main.rand.NextFloat(5, 7);
}
if (deathFadeTimer > startTime)
{
WingVel1.X *= 0.97f;
if (WingVel1.Y < 15)
WingVel1.Y += 0.2f;
if (WingVel1.Y < 5)
WingVel1.Y *= 0.97f;
WingVel2.X *= 0.97f;
if (WingVel2.Y < 15)
WingVel2.Y += 0.2f;
if (WingVel2.Y < 5)
WingVel2.Y *= 0.97f;
expectedWingPosition1 += WingVel1;
expectedWingPosition2 += WingVel2;
Projectile.rotation += 0.01f + wingNum * 0.005f;
backWingRot -= 0.01f + wingNum * 0.005f;
}
else
{
expectedWingPosition1 += Owner.velocity * 0.65f;
expectedWingPosition2 += Owner.velocity * 0.65f;
}
}
else
{
int startTime = (int)(2 * wingNum);
if (deathFadeTimer == startTime)
{
WingVel1 = (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 15;
WingVel2 = (backWingRot + MathHelper.PiOver2).ToRotationVector2() * 7;
}
if (deathFadeTimer > startTime)
{
expectedWingPosition1 += WingVel1;
expectedWingPosition2 += WingVel2;
WingVel1 *= 0.955f;
WingVel2 *= 0.955f;
}
else
{
expectedWingPosition1 += Owner.velocity * 0.85f;
expectedWingPosition2 += Owner.velocity * 0.85f;
}
}
dashfx = MathHelper.Lerp(dashfx, 0, 0.07f);
deathFadeTimer++;
int fadeTime = (BreakApart ? 90 : 20);
spawnFade = Utils.GetLerpValue(0, fadeTime, deathFadeTimer, true);
Projectile.scale = intendedScale * spawnFadePow;
if (deathFadeTimer >= fadeTime)
{
Projectile.Kill();
return;
}
return;
}
bool isFlying = Owner.controlJump;
bool isFalling = Owner.controlDown && !isFlying && Owner.velocity.Y > 0;
bool isUpBoosting = Owner.wingTime > 0 && Owner.controlJump && Owner.controlUp;
bool isHovering = Owner.wingTime > 0 && Owner.controlDown && Owner.controlJump && !isUpBoosting;
if (isFalling || timeFalling < 0)
timeFalling++;
else if (timeFalling > 0)
timeFalling -= 2;
float fallingLerp = (float)Math.Pow(Utils.GetLerpValue(0, 60, timeFalling, true), 3);
float topWingNum = (checkActiveWings() - 1);
float sine = (float)Math.Sin((time * 0.35f * (isFalling ? 3 : (isHovering || isUpBoosting) ? 3.2f : isFlying ? 2f : 1) + wingNum * ((isHovering || isUpBoosting) ? 3f : 2f)) / MathHelper.Pi);
if (Owner.dashDelay == -1 || isUpBoosting || isHovering || Owner.Calamity().adrenalineModeActive || Owner.Calamity().rageModeActive || isFalling && Owner.velocity.Y > 16)
{
dashfx = MathHelper.Lerp(dashfx, 1, 0.25f);
float bonusScale = 1;
if (Owner.Calamity().rageModeActive)
bonusScale += 0.25f;
if (Owner.Calamity().adrenalineModeActive)
bonusScale += 0.5f;
if (Projectile.scale < bonusScale)
Projectile.scale = bonusScale;
}
else
{
dashfx = MathHelper.Lerp(dashfx, 0, 0.03f);
if (dashfx > 0)
dashfx -= 0.01f;
else
dashfx = 0;
}
float flapSpeed = MathHelper.Lerp(0.06f * (isHovering ? 2.5f : isFlying ? 2f : 1), 0.55f * (isHovering ? 2.5f : isFlying ? 2f : 1), (float)Math.Pow(Utils.GetLerpValue(-1, 1, sine), 3));
wingFlapHeight = MathHelper.Lerp(wingFlapHeight, sine, flapSpeed) * spawnFadePow;
for (int i = -1; i <= 1; i += 2)
{
float dir = i * lastDir;
Vector2 flightMovement = Vector2.UnitY.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (-15 * Projectile.scale + 10 * (isFalling ? 0.35f : isUpBoosting ? 5f : isHovering ? 1.5f : isFlying ? 2.5f : 1) * wingFlapHeight) * ((Owner.velocity.Y == 0) ? 0 : 1);
float wingPartDist = (1.6f / (checkActiveWings() + 1)) * wingNum * (isFalling ? 1 - 0.3f * fallingLerp : isHovering ? 0.5f : 1);
Vector2 destination = (playerCenterPoint - (Vector2.UnitX.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (22 + 7 * wingFlapHeight * (i == -1 ? 0.5f : 1)) * Projectile.scale).RotatedBy((-0.8f + (isFalling ? 0.7f * fallingLerp : 0) + wingPartDist + (wingNum == topWingNum ? 0.1f : wingNum == 0 ? -0.1f : 0)) * dir) * dir + (Vector2.One * (isFlying ? 0 : 1)).RotatedBy((time * 0.12f + wingNum * 0.9f) * dir)) + flightMovement;
float lerpSpeed = (1 + wingNum * (0.1f + 0.15f * fallingLerp));
float spawnDistance = 150;
if (i == 1)
expectedWingPosition1 += ((destination + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition1) / lerpSpeed;
else
expectedWingPosition2 += ((destination + (Vector2.UnitX * -6f * lastDir) + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition2) / lerpSpeed;
}
Projectile.Center = Owner.Center;
Projectile.rotation = expectedWingPosition1.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2;
backWingRot = expectedWingPosition2.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2;
if (wingNum == 0)
Lighting.AddLight(Owner.Center, Color.Lerp(drawColor, Color.White, 0.5f).ToVector3() * 1.1f * spawnFadePow);
if (dashfx > 0.3f && (wingNum == checkActiveWings() - 1 || wingNum == 0))
{
for (int i = -2; i <= 2; i += 1)
{
if (i == 0)
i++;
bool front = i > 0;
Vector2 pos1 = expectedWingPosition1 + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * (45 + 5 * wingNum) * (Projectile.scale + 0.15f);
Vector2 pos2 = expectedWingPosition2 + (backWingRot + MathHelper.PiOver2).ToRotationVector2() * (15 + 3 * wingNum) * (Projectile.scale + 0.15f);
if (Owner.Calamity().XykVisualsBlue)
{
bool circle = Main.rand.NextBool(3);
Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, circle ? ModContent.DustType<SquashDustHollow>() : ModContent.DustType<SquashDust>(), Owner.velocity.RotatedByRandom(circle ? 0.5f : 0) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx);
dust.scale = Main.rand.NextFloat(1.3f, 1.4f) * (front ? 1 : 0.6f) * dashfx * (circle ? 0.6f : 1f) * (float)Math.Pow(Projectile.scale, 0.4f);
dust.noGravity = true;
dust.color = drawColor;
dust.noLightEmittence = true;
dust.fadeIn = 1.5f * (circle ? 0 : 1f);
}
else
{
bool square = Main.rand.NextBool(3);
Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, square ? ModContent.DustType<SquareDust>() : ModContent.DustType<SquashDust>(), Owner.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx);
dust.scale = Main.rand.NextFloat(0.8f, 1f) * (front ? 1 : 0.6f) * dashfx * (square ? 1 : 1.5f) * (float)Math.Pow(Projectile.scale, 0.4f);
dust.noGravity = true;
dust.color = drawColor;
dust.noLightEmittence = true;
dust.fadeIn = 0.1f * (square ? 1 : 3f);
}
}
}
time++;
}
public override bool PreDraw(ref Color lightColor)
{
if (!BreakApart)
lastDir = Owner.direction;
float topWingNum = (checkActiveWings() - 1);
float width = 1;
float height = 1;
Texture2D tex;
if (wingNum == 0)
tex = ModContent.Request<Texture2D>("CalamityMod/Particles/XykWing2").Value;
else if (wingNum == topWingNum || iAmTopWing)
{
height = 1.5f;
tex = ModContent.Request<Texture2D>("CalamityMod/Particles/XykWing1").Value;
}
else
{
width = 2;
height = 1f + 0.1f * wingNum;
tex = ModContent.Request<Texture2D>("CalamityMod/Particles/XykWing3").Value;
}
Texture2D glow = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Vector2 scale = new Vector2(width, height * spawnFadePow) * 0.12f * Projectile.scale;
Vector2 scaleBack = new Vector2(width * 1.5f, height * 0.7f * spawnFadePow) * 0.07f * Projectile.scale;
if (dashfx > 0)
{
for (int i = 0; i < 4; i++)
{
Main.EntitySpriteDraw(glow, expectedWingPosition1 - Main.screenPosition, null, (i < 2 ? Color.White : drawColor) with { A = 0 } * 0.65f, Projectile.rotation + (i % 2 == 0 ? MathHelper.PiOver2 : 0) + MathHelper.PiOver4, glow.Size() * 0.5f, new Vector2(0.2f, 1.2f) * (i < 2 ? 0.7f : 1) * Projectile.scale * (Main.rand.NextFloat(0.25f, 0.35f) + 0.02f * wingNum) * (float)Math.Pow(dashfx, 7), SpriteEffects.None, 0);
Main.EntitySpriteDraw(glow, expectedWingPosition2 - Main.screenPosition, null, (i < 2 ? Color.White : drawColor) with { A = 0 } * 0.65f, backWingRot + (i % 2 == 0 ? MathHelper.PiOver2 : 0) + MathHelper.PiOver4, glow.Size() * 0.5f, new Vector2(0.2f, 1.2f) * (i < 2 ? 0.3f : 0.6f) * Projectile.scale * (Main.rand.NextFloat(0.25f, 0.35f) + 0.02f * wingNum) * (float)Math.Pow(dashfx, 7), SpriteEffects.None, 0);
}
int draws = 12;
for (int i = 0; i < draws; i++)
{
Vector2 addedPos = ((MathHelper.TwoPi * i / draws).ToRotationVector2() * 2.5f + Main.rand.NextVector2Circular(2, 2)) * dashfx;
Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition + addedPos, null, drawColor with { A = 0 } * spawnFadePow * 0.3f * dashfx, Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0);
Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition + addedPos, null, drawColor with { A = 0 } * spawnFadePow * 0.3f * dashfx, backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0);
}
}
Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0);
Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0);
return false;
}
public int checkActiveWings()
{
int numOfActiveWings = 0;
foreach (Projectile p in Main.ActiveProjectiles)
if (p.type == ModContent.ProjectileType<XykWings>() && p.owner == Owner.whoAmI && p.ai[1] == 0)
numOfActiveWings++;
if (Projectile.ai[1] == 5)
numOfActiveWings = 7;
return numOfActiveWings;
}
public override bool? CanDamage() => false;
}
}