Every normalization is now safe
Minus some particle ones but those don't matter that much
This commit is contained in:
1 parent
f0e61af72a
commit
b24863d23d
39 files changed
+75
-77
No files matched your search
@@ -541,7 +541,7 @@ namespace CalamityMod.DataStructures
|
||||
if (UseTimer % 30 == 29 && Main.rand.Next(2) == 0)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item78);
|
||||
Projectile beamSword = Projectile.NewProjectileDirect(player.Center, player.DirectionTo(Main.MouseWorld) * 15f, ProjectileType<SwordsmithsPrideBeam>(), (int)(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage * player.MeleeDamage()), 10f, player.whoAmI, 1f);
|
||||
Projectile beamSword = Projectile.NewProjectileDirect(player.Center, player.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType<SwordsmithsPrideBeam>(), (int)(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage * player.MeleeDamage()), 10f, player.whoAmI, 1f);
|
||||
beamSword.timeLeft = 50;
|
||||
UseTimer++;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (scissorState != 2)
|
||||
{
|
||||
Vector2 throwVector = new Vector2(speedX, speedY);
|
||||
Projectile.NewProjectile(player.Center + Vector2.Normalize(throwVector) * 20, new Vector2(speedX, speedY) * 1.4f, ProjectileType<RendingNeedle>(), (int)(damage * NeedleDamageMultiplier), knockBack, player.whoAmI);
|
||||
Projectile.NewProjectile(player.Center + Utils.SafeNormalize(throwVector, Vector2.Zero) * 20, new Vector2(speedX, speedY) * 1.4f, ProjectileType<RendingNeedle>(), (int)(damage * NeedleDamageMultiplier), knockBack, player.whoAmI);
|
||||
}
|
||||
|
||||
Combo += 1;
|
||||
|
||||
@@ -144,10 +144,10 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
Vector2 throwVector = new Vector2(speedX, speedY);
|
||||
float empoweredNeedles = Charge > 0 ? 1f : 0f;
|
||||
Projectile.NewProjectile(player.Center + Vector2.Normalize(throwVector) * 20, new Vector2(speedX, speedY) * 2.8f, ProjectileType<SolarNeedle>(), (int)(damage * 0.5f), knockBack, player.whoAmI, empoweredNeedles);
|
||||
Projectile.NewProjectile(player.Center + Utils.SafeNormalize(throwVector, Vector2.Zero) * 20, new Vector2(speedX, speedY) * 2.8f, ProjectileType<SolarNeedle>(), (int)(damage * 0.5f), knockBack, player.whoAmI, empoweredNeedles);
|
||||
|
||||
|
||||
Vector2 Shift = Vector2.Normalize(new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver2)) * 20;
|
||||
Vector2 Shift = Utils.SafeNormalize(new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 20;
|
||||
|
||||
Projectile.NewProjectile(player.Center + Shift, throwVector.RotatedBy(MathHelper.PiOver4 * 0.3f), ProjectileType<ElementalGlassStar>(), (int)(damage * 0.2f), knockBack, player.whoAmI);
|
||||
Projectile.NewProjectile(player.Center + Shift * 1.2f, throwVector.RotatedBy(MathHelper.PiOver4 * 0.4f) * 0.8f, ProjectileType<ElementalGlassStar>(), (int)(damage * 0.2f), knockBack, player.whoAmI);
|
||||
|
||||
@@ -85,8 +85,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
if (Charge > 0 && player.controlUp)
|
||||
{
|
||||
float angle = player.DirectionTo(Main.MouseWorld).ToRotation();
|
||||
Vector2 laserVector = player.DirectionTo(Main.MouseWorld) * 600;
|
||||
float angle = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).ToRotation();
|
||||
Vector2 laserVector = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 600;
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, laserVector, ProjectileType<TrueAncientBlast>(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI);
|
||||
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
|
||||
@@ -115,9 +115,9 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
//Only shoot the center star if theres no charge
|
||||
if (Charge == 0)
|
||||
Projectile.NewProjectile(player.Center + Vector2.Normalize(new Vector2(speedX, speedY)) * 20, new Vector2(speedX, speedY), ProjectileType<AncientStar>(), (int)(damage * glassStarDamageMultiplier), knockBack, player.whoAmI);
|
||||
Projectile.NewProjectile(player.Center + Utils.SafeNormalize(new Vector2(speedX, speedY), Vector2.Zero) * 20, new Vector2(speedX, speedY), ProjectileType<AncientStar>(), (int)(damage * glassStarDamageMultiplier), knockBack, player.whoAmI);
|
||||
|
||||
Vector2 Shift = Vector2.Normalize(new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver2)) * 30;
|
||||
Vector2 Shift = Utils.SafeNormalize(new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 30;
|
||||
|
||||
Projectile.NewProjectile(player.Center + Shift, new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver4 * 0.3f) , ProjectileType<AncientStar>(), (int)(damage * glassStarDamageMultiplier), knockBack, player.whoAmI, Charge > 0 ? 1 : 0);
|
||||
Projectile.NewProjectile(player.Center - Shift, new Vector2(speedX, speedY).RotatedBy(-MathHelper.PiOver4 * 0.3f), ProjectileType<AncientStar>(), (int)(damage * glassStarDamageMultiplier), knockBack, player.whoAmI, Charge > 0 ? 1 : 0);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.timeLeft = (int)MaxTime;
|
||||
Main.PlaySound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center);
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
//Bounce off the player if they are in the air
|
||||
if (Owner.velocity.Y != 0)
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Owner.Calamity().LungingDown = true;
|
||||
Owner.fallStart = (int)(Owner.position.Y / 16f);
|
||||
Owner.velocity = Owner.DirectionTo(scissorPosition) * 60f;
|
||||
Owner.velocity = Owner.SafeDirectionTo(scissorPosition, Vector2.Zero) * 60f;
|
||||
|
||||
if (Owner.Distance(scissorPosition) < 60f)
|
||||
{
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
var sound = Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
CalamityUtils.SafeVolumeChange(ref sound, 0.3f);
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Main.MouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
GeneralParryEffects();
|
||||
if (Owner.velocity.Y != 0)
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2;
|
||||
}
|
||||
|
||||
//Reduce the projectile's damage by 300 for a second.
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 78f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(MathHelper.PiOver2 * Owner.direction)) * 2 * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2 * Owner.direction), Vector2.Zero) * 2 * (1f + distance.Length() / 15f);
|
||||
Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.Next(3) == 0 ? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
}
|
||||
@@ -386,7 +386,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 78f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(-MathHelper.PiOver2)) * 2 * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(-MathHelper.PiOver2), Vector2.Zero) * 2 * (1f + distance.Length() / 15f);
|
||||
Color glitterColor = Main.hslToRgb(Main.rand.NextFloat(), 1, 0.5f);
|
||||
Particle glitter = new CritSpark(projectile.Center + distance, Owner.velocity + angularVelocity, Color.White , glitterColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
@@ -455,7 +455,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
|
||||
Vector2 sliceDirection = Vector2.Normalize(direction) * 40;
|
||||
Vector2 sliceDirection = Utils.SafeNormalize(direction, Vector2.One) * 40;
|
||||
Particle SliceLine = new LineVFX(projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f)
|
||||
{
|
||||
Lifetime = 10
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
var sound = Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
CalamityUtils.SafeVolumeChange(ref sound, 0.3f);
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Main.MouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
GeneralParryEffects();
|
||||
if (Owner.velocity.Y != 0)
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2;
|
||||
}
|
||||
|
||||
//Reduce the projectile's damage by 200 for a second.
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
constellationColorHue = (constellationColorHue + 0.16f) % 1;
|
||||
constellationColor = Main.hslToRgb(constellationColorHue, 1, 0.8f);
|
||||
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero);
|
||||
Star = new GenericSparkle(AnchorStart + SizeVector * i + offset, Vector2.Zero, Color.White, constellationColor, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
BootlegSpawnParticle(Star);
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
constellationColorHue = (constellationColorHue + 0.16f) % 1;
|
||||
constellationColor = Main.hslToRgb(constellationColorHue, 1, 0.8f);
|
||||
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero);
|
||||
Star = new GenericSparkle(AnchorStart + SizeVector * i + offset, Vector2.Zero, Color.White, constellationColor, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
BootlegSpawnParticle(Star);
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio);
|
||||
|
||||
//Manage position and rotation
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * 60);
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
//Take the direction the sword is swung. FUCK not controlling the swing direction more than just left/right :|
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
CanBounce = 1f;
|
||||
projectile.timeLeft = (int)MaxTime;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
if (CanLunge == 1f)
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
if (!initialized) //Initialization. create control points & shit)
|
||||
{
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach);
|
||||
Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center);
|
||||
controlPoint1 = projectile.Center;
|
||||
@@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground)
|
||||
if (Collision.SolidCollision(projectile.position, 32, 32) && (Owner.velocity.Y != 0 || projectile.position.Y < Owner.position.Y))
|
||||
{
|
||||
Owner.velocity = Owner.DirectionTo(projectile.Center) * ReelBackStrenght;
|
||||
Owner.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * ReelBackStrenght;
|
||||
SnapCoyoteTime = 0f;
|
||||
}
|
||||
Main.PlaySound(SoundID.Item65, projectile.position);
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (State == 0f)
|
||||
{
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement());
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
NPC potentialTarget = TargetNext(target.Center, i);
|
||||
if (potentialTarget == null)
|
||||
break;
|
||||
Projectile proj = Projectile.NewProjectileDirect(target.Center, target.DirectionTo(potentialTarget.Center) * 25f, ProjectileType<GalaxiaBolt>(), (int)(damage * FourSeasonsGalaxia.AriesAttunement_OnHitBoltDamageReduction), 0, Owner.whoAmI, 0.9f, MathHelper.PiOver4 * 0.4f);
|
||||
Projectile proj = Projectile.NewProjectileDirect(target.Center, target.SafeDirectionTo(potentialTarget.Center, Vector2.Zero) * 25f, ProjectileType<GalaxiaBolt>(), (int)(damage * FourSeasonsGalaxia.AriesAttunement_OnHitBoltDamageReduction), 0, Owner.whoAmI, 0.9f, MathHelper.PiOver4 * 0.4f);
|
||||
proj.scale = 2f;
|
||||
}
|
||||
Array.Clear(excludedTargets, 0, 3);
|
||||
@@ -135,9 +135,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.velocity *= 10f;
|
||||
}
|
||||
if (projectile.velocity.AngleBetween(Owner.Center - projectile.Center) > MathHelper.PiOver4)
|
||||
projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.DirectionTo(Owner.Center).ToRotation(), MathHelper.Pi / 20f)).ToRotationVector2() * projectile.velocity.Length() * 0.98f;
|
||||
projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.SafeDirectionTo(Owner.Center, Vector2.Zero).ToRotation(), MathHelper.Pi / 20f)).ToRotationVector2() * projectile.velocity.Length() * 0.98f;
|
||||
else
|
||||
projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.DirectionTo(Owner.Center).ToRotation(), MathHelper.Pi)).ToRotationVector2() * projectile.velocity.Length() * 1.05f;
|
||||
projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.SafeDirectionTo(Owner.Center, Vector2.Zero).ToRotation(), MathHelper.Pi)).ToRotationVector2() * projectile.velocity.Length() * 1.05f;
|
||||
projectile.rotation = Main.GlobalTime * 25f;
|
||||
projectile.scale = MathHelper.Clamp((Owner.Center - projectile.Center).Length() / (FourSeasonsGalaxia.AriesAttunement_Reach * 0.5f), 0.3f, 2f);
|
||||
projectile.timeLeft = 4;
|
||||
@@ -163,12 +163,12 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.Center = projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 40f * ThrowDisplace());
|
||||
|
||||
if ((projectile.Center - Owner.Center).Length() > FourSeasonsGalaxia.AriesAttunement_Reach)
|
||||
projectile.Center = Owner.Center + Owner.DirectionTo(projectile.Center) * FourSeasonsGalaxia.AriesAttunement_Reach;
|
||||
projectile.Center = Owner.Center + Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * FourSeasonsGalaxia.AriesAttunement_Reach;
|
||||
|
||||
projectile.rotation = Main.GlobalTime * 25f;
|
||||
//Make the owner look like theyre "holding" the sword bla bla
|
||||
Owner.heldProj = projectile.whoAmI;
|
||||
projectile.velocity = Owner.DirectionTo(projectile.Center);
|
||||
projectile.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero);
|
||||
Owner.direction = Math.Sign(projectile.velocity.X);
|
||||
Owner.itemRotation = projectile.velocity.ToRotation();
|
||||
if (Owner.direction != 1)
|
||||
@@ -197,14 +197,14 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 82f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(MathHelper.PiOver2)) * 2f * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f);
|
||||
Particle glitter = new CritSpark(projectile.Center + distance, angularVelocity, Main.rand.Next(3) == 0 ? Color.HotPink : Color.Plum, Color.DarkOrchid, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
}
|
||||
|
||||
float smokeDistance = projectile.scale * 62f;
|
||||
Vector2 smokePos = Main.rand.NextVector2Circular(smokeDistance, smokeDistance);
|
||||
Vector2 smokeSpeed = Vector2.Normalize(smokePos.RotatedBy(MathHelper.PiOver2)) * 0.1f * (1f + smokePos.Length() / 15f);
|
||||
Vector2 smokeSpeed = Utils.SafeNormalize(smokePos.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 0.1f * (1f + smokePos.Length() / 15f);
|
||||
Particle smoke = new HeavySmokeParticle(projectile.Center + smokePos, smokeSpeed, Color.Lerp(Color.Navy, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.4f, 1f) * projectile.scale, 0.8f, 0, false, 0, true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
for (float i = 0 + Main.rand.NextFloat(0.2f, 0.5f); i < 1; i += Main.rand.NextFloat(0.2f, 0.5f))
|
||||
{
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero);
|
||||
Star = new GenericSparkle(projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (Main.rand.Next(3) == 0)
|
||||
{
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero);
|
||||
Star = new GenericSparkle(projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
projectile.velocity = Vector2.Zero;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
initialized = true;
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
|
||||
|
||||
Main.PlaySound(SoundID.Item80, projectile.Center);
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
//PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES
|
||||
for (int i = 0; i <= 8; i++)
|
||||
{
|
||||
@@ -207,17 +207,17 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi;
|
||||
float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.DirectionTo(Main.MouseWorld).ToRotation()) + MathHelper.Pi;
|
||||
float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi;
|
||||
float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted));
|
||||
|
||||
if (CanDirectFire && deltaAngleShoot < 0.1f)
|
||||
{
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(Owner.Center, Owner.DirectionTo(Main.MouseWorld) * 15f, ProjectileType<GalaxiaBolt>(), (int)(projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
|
||||
Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType<GalaxiaBolt>(), (int)(projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
|
||||
}
|
||||
CanDirectFire = false;
|
||||
AngleReset = Owner.DirectionTo(Main.MouseWorld).ToRotation();
|
||||
AngleReset = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation();
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 1.9f * 78f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(MathHelper.PiOver2)) * 2f * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f);
|
||||
Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.Next(3) == 0 ? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Shred = 0;
|
||||
|
||||
//Manage position and rotation
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * 60);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Explode into cosmic bolts
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Owner.DirectionTo(target.Center).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType<GalaxiaBolt>(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.meleeDamage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f);
|
||||
Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType<GalaxiaBolt>(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.meleeDamage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f);
|
||||
{
|
||||
blast.timeLeft = 100;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
initialized = true;
|
||||
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -67,13 +67,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f;
|
||||
|
||||
Vector2 lineDirection = Vector2.Normalize(DashEnd - DashStart);
|
||||
int dist = (int)Vector2.Distance(DashEnd, DashStart) / 16;
|
||||
Vector2[] Nodes = new Vector2[dist + 1];
|
||||
Nodes[0] = DashStart;
|
||||
Nodes[dist] = DashEnd;
|
||||
|
||||
|
||||
for (int i = 1; i < dist + 1; i++)
|
||||
{
|
||||
Vector2 positionAlongLine = Vector2.Lerp(DashStart, DashEnd, i / (float)dist); //Get the position of the segment along the line
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (State == 0f)
|
||||
{
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement());
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Bottom, projectile.Bottom - (Vector2.UnitY * scaleY * 110), scaleX * 40, ref collisionPoint);
|
||||
|
||||
float halfLenght = 66f * projectile.scale;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + Vector2.Normalize(projectile.velocity.RotatedBy(MathHelper.PiOver2)) * halfLenght, projectile.Center - Vector2.Normalize(projectile.velocity.RotatedBy(MathHelper.PiOver2)) * halfLenght, 40f, ref collisionPoint);
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + Utils.SafeNormalize(projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, projectile.Center - Utils.SafeNormalize(projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, 40f, ref collisionPoint);
|
||||
}
|
||||
|
||||
public override void DrawBehind(int index, List<int> drawCacheProjsBehindNPCsAndTiles, List<int> drawCacheProjsBehindNPCs, List<int> drawCacheProjsBehindProjectiles, List<int> drawCacheProjsOverWiresUI)
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
float opacity = projectile.timeLeft > 10 ? 1 : projectile.timeLeft / 10f;
|
||||
Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f;
|
||||
|
||||
Vector2 lineDirection = Vector2.Normalize(Target.Center - NPCfrom.Center);
|
||||
Vector2 lineDirection = Utils.SafeNormalize(Target.Center - NPCfrom.Center, Vector2.Zero);
|
||||
int dist = (int)Vector2.Distance(Target.Center, NPCfrom.Center) / 16;
|
||||
Vector2[] Nodes = new Vector2[dist + 1];
|
||||
Nodes[0] = NPCfrom.Center;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
projectile.velocity = Vector2.Zero;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
oldDirection = direction;
|
||||
initialized = true;
|
||||
@@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
CurrentState = 1f;
|
||||
Main.PlaySound(SoundID.Item80, projectile.Center);
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
//PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES
|
||||
for (int i = 0; i <= 8; i++)
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio);
|
||||
|
||||
//Manage position and rotation
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * 60);
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.timeLeft = (int)(30f + ShredRatio * 30f);
|
||||
initialized = true;
|
||||
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
break;
|
||||
}
|
||||
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
CanBounce = 1f;
|
||||
projectile.timeLeft = (int)MaxTime;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
if (CanLunge == 1f && !ChargedUp)
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
if (!initialized) //Initialization. create control points & shit)
|
||||
{
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach);
|
||||
Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center);
|
||||
controlPoint1 = projectile.Center;
|
||||
@@ -201,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground)
|
||||
if (Collision.SolidCollision(projectile.position, 32, 32) && (Owner.velocity.Y != 0 || projectile.position.Y < Owner.position.Y))
|
||||
{
|
||||
Owner.velocity = Owner.DirectionTo(projectile.Center) * ReelBackStrenght;
|
||||
Owner.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * ReelBackStrenght;
|
||||
SnapCoyoteTime = 0f;
|
||||
}
|
||||
Main.PlaySound(SoundID.Item65, projectile.position);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Vector2 particleSpeed = Vector2.Normalize(projectile.velocity).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f);
|
||||
Vector2 particleSpeed = Utils.SafeNormalize(projectile.velocity, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f);
|
||||
Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f);
|
||||
GeneralParticleHandler.SpawnParticle(energyLeak);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.timeLeft = (int)MaxTime;
|
||||
Main.PlaySound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center);
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
//Bounce off the player if they are in the air
|
||||
if (Owner.velocity.Y != 0)
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
if (projectile.timeLeft == MaxTwirlTime)
|
||||
{
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
Main.PlaySound(SoundID.Item71, projectile.Center);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
return;
|
||||
}
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
projectile.Center = Owner.Center + (projectile.velocity * 60);
|
||||
@@ -326,7 +326,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Vector2 directionFromHead = direction.RotatedBy(MathHelper.ToRadians(MathHelper.Lerp(0, 160f * flip, (float)Math.Sin(randomNumber * MathHelper.Pi)))) * MathHelper.Lerp(130f, 200f, MathHelper.Clamp((float)Math.Sin(randomNumber * MathHelper.Pi) - 0.5f, 0f, 1f) * 2f);
|
||||
control2 = control3 + directionFromHead;
|
||||
|
||||
Vector2 directionFromSecondToLastPoint = Vector2.Normalize(directionFromHead.RotatedBy(MathHelper.Pi - MathHelper.ToRadians(MathHelper.Lerp(80f * flip, 110f * flip, (float)Math.Sin(randomNumber * MathHelper.Pi))))) * MathHelper.Lerp(120f, 280f, (float)Math.Sin(randomNumber * MathHelper.Pi));
|
||||
Vector2 directionFromSecondToLastPoint = Utils.SafeNormalize(directionFromHead.RotatedBy(MathHelper.Pi - MathHelper.ToRadians(MathHelper.Lerp(80f * flip, 110f * flip, (float)Math.Sin(randomNumber * MathHelper.Pi)))), Vector2.Zero) * MathHelper.Lerp(120f, 280f, (float)Math.Sin(randomNumber * MathHelper.Pi));
|
||||
control1 = control2 + directionFromSecondToLastPoint;
|
||||
|
||||
control3 += Vector2.UnitX.RotatedBy(MathHelper.TwoPi * seed1) * seed3 * 30f;
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (State == 0f)
|
||||
{
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement());
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio);
|
||||
|
||||
//Manage position and rotation
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * 60);
|
||||
@@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Owner.Calamity().LungingDown = true;
|
||||
Owner.fallStart = (int)(Owner.position.Y / 16f);
|
||||
Owner.velocity = Owner.DirectionTo(Wheel.Center) * 60f;
|
||||
Owner.velocity = Owner.SafeDirectionTo(Wheel.Center, Vector2.Zero) * 60f;
|
||||
|
||||
if (Owner.Distance(Wheel.Center) < 60f)
|
||||
Wheel.active = false;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
initialized = true;
|
||||
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
projectile.velocity = Vector2.Zero;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
initialized = true;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
CurrentState = 1f;
|
||||
Main.PlaySound(SoundID.Item80, projectile.Center);
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
//PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES
|
||||
for (int i = 0; i <= 8; i++)
|
||||
{
|
||||
@@ -179,33 +179,33 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (sightLine == null)
|
||||
{
|
||||
sightLine = new LineVFX(Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld), 0.2f, Color.HotPink, false);
|
||||
sightLine = new LineVFX(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One), 0.2f, Color.HotPink, false);
|
||||
GeneralParticleHandler.SpawnParticle(sightLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
sightLine.Position = Owner.Center + Owner.DirectionTo(Owner.Calamity().mouseWorld) * projectile.scale * 1.88f * 40;
|
||||
(sightLine as LineVFX).LineVector = Owner.DirectionTo(Owner.Calamity().mouseWorld) * projectile.scale * 1.88f * 38f;
|
||||
sightLine.Position = Owner.Center + Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * projectile.scale * 1.88f * 40;
|
||||
(sightLine as LineVFX).LineVector = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * projectile.scale * 1.88f * 38f;
|
||||
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 mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).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, 1.5f, 10, 0.1f, 3f);
|
||||
Particle Blink = new GenericSparkle(Owner.Center + Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * projectile.scale * 1.88f * 78f, Owner.velocity, Color.White, currentColor, 1.5f, 10, 0.1f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Blink);
|
||||
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(Owner.Center, Owner.DirectionTo(Main.MouseWorld) * 15f, ProjectileType<SwordsmithsPrideBeam>(), (int)(projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI);
|
||||
Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType<SwordsmithsPrideBeam>(), (int)(projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI);
|
||||
}
|
||||
CanDirectFire = false;
|
||||
AngleReset = Owner.DirectionTo(Main.MouseWorld).ToRotation();
|
||||
AngleReset = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation();
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 1.9f * 78f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(MathHelper.PiOver2)) * 2f * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f);
|
||||
Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Color.White, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user