made a beam proj util

This commit is contained in:
termigator1359 committed 2020-08-31 15:43:09 -04:00
1 parent 3230939415
commit e5aa68e603
20 files changed
+138 -778

No files matched your search

+2 -32
View File
@@ -84,39 +84,9 @@ namespace CalamityMod.Projectiles.Boss
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 100, 255, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(255, 100, 255, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 50f;
float scaleFactor = 1.5f;
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(50f, 1.5f, lightColor);
public override void OnHitPlayer(Player target, int damage, bool crit)
{
+1 -27
View File
@@ -51,32 +51,6 @@ namespace CalamityMod.Projectiles.Enemy
public override Color? GetAlpha(Color lightColor) => new Color(255, 190, 255, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D texture = ModContent.GetTexture(Texture);
float adjustedXOrigin = (texture.Width - projectile.width) * 0.5f + projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle roughScreenBounds = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
// Only draw when within the bounds of the screen for performance reasons.
if (projectile.Hitbox.Intersects(roughScreenBounds))
{
Vector2 drawPosition = new Vector2(projectile.position.X + adjustedXOrigin, projectile.position.Y + projectile.height / 2) - Main.screenPosition;
drawPosition += Vector2.UnitY * projectile.gfxOffY;
for (int i = 1; i <= (int)TrailLength; i++)
{
Vector2 drawOffset = Vector2.Normalize(projectile.velocity) * i * 1.5f;
Color drawColor = projectile.GetAlpha(lightColor); // The parameter doesn't really matter. The lightColor parameter in GetAlpha is ignored in this case.
drawColor.A = (byte)(255 - projectile.alpha);
drawColor *= (MaxTrailPoints - i) / (float)MaxTrailPoints;
float scale = MathHelper.Lerp(0.45f, 1f, 1f - i / TrailLength) * projectile.scale;
spriteBatch.Draw(texture, drawPosition - drawOffset, null, drawColor, projectile.rotation, new Vector2(adjustedXOrigin, projectile.height * 0.5f), scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(MaxTrailPoints, 1.5f, lightColor);
}
}
+2 -36
View File
@@ -71,43 +71,9 @@ namespace CalamityMod.Projectiles.Hybrid
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(250, 50, 200, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(250, 50, 200, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 100f;
float scaleFactor = 2f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 2f, lightColor);
public override bool OnTileCollide(Vector2 oldVelocity)
{
+7 -41
View File
@@ -54,52 +54,18 @@ namespace CalamityMod.Projectiles.Magic
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(100, 255, 100, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 100f;
float scaleFactor = 3f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
public override void Kill(int timeLeft)
{
int num212 = Main.rand.Next(3, 7);
for (int num213 = 0; num213 < num212; num213++)
int dustAmt = Main.rand.Next(3, 7);
for (int d = 0; d < dustAmt; d++)
{
int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default, 2.1f);
Main.dust[num214].velocity *= 2f;
Main.dust[num214].noGravity = true;
int nano = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default, 2.1f);
Main.dust[nano].velocity *= 2f;
Main.dust[nano].noGravity = true;
}
}
}
+13 -54
View File
@@ -55,65 +55,24 @@ namespace CalamityMod.Projectiles.Magic
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, Main.DiscoG, 155, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(255, Main.DiscoG, 155, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 100f;
float scaleFactor = 3f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
public override void Kill(int timeLeft)
{
int num212 = Main.rand.Next(3, 7);
for (int num213 = 0; num213 < num212; num213++)
int dustAmt = Main.rand.Next(3, 7);
for (int d = 0; d < dustAmt; d++)
{
int randomDust = Main.rand.Next(3);
if (randomDust == 0)
{
randomDust = 246;
}
else if (randomDust == 1)
{
randomDust = 73;
}
else
{
randomDust = 187;
}
int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, randomDust, 0f, 0f, 100, default, 2.1f);
Main.dust[num214].velocity *= 2f;
Main.dust[num214].noGravity = true;
int dustType = Utils.SelectRandom(Main.rand, new int[]
{
246,
73,
187
});
int idx = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, dustType, 0f, 0f, 100, default, 2.1f);
Main.dust[idx].velocity *= 2f;
Main.dust[idx].noGravity = true;
}
}
}
+7 -41
View File
@@ -54,52 +54,18 @@ namespace CalamityMod.Projectiles.Magic
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 100f;
float scaleFactor = 3f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
public override void Kill(int timeLeft)
{
int num212 = Main.rand.Next(3, 7);
for (int num213 = 0; num213 < num212; num213++)
int dustAmt = Main.rand.Next(3, 7);
for (int d = 0; d < dustAmt; d++)
{
int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f);
Main.dust[num214].velocity *= 2f;
Main.dust[num214].noGravity = true;
int rainbow = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f);
Main.dust[rainbow].velocity *= 2f;
Main.dust[rainbow].noGravity = true;
}
}
}
+2 -36
View File
@@ -58,43 +58,9 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(0, 0, 250, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(0, 0, 250, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 40f;
float scaleFactor = 1.5f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor);
public override void OnHitPvp(Player target, int damage, bool crit)
{
+2 -36
View File
@@ -55,42 +55,8 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(0, 0, 250, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(0, 0, 250, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 40f;
float scaleFactor = 1.5f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor);
}
}
+2 -36
View File
@@ -56,43 +56,9 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(100, 100, 255, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 100f;
float scaleFactor = 3f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
public override void Kill(int timeLeft)
{
+2 -36
View File
@@ -56,43 +56,9 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(100, 100, 255, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 30f;
float scaleFactor = 1f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
public override bool OnTileCollide(Vector2 oldVelocity)
{
+2 -36
View File
@@ -55,43 +55,9 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(100, 100, 255, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 50f;
float scaleFactor = 1.5f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
public override bool OnTileCollide(Vector2 oldVelocity)
{
+2 -36
View File
@@ -76,42 +76,8 @@ namespace CalamityMod.Projectiles.Ranged
target.ExoDebuffs();
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(250, 25, 0, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(250, 25, 0, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 100f;
float scaleFactor = 3f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
}
}
+5 -45
View File
@@ -55,59 +55,19 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs();
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs();
public override Color? GetAlpha(Color lightColor)
{
return new Color(0, 250, 0, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 0, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 40f;
float scaleFactor = 1.5f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor);
public override void Kill(int timeLeft)
{
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<ExoMark>(),projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<ExoMark>(),projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
+4 -44
View File
@@ -63,52 +63,12 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 100f;
float scaleFactor = 2f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 2f, lightColor);
public override Color? GetAlpha(Color lightColor)
{
return new Color(0, 250, 75, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(0, 250, 75, projectile.alpha);
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs();
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs();
}
}
+17 -60
View File
@@ -55,80 +55,37 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(250, 100, 0, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(250, 100, 0, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 40f;
float scaleFactor = 1.5f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor);
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs();
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs();
public override void Kill(int timeLeft)
{
projectile.position = projectile.Center;
projectile.width = projectile.height = 188;
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
CalamityGlobalProjectile.ExpandHitboxBy(projectile, 188);
projectile.maxPenetrate = -1;
projectile.penetrate = -1;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 20;
projectile.Damage();
Main.PlaySound(SoundID.Item14, projectile.position);
for (int num193 = 0; num193 < 4; num193++)
Main.PlaySound(SoundID.Item14, projectile.Center);
for (int d = 0; d < 4; d++)
{
Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f);
Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f);
}
for (int num194 = 0; num194 < 40; num194++)
for (int d = 0; d < 40; d++)
{
int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 0, default, 1.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].noLight = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
Main.dust[num195].noLight = true;
int orange = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 0, default, 1.5f);
Main.dust[orange].noGravity = true;
Main.dust[orange].noLight = true;
Main.dust[orange].velocity *= 3f;
orange = Dust.NewDust(projectile.position, projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f);
Main.dust[orange].velocity *= 2f;
Main.dust[orange].noGravity = true;
Main.dust[orange].noLight = true;
}
}
}
+19 -61
View File
@@ -44,17 +44,17 @@ namespace CalamityMod.Projectiles.Ranged
}
else
{
for (int num41 = 0; num41 < 2; num41++)
for (int d = 0; d < 2; d++)
{
int dustType = num41 == 0 ? dust1 : dust2;
int dustType = d == 0 ? dust1 : dust2;
Vector2 value8 = Vector2.UnitX * -12f;
value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7;
value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)d * MathHelper.Pi), default) * value7;
int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f);
Main.dust[num42].scale = dustType == dust1 ? 1.5f : 1f;
Main.dust[num42].noGravity = true;
Main.dust[num42].position = projectile.Center + value8;
Main.dust[num42].velocity = projectile.velocity;
int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f);
int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f);
Main.dust[num458].noGravity = true;
Main.dust[num458].velocity *= 0f;
}
@@ -124,55 +124,17 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 255, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 40f;
float scaleFactor = 1.5f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor);
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
Player player = Main.player[projectile.owner];
if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue)
if ((target.damage > 5 || target.boss) && projectile.owner == Main.myPlayer && !target.SpawnedFromStatue)
{
player.AddBuff(ModContent.BuffType<PolarisBuff>(), 180);
}
else
{
return;
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
@@ -199,11 +161,7 @@ namespace CalamityMod.Projectiles.Ranged
}
if (projectile.ai[1] == 2f) //Boost three
{
int height = 150;
projectile.position = projectile.Center;
projectile.width = projectile.height = height;
projectile.Center = projectile.position;
CalamityGlobalProjectile.ExpandHitboxBy(projectile, 150);
projectile.maxPenetrate = -1;
projectile.penetrate = -1;
projectile.usesLocalNPCImmunity = true;
@@ -211,21 +169,21 @@ namespace CalamityMod.Projectiles.Ranged
projectile.damage /= 2;
projectile.Damage();
int num226 = 36;
for (int num227 = 0; num227 < num226; num227++) // 108 dusts
int dustAmt = 36;
for (int d = 0; d < dustAmt; d++) // 108 dusts
{
Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.3f;
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + projectile.Center;
Vector2 vector7 = vector6 - projectile.Center;
Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.3f;
source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center;
Vector2 dustVel = source - projectile.Center;
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, vector7.X * 0.3f, vector7.Y * 0.3f, 100, default, 2f);
Main.dust[num228].noGravity = true;
int i = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, dustVel.X * 0.3f, dustVel.Y * 0.3f, 100, default, 2f);
Main.dust[i].noGravity = true;
int num229 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, vector7.X * 0.2f, vector7.Y * 0.2f, 100, default, 2f);
Main.dust[num229].noGravity = true;
int j = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, dustVel.X * 0.2f, dustVel.Y * 0.2f, 100, default, 2f);
Main.dust[j].noGravity = true;
int num230 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, vector7.X * 0.1f, vector7.Y * 0.1f, 100, default, 2f);
Main.dust[num230].noGravity = true;
int k = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, dustVel.X * 0.1f, dustVel.Y * 0.1f, 100, default, 2f);
Main.dust[k].noGravity = true;
}
bool random = Main.rand.NextBool();
+4 -44
View File
@@ -57,52 +57,12 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs();
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs();
public override Color? GetAlpha(Color lightColor)
{
return new Color(0, 100, 100, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(0, 100, 100, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 40f;
float scaleFactor = 1.5f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor);
}
}
+2 -36
View File
@@ -56,42 +56,8 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(53, Main.DiscoG, 255, projectile.alpha);
}
public override Color? GetAlpha(Color lightColor) => new Color(53, Main.DiscoG, 255, projectile.alpha);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 40f;
float scaleFactor = 1.5f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor);
}
}
+7 -41
View File
@@ -54,52 +54,18 @@ namespace CalamityMod.Projectiles.Typeless
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(200, 0, 250, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 250, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
int num147 = 0;
int num148 = 0;
float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(value6))
{
Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY);
float num162 = 30f;
float scaleFactor = 2f;
if (projectile.ai[1] == 1f)
{
num162 = (float)(int)projectile.localAI[0];
}
for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++)
{
Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor;
Color color29 = projectile.GetAlpha(color25);
color29 *= (num162 - (float)num163) / num162;
color29.A = 0;
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(30f, 2f, lightColor);
public override void Kill(int timeLeft)
{
int num212 = Main.rand.Next(3, 7);
for (int num213 = 0; num213 < num212; num213++)
int dustAmt = Main.rand.Next(3, 7);
for (int d = 0; d < dustAmt; d++)
{
int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default, 2.1f);
Main.dust[num214].velocity *= 2f;
Main.dust[num214].noGravity = true;
int purple = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default, 2.1f);
Main.dust[purple].velocity *= 2f;
Main.dust[purple].noGravity = true;
}
}
+36
View File
@@ -1781,6 +1781,42 @@ namespace CalamityMod
}
}
public static bool DrawBeam(this Projectile projectile, float length, float width, Color lightColor, Texture2D texture = null)
{
if (texture is null)
texture = Main.projectileTexture[projectile.type];
float widthOffset = (float)(texture.Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f;
float heightOffset = (float)(projectile.height / 2);
Vector2 origin = new Vector2(widthOffset, heightOffset);
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
Rectangle roughScreenBounds = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000);
if (projectile.getRect().Intersects(roughScreenBounds))
{
Vector2 drawPos = projectile.position - Main.screenPosition + origin;
drawPos.Y += projectile.gfxOffY;
float maxTrailPoints = length;
float wide = width;
if (projectile.ai[1] == 1f)
{
maxTrailPoints = (int)projectile.localAI[0];
}
for (int i = 1; i <= (int)projectile.localAI[0]; i++)
{
Vector2 offset = Vector2.Normalize(projectile.velocity) * (float)i * wide;
Color color = projectile.GetAlpha(lightColor);
color *= (maxTrailPoints - (float)i) / maxTrailPoints;
color.A = 0;
Main.spriteBatch.Draw(texture, drawPos - offset, null, color, projectile.rotation, origin, projectile.scale, spriteEffects, 0f);
}
}
return false;
}
public static void ExplodeandDestroyTiles(Projectile projectile, int explosionRadius, bool checkExplosions, List<int> tilesToCheck, List<int> wallsToCheck)
{
int minTileX = (int)projectile.position.X / 16 - explosionRadius;