made a utility for summoning off screen projectiles

This commit is contained in:
termigator1359 committed 2020-07-17 15:53:49 -04:00
1 parent 8a0d1f2456
commit 8408748dbd
19 files changed
+329 -396

No files matched your search

+21 -21
View File
@@ -147,25 +147,25 @@ namespace CalamityMod.NPCs.SulphurousSea
}
else
{
npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f;
npc.velocity.X += (float)npc.direction * 0.2f;
if (npc.velocity.X < -4f || npc.velocity.X > 4f)
{
npc.velocity.X = npc.velocity.X * 0.95f;
npc.velocity.X *= 0.95f;
}
if (npc.ai[0] == -1f)
{
npc.velocity.Y = npc.velocity.Y - 0.01f;
if ((double)npc.velocity.Y < -0.3)
{
npc.ai[0] = 1f;
}
}
else
{
npc.velocity.Y = npc.velocity.Y + 0.01f;
if ((double)npc.velocity.Y > 0.3)
{
npc.ai[0] = -1f;
npc.velocity.Y -= 0.01f;
if (npc.velocity.Y < -0.3f)
{
npc.ai[0] = 1f;
}
}
else
{
npc.velocity.Y += 0.01f;
if (npc.velocity.Y > 0.3f)
{
npc.ai[0] = -1f;
}
}
}
@@ -194,9 +194,9 @@ namespace CalamityMod.NPCs.SulphurousSea
npc.ai[0] = -1f;
}
}
if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4)
if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f)
{
npc.velocity.Y = npc.velocity.Y * 0.95f;
npc.velocity.Y *= 0.95f;
}
}
else
@@ -261,11 +261,11 @@ namespace CalamityMod.NPCs.SulphurousSea
}
}
npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f;
if ((double)npc.rotation < -0.2)
if (npc.rotation < -0.2f)
{
npc.rotation = -0.2f;
}
if ((double)npc.rotation > 0.2)
if (npc.rotation > 0.2f)
{
npc.rotation = 0.2f;
return;
@@ -303,7 +303,7 @@ namespace CalamityMod.NPCs.SulphurousSea
}
for (int num621 = 0; num621 < 25; num621++)
{
int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 31, 0f, 0f, 100, default, 2f);
int num622 = Dust.NewDust(npc.position, npc.width, npc.height, 31, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool(2))
{
@@ -314,10 +314,10 @@ namespace CalamityMod.NPCs.SulphurousSea
}
for (int num623 = 0; num623 < 50; num623++)
{
int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f);
int num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f);
num624 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
Main.dust[num624].noGravity = true;
}
+26 -27
View File
@@ -59,24 +59,21 @@ namespace CalamityMod.Projectiles.Magic
{
Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height);
Main.PlaySound(SoundID.Item10, projectile.position);
int num487 = Main.rand.Next(4, 10);
for (int num488 = 0; num488 < num487; num488++)
int dustAmt = Main.rand.Next(4, 10);
for (int d = 0; d < dustAmt; d++)
{
int num489 = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f);
Main.dust[num489].velocity *= 1.6f;
Dust expr_FEDF_cp_0 = Main.dust[num489];
expr_FEDF_cp_0.velocity.Y -= 1f;
Main.dust[num489].velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f;
Main.dust[num489].scale = 2f;
Main.dust[num489].fadeIn = 0.5f;
Main.dust[num489].noGravity = true;
int fire = Dust.NewDust(projectile.Center, 0, 0, 182, 0f, 0f, 100, default, 1f);
Dust dust = Main.dust[fire];
dust.velocity *= 1.6f;
dust.velocity.Y -= 1f;
dust.velocity += -projectile.velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f;
dust.scale = 2f;
dust.fadeIn = 0.5f;
dust.noGravity = true;
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 50, 50, 0);
}
public override Color? GetAlpha(Color lightColor) => new Color(255, 50, 50, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
@@ -119,20 +116,22 @@ namespace CalamityMod.Projectiles.Magic
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt();
float yPos = projectile.Center.Y + Main.rand.Next(-800, 801);
Vector2 spawnPosition = new Vector2(xPos, yPos);
Vector2 velocity = target.Center - spawnPosition;
float dir = 10 / spawnPosition.X;
velocity.X *= dir * 150;
velocity.Y *= dir * 150;
velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f);
velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f);
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType<InfernalBlade2>(), (int)((double)projectile.damage * 0.75), 1f, projectile.owner);
}
OnHitEffects(target.Center);
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 240);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center);
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 240);
}
private void OnHitEffects(Vector2 targetPos)
{
if (projectile.owner == Main.myPlayer)
{
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType<InfernalBlade2>(), (int)(projectile.damage * 0.75), 1f, projectile.owner, true);
}
}
}
}
+18 -13
View File
@@ -120,23 +120,28 @@ namespace CalamityMod.Projectiles.Magic
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt();
float yPos = projectile.Center.Y + Main.rand.Next(-800, 801);
Vector2 spawnPosition = new Vector2(xPos, yPos);
Vector2 velocity = target.Center - spawnPosition;
float dir = 10 / spawnPosition.X;
velocity.X *= dir * 150;
velocity.Y *= dir * 150;
velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f);
velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f);
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType<LiquidBlade2>(), (int)(projectile.damage * 0.75), 1f, projectile.owner);
}
OnHitEffects(target.Center);
target.AddBuff(BuffID.Ichor, 240);
target.AddBuff(BuffID.Frostburn, 240);
target.AddBuff(BuffID.OnFire, 240);
target.AddBuff(BuffID.CursedInferno, 120);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center);
target.AddBuff(BuffID.Ichor, 240);
target.AddBuff(BuffID.Frostburn, 240);
target.AddBuff(BuffID.OnFire, 240);
target.AddBuff(BuffID.CursedInferno, 120);
}
private void OnHitEffects(Vector2 targetPos)
{
if (projectile.owner == Main.myPlayer)
{
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType<LiquidBlade2>(), (int)(projectile.damage * 0.75), 1f, projectile.owner, true);
}
}
}
}
+28 -32
View File
@@ -150,61 +150,57 @@ namespace CalamityMod.Projectiles.Melee
if (target.type == NPCID.TargetDummy)
return;
PetalStorm(target, damage, knockback, crit);
Waterfalls(target, damage, knockback, crit);
PetalStorm(target.Center);
Waterfalls(target.Center);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
// Inflicts Abyssal Flames and Holy Flames for 8 seconds on-hit
target.AddBuff(ModContent.BuffType<AbyssalFlames>(), 480);
target.AddBuff(ModContent.BuffType<HolyFlames>(), 480);
projectile.ai[0] = 1f;
projectile.netUpdate = true;
PetalStorm(target.Center);
Waterfalls(target.Center);
}
// Spawns a storm of flower petals on-hit.
private void PetalStorm(NPC target, int damage, float knockback, bool crit)
private void PetalStorm(Vector2 targetPos)
{
Main.PlaySound(SoundID.Item105, target.Center);
Main.PlaySound(SoundID.Item105, targetPos);
int type = ProjectileID.FlowerPetal;
int numPetals = 12;
int petalDamage = projectile.damage / 8;
float petalKB = 0f;
Player owner = Main.player[projectile.owner];
for (int i = 0; i < numPetals; ++i)
{
float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f);
float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f);
Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY);
float dx = target.Center.X - startPos.X;
float dy = target.Center.Y - startPos.Y;
// Add some randomness / inaccuracy to the petal target location
dx += Main.rand.NextFloat(-5f, 5f);
dy += Main.rand.NextFloat(-5f, 5f);
float speed = Main.rand.NextFloat(DragonPow.MinPetalSpeed, DragonPow.MaxPetalSpeed);
float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy));
dist = speed / dist;
dx *= dist;
dy *= dist;
Vector2 petalVel = new Vector2(dx, dy);
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
if (projectile.owner == Main.myPlayer)
{
int idx = Projectile.NewProjectile(startPos, petalVel, type, petalDamage, petalKB, projectile.owner, 0f, 0f);
Main.projectile[idx].rotation = angle;
Main.projectile[idx].melee = true;
Main.projectile[idx].usesLocalNPCImmunity = true;
Main.projectile[idx].localNPCHitCooldown = -1;
}
if (projectile.owner == Main.myPlayer)
{
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(DragonPow.MinPetalSpeed, DragonPow.MaxPetalSpeed), type, petalDamage, petalKB, projectile.owner);
petal.rotation = angle;
petal.Calamity().forceMelee = true;
petal.usesLocalNPCImmunity = true;
petal.localNPCHitCooldown = -1;
}
}
}
private void Waterfalls(NPC target, int damage, float knockback, bool crit)
private void Waterfalls(Vector2 targetPos)
{
int type = ModContent.ProjectileType<Waterfall>();
int numWaterfalls = 12;
int waterfallDamage = projectile.damage / 6;
float waterfallKB = 0f;
Player owner = Main.player[projectile.owner];
for (int i = 0; i < numWaterfalls; ++i)
{
float startOffsetX = Main.rand.NextFloat(-120f, 120f);
float startOffsetY = Main.rand.NextFloat(-740f, -700f);
Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY);
Vector2 startPos = new Vector2(targetPos.X + startOffsetX, targetPos.Y + startOffsetY);
float fallSpeed = Main.rand.NextFloat(DragonPow.MinWaterfallSpeed, DragonPow.MaxWaterfallSpeed);
Vector2 fallVec = new Vector2(0f, fallSpeed);
fallVec = fallVec.RotatedBy(Main.rand.NextFloat(-0.08f, 0.08f));
+28 -25
View File
@@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 10;
projectile.width = 20;
projectile.height = 20;
projectile.friendly = true;
projectile.melee = true;
projectile.penetrate = 1;
@@ -29,9 +29,9 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
Main.dust[num250].noGravity = true;
Main.dust[num250].velocity *= 0f;
int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
Main.dust[rainbow].noGravity = true;
Main.dust[rainbow].velocity = Vector2.Zero;
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 36f, 20f);
}
@@ -48,35 +48,38 @@ namespace CalamityMod.Projectiles.Melee
{
for (int k = 0; k < 4; k++)
{
int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
Main.dust[num].noGravity = true;
int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
Main.dust[rainbow].noGravity = true;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (projectile.owner == Main.myPlayer)
{
for (int i = 0; i < 4; i++)
{
float xPos = i < 2 ? projectile.Center.X + 800 : projectile.Center.X - 800;
Vector2 source = new Vector2(xPos, projectile.Center.Y + Main.rand.Next(-800, 801));
float xStart = xPos;
Vector2 speed = target.Center - source;
float dir = speed.Length();
dir = 10 / xStart;
float random = (float)Main.rand.Next(1, 150);
speed.X *= dir * random;
speed.Y *= dir * random;
Projectile.NewProjectile(source, speed, ModContent.ProjectileType<SHIV>(), projectile.damage, 1f, projectile.owner);
}
}
OnHitEffects(target.Center);
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
target.AddBuff(ModContent.BuffType<Plague>(), 120);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center);
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
target.AddBuff(ModContent.BuffType<Plague>(), 120);
}
private void OnHitEffects(Vector2 targetPos)
{
for (int x = 0; x < 4; x++)
{
if (projectile.owner == Main.myPlayer)
{
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x > 2, 800f, 800f, 0f, 800f, 1f, ModContent.ProjectileType<SHIV>(), projectile.damage, projectile.knockBack, projectile.owner, false, 50f);
}
}
}
}
}
+49 -90
View File
@@ -38,58 +38,26 @@ namespace CalamityMod.Projectiles.Melee
}
else
{
for (int num41 = 0; num41 < 2; num41++)
for (int i = 0; i < 2; i++)
{
int dustType = num41 == 0 ? 107 : 234;
int dustType = i == 0 ? 107 : 234;
if (Main.rand.NextBool(4))
{
dustType = 269;
}
Vector2 value8 = Vector2.UnitX * -12f;
value8 = -Vector2.UnitY.RotatedBy((double)(counter * 0.1308997f + (float)num41 * 3.14159274f), default) * value7;
int num42 = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1.5f);
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);
Main.dust[num458].noGravity = true;
Main.dust[num458].velocity *= 0f;
Vector2 offset = Vector2.UnitX * -12f;
offset = -Vector2.UnitY.RotatedBy((double)(counter * 0.1308997f + (float)i * MathHelper.Pi), default) * value7;
int exo = Dust.NewDust(projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1.5f);
Main.dust[exo].noGravity = true;
Main.dust[exo].position = projectile.Center + offset;
Main.dust[exo].velocity = projectile.velocity;
int dusters = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f);
Main.dust[dusters].noGravity = true;
Main.dust[dusters].velocity *= 0f;
}
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float num474 = 1000f;
bool flag17 = false;
for (int num475 = 0; num475 < Main.npc.Length; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false))
{
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 = 36f;
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, 1000f, 36f, 20f);
}
public override void Kill(int timeLeft)
@@ -102,57 +70,14 @@ namespace CalamityMod.Projectiles.Melee
});
for (int k = 0; k < 4; k++)
{
int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, (float)(projectile.direction * 2), 0f, 150, default, 1f);
Main.dust[num].noGravity = true;
int exo = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, dustType, (float)(projectile.direction * 2), 0f, 150, default, 1f);
Main.dust[exo].noGravity = true;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
int type = ModContent.ProjectileType<ExoGladiusBeam>();
int numSwords = Main.rand.Next(1,4);
float swordKB = projectile.knockBack;
for (int i = 0; i < numSwords; ++i)
{
float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f);
float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f);
Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY);
float dx = target.Center.X - startPos.X;
float dy = target.Center.Y - startPos.Y;
dx += Main.rand.NextFloat(-5f, 5f);
dy += Main.rand.NextFloat(-5f, 5f);
float speed = Main.rand.NextFloat(24f, 30f);
float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy));
dist = speed / dist;
dx *= dist;
dy *= dist;
Vector2 swordVel = new Vector2(dx, dy);
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
if (projectile.owner == Main.myPlayer)
{
int idx = Projectile.NewProjectile(startPos, swordVel, type, (int)((double)projectile.damage * 0.25), swordKB, projectile.owner, 0f, 0f);
Main.projectile[idx].rotation = angle;
}
}
int spearAmt = Main.rand.Next(1,4);
for (int n = 0; n < spearAmt; n++)
{
float x = projectile.position.X + (float)Main.rand.Next(-400, 400);
float y = projectile.position.Y + (float)Main.rand.Next(800, 1000);
Vector2 vector = new Vector2(x, y);
float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X;
float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y;
num13 += (float)Main.rand.Next(-100, 101);
int num15 = 29;
float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14));
num16 = (float)num15 / num16;
num13 *= num16;
num14 *= num16;
int num17 = Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType<ExoGladSpears>(), (int)((double)projectile.damage * 0.5), swordKB, projectile.owner, 0f, 0f);
}
OnHitEffects(target.Center);
target.AddBuff(ModContent.BuffType<ExoFreeze>(), 30);
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
@@ -163,5 +88,39 @@ namespace CalamityMod.Projectiles.Melee
target.AddBuff(BuffID.OnFire, 120);
target.AddBuff(BuffID.Ichor, 120);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center);
target.AddBuff(ModContent.BuffType<ExoFreeze>(), 30);
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
target.AddBuff(ModContent.BuffType<Plague>(), 120);
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
target.AddBuff(BuffID.CursedInferno, 120);
target.AddBuff(BuffID.Frostburn, 120);
target.AddBuff(BuffID.OnFire, 120);
target.AddBuff(BuffID.Ichor, 120);
}
private void OnHitEffects(Vector2 targetPos)
{
float swordKB = projectile.knockBack;
int swordDmg = (int)(projectile.damage * 0.25);
int numSwords = Main.rand.Next(1,4);
int spearAmt = Main.rand.Next(1,4);
if (projectile.owner == Main.myPlayer)
{
for (int i = 0; i < numSwords; ++i)
{
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(24f, 30f), ModContent.ProjectileType<ExoGladiusBeam>(), swordDmg, swordKB, projectile.owner);
}
for (int n = 0; n < spearAmt; n++)
{
CalamityUtils.ProjectileRain(targetPos, 400f, 100f, -1000f, -800f, 29f, ModContent.ProjectileType<ExoGladSpears>(), swordDmg, swordKB, projectile.owner);
}
}
}
}
}
+18 -16
View File
@@ -56,25 +56,27 @@ namespace CalamityMod.Projectiles.Melee
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[projectile.owner] = 8;
OnHitEffects(target.Center, crit);
target.AddBuff(BuffID.Venom, 300);
if (crit)
{
float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt();
float yPos = projectile.Center.Y + Main.rand.Next(-800, 801);
Vector2 spawnPosition = new Vector2(xPos, yPos);
Vector2 velocity = target.Center - spawnPosition;
float dir = 10 / spawnPosition.X;
velocity.X *= dir * 150;
velocity.Y *= dir * 150;
velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f);
velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center, crit);
target.AddBuff(BuffID.Venom, 300);
}
private void OnHitEffects(Vector2 targetPos, bool crit)
{
if (crit)
{
if (projectile.owner == Main.myPlayer)
{
int petal = Projectile.NewProjectile(spawnPosition, velocity, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner);
Main.projectile[petal].Calamity().forceMelee = true;
Main.projectile[petal].localNPCHitCooldown = -1;
Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true);
petal.Calamity().forceMelee = true;
petal.localNPCHitCooldown = -1;
}
}
}
}
}
}
}
+11 -9
View File
@@ -18,29 +18,31 @@ namespace CalamityMod.Projectiles.Melee
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 10;
projectile.width = 20;
projectile.height = 20;
projectile.friendly = true;
projectile.melee = true;
projectile.penetrate = 1;
projectile.tileCollide = false;
projectile.timeLeft = 600;
projectile.aiStyle = 27;
projectile.extraUpdates = 1;
}
public override void AI()
{
projectile.velocity.X *= 1.075f;
projectile.velocity.Y *= 1.075f;
int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
Main.dust[num250].noGravity = true;
Main.dust[num250].velocity *= 0f;
if (projectile.velocity.Length() < 25f && projectile.timeLeft % 2 == 0)
projectile.velocity *= 1.04f;
int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
Main.dust[rainbow].noGravity = true;
Main.dust[rainbow].velocity = Vector2.Zero;
}
public override void Kill(int timeLeft)
{
int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
Main.dust[num].noGravity = true;
int rainbow = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
Main.dust[rainbow].noGravity = true;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
@@ -38,17 +38,29 @@ namespace CalamityMod.Projectiles.Melee.Spears
if (Main.rand.NextBool(5))
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.NextBool(3) ? 16 : 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
Vector2 goreVec = new Vector2(projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X, projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y);
Vector2 goreVec = projectile.Center + projectile.velocity;
if (Main.rand.NextBool(8))
{
int smoke = Gore.NewGore(goreVec, default, Main.rand.Next(375, 378), 1f);
Main.gore[smoke].behindTiles = true;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[projectile.owner] = 6;
OnHitEffects(target.Center, crit);
target.AddBuff(BuffID.OnFire, 300);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center, crit);
target.AddBuff(BuffID.OnFire, 300);
}
private void OnHitEffects(Vector2 targetPos, bool crit)
{
if (projectile.owner == Main.myPlayer)
{
int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<FuckYou>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
@@ -58,20 +70,12 @@ namespace CalamityMod.Projectiles.Melee.Spears
{
for (int i = 0; i < 2; i++)
{
float xPos = projectile.position.X + 800f * Main.rand.NextBool(2).ToDirectionInt();
Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801));
float speedX = target.position.X - spawnPosition.X;
float speedY = target.position.Y - spawnPosition.Y;
float magnitude = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
magnitude = 10f / xPos;
speedX *= magnitude * 150;
speedY *= magnitude * 150;
speedX = MathHelper.Clamp(speedX, -15f, 15f);
speedY = MathHelper.Clamp(speedY, -15f, 15f);
if (projectile.owner == Main.myPlayer)
Projectile.NewProjectile(spawnPosition.X, spawnPosition.Y, speedX, speedY, ModContent.ProjectileType<TinyFlare>(), (int)(projectile.damage * 0.5), 2f, projectile.owner);
}
}
if (projectile.owner == Main.myPlayer)
{
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType<TinyFlare>(), (int)(projectile.damage * 0.5), 2f, projectile.owner, true);
}
}
}
}
}
}
@@ -37,27 +37,29 @@ namespace CalamityMod.Projectiles.Melee.Spears
{
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType<HellionSpike>(), (int)(projectile.damage * 0.65), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
};
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[projectile.owner] = 8;
target.AddBuff(BuffID.Venom, 300);
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[projectile.owner] = 8;
OnHitEffects(target.Center, crit);
target.AddBuff(BuffID.Venom, 300);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center, crit);
target.AddBuff(BuffID.Venom, 300);
}
private void OnHitEffects(Vector2 targetPos, bool crit)
{
if (crit)
{
float xPos = projectile.position.X + 800f * Main.rand.NextBool(2).ToDirectionInt();
Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801));
float speedX = target.position.X - spawnPosition.X;
float speedY = target.position.Y - spawnPosition.Y;
float magnitude = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
magnitude = 10f / xPos;
speedX *= magnitude * 150;
speedY *= magnitude * 150;
speedX = MathHelper.Clamp(speedX, -15f, 15f);
speedY = MathHelper.Clamp(speedY, -15f, 15f);
if (projectile.owner == Main.myPlayer)
if (projectile.owner == Main.myPlayer)
{
int petal = Projectile.NewProjectile(spawnPosition.X, spawnPosition.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), 2f, projectile.owner);
Main.projectile[petal].Calamity().forceMelee = true;
Main.projectile[petal].localNPCHitCooldown = -1;
Projectile petal = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true);
petal.Calamity().forceMelee = true;
petal.localNPCHitCooldown = -1;
}
}
}
@@ -64,22 +64,9 @@ namespace CalamityMod.Projectiles.Melee.Spears
for (int i = 0; i < projAmt; ++i)
{
int type = Main.rand.NextBool() ? ModContent.ProjectileType<TenebreusTidesWaterSword>() : ModContent.ProjectileType<TenebreusTidesWaterSpear>();
float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f);
float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f);
Vector2 startPos = new Vector2(targetPos.X + startOffsetX, targetPos.Y + startOffsetY);
Vector2 projVel = targetPos - startPos;
// Add some randomness / inaccuracy to the projectile target location
projVel.X += Main.rand.NextFloat(-5f, 5f);
projVel.Y += Main.rand.NextFloat(-5f, 5f);
float speed = Main.rand.NextFloat(25f, 35f);
float dist = projVel.Length();
dist = speed / dist;
projVel.X *= dist;
projVel.Y *= dist;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f);
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(25f, 35f), type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner);
}
}
}
@@ -98,22 +98,9 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i < projAmt; ++i)
{
int type = Main.rand.NextBool() ? ModContent.ProjectileType<TenebreusTidesWaterSword>() : ModContent.ProjectileType<TenebreusTidesWaterSpear>();
float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f);
float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f);
Vector2 startPos = new Vector2(targetPos.X + startOffsetX, targetPos.Y + startOffsetY);
Vector2 projVel = targetPos - startPos;
// Add some randomness / inaccuracy to the projectile target location
projVel.X += Main.rand.NextFloat(-5f, 5f);
projVel.Y += Main.rand.NextFloat(-5f, 5f);
float speed = Main.rand.NextFloat(25f, 35f);
float dist = projVel.Length();
dist = speed / dist;
projVel.X *= dist;
projVel.Y *= dist;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(startPos, projVel, type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f);
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(25f, 35f), type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner);
}
}
}
+4 -13
View File
@@ -142,19 +142,10 @@ namespace CalamityMod.Projectiles.Melee
projectile.localAI[0] += 1f;
if (projectile.localAI[0] % 12f == 0f)
{
float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt();
float yPos = projectile.Center.Y + Main.rand.Next(-800, 801);
Vector2 spawnPosition = new Vector2(xPos, yPos);
Vector2 velocity = player.Center - spawnPosition;
float dir = 10 / spawnPosition.X;
velocity.X *= dir * 150;
velocity.Y *= dir * 150;
velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f);
velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f);
if (projectile.owner == Main.myPlayer)
{
float ai1 = Main.rand.NextFloat() + 0.5f;
Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType<TyphonsGreedBubble>(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, ai1);
Projectile bubble = CalamityUtils.ProjectileBarrage(projectile.Center, player.Center, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType<TyphonsGreedBubble>(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, true);
bubble.ai[1] = Main.rand.NextFloat() + 0.5f;
}
}
}
@@ -164,10 +155,10 @@ namespace CalamityMod.Projectiles.Melee
Rectangle myRect = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height);
if (projectile.owner == Main.myPlayer)
{
for (int i = 0; i < 200; i++)
for (int i = 0; i < Main.maxNPCs; i++)
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage &&
((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) ||
((projectile.friendly && (!Main.npc[i].friendly || (Main.npc[i].type == NPCID.Guide && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == NPCID.Clothier && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) ||
(projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1))
{
if (Main.npc[i].noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(Main.npc[i]))
+21 -18
View File
@@ -40,29 +40,32 @@ namespace CalamityMod.Projectiles.Ranged
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (crit)
{
for (int x = 0; x < 8; x++)
{
float xPos = x > 4 ? projectile.Center.X + 500 : projectile.Center.X - 500;
float yPos = projectile.Center.Y + Main.rand.Next(-500, 501);
Vector2 spawnPosition = new Vector2(xPos, yPos);
Vector2 velocity = target.Center - spawnPosition;
float dir = velocity.Length();
dir = 10 / spawnPosition.X;
velocity.X *= dir * 150;
velocity.Y *= dir * 150;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType<AMR2>(), (int)(projectile.damage * 0.1), 1f, projectile.owner);
}
}
}
OnHitEffects(target.Center, crit);
target.AddBuff(ModContent.BuffType<MarkedforDeath>(), 600);
if (target.defense > 50)
{
target.defense -= 50;
}
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center, crit);
target.AddBuff(ModContent.BuffType<MarkedforDeath>(), 600);
}
private void OnHitEffects(Vector2 targetPos, bool crit)
{
if (crit)
{
for (int x = 0; x < 8; x++)
{
if (projectile.owner == Main.myPlayer)
{
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x > 4, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType<AMR2>(), (int)(projectile.damage * 0.1), 1f, projectile.owner);
}
}
}
}
}
}
+14 -15
View File
@@ -75,21 +75,20 @@ namespace CalamityMod.Projectiles.Ranged
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
float xPos = projectile.Center.X + 800 * Main.rand.NextBool(2).ToDirectionInt();
float yPos = projectile.Center.Y + Main.rand.Next(-800, 801);
Vector2 spawnPosition = new Vector2(xPos, yPos);
Vector2 velocity = target.Center - spawnPosition;
float dir = 10 / spawnPosition.X;
velocity.X *= dir * 150;
velocity.Y *= dir * 150;
velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f);
velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f);
if (projectile.owner == Main.myPlayer)
{
int splitDamage = (int)(projectile.damage * 0.6f);
float splitKB = 1f;
Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType<HyperiusSplit>(), splitDamage, splitKB, projectile.owner);
}
OnHitEffects(target.Center);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center);
}
private void OnHitEffects(Vector2 targetPos)
{
if (projectile.owner == Main.myPlayer)
{
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ModContent.ProjectileType<HyperiusSplit>(), (int)(projectile.damage * 0.6), 1f, projectile.owner, true);
}
}
public override void Kill(int timeLeft)
+2
View File
@@ -50,6 +50,8 @@ namespace CalamityMod.Projectiles.Ranged
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
if (projectile.timeLeft == 360)
return false;
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
+9 -28
View File
@@ -54,48 +54,29 @@ namespace CalamityMod.Projectiles.Ranged
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (crit)
{
int bulletCount = 10;
for (int x = 0; x < bulletCount; x++)
{
float speed = 12f;
float xPos = projectile.Center.X + (x < bulletCount / 2 ? 500f : -500f);
float yPos = projectile.Center.Y + Main.rand.Next(-500, 501);
Vector2 origin = new Vector2(xPos, yPos);
Vector2 velocity = new Vector2(target.Center.X - origin.X, target.Center.Y - origin.Y);
velocity.Normalize();
velocity *= speed;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(origin, velocity, ModContent.ProjectileType<AMR2>(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner);
}
}
}
OnHitEffects(target.Center, crit);
target.AddBuff(ModContent.BuffType<MarkedforDeath>(), 900);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center, crit);
target.AddBuff(ModContent.BuffType<MarkedforDeath>(), 900);
}
private void OnHitEffects(Vector2 targetPos, bool crit)
{
if (crit)
{
int bulletCount = 10;
for (int x = 0; x < bulletCount; x++)
{
float speed = 12f;
float xPos = projectile.Center.X + (x < bulletCount / 2 ? 500f : -500f);
float yPos = projectile.Center.Y + Main.rand.Next(-500, 501);
Vector2 origin = new Vector2(xPos, yPos);
Vector2 velocity = new Vector2(target.Center.X - origin.X, target.Center.Y - origin.Y);
velocity.Normalize();
velocity *= speed;
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(origin, velocity, ModContent.ProjectileType<AMR2>(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner);
}
CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x < bulletCount / 2, 500f, 500f, 0f, 500f, 12f, ModContent.ProjectileType<AMR2>(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner);
}
}
}
target.AddBuff(ModContent.BuffType<MarkedforDeath>(), 900);
}
}
}
+19 -28
View File
@@ -88,42 +88,33 @@ namespace CalamityMod.Projectiles.Ranged
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
Main.PlaySound(SoundID.Item96, projectile.position);
OnHitEffects(target.Center);
target.AddBuff(BuffID.Wet, 240);
target.AddBuff(ModContent.BuffType<SulphuricPoisoning>(), 240);
}
int type = ModContent.ProjectileType<SeasSearingBubble>();
public override void OnHitPvp(Player target, int damage, bool crit)
{
OnHitEffects(target.Center);
target.AddBuff(BuffID.Wet, 240);
target.AddBuff(ModContent.BuffType<SulphuricPoisoning>(), 240);
}
private void OnHitEffects(Vector2 targetPos)
{
Main.PlaySound(SoundID.Item96, projectile.Center);
if (projectile.ai[0] == 1f)
{
int numWaterBlasts = 2;
int waterDamage = SeasSearing.BaseDamage / 2;
float waterKB = 1f;
Player owner = Main.player[projectile.owner];
for (int i = 0; i < numWaterBlasts; ++i)
for (int x = 0; x < 2; x++)
{
float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f);
float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f);
Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY);
float dx = target.Center.X - startPos.X;
float dy = target.Center.Y - startPos.Y;
// Add some randomness / inaccuracy
dx += Main.rand.NextFloat(-5f, 5f);
dy += Main.rand.NextFloat(-5f, 5f);
float speed = Main.rand.NextFloat(20f, 25f);
float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy));
dist = speed / dist;
dx *= dist;
dy *= dist;
Vector2 waterVel = new Vector2(dx, dy);
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
if (projectile.owner == Main.myPlayer)
{
int idx = Projectile.NewProjectile(startPos, waterVel, type, waterDamage, waterKB, projectile.owner, 0f, 0f);
Main.projectile[idx].rotation = angle;
Main.projectile[idx].tileCollide = false;
Main.projectile[idx].usesLocalNPCImmunity = true;
Main.projectile[idx].localNPCHitCooldown = -1;
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
Projectile bubble = CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, Main.rand.NextBool(), 1000f, 1400f, 80f, 900f, Main.rand.NextFloat(20f, 25f), ModContent.ProjectileType<SeasSearingBubble>(), projectile.damage / 2, 1f, projectile.owner);
bubble.rotation = angle;
bubble.tileCollide = false;
bubble.usesLocalNPCImmunity = true;
bubble.localNPCHitCooldown = -1;
}
}
}
+20
View File
@@ -969,6 +969,26 @@ namespace CalamityMod
return proj;
}
public static Projectile ProjectileBarrage(Vector2 originVec, Vector2 targetPos, bool fromRight, float xOffsetMin, float xOffsetMax, float yOffsetMin, float yOffsetMax, float projSpeed, int projType, int damage, float knockback, int owner, bool clamped = false, float inaccuracyOffset = 5f)
{
float xPos = originVec.X + Main.rand.NextFloat(xOffsetMin, xOffsetMax) * fromRight.ToDirectionInt();
float yPos = originVec.Y + Main.rand.NextFloat(yOffsetMin, yOffsetMax) * Main.rand.NextBool().ToDirectionInt();
Vector2 spawnPosition = new Vector2(xPos, yPos);
Vector2 velocity = targetPos - spawnPosition;
velocity.X += Main.rand.NextFloat(-inaccuracyOffset, inaccuracyOffset);
velocity.Y += Main.rand.NextFloat(-inaccuracyOffset, inaccuracyOffset);
velocity.Normalize();
velocity *= projSpeed * (clamped ? 150f : 1f);
//This clamp means the spawned projectiles only go at diagnals and are not accurate
if (clamped)
{
velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f);
velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f);
}
Projectile proj = Projectile.NewProjectileDirect(spawnPosition, velocity, projType, damage, knockback, owner);
return proj;
}
public static int DamageSoftCap(double dmgInput, int cap)
{
int newDamage = (int)(dmgInput);