This changes absolutely nothing except internal typos
This commit is contained in:
Altixal committed 2023-03-16 19:44:16 +07:00
1 parent 227b2428b4
commit 6fc7245c30
62 files changed
+196 -196

No files matched your search

+2 -2
View File
@@ -43,7 +43,7 @@ float mod(float a, float n)
(
float2 origin, float angle, float2 plot, float plotAngle)
{
//If the angle between the line's angle and the plot's angle is less than 90° (aka , not BEHIND the half-line), return the distance from the line
//If the angle between the line's angle and the plot's angle is less than 90� (aka , not BEHIND the half-line), return the distance from the line
if (abs(mod(angle - plotAngle + 3.1415926, 6.2831853) - 3.1415926) < 1.5707)
return distanceFromLine(origin, angle, plot);
@@ -75,7 +75,7 @@ float4 main(float2 uv : TEXCOORD) : COLOR
//Grabs the distance of the point from the edge line.
float distanceFromLine = distanceFromLineCropped(float2(0, 0), laserAngle, mappedUv, angle);
//If we are further from the line than the bloom's blending lenght, just don't.
//If we are further from the line than the bloom's blending length, just don't.
if (distanceFromLine > bloomSize + halfLaserWidth)
return float4(0, 0, 0, 0);
+5 -5
View File
@@ -1,7 +1,7 @@
float3 edgeColor;
float3 centerColor;
float edgeBlendLenght;
float edgeBlendLength;
float edgeBlendStrength;
float mainOpacity;
@@ -27,7 +27,7 @@ float distanceFromLine(float2 origin, float angle, float2 plot)
//Gets the distance of a plot from a line with a specified origin and angle, but crops the line so it only expands towards the angle
float distanceFromLineCropped(float2 origin, float angle, float2 plot, float plotAngle)
{
//If the angle between the line's angle and the plot's angle is less than 90° (aka , not BEHIND the half-line), return the distance from the line
//If the angle between the line's angle and the plot's angle is less than 90� (aka , not BEHIND the half-line), return the distance from the line
if (abs(angle - plotAngle) < 1.5707)
return distanceFromLine(origin, angle, plot);
@@ -68,12 +68,12 @@ float4 main(float2 uv : TEXCOORD) : COLOR
opacity = centerOpacity * pow(1 - distanceFromCenter, 2);
}
//If we are further from the line than the edge's blending lenght, just don't even do the blending.
if (distanceFromLine > edgeBlendLenght)
//If we are further from the line than the edge's blending length, just don't even do the blending.
if (distanceFromLine > edgeBlendLength)
return float4(colour * opacity * mainOpacity, opacity * mainOpacity);
//The higher this value is, the more we blend with the edge's opacity & color.
float edgeBlendFactor = pow(1 - distanceFromLine / edgeBlendLenght, edgeBlendStrength);
float edgeBlendFactor = pow(1 - distanceFromLine / edgeBlendLength, edgeBlendStrength);
colour = lerp(colour, edgeColor, edgeBlendFactor);
opacity = lerp(opacity, 1 * pow(1 - distanceFromCenter, 3), edgeBlendFactor) * mainOpacity;
+1 -1
View File
@@ -1,6 +1,6 @@
float rotation; // The rotation of the sword sprite.
//float2 spriteDimensions; //The size of the sprite (necessary as the shader only gives us a map between 0 and 1).
float pommelToOriginPercent; //I have no idea for a better variable name. This is the perccentage of the full lenght between the rotation origin and the sword's tip that is an empty gap between it and the bottom left of the sword.
float pommelToOriginPercent; //I have no idea for a better variable name. This is the perccentage of the full length between the rotation origin and the sword's tip that is an empty gap between it and the bottom left of the sword.
float4 color;
texture sampleTexture;
+4 -4
View File
@@ -8,7 +8,7 @@ float pingProgress; //How far along the ping progressed
float pingTravelTime; //Percent of the ping's duration during which the ping expands to reach its full radius.
float pingFadePoint; //Percent of the ping's duration at which to start fading away.
float edgeBlendStrength; //How starkly should the ping's edge fade off.
float edgeBlendOutLenght; //Small lenght at the edge of the wave to blend away smoothly.
float edgeBlendOutLength; //Small length at the edge of the wave to blend away smoothly.
float tileEdgeBlendStrenght; //How hard the border of a tile should get blended away.
float4 baseTintColor; //Color of the tile's overlay
@@ -175,7 +175,7 @@ float4 main(float2 uv : TEXCOORD) : COLOR
return float4(0, 0, 0, 0);
float waveEdgeDistanceFromCenter = max(currentPingRadius - pingWaveThickness, 0);
float edgeBlendFactor = pow(min(max((distanceFromPingOrigin - (waveEdgeDistanceFromCenter)), 0) / (pingWaveThickness - edgeBlendOutLenght), 1), edgeBlendStrength);
float edgeBlendFactor = pow(min(max((distanceFromPingOrigin - (waveEdgeDistanceFromCenter)), 0) / (pingWaveThickness - edgeBlendOutLength), 1), edgeBlendStrength);
float3 ColorTotal = lerp(baseTintColor.rgb, waveColor.rgb, edgeBlendFactor);
float OpacityTotal = lerp(baseTintColor.a, waveColor.a, edgeBlendFactor);
@@ -193,8 +193,8 @@ float4 main(float2 uv : TEXCOORD) : COLOR
}
//Fade away the border
if (realPingRadius - distanceFromPingOrigin < edgeBlendOutLenght)
OpacityTotal *= (realPingRadius - distanceFromPingOrigin) / edgeBlendOutLenght;
if (realPingRadius - distanceFromPingOrigin < edgeBlendOutLength)
OpacityTotal *= (realPingRadius - distanceFromPingOrigin) / edgeBlendOutLength;
//General fade out at the end.
OpacityTotal *= 1 - max(pingProgress - pingFadePoint, 0) / (1 - pingFadePoint);
+5 -5
View File
@@ -120,9 +120,9 @@ namespace CalamityMod.Items.Accessories
/// </summary>
public int Grapple = 0;
/// <summary>
/// The lenght of the current rope. Determined when the grapple lands.
/// The length of the current rope. Determined when the grapple lands.
/// </summary>
public float SwingLenght = 0f;
public float SwingLength = 0f;
/// <summary>
/// Used when we need to store the hook between instructions.
/// </summary>
@@ -145,7 +145,7 @@ namespace CalamityMod.Items.Accessories
if (!PlayerOnGround)
return false;
if ((Player.Center - Main.projectile[Grapple].Center).Length() > SwingLenght)
if ((Player.Center - Main.projectile[Grapple].Center).Length() > SwingLength)
return false;
return true;
@@ -223,7 +223,7 @@ namespace CalamityMod.Items.Accessories
if (Grappled)
{
if ((Main.projectile[Grapple].Center - Player.Center).Length() > SwingLenght + 80f)
if ((Main.projectile[Grapple].Center - Player.Center).Length() > SwingLength + 80f)
{
SoundEngine.PlaySound(WulfrumAcrobaticsPack.ReleaseSound, Main.projectile[Grapple].Center);
Main.projectile[Grapple].Kill();
@@ -235,7 +235,7 @@ namespace CalamityMod.Items.Accessories
public void SimulateMovement(Projectile grapple)
{
Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SwingLenght / SimulationResolution, 50, 0.3f * Player.gravDir);
Segments = VerletSimulatedSegment.SimpleSimulation(Segments, SwingLength / SimulationResolution, 50, 0.3f * Player.gravDir);
Vector2 CurrentPosition;
+3 -3
View File
@@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee
public float Combo = 0f;
public float Charge = 0f;
public const float ComboLenght = 4f; //How many regular swings before the long throw happens
public const float ComboLength = 4f; //How many regular swings before the long throw happens
public static float snapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap
public static float chargeDamageMultiplier = 1.2f; //Extra damage from charge
@@ -146,12 +146,12 @@ namespace CalamityMod.Items.Weapons.Melee
if (Charge > 0)
damage = (int)(chargeDamageMultiplier * damage);
float scissorState = Combo == ComboLenght ? 2 : Combo % 2;
float scissorState = Combo == ComboLength ? 2 : Combo % 2;
Projectile.NewProjectile(source, player.Center, velocity, ProjectileType<ArkoftheElementsSwungBlade>(), damage, knockback, player.whoAmI, scissorState, Charge);
Combo += 1;
if (Combo > ComboLenght)
if (Combo > ComboLength)
Combo = 0;
+2 -2
View File
@@ -55,10 +55,10 @@ namespace CalamityMod.Items.Weapons.Ranged
Rectangle targetHitbox = target.Hitbox;
float collisionPoint = 0f;
float gunLenght = 66f;
float gunLength = 66f;
float gunHeight = 15;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLenght), gunHeight, ref collisionPoint) ? null : false;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLength), gunHeight, ref collisionPoint) ? null : false;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
+2 -2
View File
@@ -48,10 +48,10 @@ namespace CalamityMod.Items.Weapons.Ranged
Rectangle targetHitbox = target.Hitbox;
float collisionPoint = 0f;
float gunLenght = 60f;
float gunLength = 60f;
float gunHeight = 26f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLenght), gunHeight, ref collisionPoint) ? null : false;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLength), gunHeight, ref collisionPoint) ? null : false;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
+4 -4
View File
@@ -106,8 +106,8 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback)
{
float aimLenght = (Main.MouseWorld - player.MountedCenter).Length();
float damageMult = MathHelper.Lerp(1f, MaxDamageFalloff, Math.Clamp(aimLenght - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance));
float aimLength = (Main.MouseWorld - player.MountedCenter).Length();
float damageMult = MathHelper.Lerp(1f, MaxDamageFalloff, Math.Clamp(aimLength - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance));
damage = (int)(damage * damageMult);
}
@@ -116,8 +116,8 @@ namespace CalamityMod.Items.Weapons.Ranged
if (player.Calamity().GeneralScreenShakePower < 3f)
player.Calamity().GeneralScreenShakePower = 3f;
float aimLenght = (Main.MouseWorld - player.MountedCenter).Length();
float spreadDistance = Math.Clamp(aimLenght - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance);
float aimLength = (Main.MouseWorld - player.MountedCenter).Length();
float spreadDistance = Math.Clamp(aimLength - MaxSpreadDistance, 0, MinSpreadDistance - MaxSpreadDistance) / (MinSpreadDistance - MaxSpreadDistance);
float spread = MathHelper.Lerp(MaxSpread, MinSpread, spreadDistance);
Vector2 nuzzleDir = velocity.SafeNormalize(Vector2.Zero);
+1 -1
View File
@@ -918,7 +918,7 @@ namespace CalamityMod.NPCs.ExoMechs
effect.Parameters["halfSpreadAngle"].SetValue(MathHelper.PiOver4);
effect.Parameters["edgeColor"].SetValue(Color.DarkCyan.ToVector3());
effect.Parameters["centerColor"].SetValue(Color.Cyan.ToVector3());
effect.Parameters["edgeBlendLenght"].SetValue(0.07f);
effect.Parameters["edgeBlendLength"].SetValue(0.07f);
effect.Parameters["edgeBlendStrength"].SetValue(8f);
Main.spriteBatch.End();
+2 -2
View File
@@ -19,7 +19,7 @@ namespace CalamityMod.Particles
public float BaseScale;
public float Opacity;
public float LineDirection;
public float LineLenght = 0f;
public float LineLength = 0f;
private Vector2 PrevOffset = Vector2.Zero;
private Vector2 BasePosition;
public bool Telegraph; //Denotes if the line is used as an enemy telegraph. In that case, it'll be marked as important
@@ -63,7 +63,7 @@ namespace CalamityMod.Particles
RelativeOffset = offsetPosition() * LineDirection.ToRotationVector2() * BasePosition.Length();
LineLenght = (BasePosition - RelativeOffset).Length();
LineLength = (BasePosition - RelativeOffset).Length();
RelativeOffset = RelativeOffset.RotatedBy(MathHelper.PiOver4 / 16f);
//LineDirection -= MathHelper.PiOver4 / 16f;
+2 -2
View File
@@ -50,8 +50,8 @@ namespace CalamityMod.Particles
float currentDisplace = MathHelper.Lerp(StartDistanceFromPlayer, FinalDistanceFromPlayer, (float)Math.Pow(LifetimeCompletion, 2));
float earlierDisplace = MathHelper.Lerp(StartDistanceFromPlayer, FinalDistanceFromPlayer, (float)Math.Pow(Math.Clamp(LifetimeCompletion - 0.2f, 0f, 1f), 2));
float lenght = (currentDisplace - earlierDisplace) / tex.Height;
Vector2 scale = new Vector2(Scale, lenght);
float Length = (currentDisplace - earlierDisplace) / tex.Height;
Vector2 scale = new Vector2(Scale, Length);
Vector2 origin = new Vector2(tex.Width / 2f, tex.Height);
@@ -122,8 +122,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 12f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint);
float bladeLength = 12f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint);
}
}
}
+1 -1
View File
@@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic
effect.Parameters["halfSpreadAngle"].SetValue(Spread / 2f);
effect.Parameters["edgeColor"].SetValue(Color.Lerp(Color.DeepSkyBlue, Color.Coral, blinkage ).ToVector3());
effect.Parameters["centerColor"].SetValue(Color.Lerp(Color.DodgerBlue, Color.Coral, blinkage).ToVector3());
effect.Parameters["edgeBlendLenght"].SetValue(0.07f);
effect.Parameters["edgeBlendLength"].SetValue(0.07f);
effect.Parameters["edgeBlendStrength"].SetValue(8f);
Main.spriteBatch.End();
+2 -2
View File
@@ -37,10 +37,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 34f * Projectile.scale;
float bladeLength = 34f * Projectile.scale;
Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 8.5f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLength, 24, ref collisionPoint);
}
public override void AI()
@@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 80f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint);
float bladeLength = 80f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint);
}
public void GeneralParryEffects()
@@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee
if (AlreadyParried == 0)
{
float collisionPoint = 0f;
float bladeLenght = 80f * Projectile.scale;
float bladeLength = 80f * Projectile.scale;
for (int k = 0; k < Main.maxProjectiles; k++)
{
@@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee
if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles
proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly
proj.Size.Length() < 300 && //Only parry projectiles that aren't too large
Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint))
Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint))
{
GeneralParryEffects();
@@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 78f * Projectile.scale;
float bladeLength = 78f * Projectile.scale;
Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2();
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLength, 24, ref collisionPoint);
}
@@ -89,8 +89,8 @@ namespace CalamityMod.Projectiles.Melee
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = ThrustDisplaceRatio() * 242f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 30, ref collisionPoint);
float bladeLength = ThrustDisplaceRatio() * 242f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLength), 30, ref collisionPoint);
}
public override bool ShouldUpdatePosition() => false;
@@ -319,13 +319,13 @@ namespace CalamityMod.Projectiles.Melee
rot = Projectile.rotation + MathHelper.PiOver2 + StitchRotations[i];
origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f);
float stitchLenght = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f;
float stitchLength = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f;
float stitchScale = (1f + (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.Pi) * 0.3f) * 0.85f;
if (CurrentStitches == maxStitches)
{
stitchScale *= 1 - ((StitchTimer - (MaxTime - SnapTime - HoldTime * 0.5f) * 0.3f) / (MaxTime - SnapTime - HoldTime * 0.5f) * 0.7f) * 0.8f;
}
scale = new Vector2(0.2f, stitchLenght) * stitchScale;
scale = new Vector2(0.2f, stitchLength) * stitchScale;
Color stitchColor = Color.Lerp(Color.White, Color.CornflowerBlue * 0.7f, (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.PiOver2));
@@ -49,8 +49,8 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 142f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 44, ref collisionPoint);
float bladeLength = 142f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 44, ref collisionPoint);
}
public void GeneralParryEffects()
@@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee
return;
float collisionPoint = 0f;
float bladeLenght = 142f * Projectile.scale;
float bladeLength = 142f * Projectile.scale;
for (int k = 0; k < Main.maxProjectiles; k++)
{
@@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee
if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles
proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly
proj.Size.Length() < 300 && //Only parry projectiles that aren't too large
Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint))
Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint))
{
if (AlreadyParried == 0)
{
@@ -94,18 +94,18 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float bladeLenght = 172f * Projectile.scale;
float bladeLength = 172f * Projectile.scale;
if (Thrown)
{
bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLenght / 2f, Vector2.One * bladeLenght);
bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLength / 2f, Vector2.One * bladeLength);
if (Combo == 2f)
return mainCollision;
else
{
Vector2 thrownBladeStart = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f));
bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLenght);
bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLength);
return mainCollision || thrownScissorCollision;
}
}
@@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee
float collisionPoint = 0f;
Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2();
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLength, 24, ref collisionPoint);
}
//Swing animation keys
@@ -48,8 +48,8 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 142f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 44, ref collisionPoint);
float bladeLength = 142f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 44, ref collisionPoint);
}
public void GeneralParryEffects()
@@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee
return;
float collisionPoint = 0f;
float bladeLenght = 142f * Projectile.scale;
float bladeLength = 142f * Projectile.scale;
for (int k = 0; k < Main.maxProjectiles; k++)
{
@@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Melee
if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles
proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly
proj.Size.Length() < 300 && //Only parry projectiles that aren't too large
Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint))
Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint))
{
if (AlreadyParried == 0)
{
@@ -70,8 +70,8 @@ namespace CalamityMod.Projectiles.Melee
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = ThrustDisplaceRatio() * 242f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 30, ref collisionPoint);
float bladeLength = ThrustDisplaceRatio() * 242f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLength), 30, ref collisionPoint);
}
public override bool ShouldUpdatePosition() => false;
@@ -241,13 +241,13 @@ namespace CalamityMod.Projectiles.Melee
rot = Projectile.rotation + MathHelper.PiOver2 + StitchRotations[i];
origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f);
float stitchLenght = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f;
float stitchLength = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f;
float stitchScale = (1f + (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.Pi) * 0.3f) * 0.85f;
if (CurrentStitches == maxStitches)
{
stitchScale *= 1 - ((StitchTimer - (MaxTime - SnapTime - HoldTime * 0.5f) * 0.3f) / (MaxTime - SnapTime - HoldTime * 0.5f) * 0.7f) * 0.8f;
}
scale = new Vector2(0.2f, stitchLenght) * stitchScale;
scale = new Vector2(0.2f, stitchLength) * stitchScale;
Color stitchColor = Color.Lerp(Color.White, Color.CornflowerBlue * 0.7f, (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.PiOver2));
@@ -92,18 +92,18 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float bladeLenght = 142f * Projectile.scale;
float bladeLength = 142f * Projectile.scale;
if (Thrown)
{
bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLenght / 2f, Vector2.One * bladeLenght);
bool mainCollision = Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * bladeLength / 2f, Vector2.One * bladeLength);
if (Combo == 2f)
return mainCollision;
else
{
Vector2 thrownBladeStart = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f));
bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLenght);
bool thrownScissorCollision = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), thrownBladeStart, thrownBladeStart + direction * bladeLength);
return mainCollision || thrownScissorCollision;
}
}
@@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee
float collisionPoint = 0f;
Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2();
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLength, 24, ref collisionPoint);
}
//Swing animation keys
@@ -53,10 +53,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 94 * Projectile.scale;
float bladeLength = 94 * Projectile.scale;
float bladeWidth = 76 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
public void Pogo()
@@ -78,24 +78,24 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 0f;
float bladeLength = 0f;
Vector2 displace = Vector2.Zero;
switch (SwingMode)
{
case 0:
bladeLenght = 90f * Projectile.scale;
bladeLength = 90f * Projectile.scale;
break;
case 1:
bladeLenght = 110f * Projectile.scale;
bladeLength = 110f * Projectile.scale;
break;
case 2:
bladeLenght = Projectile.frame <= 2 ? 85f : 150f; //Only use the extended hitbox after the blade actually extends. For realism.
bladeLenght *= Projectile.scale;
bladeLength = Projectile.frame <= 2 ? 85f : 150f; //Only use the extended hitbox after the blade actually extends. For realism.
bladeLength *= Projectile.scale;
displace = direction * ThrustDisplaceRatio() * 60f;
break;
}
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (rotation.ToRotationVector2() * bladeLenght), 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (rotation.ToRotationVector2() * bladeLength), 24, ref collisionPoint);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
@@ -42,10 +42,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 120f * Projectile.scale;
float bladeLength = 120f * Projectile.scale;
Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLenght), 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLength), 24, ref collisionPoint);
}
public override void AI()
@@ -74,10 +74,10 @@ namespace CalamityMod.Projectiles.Melee
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
base.ModifyHitNPC(target, ref damage, ref knockback, ref crit, ref hitDirection);
Vector2 projectileHalfLenght = (Projectile.Size / 2f) * Projectile.rotation.ToRotationVector2();
Vector2 projectileHalfLength = (Projectile.Size / 2f) * Projectile.rotation.ToRotationVector2();
float collisionPoint = 0;
//If you hit the enemy during the coyote time with the blade of the whip, guarantee a crit & get some bonus damage
if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint))
if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLength, Projectile.Center + projectileHalfLength, 32, ref collisionPoint))
{
if (SnapCoyoteTime > 0f)
{
+6 -6
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee
public PrimitiveTrail PierceAfterimageDrawer = null;
const float BladeLenght = 180;
const float BladeLength = 180;
public int GetSwingTime
{
@@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee
{
float _ = 0f;
Vector2 start = Projectile.Center;
Vector2 end = start + SwordDirection * BladeLenght * Projectile.scale;
Vector2 end = start + SwordDirection * BladeLength * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, Projectile.scale * 30f, ref _);
}
@@ -317,7 +317,7 @@ namespace CalamityMod.Projectiles.Melee
if (Main.rand.NextFloat() * 3f < RiskOfDust)
{
Dust auricDust = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLenght * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.5f, 1f), 0.5f), ModContent.DustType<AuricBarDust>(), SwordDirection.RotatedBy(-MathHelper.PiOver2 * Direction) * 2f);
Dust auricDust = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLength * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.5f, 1f), 0.5f), ModContent.DustType<AuricBarDust>(), SwordDirection.RotatedBy(-MathHelper.PiOver2 * Direction) * 2f);
auricDust.noGravity = true;
auricDust.alpha = 10;
auricDust.scale = 0.5f;
@@ -326,7 +326,7 @@ namespace CalamityMod.Projectiles.Melee
if (Main.rand.NextFloat() < RiskOfDust)
{
Color dustColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.9f);
Dust must = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLenght * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.2f, 1f), 0.5f), 267, SwordDirection.RotatedBy(MathHelper.PiOver2 * Direction) * 2.6f, 0, dustColor);
Dust must = Dust.NewDustPerfect(Owner.MountedCenter + SwordDirection * BladeLength * Projectile.scale * (float)Math.Pow(Main.rand.NextFloat(0.2f, 1f), 0.5f), 267, SwordDirection.RotatedBy(MathHelper.PiOver2 * Direction) * 2.6f, 0, dustColor);
must.scale = 0.3f;
must.fadeIn = Main.rand.NextFloat() * 1.2f;
@@ -442,7 +442,7 @@ namespace CalamityMod.Projectiles.Melee
{
float progress = MathHelper.Lerp(Progression, TrailEndProgression, i / 40f);
result.Add(DirectionAtProgressScuffed(progress) * (BladeLenght - 50f) * Projectile.scale);
result.Add(DirectionAtProgressScuffed(progress) * (BladeLength - 50f) * Projectile.scale);
}
return result;
@@ -555,7 +555,7 @@ namespace CalamityMod.Projectiles.Melee
float lensFlareOpacity = (Progression < 0.3f ? 0f : 0.2f + 0.8f * (float)Math.Sin(MathHelper.Pi * (Progression - 0.3f) / 0.7f)) * 0.6f;
Color lensFlareColor = Color.Lerp(Color.LimeGreen, Color.Plum, (float)Math.Pow(Progression, 3));
lensFlareColor.A = 0;
Main.EntitySpriteDraw(shineTex, Owner.MountedCenter + DirectionAtProgressScuffed(Progression) * Projectile.scale * BladeLenght - Main.screenPosition, null, lensFlareColor * lensFlareOpacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, 0, 0);
Main.EntitySpriteDraw(shineTex, Owner.MountedCenter + DirectionAtProgressScuffed(Progression) * Projectile.scale * BladeLength - Main.screenPosition, null, lensFlareColor * lensFlareOpacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, 0, 0);
}
else
@@ -56,10 +56,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 145 * Projectile.scale;
float bladeLength = 145 * Projectile.scale;
float bladeWidth = 25 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
public CurveSegment QuickOut = new CurveSegment(EasingType.PolyIn, 0f, 0f, 0.2f, 3);
+2 -2
View File
@@ -63,9 +63,9 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 145 * Projectile.scale;
float bladeLength = 145 * Projectile.scale;
float bladeWidth = 25 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
+5 -5
View File
@@ -60,10 +60,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 145 * Projectile.scale;
float bladeLength = 145 * Projectile.scale;
float bladeWidth = 86 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
public override void AI()
@@ -102,18 +102,18 @@ namespace CalamityMod.Projectiles.Melee
#region sparkles and particles
float bladeLenght = 120 * Projectile.scale;
float bladeLength = 120 * Projectile.scale;
for (int i = 0; i < 3; i++)
{
if (Rings[i] == null)
{
Rings[i] = new ConstellationRingVFX(Owner.Center + (direction * (25 + bladeLenght * 0.33f * i)), Color.DarkOrchid, direction.ToRotation(), Projectile.scale * 0.25f * i, new Vector2(0.5f, 1f), spinSpeed: 7, starAmount: 3 + i, important: true);
Rings[i] = new ConstellationRingVFX(Owner.Center + (direction * (25 + bladeLength * 0.33f * i)), Color.DarkOrchid, direction.ToRotation(), Projectile.scale * 0.25f * i, new Vector2(0.5f, 1f), spinSpeed: 7, starAmount: 3 + i, important: true);
GeneralParticleHandler.SpawnParticle(Rings[i]);
}
else
{
Rings[i].Time = 0;
Rings[i].Position = Owner.Center + Vector2.Lerp(Vector2.Zero, ((0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 10f - i * 0.5f)) * direction * (25 + bladeLenght * 0.33f * (i + 1))), Bounce(MathHelper.Clamp(Shred - 30 * i, 0, maxShred)));
Rings[i].Position = Owner.Center + Vector2.Lerp(Vector2.Zero, ((0.9f + 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 10f - i * 0.5f)) * direction * (25 + bladeLength * 0.33f * (i + 1))), Bounce(MathHelper.Clamp(Shred - 30 * i, 0, maxShred)));
Rings[i].Rotation = direction.ToRotation();
Rings[i].Scale = Projectile.scale * 0.25f * (i + 1);
(Rings[i] as ConstellationRingVFX).Opacity = 0.5f + 0.5f * ShredRatio;
+2 -2
View File
@@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 84 * Projectile.scale;
float bladeLength = 84 * Projectile.scale;
float bladeWidth = 76 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLength / 2, Projectile.Center + direction * bladeLength / 2, bladeWidth, ref collisionPoint);
}
public override void AI()
+2 -2
View File
@@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeHalfLenght = 25f * Projectile.scale / 2f;
float bladeHalfLength = 25f * Projectile.scale / 2f;
float bladeWidth = 14f * Projectile.scale;
Vector2 direction = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2();
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeHalfLenght, Projectile.Center + direction * bladeHalfLenght, bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeHalfLength, Projectile.Center + direction * bladeHalfLength, bladeWidth, ref collisionPoint);
}
public override void Kill(int timeLeft)
@@ -57,10 +57,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 120 * Projectile.scale;
float bladeLength = 120 * Projectile.scale;
float bladeWidth = 20 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
public CurveSegment QuickOut = new CurveSegment(EasingType.PolyIn, 0f, 0f, 0.2f, 3);
@@ -69,8 +69,8 @@ namespace CalamityMod.Projectiles.Melee
if (!WaterMode)
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 + 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);
float halfLength = 66f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLength, Projectile.Center - Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLength, 40f, ref collisionPoint);
}
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
@@ -60,9 +60,9 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 100 * Projectile.scale;
float bladeLength = 100 * Projectile.scale;
float bladeWidth = 20 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
@@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 120 * Projectile.scale;
float bladeLength = 120 * Projectile.scale;
float bladeWidth = 76 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
public void Pogo()
@@ -41,10 +41,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 84 * Projectile.scale;
float bladeLength = 84 * Projectile.scale;
float bladeWidth = 76 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLength / 2, Projectile.Center + direction * bladeLength / 2, bladeWidth, ref collisionPoint);
}
public override void AI()
@@ -76,22 +76,22 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 0f;
float bladeLength = 0f;
Vector2 displace = Vector2.Zero;
switch (SwingMode)
{
case 0:
case 1:
bladeLenght = 150 * Projectile.scale;
bladeLength = 150 * Projectile.scale;
break;
case 2:
bladeLenght = 225f; //In awe e
bladeLenght *= Projectile.scale;
bladeLength = 225f; //In awe e
bladeLength *= Projectile.scale;
displace = direction * ThrustDisplaceRatio() * 60f;
break;
}
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (rotation.ToRotationVector2() * bladeLenght), 26, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (rotation.ToRotationVector2() * bladeLength), 26, ref collisionPoint);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
@@ -47,10 +47,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 140f * Projectile.scale;
float bladeLength = 140f * Projectile.scale;
Vector2 displace = direction * ((float)Math.Sin(Timer / MaxTime * 3.14f) * 60);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLenght), 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + displace, Owner.Center + displace + (direction * bladeLength), 24, ref collisionPoint);
}
public override void AI()
@@ -72,10 +72,10 @@ namespace CalamityMod.Projectiles.Melee
Vector2 previousPosition = chainPositions[i - 1];
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), position, previousPosition, 6, ref collisionPoint))
return true;
if (i == numPoints - 1) //Extra lenght collision for the blade itself
if (i == numPoints - 1) //Extra length collision for the blade itself
{
Vector2 projectileHalfLenght = 85 * Projectile.rotation.ToRotationVector2();
return (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint));
Vector2 projectileHalfLength = 85 * Projectile.rotation.ToRotationVector2();
return (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - projectileHalfLength, Projectile.Center + projectileHalfLength, 32, ref collisionPoint));
}
}
@@ -85,10 +85,10 @@ namespace CalamityMod.Projectiles.Melee
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
Vector2 projectileHalfLenght = 85f * Projectile.rotation.ToRotationVector2();
Vector2 projectileHalfLength = 85f * Projectile.rotation.ToRotationVector2();
float collisionPoint = 0;
//If you hit the enemy during the coyote time with the blade of the whip, guarantee a crit & get some bonus damage
if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLenght, Projectile.Center + projectileHalfLenght, 32, ref collisionPoint))
if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLength, Projectile.Center + projectileHalfLength, 32, ref collisionPoint))
{
if (SnapCoyoteTime > 0f)
{
+2 -2
View File
@@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 44f * Projectile.scale;
float bladeLength = 44f * Projectile.scale;
Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLength, 24, ref collisionPoint);
}
public override void AI()
+2 -2
View File
@@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 44f * Projectile.scale;
float bladeLength = 44f * Projectile.scale;
Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLength, 24, ref collisionPoint);
}
public override void AI()
@@ -186,9 +186,9 @@ namespace CalamityMod.Projectiles.Melee.Spears
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 85 * Projectile.scale;
float bladeLength = 85 * Projectile.scale;
float bladeWidth = 20 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + AppropriateRotation.ToRotationVector2() * bladeLenght * -0.5f, Projectile.Center + ThrustRotation.ToRotationVector2() * bladeLenght * 0.5f, bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + AppropriateRotation.ToRotationVector2() * bladeLength * -0.5f, Projectile.Center + ThrustRotation.ToRotationVector2() * bladeLength * 0.5f, bladeWidth, ref collisionPoint);
}
public override void AI()
+2 -2
View File
@@ -39,10 +39,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 44f * Projectile.scale;
float bladeLength = 44f * Projectile.scale;
Vector2 start = -Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 16f;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLenght, 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + start, Projectile.Center + start + Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * bladeLength, 24, ref collisionPoint);
}
public override void AI()
@@ -45,8 +45,8 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 100f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint);
float bladeLength = 100f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint);
}
public void GeneralParryEffects()
@@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee
if (AlreadyParried == 0)
{
float collisionPoint = 0f;
float bladeLenght = 100f * Projectile.scale;
float bladeLength = 100f * Projectile.scale;
for (int k = 0; k < Main.maxProjectiles; k++)
{
@@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee
if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles
proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly
proj.Size.Length() < 300 && //Only parry projectiles that aren't too large
Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint))
Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint))
{
GeneralParryEffects();
@@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 88f * Projectile.scale;
float bladeLength = 88f * Projectile.scale;
Vector2 holdPoint = DistanceFromPlayer.Length() * Projectile.rotation.ToRotationVector2();
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLenght, 24, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + holdPoint, Owner.Center + holdPoint + Projectile.rotation.ToRotationVector2() * bladeLength, 24, ref collisionPoint);
}
@@ -57,10 +57,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 145 * Projectile.scale;
float bladeLength = 145 * Projectile.scale;
float bladeWidth = 25 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
public CurveSegment QuickOut = new CurveSegment(EasingType.PolyIn, 0f, 0f, 0.2f, 3);
@@ -61,10 +61,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 130 * Projectile.scale;
float bladeLength = 130 * Projectile.scale;
float bladeWidth = 86 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
public void Pogo()
@@ -52,10 +52,10 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 84 * Projectile.scale;
float bladeLength = 84 * Projectile.scale;
float bladeWidth = 76 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLenght / 2, Projectile.Center + direction * bladeLenght / 2, bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - direction * bladeLength / 2, Projectile.Center + direction * bladeLength / 2, bladeWidth, ref collisionPoint);
}
public override void AI()
@@ -65,9 +65,9 @@ namespace CalamityMod.Projectiles.Melee
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 140 * Projectile.scale;
float bladeLength = 140 * Projectile.scale;
float bladeWidth = 25 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLength), bladeWidth, ref collisionPoint);
}
+2 -2
View File
@@ -45,9 +45,9 @@ namespace CalamityMod.Projectiles.Melee
return false;
float collisionPoint = 0f;
float bladeLenght = 70 * Projectile.scale;
float bladeLength = 70 * Projectile.scale;
float bladeWidth = 30 * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLenght), bladeWidth, ref collisionPoint);
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint);
}
public override void AI()
+4 -4
View File
@@ -63,8 +63,8 @@ namespace CalamityMod.Projectiles.Melee
{
//The hitbox is simplified into a line collision.
float collisionPoint = 0f;
float bladeLenght = 78f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint);
float bladeLength = 78f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint);
}
public override void AI()
@@ -96,8 +96,8 @@ namespace CalamityMod.Projectiles.Melee
if (proj.ModProjectile != null && proj.owner == Projectile.owner && proj.ModProjectile is WulfrumScrew screw && screw.BazingaTime == 0)
{
float collisionPoint = 0f;
float bladeLenght = 86f * Projectile.scale;
if (Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + OffsetFromPlayer, Owner.Center + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 34, ref collisionPoint))
float bladeLength = 86f * Projectile.scale;
if (Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + OffsetFromPlayer, Owner.Center + OffsetFromPlayer + (Projectile.velocity * bladeLength), 34, ref collisionPoint))
{
Vector2 thudVelocity = TrueDirection.ToRotationVector2() * 6f;
NPC potentialAimAssist = FindTarget();
+1 -1
View File
@@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Ranged
spreadEffect.Parameters["halfSpreadAngle"].SetValue(halfAngle);
spreadEffect.Parameters["edgeColor"].SetValue(sightsColor.ToVector3());
spreadEffect.Parameters["centerColor"].SetValue(sightsColor.ToVector3());
spreadEffect.Parameters["edgeBlendLenght"].SetValue(0.07f);
spreadEffect.Parameters["edgeBlendLength"].SetValue(0.07f);
spreadEffect.Parameters["edgeBlendStrength"].SetValue(8f);
Main.spriteBatch.End();
+4 -4
View File
@@ -53,13 +53,13 @@ namespace CalamityMod.Projectiles.Ranged
{
Vector2 beamVector = Projectile.velocity;
float beamLenght = DetermineLaserLength_CollideWithTiles(12);
float beamLength = DetermineLaserLength_CollideWithTiles(12);
//Rapid dust
int dustCount = Main.rand.Next(10, 30);
for (int i = 0; i < dustCount; i++)
{
float dustProgressAlongBeam = beamLenght * Main.rand.NextFloat(0f, 0.8f);
float dustProgressAlongBeam = beamLength * Main.rand.NextFloat(0f, 0.8f);
Vector2 dustPosition = Projectile.Center + dustProgressAlongBeam * beamVector + beamVector.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-6f, 6f) * Projectile.scale;
Dust dust = Dust.NewDustPerfect(dustPosition, 187, beamVector * Main.rand.NextFloat(5f, 26f), 0, Color.White, 2.2f);
@@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Ranged
}
//Put a titanium shell into the impact tile (if it collided with one)
if (beamLenght < MaxLaserLength)
if (beamLength < MaxLaserLength)
{
Vector2 endPoint = beamLenght * beamVector + Projectile.Center + beamVector * 8.5f;
Vector2 endPoint = beamLength * beamVector + Projectile.Center + beamVector * 8.5f;
Point anchorPos = new Point((int)endPoint.X / 16, (int)endPoint.Y / 16);
Color burnColor = Main.rand.NextBool(4) ? Color.PaleGreen : Main.rand.NextBool(4) ? Color.PaleTurquoise : Color.OrangeRed;
+5 -5
View File
@@ -231,23 +231,23 @@ namespace CalamityMod.Projectiles.Summon
}
Vector2 center2 = Projectile.Center;
Vector2 playerpos = player.Center - center2 + new Vector2(0f, -60f);
float lenghttoplayer = playerpos.Length();
if (lenghttoplayer > 200f && speedtoplayer < 8f)
float LengthToPlayer = playerpos.Length();
if (LengthToPlayer > 200f && speedtoplayer < 8f)
{
speedtoplayer = 10f;
}
if (lenghttoplayer < idledistance && gotoplayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))
if (LengthToPlayer < idledistance && gotoplayer && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))
{
Projectile.ai[0] = 0f;
Projectile.netUpdate = true;
}
if (lenghttoplayer > 2700f)
if (LengthToPlayer > 2700f)
{
Projectile.position.X = Main.player[Projectile.owner].Center.X - (float)(Projectile.width / 2);
Projectile.position.Y = Main.player[Projectile.owner].Center.Y - (float)(Projectile.height / 2);
Projectile.netUpdate = true;
}
if (lenghttoplayer > 70f)
if (LengthToPlayer > 70f)
{
playerpos.Normalize();
playerpos *= speedtoplayer;
+2 -2
View File
@@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Typeless
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float collisionPoint = 0f;
float bladeLenght = 54f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLenght), 24, ref collisionPoint);
float bladeLength = 54f * Projectile.scale;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLength), 24, ref collisionPoint);
}
public override void AI()
+3 -3
View File
@@ -113,9 +113,9 @@ namespace CalamityMod.Projectiles.Typeless
else
{
float lenghtToOwner = BetweenOwner.Length();
float LengthToOwner = BetweenOwner.Length();
if (lenghtToOwner > Owner.GetModPlayer<WulfrumPackPlayer>().SwingLenght + 60f)
if (LengthToOwner > Owner.GetModPlayer<WulfrumPackPlayer>().SwingLength + 60f)
{
State = HookState.Retracting;
}
@@ -196,7 +196,7 @@ namespace CalamityMod.Projectiles.Typeless
//Owner.velocity = Vector2.Zero;
}
mp.SwingLenght = (Owner.Center - Projectile.Center).Length();
mp.SwingLength = (Owner.Center - Projectile.Center).Length();
mp.OldPosition = Owner.Center - Owner.velocity;
mp.SetSegments(Projectile.Center);
mp.Grapple = Projectile.whoAmI;
+1 -1
View File
@@ -269,7 +269,7 @@ namespace CalamityMod.Systems
tileEffect.Parameters["pingTravelTime"].SetValue(MaxPingTravelTime / (float)MaxPingLife);
tileEffect.Parameters["pingFadePoint"].SetValue(0.9f);
tileEffect.Parameters["edgeBlendStrength"].SetValue(1f);
tileEffect.Parameters["edgeBlendOutLenght"].SetValue(6f);
tileEffect.Parameters["edgeBlendOutLength"].SetValue(6f);
tileEffect.Parameters["tileEdgeBlendStrenght"].SetValue(2f);
tileEffect.Parameters["waveColor"].SetValue(Color.GreenYellow.ToVector4());
+19 -19
View File
@@ -30,10 +30,10 @@ namespace CalamityMod.UI.ModeIndicator
public static bool ClickingMouse => Main.mouseLeft && Main.mouseLeftRelease;
public static Vector2 DrawCenter => new Vector2(Main.screenWidth - 400f - WidthForTier(MostAlternateDifficulties) * 0.5f, 82f) + FrameSize * 0.5f;
private static int GlowFadeAnimLenght = 40;
private static int GlowFadeAnimLength = 40;
public static int GlowFadeTime = 0;
//Lock icon
internal const int LockAnimLenght = 30;
internal const int LockAnimLength = 30;
private static int lockClickTime = 0;
private static bool previousLockStatus = false;
//Expand and shrink on hover
@@ -45,7 +45,7 @@ namespace CalamityMod.UI.ModeIndicator
public static float MainIconScale => 1f + iconHoverScaleBoost;
//Menu state
private static bool menuOpen = false;
internal static int MenuAnimLenght => MostAlternateDifficulties > 1 ? 60 : 40;
internal static int MenuAnimLength => MostAlternateDifficulties > 1 ? 60 : 40;
private static int menuOpenTransitionTime = 0;
private static DifficultyMode previouslyHoveredMode = null;
public static float WidthForTier(int alts) => (alts - 1) * 40f;
@@ -99,7 +99,7 @@ namespace CalamityMod.UI.ModeIndicator
{
if (!_hasCheckedItOutYet)
{
GlowFadeTime = GlowFadeAnimLenght;
GlowFadeTime = GlowFadeAnimLength;
_hasCheckedItOutYet = true;
}
@@ -116,7 +116,7 @@ namespace CalamityMod.UI.ModeIndicator
if (ClickingMouse && menuOpenTransitionTime == 0 && !locked)
{
SoundEngine.PlaySound(menuOpen ? SoundID.MenuClose : SoundID.MenuOpen);
menuOpenTransitionTime = MenuAnimLenght;
menuOpenTransitionTime = MenuAnimLength;
menuOpen = !menuOpen;
}
}
@@ -130,7 +130,7 @@ namespace CalamityMod.UI.ModeIndicator
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix);
Texture2D bloomTex = ModContent.Request<Texture2D>("CalamityMod/UI/ModeIndicator/BloomFlare").Value;
float opacity = !_hasCheckedItOutYet ? 1f : 1f * GlowFadeTime / (float)GlowFadeAnimLenght;
float opacity = !_hasCheckedItOutYet ? 1f : 1f * GlowFadeTime / (float)GlowFadeAnimLength;
float scale = 0.4f + (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.05f;
float rot = Main.GlobalTimeWrappedHourly * 0.5f;
@@ -244,7 +244,7 @@ namespace CalamityMod.UI.ModeIndicator
//Shakes the lock if it automatically changed, because a boss was summoned
if (locked != previousLockStatus && lockClickTime == 0)
lockClickTime = LockAnimLenght;
lockClickTime = LockAnimLength;
previousLockStatus = locked;
@@ -252,7 +252,7 @@ namespace CalamityMod.UI.ModeIndicator
if (locked && menuOpen)
{
menuOpen = false;
menuOpenTransitionTime = MenuAnimLenght - menuOpenTransitionTime;
menuOpenTransitionTime = MenuAnimLength - menuOpenTransitionTime;
}
//Click handling
@@ -260,7 +260,7 @@ namespace CalamityMod.UI.ModeIndicator
{
if (MouseScreenArea.Intersects(MainClickArea))
{
lockClickTime = LockAnimLenght;
lockClickTime = LockAnimLength;
SoundEngine.PlaySound(SoundID.MenuTick);
}
}
@@ -270,15 +270,15 @@ namespace CalamityMod.UI.ModeIndicator
private static CurveSegment lockGrow = new CurveSegment(SineOutEasing, 0f, 1f, 0.4f);
private static CurveSegment lockShrink = new CurveSegment(SineInEasing, 0.6f, 1.4f, -0.4f);
private static CurveSegment lockBump = new CurveSegment(SineBumpEasing, 0.9f, 1f, -0.2f);
internal static float LockShakeScale => PiecewiseAnimation(lockClickTime / (float)LockAnimLenght, new CurveSegment[] { lockGrow, lockShrink, lockBump });
internal static float LockShakeScale => PiecewiseAnimation(lockClickTime / (float)LockAnimLength, new CurveSegment[] { lockGrow, lockShrink, lockBump });
private static CurveSegment barExpand = new CurveSegment(SineInOutEasing, 0f, 0f, 1f);
internal static float BarExpansionProgress
{
get
{
float animLenght = MostAlternateDifficulties == 1 ? (float)MenuAnimLenght : MenuAnimLenght * 2 / 3f;
float progress = (menuOpenTransitionTime / animLenght);
float animLength = MostAlternateDifficulties == 1 ? (float)MenuAnimLength : MenuAnimLength * 2 / 3f;
float progress = (menuOpenTransitionTime / animLength);
if (menuOpen)
progress = 1 - progress;
@@ -294,7 +294,7 @@ namespace CalamityMod.UI.ModeIndicator
{
get
{
float progress = Math.Max(menuOpenTransitionTime - MenuAnimLenght * 2 / 3f, 0f) / (MenuAnimLenght / 3f);
float progress = Math.Max(menuOpenTransitionTime - MenuAnimLength * 2 / 3f, 0f) / (MenuAnimLength / 3f);
if (menuOpen)
progress = 1 - progress;
@@ -305,9 +305,9 @@ namespace CalamityMod.UI.ModeIndicator
public static void ManageHexIcons(SpriteBatch spriteBatch, out string text)
{
int tiers = DifficultyTiers.Count();
float barLenght = 60 * tiers * BarExpansionProgress;
float progress = menuOpen ? 1 - menuOpenTransitionTime / (float)MenuAnimLenght : menuOpenTransitionTime / (float)MenuAnimLenght;
Vector2 basePosition = DrawCenter + (barLenght / (float)(tiers + 1f)) * Vector2.UnitY;
float barLength = 60 * tiers * BarExpansionProgress;
float progress = menuOpen ? 1 - menuOpenTransitionTime / (float)MenuAnimLength : menuOpenTransitionTime / (float)MenuAnimLength;
Vector2 basePosition = DrawCenter + (barLength / (float)(tiers + 1f)) * Vector2.UnitY;
Texture2D outlineTexture = ModContent.Request<Texture2D>("CalamityMod/UI/ModeIndicator/ModeIndicatorOutline").Value;
@@ -323,7 +323,7 @@ namespace CalamityMod.UI.ModeIndicator
Texture2D hexIcon = mode.Texture.Value;
//Get position
Vector2 iconPosition = basePosition + (barLenght / (float)(tiers + 1f)) * Vector2.UnitY * i;
Vector2 iconPosition = basePosition + (barLength / (float)(tiers + 1f)) * Vector2.UnitY * i;
if (modesAtTier > 1)
iconPosition += Vector2.UnitX * MathHelper.Lerp(WidthForTier(modesAtTier) * -0.5f, WidthForTier(modesAtTier) * 0.5f, j / (float)(modesAtTier - 1)) * BarWidthExpansionProgress;
@@ -365,7 +365,7 @@ namespace CalamityMod.UI.ModeIndicator
public static void DrawLock(SpriteBatch spriteBatch)
{
Texture2D lockTexture = ModContent.Request<Texture2D>("CalamityMod/UI/ModeIndicator/ModeIndicatorLock").Value;
float rotationShift = lockClickTime == 0 ? 0f : (float)Math.Sin((1 - lockClickTime / (float)LockAnimLenght) * MathHelper.TwoPi * 2f) * 0.5f * (lockClickTime / (float)LockAnimLenght);
float rotationShift = lockClickTime == 0 ? 0f : (float)Math.Sin((1 - lockClickTime / (float)LockAnimLength) * MathHelper.TwoPi * 2f) * 0.5f * (lockClickTime / (float)LockAnimLength);
spriteBatch.Draw(lockTexture, DrawCenter + Vector2.UnitY * 12 * MainIconScale, null, Color.White, 0f + rotationShift, lockTexture.Size() * 0.5f, LockShakeScale * MainIconScale, SpriteEffects.None, 0f);
}
#endregion
@@ -450,7 +450,7 @@ namespace CalamityMod.UI.ModeIndicator
CalamityNetcode.SyncCalamityWorldDifficulties(Main.myPlayer);
menuOpen = false;
menuOpenTransitionTime = MenuAnimLenght;
menuOpenTransitionTime = MenuAnimLength;
}
#endregion
+2 -2
View File
@@ -342,8 +342,8 @@ namespace CalamityMod
endPoint = segments[i + 1].startingX;
}
float segmentLenght = endPoint - startPoint;
float segmentProgress = (progress - segment.startingX) / segmentLenght; //How far along the specific segment
float segmentLength = endPoint - startPoint;
float segmentProgress = (progress - segment.startingX) / segmentLength; //How far along the specific segment
ratio = segment.startingHeight;
//Failsafe because somehow it can fail? what
+10 -10
View File
@@ -322,11 +322,11 @@ namespace CalamityMod
public static bool IntoMorseCode(string originalText, float completion)
{
int spaceLenght = 13;
int betweenLetterLenght = 7;
int betweenBlipLenght = 4;
int shortLenght = 3;
int longLenght = 8;
int spaceLength = 13;
int betweenLetterLength = 7;
int betweenBlipLength = 4;
int shortLength = 3;
int longLength = 8;
char[] TextKeys = { ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
@@ -358,18 +358,18 @@ namespace CalamityMod
for (int i = 0; i < morseText.Length; i++)
{
if (morseText[i] == " ".ToCharArray()[0])
morseState.AddRange(Enumerable.Repeat(false, spaceLenght));
morseState.AddRange(Enumerable.Repeat(false, spaceLength));
if (morseText[i] == "|".ToCharArray()[0])
morseState.AddRange(Enumerable.Repeat(false, betweenLetterLenght));
morseState.AddRange(Enumerable.Repeat(false, betweenLetterLength));
if (morseText[i] == ".".ToCharArray()[0])
morseState.AddRange(Enumerable.Repeat(true, shortLenght));
morseState.AddRange(Enumerable.Repeat(true, shortLength));
if (morseText[i] == "-".ToCharArray()[0])
morseState.AddRange(Enumerable.Repeat(true, longLenght));
morseState.AddRange(Enumerable.Repeat(true, longLength));
morseState.AddRange(Enumerable.Repeat(false, betweenBlipLenght));
morseState.AddRange(Enumerable.Repeat(false, betweenBlipLength));
}
return morseState[(int)((morseState.Count - 1) * completion)];