Merge branch 'master' into draedon-summoner
This commit is contained in:
commit
eb2bbb13c4
7 files changed
+55
-94
No files matched your search
@@ -331,9 +331,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
|
||||
// Velocity and acceleration values
|
||||
float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f;
|
||||
float baseVelocity = 14f * baseVelocityMult;
|
||||
float baseVelocity = 18f * baseVelocityMult;
|
||||
float baseAcceleration = 1f;
|
||||
float decelerationVelocityMult = 0.9f;
|
||||
float decelerationVelocityMult = 0.85f;
|
||||
if (berserk)
|
||||
{
|
||||
baseVelocity *= 1.5f;
|
||||
|
||||
@@ -264,9 +264,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
|
||||
// Velocity and acceleration values
|
||||
float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f;
|
||||
float baseVelocity = 15f * baseVelocityMult;
|
||||
float baseVelocity = 20f * baseVelocityMult;
|
||||
float baseAcceleration = 1f;
|
||||
float decelerationVelocityMult = 0.9f;
|
||||
float decelerationVelocityMult = 0.85f;
|
||||
if (berserk)
|
||||
{
|
||||
baseVelocity *= 1.5f;
|
||||
|
||||
@@ -257,9 +257,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
|
||||
// Velocity and acceleration values
|
||||
float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f;
|
||||
float baseVelocity = 15f * baseVelocityMult;
|
||||
float baseVelocity = 20f * baseVelocityMult;
|
||||
float baseAcceleration = 1f;
|
||||
float decelerationVelocityMult = 0.9f;
|
||||
float decelerationVelocityMult = 0.85f;
|
||||
if (berserk)
|
||||
{
|
||||
baseVelocity *= 1.5f;
|
||||
|
||||
@@ -262,9 +262,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
|
||||
// Velocity and acceleration values
|
||||
float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f;
|
||||
float baseVelocity = 15f * baseVelocityMult;
|
||||
float baseVelocity = 20f * baseVelocityMult;
|
||||
float baseAcceleration = 1f;
|
||||
float decelerationVelocityMult = 0.9f;
|
||||
float decelerationVelocityMult = 0.85f;
|
||||
if (berserk)
|
||||
{
|
||||
baseVelocity *= 1.5f;
|
||||
|
||||
@@ -262,9 +262,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
|
||||
// Velocity and acceleration values
|
||||
float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f;
|
||||
float baseVelocity = 15f * baseVelocityMult;
|
||||
float baseVelocity = 20f * baseVelocityMult;
|
||||
float baseAcceleration = 1f;
|
||||
float decelerationVelocityMult = 0.9f;
|
||||
float decelerationVelocityMult = 0.85f;
|
||||
if (berserk)
|
||||
{
|
||||
baseVelocity *= 1.5f;
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class AresLaserBeamStart : ModProjectile
|
||||
{
|
||||
private const int maxFrames = 5;
|
||||
private int frameDrawn = 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
@@ -72,13 +73,6 @@ namespace CalamityMod.Projectiles.Boss
|
||||
return;
|
||||
}
|
||||
|
||||
if (projectile.localAI[0] % 5f == 0f)
|
||||
{
|
||||
frameDrawn++;
|
||||
if (frameDrawn >= 5)
|
||||
frameDrawn = 0;
|
||||
}
|
||||
|
||||
projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 60f) * 10f * num801;
|
||||
if (projectile.scale > num801)
|
||||
projectile.scale = num801;
|
||||
@@ -111,32 +105,10 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
float amount = 0.5f;
|
||||
projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); //length of laser, linear interpolation
|
||||
Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f);
|
||||
|
||||
int dustType = (int)CalamityDusts.Brimstone;
|
||||
|
||||
// Spawn dust at the start of the beam
|
||||
Vector2 dustPos = projectile.Center + projectile.velocity * 14f;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2;
|
||||
float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f;
|
||||
Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult);
|
||||
int dust = Dust.NewDust(dustPos, 0, 0, dustType, -dustVel.X, -dustVel.Y, 0, default, 1f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1.7f;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width;
|
||||
int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f);
|
||||
Main.dust[dust].velocity *= 0.5f;
|
||||
Main.dust[dust].velocity.Y = Math.Abs(Main.dust[dust].velocity.Y);
|
||||
}
|
||||
|
||||
// Spawn dust at the end of the beam
|
||||
dustPos = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f);
|
||||
int dustType = (int)CalamityDusts.Brimstone;
|
||||
Vector2 dustPos = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2;
|
||||
@@ -171,44 +143,52 @@ namespace CalamityMod.Projectiles.Boss
|
||||
float drawLength = projectile.localAI[1];
|
||||
Color color = new Color(250, 100, 100, 0);
|
||||
|
||||
if (projectile.localAI[0] % 5f == 0f)
|
||||
{
|
||||
frameDrawn++;
|
||||
if (frameDrawn >= maxFrames)
|
||||
frameDrawn = 0;
|
||||
}
|
||||
|
||||
// Draw start of beam
|
||||
Vector2 vector = projectile.Center - Main.screenPosition;
|
||||
Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / 5 * frameDrawn, beamStart.Width, beamStart.Height / 5);
|
||||
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / 5) / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames);
|
||||
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
|
||||
// Draw middle of beam
|
||||
drawLength -= (beamStart.Height / 5 / 2 + beamEnd.Height / 5) * projectile.scale;
|
||||
drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale;
|
||||
Vector2 center = projectile.Center;
|
||||
center += projectile.velocity * projectile.scale * beamStart.Height / 5f / 2f;
|
||||
center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f;
|
||||
if (drawLength > 0f)
|
||||
{
|
||||
float i = 0f;
|
||||
int middleFrameDrawn = frameDrawn;
|
||||
Rectangle rectangle = new Rectangle(0, beamMiddle.Height / 5 * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / 5);
|
||||
while (i + 1f < drawLength)
|
||||
{
|
||||
Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames);
|
||||
|
||||
if (drawLength - i < rectangle.Height)
|
||||
rectangle.Height = (int)(drawLength - i);
|
||||
|
||||
spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f);
|
||||
|
||||
middleFrameDrawn++;
|
||||
if (middleFrameDrawn >= 5)
|
||||
if (middleFrameDrawn >= maxFrames)
|
||||
middleFrameDrawn = 0;
|
||||
|
||||
i += rectangle.Height * projectile.scale;
|
||||
center += projectile.velocity * rectangle.Height * projectile.scale;
|
||||
|
||||
rectangle.Y += beamMiddle.Height / 5;
|
||||
if (rectangle.Y + rectangle.Height > beamMiddle.Height / 5)
|
||||
rectangle.Y += beamMiddle.Height / maxFrames;
|
||||
if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames)
|
||||
rectangle.Y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw end of beam
|
||||
Vector2 vector2 = center - Main.screenPosition;
|
||||
sourceRectangle = new Rectangle(0, beamEnd.Height / 5 * frameDrawn, beamEnd.Width, beamEnd.Height / 5);
|
||||
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / 5) / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames);
|
||||
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
public ref float LengthOfLaser => ref projectile.localAI[1];
|
||||
public const int Lifetime = 180;
|
||||
public const float BeamPosOffset = 16f;
|
||||
private const int maxFrames = 4;
|
||||
private int frameDrawn = 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
@@ -89,13 +90,6 @@ namespace CalamityMod.Projectiles.Boss
|
||||
return;
|
||||
}
|
||||
|
||||
if (Time % 5 == 0)
|
||||
{
|
||||
frameDrawn++;
|
||||
if (frameDrawn >= 4)
|
||||
frameDrawn = 0;
|
||||
}
|
||||
|
||||
float scale = 1f;
|
||||
projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale;
|
||||
if (projectile.scale > scale)
|
||||
@@ -149,31 +143,10 @@ namespace CalamityMod.Projectiles.Boss
|
||||
}
|
||||
}
|
||||
|
||||
int dustType = (int)CalamityDusts.Brimstone;
|
||||
|
||||
// Spawn dust at the start of the beam
|
||||
Vector2 dustPos = projectile.Center + projectile.velocity * 14f;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2;
|
||||
float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f;
|
||||
Vector2 dustVel = new Vector2((float)Math.Cos(dustRot) * dustVelMult, (float)Math.Sin(dustRot) * dustVelMult);
|
||||
int dust = Dust.NewDust(dustPos, 0, 0, dustType, -dustVel.X, -dustVel.Y, 0, default, 1f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1.7f;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Vector2 dustRot = projectile.velocity.RotatedBy(MathHelper.PiOver2, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width;
|
||||
int dust = Dust.NewDust(dustPos + dustRot - Vector2.One * 4f, 8, 8, dustType, 0f, 0f, 100, default, 1.5f);
|
||||
Main.dust[dust].velocity *= 0.5f;
|
||||
Main.dust[dust].velocity.Y = Math.Abs(Main.dust[dust].velocity.Y);
|
||||
}
|
||||
|
||||
// Spawn dust at the end of the beam
|
||||
dustPos = projectile.Center + projectile.velocity * (LengthOfLaser - 14f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
int dustType = (int)CalamityDusts.Brimstone;
|
||||
Vector2 dustPos = projectile.Center + projectile.velocity * (LengthOfLaser - 14f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float dustRot = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2;
|
||||
float dustVelMult = (float)Main.rand.NextDouble() * 2f + 2f;
|
||||
@@ -207,44 +180,52 @@ namespace CalamityMod.Projectiles.Boss
|
||||
float drawLength = LengthOfLaser;
|
||||
Color color = new Color(250, 100, 100, 0);
|
||||
|
||||
if (Time % 5 == 0)
|
||||
{
|
||||
frameDrawn++;
|
||||
if (frameDrawn >= maxFrames)
|
||||
frameDrawn = 0;
|
||||
}
|
||||
|
||||
// Draw start of beam
|
||||
Vector2 vector = projectile.Center - Main.screenPosition;
|
||||
Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / 4 * frameDrawn, beamStart.Width, beamStart.Height / 4);
|
||||
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / 4) / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
Vector2 vector = projectile.Center - Main.screenPosition;
|
||||
Rectangle? sourceRectangle = new Rectangle(0, beamStart.Height / maxFrames * frameDrawn, beamStart.Width, beamStart.Height / maxFrames);
|
||||
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(beamStart.Width, beamStart.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
|
||||
// Draw middle of beam
|
||||
drawLength -= (beamStart.Height / 4 / 2 + beamEnd.Height / 4) * projectile.scale;
|
||||
drawLength -= (beamStart.Height / maxFrames / 2 + beamEnd.Height / maxFrames) * projectile.scale;
|
||||
Vector2 center = projectile.Center;
|
||||
center += projectile.velocity * projectile.scale * beamStart.Height / 4f / 2f;
|
||||
center += projectile.velocity * projectile.scale * beamStart.Height / maxFrames / 2f;
|
||||
if (drawLength > 0f)
|
||||
{
|
||||
float i = 0f;
|
||||
int middleFrameDrawn = frameDrawn;
|
||||
Rectangle rectangle = new Rectangle(0, beamMiddle.Height / 4 * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / 4);
|
||||
while (i + 1f < drawLength)
|
||||
{
|
||||
if (drawLength - i < rectangle.Height)
|
||||
Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames);
|
||||
|
||||
if (drawLength - i < rectangle.Height)
|
||||
rectangle.Height = (int)(drawLength - i);
|
||||
|
||||
spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f);
|
||||
|
||||
middleFrameDrawn++;
|
||||
if (middleFrameDrawn >= 4)
|
||||
if (middleFrameDrawn >= maxFrames)
|
||||
middleFrameDrawn = 0;
|
||||
|
||||
i += rectangle.Height * projectile.scale;
|
||||
center += projectile.velocity * rectangle.Height * projectile.scale;
|
||||
|
||||
rectangle.Y += beamMiddle.Height / 4;
|
||||
if (rectangle.Y + rectangle.Height > beamMiddle.Height / 4)
|
||||
rectangle.Y += beamMiddle.Height / maxFrames;
|
||||
if (rectangle.Y + rectangle.Height > beamMiddle.Height / maxFrames)
|
||||
rectangle.Y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw end of beam
|
||||
Vector2 vector2 = center - Main.screenPosition;
|
||||
sourceRectangle = new Rectangle(0, beamEnd.Height / 4 * frameDrawn, beamEnd.Width, beamEnd.Height / 4);
|
||||
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / 4) / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
sourceRectangle = new Rectangle(0, beamEnd.Height / maxFrames * frameDrawn, beamEnd.Width, beamEnd.Height / maxFrames);
|
||||
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(beamEnd.Width, beamEnd.Height / maxFrames) / 2f, projectile.scale, SpriteEffects.None, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user