Homing projectile methods for magnet sphere-type projectiles and normal homing projectiles, Laserfish texture bug fix.

This commit is contained in:
Andrew Marheine committed 2020-02-14 23:12:56 -06:00
1 parent 0d2284318c
commit 081f250cfb
52 files changed
+243 -1513

No files matched your search

+2 -2
View File
@@ -269,10 +269,10 @@ namespace CalamityMod.NPCs.Abyss
Vector2 center = new Vector2(npc.Center.X, npc.Center.Y);
Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2));
Vector2 vector = center - Main.screenPosition;
vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/Laserfishglow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/Laserfishglow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f;
vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f;
vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY);
Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Yellow);
Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/Laserfishglow"), vector,
Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/LaserfishGlow"), vector,
new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f);
}
+88 -2
View File
@@ -1989,6 +1989,92 @@ namespace CalamityMod.Projectiles
}
return true;
}
#endregion
}
#endregion
#region Homing AI
public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N)
{
Vector2 center = projectile.Center;
float maxDistance = distanceRequired;
bool homeIn = false;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2);
bool canHit = true;
if (extraDistance < maxDistance && !ignoreTiles)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1);
if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit)
{
center = Main.npc[i].Center;
homeIn = true;
break;
}
}
}
if (homeIn)
{
Vector2 homeInVector = projectile.DirectionTo(center);
if (homeInVector.HasNaNs())
homeInVector = Vector2.UnitY;
projectile.velocity = (projectile.velocity * N + homeInVector * homingVelocity) / (N + 1f);
}
}
public static void MagnetSphereHitscan(Projectile projectile, float distanceRequired, float homingVelocity, float projectileTimer, int maxTargets, int spawnedProjectile)
{
float maxDistance = distanceRequired;
bool homeIn = false;
int[] targetArray = new int[maxTargets];
int targetArrayIndex = 0;
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2);
bool canHit = true;
if (extraDistance < maxDistance)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1);
if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit)
{
if (targetArrayIndex < maxTargets)
{
targetArray[targetArrayIndex] = i;
targetArrayIndex++;
homeIn = true;
}
else
break;
}
}
}
if (homeIn)
{
int randomTarget = Main.rand.Next(targetArrayIndex);
randomTarget = targetArray[randomTarget];
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > projectileTimer)
{
projectile.localAI[0] = 0f;
Vector2 value = projectile.Center + projectile.velocity * 4f;
Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - value) * homingVelocity;
if (projectile.owner == Main.myPlayer)
Projectile.NewProjectile(value.X, value.Y, velocity.X, velocity.Y, spawnedProjectile, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
#endregion
}
}
+4 -44
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic
{
int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1f);
Main.dust[num469].noGravity = true;
Main.dust[num469].velocity *= 0f;
if (projectile.velocity.X < 0f)
{
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
@@ -42,44 +42,7 @@ namespace CalamityMod.Projectiles.Magic
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
}
float centerX = projectile.Center.X;
float centerY = projectile.Center.Y;
float distance = 250f;
bool homeIn = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
centerX = Main.npc[num475].Center.X;
centerY = Main.npc[num475].Center.Y;
homeIn = true;
}
}
}
if (homeIn)
{
float num483 = 13f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = centerX - vector35.X;
float num485 = centerY - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 25f + num484) / 26f;
projectile.velocity.Y = (projectile.velocity.Y * 25f + num485) / 26f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 13f, 25f);
}
public override void Kill(int timeLeft)
@@ -88,11 +51,8 @@ namespace CalamityMod.Projectiles.Magic
for (int k = 0; k < 3; k++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType<AstralOrange>(), 0f, 0f);
}
for (int k = 0; k < 3; k++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType<AstralBlue>(), 0f, 0f);
}
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType<AstralBlue>(), 0f, 0f);
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
+1 -39
View File
@@ -42,45 +42,7 @@ namespace CalamityMod.Projectiles.Magic
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 400f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 20f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
return;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f);
}
public override void Kill(int timeLeft)
+1 -37
View File
@@ -130,44 +130,8 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.ai[0] >= 30f)
{
projectile.velocity *= 1.001f;
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 400f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 20f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f);
}
}
+4 -13
View File
@@ -41,19 +41,10 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 1; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num249 = 206;
int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 3f);
Main.dust[num448].position = vector33;
Main.dust[num448].velocity *= 0.1f;
}
}
if (projectile.localAI[0] > 9f)
{
Dust.NewDust(projectile.position, 1, 1, 206, 0f, 0f, 0, default, 3f);
}
}
}
}
+6 -16
View File
@@ -26,21 +26,11 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 1; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num249 = 206;
int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 3f);
Main.dust[num448].position = vector33;
Main.dust[num448].velocity *= 0.1f;
}
return;
}
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
Dust.NewDust(projectile.position, 1, 1, 206, 0f, 0f, 0, default, 3f);
}
}
}
}
@@ -79,6 +79,7 @@ namespace CalamityMod.Projectiles.Magic
num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f;
num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f;
}
float num380 = 6f;
float num381 = 0.1f;
Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
+8 -15
View File
@@ -22,21 +22,14 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 2; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
return;
}
for (int num447 = 0; num447 < 2; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
}
}
}
+1 -61
View File
@@ -24,67 +24,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 1.01f;
projectile.velocity.Y *= 1.01f;
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = projectile.velocity.X;
projectile.ai[1] = projectile.velocity.Y;
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (flag14)
{
int num434 = Main.rand.Next(num428);
num434 = array[num434];
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 24f)
{
projectile.localAI[0] = 0f;
float num437 = 6f;
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
value10 += projectile.velocity * 4f;
float num438 = num435 - value10.X;
float num439 = num436 - value10.Y;
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
num440 = num437 / num440;
num438 *= num440;
num439 *= num440;
Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType<BloodBolt>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType<BloodBolt>());
}
}
}
+2 -3
View File
@@ -27,8 +27,9 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer)
{
projectile.localAI[1] = 0f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType<BloodOrb>(), (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<BloodOrb>(), (int)(projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
@@ -36,13 +37,11 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 235, 0f, 0f, 0, default, 1.5f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
return;
}
}
}
+4 -46
View File
@@ -26,55 +26,13 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
for (int num468 = 0; num468 < 2; num468++)
{
int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f);
Main.dust[num469].noGravity = true;
Main.dust[num469].velocity *= 0f;
}
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 500f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
for (int num468 = 0; num468 < 2; num468++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 235, 0f, 0f, 100, default, 1f);
Main.dust[num469].noGravity = true;
}
if (flag17)
{
float num483 = 8f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 8f, 20f);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
+3 -53
View File
@@ -35,6 +35,7 @@ namespace CalamityMod.Projectiles.Magic
projectile.velocity.X = (float)(Math.Sin(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize);
projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize);
circleSize += circleGrowth;
if (projectile.velocity.X > 0f)
{
projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
@@ -43,6 +44,7 @@ namespace CalamityMod.Projectiles.Magic
{
projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
}
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
@@ -54,59 +56,7 @@ namespace CalamityMod.Projectiles.Magic
}
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (projectile.timeLeft < 30)
{
flag14 = false;
}
if (flag14)
{
int num440 = Main.rand.Next(num428);
num440 = array[num440];
float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2);
float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
projectile.localAI[0] = 0f;
float num443 = 8f;
Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
vector33 += projectile.velocity * 4f;
float num444 = num441 - vector33.X;
float num445 = num442 - vector33.Y;
float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445));
num446 = num443 / num446;
num444 *= num446;
num445 *= num446;
Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, ModContent.ProjectileType<ClimaxBeam>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 5, ModContent.ProjectileType<ClimaxBeam>());
}
public override Color? GetAlpha(Color lightColor)
+5 -18
View File
@@ -20,23 +20,10 @@ namespace CalamityMod.Projectiles.Magic
projectile.magic = true;
}
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 1; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
return;
}
}
public override void AI()
{
int num448 = Dust.NewDust(projectile.position, 1, 1, 206, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
}
}
+4 -59
View File
@@ -27,8 +27,8 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 0.98f;
projectile.velocity.Y *= 0.98f;
projectile.velocity *= 0.96f;
if (projectile.velocity.X > 0f)
{
projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
@@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Magic
{
projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
}
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
@@ -47,64 +48,8 @@ namespace CalamityMod.Projectiles.Magic
projectile.frame = 0;
}
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 400f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (projectile.timeLeft < 30)
{
flag14 = false;
}
if (flag14)
{
int num440 = Main.rand.Next(num428);
num440 = array[num440];
float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2);
float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
projectile.localAI[0] = 0f;
float num443 = 8f;
Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
vector33 += projectile.velocity * 4f;
float num444 = num441 - vector33.X;
float num445 = num442 - vector33.Y;
float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445));
num446 = num443 / num446;
num444 *= num446;
num445 *= num446;
Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, ModContent.ProjectileType<ClimaxBeam>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 5, ModContent.ProjectileType<ClimaxBeam>());
}
public override Color? GetAlpha(Color lightColor)
+3 -38
View File
@@ -35,6 +35,7 @@ namespace CalamityMod.Projectiles.Magic
float num953 = 25f * projectile.ai[1]; //100
float scaleFactor12 = 5f * projectile.ai[1]; //5
float num954 = 1000f;
if (projectile.velocity.X < 0f)
{
projectile.spriteDirection = -1;
@@ -45,6 +46,7 @@ namespace CalamityMod.Projectiles.Magic
projectile.spriteDirection = 1;
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
}
Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f);
if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead)
{
@@ -59,44 +61,7 @@ namespace CalamityMod.Projectiles.Magic
return;
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 600f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 9f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 9f, 20f);
}
else
{
+11 -16
View File
@@ -26,23 +26,18 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer)
{
projectile.localAI[1] = 0f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType<ElementOrb2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 2; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<ElementOrb2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
for (int num447 = 0; num447 < 2; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
}
}
}
+6 -18
View File
@@ -20,23 +20,11 @@ namespace CalamityMod.Projectiles.Magic
projectile.magic = true;
}
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 1; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
public override void AI()
{
int num448 = Dust.NewDust(projectile.position, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f);
Main.dust[num448].noGravity = true;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
}
}
+1 -64
View File
@@ -24,70 +24,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 1.01f;
projectile.velocity.Y *= 1.01f;
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = projectile.velocity.X;
projectile.ai[1] = projectile.velocity.Y;
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (flag14)
{
int num434 = Main.rand.Next(num428);
num434 = array[num434];
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 24f)
{
projectile.localAI[0] = 0f;
float num437 = 6f;
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
value10 += projectile.velocity * 4f;
float num438 = num435 - value10.X;
float num439 = num436 - value10.Y;
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
num440 = num437 / num440;
num438 *= num440;
num439 *= num440;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType<ElementBolt>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType<ElementBolt>());
}
}
}
+2 -65
View File
@@ -24,70 +24,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 1.01f;
projectile.velocity.Y *= 1.01f;
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = projectile.velocity.X;
projectile.ai[1] = projectile.velocity.Y;
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (flag14)
{
int num434 = Main.rand.Next(num428);
num434 = array[num434];
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 24f)
{
projectile.localAI[0] = 0f;
float num437 = 6f;
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
value10 += projectile.velocity * 4f;
float num438 = num435 - value10.X;
float num439 = num436 - value10.Y;
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
num440 = num437 / num440;
num438 *= num440;
num439 *= num440;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType<ElementBolt2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType<ElementBolt2>());
}
}
}
+2 -3
View File
@@ -29,8 +29,9 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.localAI[1] >= 22f && projectile.owner == Main.myPlayer)
{
projectile.localAI[1] = 0f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType<ElementOrb>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<ElementOrb>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
@@ -38,12 +39,10 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
+6 -18
View File
@@ -20,23 +20,11 @@ namespace CalamityMod.Projectiles.Magic
projectile.magic = true;
}
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
for (int num447 = 0; num447 < 1; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
public override void AI()
{
int num448 = Dust.NewDust(projectile.position, 1, 1, 234, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].noGravity = true;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
}
}
+1 -64
View File
@@ -24,70 +24,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 1.01f;
projectile.velocity.Y *= 1.01f;
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = projectile.velocity.X;
projectile.ai[1] = projectile.velocity.Y;
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (flag14)
{
int num434 = Main.rand.Next(num428);
num434 = array[num434];
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 24f)
{
projectile.localAI[0] = 0f;
float num437 = 6f;
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
value10 += projectile.velocity * 4f;
float num438 = num435 - value10.X;
float num439 = num436 - value10.Y;
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
num440 = num437 / num440;
num438 *= num440;
num439 *= num440;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType<FabBolt>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType<FabBolt>());
}
}
}
+2 -3
View File
@@ -29,8 +29,9 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.localAI[1] >= 9f && projectile.owner == Main.myPlayer)
{
projectile.localAI[1] = 0f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType<FabOrb>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<FabOrb>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 16f)
{
@@ -38,12 +39,10 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
+5 -43
View File
@@ -31,60 +31,22 @@ namespace CalamityMod.Projectiles.Magic
{
projectile.alpha -= 3;
projectile.rotation += 0.75f;
projectile.ai[1] += 1f;
if (projectile.ai[1] <= 20f)
{
projectile.velocity.X *= 0.85f;
projectile.velocity.Y *= 0.85f;
projectile.velocity *= 0.85f;
}
else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f)
{
projectile.velocity.X *= 1.25f;
projectile.velocity.Y *= 1.25f;
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 300f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 10f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
projectile.velocity *= 1.25f;
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 10f, 20f);
}
else if (projectile.ai[1] == 40f)
{
projectile.ai[1] = 0f;
}
if (Main.rand.NextBool(8))
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f);
+2 -44
View File
@@ -24,51 +24,9 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.6f);
Main.dust[num469].velocity *= 0f;
}
Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 229, 0f, 0f, 100, default, 0.6f);
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 500f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 22f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 22f, 20f);
}
}
}
+1 -6
View File
@@ -29,9 +29,6 @@ namespace CalamityMod.Projectiles.Magic
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * 0.25f;
projectile.alpha = 255;
int num249 = Main.rand.Next(2);
if (num249 == 0)
{
@@ -41,10 +38,8 @@ namespace CalamityMod.Projectiles.Magic
{
num249 = 246;
}
int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 0.25f);
Main.dust[num448].position = vector33;
int num448 = Dust.NewDust(projectile.position, 1, 1, num249, 0f, 0f, 0, default, 0.25f);
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
+5 -42
View File
@@ -27,50 +27,13 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.rotation += 0.5f;
projectile.localAI[0] += 1f;
int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f);
projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt();
projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + (MathHelper.Pi * 0.5f * projectile.direction);
int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f);
Main.dust[num469].noGravity = true;
Main.dust[num469].velocity *= 0f;
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 400f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 10f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 10f, 20f);
}
public override void Kill(int timeLeft)
@@ -43,48 +43,11 @@ namespace CalamityMod.Projectiles.Magic
Main.dust[num42].velocity = projectile.velocity;
}
}
int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 1f);
Main.dust[num458].noGravity = true;
Main.dust[num458].velocity *= 0f;
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 500f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 12f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 12f, 20f);
}
}
}
+5 -18
View File
@@ -20,23 +20,10 @@ namespace CalamityMod.Projectiles.Magic
projectile.magic = true;
}
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 1; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
return;
}
}
public override void AI()
{
int num448 = Dust.NewDust(projectile.position, 1, 1, 173, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
}
}
+4 -59
View File
@@ -27,8 +27,8 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 0.98f;
projectile.velocity.Y *= 0.98f;
projectile.velocity *= 0.96f;
if (projectile.velocity.X > 0f)
{
projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
@@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Magic
{
projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
}
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
@@ -47,64 +48,8 @@ namespace CalamityMod.Projectiles.Magic
projectile.frame = 0;
}
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 400f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (projectile.timeLeft < 30)
{
flag14 = false;
}
if (flag14)
{
int num440 = Main.rand.Next(num428);
num440 = array[num440];
float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2);
float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
projectile.localAI[0] = 0f;
float num443 = 8f;
Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
vector33 += projectile.velocity * 4f;
float num444 = num441 - vector33.X;
float num445 = num442 - vector33.Y;
float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445));
num446 = num443 / num446;
num444 *= num446;
num445 *= num446;
Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, ModContent.ProjectileType<MagneticBeam>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 5, ModContent.ProjectileType<MagneticBeam>());
}
public override Color? GetAlpha(Color lightColor)
+8 -15
View File
@@ -22,21 +22,14 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 2; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
return;
}
for (int num447 = 0; num447 < 2; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
}
}
}
+1 -64
View File
@@ -24,70 +24,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 1.01f;
projectile.velocity.Y *= 1.01f;
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = projectile.velocity.X;
projectile.ai[1] = projectile.velocity.Y;
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (flag14)
{
int num434 = Main.rand.Next(num428);
num434 = array[num434];
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 24f)
{
projectile.localAI[0] = 0f;
float num437 = 6f;
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
value10 += projectile.velocity * 4f;
float num438 = num435 - value10.X;
float num439 = num436 - value10.Y;
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
num440 = num437 / num440;
num438 *= num440;
num439 *= num440;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType<NightBolt>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType<NightBolt>());
}
}
}
+2 -4
View File
@@ -27,8 +27,9 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer)
{
projectile.localAI[1] = 0f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType<NightOrb>(), (int)((double)projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<NightOrb>(), (int)(projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
@@ -36,13 +37,10 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 27, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
return;
}
}
}
+5 -15
View File
@@ -26,21 +26,11 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 1; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num249 = 206;
int num448 = Dust.NewDust(vector33, 1, 1, num249, 0f, 0f, 0, default, 2.5f);
Main.dust[num448].position = vector33;
Main.dust[num448].velocity *= 0.1f;
}
return;
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
Dust.NewDust(projectile.position, 1, 1, 206, 0f, 0f, 0, default, 2.5f);
}
}
}
}
+3 -41
View File
@@ -25,53 +25,15 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f, (255 - projectile.alpha) * 0.2f / 255f);
Lighting.AddLight(projectile.Center, 0.2f, 0.2f, 0.2f);
for (int num457 = 0; num457 < 5; num457++)
{
int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f);
Main.dust[num458].noGravity = true;
Main.dust[num458].velocity *= 0.5f;
Main.dust[num458].velocity += projectile.velocity * 0.1f;
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 800f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 30f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 30f, 20f);
}
}
}
+1 -38
View File
@@ -27,44 +27,7 @@ namespace CalamityMod.Projectiles.Magic
{
projectile.rotation += projectile.velocity.X * 0.05f;
float centerX = projectile.Center.X;
float centerY = projectile.Center.Y;
float distance = 600f;
bool homeIn = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
centerX = Main.npc[num475].Center.X;
centerY = Main.npc[num475].Center.Y;
homeIn = true;
}
}
}
if (homeIn)
{
float num483 = 6f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = centerX - vector35.X;
float num485 = centerY - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f;
projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 6f, 30f);
}
public override void Kill(int timeLeft)
-1
View File
@@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f;
+2 -37
View File
@@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.alpha < 0)
projectile.alpha = 0;
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
@@ -48,44 +49,8 @@ namespace CalamityMod.Projectiles.Magic
Main.dust[num102].noGravity = true;
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 500f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 8f, 20f);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 8f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
projectile.rotation += 0.3f * (float)projectile.direction;
}
+2 -3
View File
@@ -27,8 +27,9 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.localAI[1] >= 21f && projectile.owner == Main.myPlayer)
{
projectile.localAI[1] = 0f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType<TerraOrb>(), (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<TerraOrb>(), (int)(projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
@@ -36,11 +37,9 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
+10 -15
View File
@@ -26,22 +26,17 @@ namespace CalamityMod.Projectiles.Magic
if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer)
{
projectile.localAI[1] = 0f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType<TerraOrb2>(), (int)((double)projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 2; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<TerraOrb2>(), (int)(projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f);
}
for (int num447 = 0; num447 < 2; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
+5 -17
View File
@@ -20,23 +20,11 @@ namespace CalamityMod.Projectiles.Magic
projectile.magic = true;
}
public override void AI()
{
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 9f)
{
for (int num447 = 0; num447 < 1; num447++)
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
public override void AI()
{
int num448 = Dust.NewDust(projectile.position, 1, 1, 107, 0f, 0f, 0, default, 1.25f);
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
+1 -64
View File
@@ -24,70 +24,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 1.01f;
projectile.velocity.Y *= 1.01f;
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = projectile.velocity.X;
projectile.ai[1] = projectile.velocity.Y;
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (flag14)
{
int num434 = Main.rand.Next(num428);
num434 = array[num434];
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 24f)
{
projectile.localAI[0] = 0f;
float num437 = 6f;
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
value10 += projectile.velocity * 4f;
float num438 = num435 - value10.X;
float num439 = num436 - value10.Y;
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
num440 = num437 / num440;
num438 *= num440;
num439 *= num440;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType<TerraBolt>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType<TerraBolt>());
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
+1 -64
View File
@@ -24,70 +24,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 1.01f;
projectile.velocity.Y *= 1.01f;
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = projectile.velocity.X;
projectile.ai[1] = projectile.velocity.Y;
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (flag14)
{
int num434 = Main.rand.Next(num428);
num434 = array[num434];
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 18f)
{
projectile.localAI[0] = 0f;
float num437 = 6f;
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
value10 += projectile.velocity * 4f;
float num438 = num435 - value10.X;
float num439 = num436 - value10.Y;
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
num440 = num437 / num440;
num438 *= num440;
num439 *= num440;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType<TerraBolt2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 18f, 5, ModContent.ProjectileType<TerraBolt2>());
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
+1 -38
View File
@@ -70,44 +70,7 @@ namespace CalamityMod.Projectiles.Magic
return;
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = 600f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 9f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 9f, 20f);
}
else
{
-2
View File
@@ -71,11 +71,9 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 5, 0f, 0f, 0, default, 1f);
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
-2
View File
@@ -55,12 +55,10 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
-2
View File
@@ -54,12 +54,10 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.0065f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
+3 -3
View File
@@ -48,12 +48,14 @@ namespace CalamityMod.Projectiles.Magic
Main.dust[num42].velocity = projectile.velocity;
}
}
projectile.localAI[1] += 1f;
if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer)
{
projectile.localAI[1] = 0f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType<VividOrb>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<VividOrb>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 4f)
{
@@ -61,12 +63,10 @@ namespace CalamityMod.Projectiles.Magic
{
Vector2 vector33 = projectile.position;
vector33 -= projectile.velocity * ((float)num447 * 0.25f);
projectile.alpha = 255;
int num448 = Dust.NewDust(vector33, 1, 1, 66, 0f, 0f, 0, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
Main.dust[num448].noGravity = true;
Main.dust[num448].position = vector33;
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
Main.dust[num448].velocity *= 0.2f;
}
}
}
+3 -36
View File
@@ -39,45 +39,12 @@ namespace CalamityMod.Projectiles.Magic
Main.dust[num42].position = projectile.Center + value8;
Main.dust[num42].velocity = projectile.velocity;
}
if (projectile.timeLeft < 110)
projectile.ai[0] = 1f;
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float num474 = 400f;
bool flag17 = false;
if (projectile.ai[0] >= 1f)
{
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1))
{
float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2);
float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2);
float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477);
if (num478 < num474)
{
num474 = num478;
num472 = num476;
num473 = num477;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 30f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
return;
}
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 30f, 20f);
}
public override void Kill(int timeLeft)
+1 -64
View File
@@ -26,70 +26,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
projectile.velocity.X *= 1.01f;
projectile.velocity.Y *= 1.01f;
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = projectile.velocity.X;
projectile.ai[1] = projectile.velocity.Y;
}
if (Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)) > 2.0)
{
projectile.velocity *= 0.98f;
}
int[] array = new int[20];
int num428 = 0;
float distance = 300f;
bool flag14 = false;
for (int num430 = 0; num430 < 200; num430++)
{
if (Main.npc[num430].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num430].width / 2) + (float)(Main.npc[num430].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1);
if (Vector2.Distance(Main.npc[num430].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
if (num428 < 20)
{
array[num428] = num430;
num428++;
}
flag14 = true;
}
}
}
if (flag14)
{
int num434 = Main.rand.Next(num428);
num434 = array[num434];
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
projectile.localAI[0] += 1f;
if (projectile.localAI[0] > 24f)
{
projectile.localAI[0] = 0f;
float num437 = 6f;
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
value10 += projectile.velocity * 4f;
float num438 = num435 - value10.X;
float num439 = num436 - value10.Y;
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
num440 = num437 / num440;
num438 *= num440;
num439 *= num440;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(value10.X, value10.Y, num438, num439, ModContent.ProjectileType<VividBolt>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType<VividBolt>());
}
}
}
+2 -40
View File
@@ -31,53 +31,15 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f);
for (int num457 = 0; num457 < 5; num457++)
{
int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 0.5f);
Main.dust[num458].noGravity = true;
Main.dust[num458].velocity *= 0.5f;
Main.dust[num458].velocity += projectile.velocity * 0.1f;
}
homeTimer += 5f;
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float distance = homeTimer;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
float extraDistance = (float)(Main.npc[num475].width / 2) + (float)(Main.npc[num475].height / 2);
bool useCollisionDetection = extraDistance < distance;
bool canHit = true;
if (useCollisionDetection)
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1);
if (Vector2.Distance(Main.npc[num475].Center, projectile.Center) < (distance + extraDistance) && canHit)
{
distance = Vector2.Distance(Main.npc[num475].Center, projectile.Center);
num472 = Main.npc[num475].Center.X;
num473 = Main.npc[num475].Center.Y;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 25f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, homeTimer, 25f, 20f);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)