vivid tweaks

This commit is contained in:
termigator1359 committed 2020-06-03 14:42:16 -04:00
1 parent 560dfc9f7a
commit 91e07c0532
2 files changed
+31 -33

No files matched your search

+16 -17
View File
@@ -50,29 +50,28 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
float num72 = item.shootSpeed;
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
float f = Main.rand.NextFloat() * 6.28318548f;
float value12 = 20f;
float value13 = 60f;
Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat());
Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float speed = item.shootSpeed;
float xPos = (float)Main.mouseX + Main.screenPosition.X - playerPos.X;
float yPos = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y;
float f = Main.rand.NextFloat() * MathHelper.TwoPi;
float sourceVariationLow = 20f;
float sourceVariationHigh = 60f;
Vector2 source = playerPos + f.ToRotationVector2() * MathHelper.Lerp(sourceVariationLow, sourceVariationHigh, Main.rand.NextFloat());
for (int num202 = 0; num202 < 50; num202++)
{
vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat());
if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0))
source = playerPos + f.ToRotationVector2() * MathHelper.Lerp(sourceVariationLow, sourceVariationHigh, Main.rand.NextFloat());
if (Collision.CanHit(playerPos, 0, 0, source + (source - playerPos).SafeNormalize(Vector2.UnitX) * 8f, 0, 0))
{
break;
}
f = Main.rand.NextFloat() * 6.28318548f;
f = Main.rand.NextFloat() * MathHelper.TwoPi;
}
Vector2 mouseWorld = Main.MouseWorld;
Vector2 vector14 = mouseWorld - vector13;
Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72;
vector14 = vector14.SafeNormalize(vector15) * num72;
vector14 = Vector2.Lerp(vector14, vector15, 0.25f);
Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3));
Vector2 velocity = Main.MouseWorld - source;
Vector2 velocityVariation = new Vector2(xPos, yPos).SafeNormalize(Vector2.UnitY) * speed;
velocity = velocity.SafeNormalize(velocityVariation) * speed;
velocity = Vector2.Lerp(velocity, velocityVariation, 0.25f);
Projectile.NewProjectile(source, velocity, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3));
return false;
}
+15 -16
View File
@@ -113,28 +113,27 @@ namespace CalamityMod.Projectiles.Magic
{
if (projectile.ai[1] == 0f)
{
float x = projectile.position.X + (float)Main.rand.Next(-400, 400);
float y = projectile.position.Y - (float)Main.rand.Next(500, 800);
Vector2 vector = new Vector2(x, y);
float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X;
float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y;
num15 += (float)Main.rand.Next(-100, 101);
float num17 = 6f;
float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16));
num18 = num17 / num18;
num15 *= num18;
num16 *= num18;
int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType<VividClarityBeam>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
float xStart = projectile.position.X + (float)Main.rand.Next(-400, 400);
float yStart = projectile.position.Y - (float)Main.rand.Next(500, 800);
Vector2 startPos = new Vector2(xStart, yStart);
Vector2 velocity = projectile.Center - startPos;
velocity.X += (float)Main.rand.Next(-100, 101);
float speed = 6f;
float targetDist = velocity.Length();
targetDist = speed / targetDist;
velocity.X *= targetDist;
velocity.Y *= targetDist;
int num19 = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType<VividClarityBeam>(), (int)(projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f);
Main.projectile[num19].ai[1] = projectile.position.Y;
}
if (projectile.ai[1] == 1f)
{
int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<SupernovaBoom>(), (int)((double)projectile.damage * 2f), projectile.knockBack, projectile.owner, 0f, 0f);
int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<SupernovaBoom>(), (int)(projectile.damage * 2f), projectile.knockBack, projectile.owner, 0f, 0f);
Main.projectile[boom].Calamity().forceMagic = true;
}
if (projectile.ai[1] == 2f)
{
float spread = 30f * 0.0174f;
float spread = 30f * 0.01f * MathHelper.PiOver2;
double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
@@ -143,8 +142,8 @@ namespace CalamityMod.Projectiles.Magic
for (int i = 0; i < 4; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<VividLaser2>(), (int)((double)projectile.damage * 0.2f), projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<VividLaser2>(), (int)((double)projectile.damage * 0.2f), projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<VividLaser2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<VividLaser2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}