A few Queen Bee and Perf edits (I made sure it compiles, but the changes are untested for now).

This commit is contained in:
mountaindrew10 committed 2025-04-08 09:05:57 -05:00
1 parent 92257d578c
commit be37588348
10 files changed
+405 -36

No files matched your search

+1
View File
@@ -599,6 +599,7 @@ namespace CalamityMod
{ new Tuple<int, int>(ModContent.NPCType<PerforatorHeadLarge>(), ModContent.ProjectileType<DoGDeath>()), new int[] { 22, 36, 44, 52, 84 } },
{ new Tuple<int, int>(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 84, 126 } },
{ new Tuple<int, int>(NPCID.QueenBee, ModContent.ProjectileType<QueenBeenade>()), new int[] { 46, 72, 84, 96, 144 } }, // Beenade Bees: 122 (death mode-exclusive)
{ new Tuple<int, int>(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 72, 84, 96, 144 } },
{ new Tuple<int, int>(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 36, 72, 88, 104, 156 } },
@@ -125,6 +125,8 @@ ProfanedSpear.DisplayName: Profaned Spear
ProvidenceCrystal.DisplayName: Holy Crystal
ProvidenceCrystalShard.DisplayName: Holy Crystal Shard
ProvidenceHolyRay.DisplayName: Holy Ray
QueenBeenade.DisplayName: Queen Beenade
QueenBeenadeBee.DisplayName: Queen Beenade Bee
RavagerBlast.DisplayName: Ravaging Laser
RavagerBlaster.DisplayName: Ravager Blaster
RavagerFlame.DisplayName: Blue Flame
+27
View File
@@ -79,6 +79,9 @@ namespace CalamityMod.NPCs.Perforator
public override void AI()
{
bool bossRush = BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || bossRush;
NPC.realLife = -1;
// Target
@@ -110,8 +113,17 @@ namespace CalamityMod.NPCs.Perforator
}
// Splitting effect
bool spawnedBlob = false;
if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active)
{
if (death)
{
spawnedBlob = true;
int type = ModContent.ProjectileType<IchorBlob>();
int damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y);
}
NPC.life = 0;
NPC.HitEffect(0, 10.0);
NPC.checkDead();
@@ -120,6 +132,14 @@ namespace CalamityMod.NPCs.Perforator
}
if (!Main.npc[(int)NPC.ai[1]].active || Main.npc[(int)NPC.ai[1]].aiStyle != NPC.aiStyle)
{
if (death && !spawnedBlob)
{
spawnedBlob = true;
int type = ModContent.ProjectileType<IchorBlob>();
int damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y);
}
NPC.type = ModContent.NPCType<PerforatorHeadMedium>();
int whoAmI = NPC.whoAmI;
float lifeRatio = NPC.life / (float)NPC.lifeMax;
@@ -133,6 +153,13 @@ namespace CalamityMod.NPCs.Perforator
}
if (!Main.npc[(int)NPC.ai[0]].active || Main.npc[(int)NPC.ai[0]].aiStyle != NPC.aiStyle)
{
if (death && !spawnedBlob)
{
int type = ModContent.ProjectileType<IchorBlob>();
int damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y);
}
int whoAmI2 = NPC.whoAmI;
float otherLifeRatio = NPC.life / (float)NPC.lifeMax;
float ai1 = NPC.ai[1];
+23 -22
View File
@@ -282,31 +282,32 @@ namespace CalamityMod.NPCs.Perforator
}
// This is possibly the best or worst idea ever conceived
float laserOffset = 1500f;
float laserVelocity = 4f;
int type = ModContent.ProjectileType<DoGDeath>();
int damage = NPC.GetProjectileDamage(type);
if (Main.zenithWorld)
NPC.Calamity().newAI[3]++;
if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast
{
if (NPC.Calamity().newAI[3] % 60 == 59)
{
SoundEngine.PlaySound(SoundID.Item12, player.Center);
for (int i = -7; i < 8; i++) // 15 lasers
{
float laserGap = (i * 128f);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - laserOffset, player.Center.Y + laserGap, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
float laserOffset = 1500f;
float laserVelocity = 4f;
int type = ModContent.ProjectileType<DoGDeath>();
int damage = NPC.GetProjectileDamage(type);
if (NPC.Calamity().newAI[3] >= 300f)
NPC.Calamity().newAI[3] = -300f;
NPC.Calamity().newAI[3]++;
if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast
{
if (NPC.Calamity().newAI[3] % 60 == 59)
{
SoundEngine.PlaySound(SoundID.Item12, player.Center);
for (int i = -7; i < 8; i++) // 15 lasers
{
float laserGap = (i * 128f);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserOffset, player.Center.Y + laserGap, -laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - laserOffset, player.Center.Y + laserGap, laserVelocity, 0f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, -laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + laserGap, player.Center.Y + laserOffset, 0f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
if (NPC.Calamity().newAI[3] >= 300f)
NPC.Calamity().newAI[3] = -300f;
}
}
float speedCopy = speed;
+16
View File
@@ -157,8 +157,17 @@ namespace CalamityMod.NPCs.Perforator
}
// Splitting effect
bool spawnedBlob = false;
if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active)
{
if (death)
{
spawnedBlob = true;
int type = ModContent.ProjectileType<IchorBlob>();
int damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y);
}
NPC.life = 0;
NPC.HitEffect(0, 10.0);
NPC.checkDead();
@@ -167,6 +176,13 @@ namespace CalamityMod.NPCs.Perforator
}
if (!Main.npc[(int)NPC.ai[0]].active)
{
if (death && !spawnedBlob)
{
int type = ModContent.ProjectileType<IchorBlob>();
int damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y);
}
NPC.life = 0;
NPC.HitEffect(0, 10.0);
NPC.checkDead();
+19 -10
View File
@@ -273,8 +273,17 @@ namespace CalamityMod.NPCs.Perforator
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<PerforatorHeadSmall>(), 1);
}
else
{
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, wormType, 1);
// Spawn two small worms in Death
if (death)
{
if (wormType == ModContent.NPCType<PerforatorHeadSmall>())
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, wormType, 1);
}
}
NPC.TargetClosest();
SoundEngine.PlaySound(WormSpawn, NPC.Center);
@@ -384,9 +393,9 @@ namespace CalamityMod.NPCs.Perforator
NPC.damage = 0;
if (revenge)
Movement(player, 6f + velocityEnrageIncrease, 0.3f, 450f);
Movement(player, 9f + velocityEnrageIncrease, 0.3f, 450f);
else
Movement(player, 5f + velocityEnrageIncrease, 0.2f, 450f);
Movement(player, 6f + velocityEnrageIncrease, 0.2f, 450f);
return;
}
@@ -449,13 +458,13 @@ namespace CalamityMod.NPCs.Perforator
NPC.damage = NPC.defDamage;
if (large || death)
Movement(player, 11f + velocityEnrageIncrease, death ? 0.1125f : 0.0975f, 20f);
Movement(player, 13f + velocityEnrageIncrease, death ? 0.115f : 0.1f, 20f);
else if (medium)
Movement(player, 10f + velocityEnrageIncrease, death ? 0.105f : 0.09f, 30f);
Movement(player, 12f + velocityEnrageIncrease, death ? 0.11f : 0.095f, 30f);
else if (small)
Movement(player, 9f + velocityEnrageIncrease, death ? 0.0975f : 0.0825f, 40f);
Movement(player, 11f + velocityEnrageIncrease, death ? 0.105f : 0.09f, 40f);
else
Movement(player, 8f + velocityEnrageIncrease, death ? 0.09f : 0.075f, 50f);
Movement(player, 10f + velocityEnrageIncrease, death ? 0.1f : 0.085f, 50f);
break;
@@ -464,7 +473,7 @@ namespace CalamityMod.NPCs.Perforator
// Avoid cheap bullshit
NPC.damage = 0;
Movement(player, 6f + velocityEnrageIncrease, 0.15f, 350f);
Movement(player, 8f + velocityEnrageIncrease, 0.2f, 350f);
break;
@@ -473,7 +482,7 @@ namespace CalamityMod.NPCs.Perforator
// Avoid cheap bullshit
NPC.damage = 0;
Movement(player, 6f + velocityEnrageIncrease, 0.15f, 275f);
Movement(player, 8f + velocityEnrageIncrease, 0.2f, 275f);
break;
@@ -482,7 +491,7 @@ namespace CalamityMod.NPCs.Perforator
// Avoid cheap bullshit
NPC.damage = 0;
Movement(player, 6f + velocityEnrageIncrease, 0.15f, 200f);
Movement(player, 8f + velocityEnrageIncrease, 0.2f, 200f);
break;
}
@@ -492,7 +501,7 @@ namespace CalamityMod.NPCs.Perforator
// Avoid cheap bullshit
NPC.damage = 0;
Movement(player, 6f + velocityEnrageIncrease, 0.075f, 350f);
Movement(player, 6f + velocityEnrageIncrease, 0.15f, 350f);
}
}
+19
View File
@@ -79,6 +79,9 @@ namespace CalamityMod.NPCs.Perforator
public override void AI()
{
bool bossRush = BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || bossRush;
NPC.realLife = -1;
// Target
@@ -98,8 +101,17 @@ namespace CalamityMod.NPCs.Perforator
if (Main.netMode != NetmodeID.MultiplayerClient)
{
// Splitting effect
bool spawnedBlob = false;
if (!Main.npc[(int)NPC.ai[1]].active && !Main.npc[(int)NPC.ai[0]].active)
{
if (death)
{
spawnedBlob = true;
int type = ModContent.ProjectileType<IchorBlob>();
int damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y);
}
NPC.life = 0;
NPC.HitEffect(0, 10.0);
NPC.checkDead();
@@ -108,6 +120,13 @@ namespace CalamityMod.NPCs.Perforator
}
if (!Main.npc[(int)NPC.ai[1]].active)
{
if (death && !spawnedBlob)
{
int type = ModContent.ProjectileType<IchorBlob>();
int damage = NPC.GetProjectileDamage(type);
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y);
}
NPC.life = 0;
NPC.HitEffect(0, 10.0);
NPC.checkDead();
@@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
// Despawn
float distanceFromTarget = Vector2.Distance(npc.Center, Main.player[npc.target].Center);
if (npc.ai[0] != 6f)
if (npc.ai[0] != 7f)
{
if (npc.timeLeft < 60)
npc.timeLeft = 60;
@@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.ai[0] = 4f;
}
if (Main.player[npc.target].dead)
npc.ai[0] = 6f;
npc.ai[0] = 7f;
// Adjust slowing debuff immunity
bool immuneToSlowingDebuffs = npc.ai[0] == 0f;
@@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
// Despawn phase
if (npc.ai[0] == 6f)
if (npc.ai[0] == 7f)
{
// Avoid cheap bullshit
npc.damage = 0;
@@ -202,7 +202,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int phase;
int maxRandom = phase4 ? 5 : 4;
int maxRandom = phase4 ? (death ? 6 : 5) : 4;
do phase = Main.rand.Next(maxRandom);
while (phase == npc.ai[1] || phase == 1 || (phase == 2 && phase4) || (death && phase6 && phase == 3));
@@ -212,6 +212,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (phase == 4)
phase = 5;
// 6 is beenade vomit
if (phase == 5)
phase = 6;
CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults);
npc.ai[0] = phase;
npc.ai[1] = 0f;
@@ -910,6 +914,46 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel);
}
// Spit beenades
else if (npc.ai[0] == 6f)
{
// Avoid cheap bullshit
npc.damage = 0;
// Direction
float playerLocation = npc.Center.X - Main.player[npc.target].Center.X;
npc.direction = playerLocation < 0 ? 1 : -1;
npc.spriteDirection = npc.direction;
float beenadeAttackSpeed = 20f + 4f * enrageScale;
float beenadeAttackAccel = 0.75f;
Vector2 targetVector = Main.player[npc.target].Center + Vector2.UnitY * 240f;
if (npc.Distance(targetVector) > 80f)
npc.SimpleFlyMovement(npc.SafeDirectionTo(targetVector) * beenadeAttackSpeed, beenadeAttackAccel);
else
npc.velocity *= 0.8f;
float phaseLimit = 180f;
npc.ai[1] += 1f;
if (npc.ai[1] >= phaseLimit)
{
npc.ai[0] = -1f;
npc.ai[1] = 5f;
npc.ai[2] = 0f;
npc.netUpdate = true;
}
else if (npc.ai[1] % 61f == 0f)
{
Vector2 beenadeSpawnLocation = npc.Center + new Vector2(20f * npc.direction, -40f);
SoundEngine.PlaySound(SoundID.Item76, beenadeSpawnLocation);
int type = ModContent.ProjectileType<QueenBeenade>();
int damage = npc.GetProjectileDamage(type);
if (Main.netMode != NetmodeID.MultiplayerClient)
Projectile.NewProjectile(npc.GetSource_FromAI(), beenadeSpawnLocation, Vector2.UnitX * 6f * npc.direction, type, damage, 0f, Main.myPlayer);
}
}
if (Main.dedServ)
npc.ForceNetUpdate();
+111
View File
@@ -0,0 +1,111 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class QueenBeenade : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public override string Texture => $"Terraria/Images/Projectile_{ProjectileID.Beenade}";
public override void SetDefaults()
{
Projectile.Calamity().DealsDefenseDamage = true;
Projectile.width = 14;
Projectile.height = 22;
Projectile.hostile = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 180;
}
public override void AI()
{
if (Projectile.ai[0] > 5f)
{
if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f)
{
Projectile.velocity.X *= 0.97f;
if (Math.Abs(Projectile.velocity.X) < 0.01f)
{
Projectile.velocity.X = 0f;
Projectile.netUpdate = true;
}
}
Projectile.velocity.Y += 0.2f;
}
else
Projectile.ai[0] += 1f;
Projectile.rotation += Projectile.velocity.X * 0.1f;
if (Projectile.velocity.Y > 16f)
Projectile.velocity.Y = 16f;
}
public override bool? CanDamage() => Projectile.timeLeft <= 0;
public override bool OnTileCollide(Vector2 oldVelocity)
{
if (Projectile.velocity.X != oldVelocity.X)
Projectile.velocity.X = oldVelocity.X * -0.5f;
if (Projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 1f)
Projectile.velocity.Y = oldVelocity.Y * -0.5f;
return false;
}
public override void OnKill(int timeLeft)
{
int newSize = 40;
Projectile.position = Projectile.Center;
Projectile.width = Projectile.height = newSize;
Projectile.Center = Projectile.position;
Projectile.Damage();
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
for (int i = 0; i < 20; i++)
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 31, 0f, 0f, 100, default, 1.5f);
if (!Main.dedServ)
{
int gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64));
Main.gore[gore].velocity.X += 1f;
Main.gore[gore].velocity.Y += 1f;
Main.gore[gore].velocity *= 0.3f;
gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64));
Main.gore[gore].velocity.X -= 1f;
Main.gore[gore].velocity.Y += 1f;
Main.gore[gore].velocity *= 0.3f;
gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64));
Main.gore[gore].velocity.X += 1f;
Main.gore[gore].velocity.Y -= 1f;
Main.gore[gore].velocity *= 0.3f;
gore = Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, default, Main.rand.Next(61, 64));
Main.gore[gore].velocity.X -= 1f;
Main.gore[gore].velocity.Y -= 1f;
Main.gore[gore].velocity *= 0.3f;
}
if (Projectile.owner == Main.myPlayer)
{
int beeAmount = Main.rand.Next(5, 8);
int type = ModContent.ProjectileType<QueenBeenadeBee>();
float minVelocity = 8f;
float maxVelocity = 16f;
for (int i = 0; i < beeAmount; i++)
{
float speedX = (float)Main.rand.Next(-35, 36) * 0.02f;
float speedY = (float)Main.rand.Next(-35, 36) * 0.02f;
Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, new Vector2(speedX, speedY), type, (int)Math.Round(Projectile.damage * 0.85), 0f, Main.myPlayer, 0f, minVelocity, maxVelocity);
}
}
}
}
}
+139
View File
@@ -0,0 +1,139 @@
using System;
using CalamityMod.Events;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class QueenBeenadeBee : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public override string Texture => $"Terraria/Images/Projectile_{ProjectileID.GiantBee}";
public override void SetStaticDefaults()
{
Main.projFrames[Type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.hostile = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 420;
}
public override void AI()
{
// Animation
Projectile.frameCounter++;
if (Projectile.frameCounter > 4)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 4)
Projectile.frame = 0;
// Direction and rotation
Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1;
Projectile.rotation = Projectile.velocity.X * 0.1f;
// Difficulty modes
bool bossRush = BossRushEvent.BossRushActive;
bool death = CalamityWorld.death || bossRush;
// Get a target and calculate distance from it
int target = Player.FindClosest(Projectile.Center, 1, 1);
Vector2 distanceFromTarget = Main.player[target].Center - Projectile.Center;
// Set AI to stop homing, start accelerating
float stopHomingDistance = bossRush ? 80f : 120f;
if (distanceFromTarget.Length() < stopHomingDistance || Projectile.ai[0] == 1f || Projectile.timeLeft < 120)
{
Projectile.ai[0] = 1f;
if (Projectile.velocity.Length() < Projectile.ai[2])
Projectile.velocity *= 1.05f;
return;
}
// Fly off for a bit before homing
if (Projectile.timeLeft > 300)
{
if (Projectile.velocity.Length() < Projectile.ai[1])
Projectile.velocity *= 1.05f;
return;
}
// Home in on target
float scaleFactor = Projectile.velocity.Length();
float inertia = bossRush ? 12f : 16f;
distanceFromTarget.Normalize();
distanceFromTarget *= scaleFactor;
Projectile.velocity = (Projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f);
Projectile.velocity.Normalize();
Projectile.velocity *= scaleFactor;
// Fly away from other bees
float pushForce = bossRush ? 0.06f : 0.05f;
float pushDistance = bossRush ? 90f : 60f;
for (int k = 0; k < Main.maxProjectiles; k++)
{
Projectile otherProj = Main.projectile[k];
// Short circuits to make the loop as fast as possible
if (!otherProj.active || k == Projectile.whoAmI)
continue;
// If the other projectile is indeed the same owned by the same player and they're too close, nudge them away.
bool sameProjType = otherProj.type == Projectile.type;
float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center);
if (sameProjType && taxicabDist < pushDistance)
{
if (Projectile.position.X < otherProj.position.X)
Projectile.velocity.X -= pushForce;
else
Projectile.velocity.X += pushForce;
if (Projectile.position.Y < otherProj.position.Y)
Projectile.velocity.Y -= pushForce;
else
Projectile.velocity.Y += pushForce;
}
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (info.Damage <= 0)
return;
target.AddBuff(BuffID.Poisoned, 120);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor);
return false;
}
public override void OnKill(int timeLeft)
{
for (int i = 0; i < 6; i++)
{
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 150, Projectile.velocity.X, Projectile.velocity.Y, 50);
Main.dust[dust].noGravity = true;
Main.dust[dust].scale = 1f;
}
}
}
}