More Hive Mind and Blob adjustments and fixes.

This commit is contained in:
mountaindrew10 committed 2024-05-29 17:34:29 -05:00
1 parent 3e78539486
commit 4cf38b4cb7
3 files changed
+87 -38

No files matched your search

+15 -15
View File
@@ -91,11 +91,10 @@ namespace CalamityMod.NPCs.HiveMind
NPC.TargetClosest();
float hiveMindVelocity = Main.npc[hiveMind].velocity.Length();
float relocateSpeed = (getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f) + hiveMindVelocity * 0.0625f;
Vector2 randomLocationVector = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f);
float targetX = Main.player[NPC.target].Center.X - (NPC.width / 2) - randomLocationVector.X;
float targetY = Main.player[NPC.target].Center.Y - (NPC.height / 2) - randomLocationVector.Y;
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f;
float acceleration = 0.8f;
float distanceFromMind = Main.getGoodWorld ? 256f : 128f;
float hiveMindX = Main.npc[hiveMind].Center.X;
float hiveMindY = Main.npc[hiveMind].Center.Y;
Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY);
@@ -104,32 +103,33 @@ namespace CalamityMod.NPCs.HiveMind
float finalRandPosX = randomPosX - hiveMindPos.X;
float finalRandPosY = randomPosY - hiveMindPos.Y;
float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY);
finalRandDistance = (Main.getGoodWorld ? 256f : 128f) / finalRandDistance;
finalRandDistance = distanceFromMind / finalRandDistance;
finalRandPosX *= finalRandDistance;
finalRandPosY *= finalRandDistance;
if (NPC.position.X < hiveMindX + finalRandPosX)
{
NPC.velocity.X = NPC.velocity.X + relocateSpeed;
NPC.velocity.X += relocateSpeed;
if (NPC.velocity.X < 0f && finalRandPosX > 0f)
NPC.velocity.X = NPC.velocity.X * 0.8f;
NPC.velocity.X *= acceleration;
}
else if (NPC.position.X > hiveMindX + finalRandPosX)
{
NPC.velocity.X = NPC.velocity.X - relocateSpeed;
NPC.velocity.X -= relocateSpeed;
if (NPC.velocity.X > 0f && finalRandPosX < 0f)
NPC.velocity.X = NPC.velocity.X * 0.8f;
NPC.velocity.X *= acceleration;
}
if (NPC.position.Y < hiveMindY + finalRandPosY)
{
NPC.velocity.Y = NPC.velocity.Y + relocateSpeed;
NPC.velocity.Y += relocateSpeed;
if (NPC.velocity.Y < 0f && finalRandPosY > 0f)
NPC.velocity.Y = NPC.velocity.Y * 0.8f;
NPC.velocity.Y *= acceleration;
}
else if (NPC.position.Y > hiveMindY + finalRandPosY)
{
NPC.velocity.Y = NPC.velocity.Y - relocateSpeed;
NPC.velocity.Y -= relocateSpeed;
if (NPC.velocity.Y > 0f && finalRandPosY < 0f)
NPC.velocity.Y = NPC.velocity.Y * 0.8f;
NPC.velocity.Y *= acceleration;
}
float velocityLimit = relocateSpeed * 16f;
@@ -209,7 +209,7 @@ namespace CalamityMod.NPCs.HiveMind
Color color = NPC.GetAlpha(drawColor);
if (NPC.localAI[1] > 240f)
color = Color.Lerp(color, Color.Green, MathHelper.Clamp((NPC.localAI[1] - 240f) / 120f, 0f, 1f));
color = Color.Lerp(color, Color.Green * NPC.Opacity, MathHelper.Clamp((NPC.localAI[1] - 240f) / 120f, 0f, 1f));
spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
+15 -15
View File
@@ -94,11 +94,10 @@ namespace CalamityMod.NPCs.HiveMind
NPC.TargetClosest();
float hiveMindVelocity = Main.npc[hiveMind].velocity.Length();
float relocateSpeed = (getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f) + hiveMindVelocity * 0.0625f;
Vector2 randomRelocateVector = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f);
float targetX = Main.player[NPC.target].Center.X - (NPC.width / 2) - randomRelocateVector.X;
float targetY = Main.player[NPC.target].Center.Y - (NPC.height / 2) - randomRelocateVector.Y;
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f;
float acceleration = 0.8f;
float distanceFromMind = Main.getGoodWorld ? 192f : 96f;
float hiveMindX = Main.npc[hiveMind].Center.X;
float hiveMindY = Main.npc[hiveMind].Center.Y;
Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY);
@@ -107,32 +106,33 @@ namespace CalamityMod.NPCs.HiveMind
float finalRandPosX = randomPosX - hiveMindPos.X;
float finalRandPosY = randomPosY - hiveMindPos.Y;
float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY);
finalRandDistance = (Main.getGoodWorld ? 192f : 96f) / finalRandDistance;
finalRandDistance = distanceFromMind / finalRandDistance;
finalRandPosX *= finalRandDistance;
finalRandPosY *= finalRandDistance;
if (NPC.position.X < hiveMindX + finalRandPosX)
{
NPC.velocity.X = NPC.velocity.X + relocateSpeed;
NPC.velocity.X += relocateSpeed;
if (NPC.velocity.X < 0f && finalRandPosX > 0f)
NPC.velocity.X = NPC.velocity.X * 0.8f;
NPC.velocity.X *= acceleration;
}
else if (NPC.position.X > hiveMindX + finalRandPosX)
{
NPC.velocity.X = NPC.velocity.X - relocateSpeed;
NPC.velocity.X -= relocateSpeed;
if (NPC.velocity.X > 0f && finalRandPosX < 0f)
NPC.velocity.X = NPC.velocity.X * 0.8f;
NPC.velocity.X *= acceleration;
}
if (NPC.position.Y < hiveMindY + finalRandPosY)
{
NPC.velocity.Y = NPC.velocity.Y + relocateSpeed;
NPC.velocity.Y += relocateSpeed;
if (NPC.velocity.Y < 0f && finalRandPosY > 0f)
NPC.velocity.Y = NPC.velocity.Y * 0.8f;
NPC.velocity.Y *= acceleration;
}
else if (NPC.position.Y > hiveMindY + finalRandPosY)
{
NPC.velocity.Y = NPC.velocity.Y - relocateSpeed;
NPC.velocity.Y -= relocateSpeed;
if (NPC.velocity.Y > 0f && finalRandPosY < 0f)
NPC.velocity.Y = NPC.velocity.Y * 0.8f;
NPC.velocity.Y *= acceleration;
}
float velocityLimit = relocateSpeed * 16f;
@@ -212,7 +212,7 @@ namespace CalamityMod.NPCs.HiveMind
Color color = NPC.GetAlpha(drawColor);
if (NPC.localAI[1] > 240f)
color = Color.Lerp(color, Color.Green, MathHelper.Clamp((NPC.localAI[1] - 240f) / 120f, 0f, 1f));
color = Color.Lerp(color, Color.Green * NPC.Opacity, MathHelper.Clamp((NPC.localAI[1] - 240f) / 120f, 0f, 1f));
spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
+57 -8
View File
@@ -572,7 +572,7 @@ namespace CalamityMod.NPCs.HiveMind
int fivePercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type);
Main.npc[fivePercentMinions].SetDefaults(type);
if (Main.netMode == NetmodeID.Server && fivePercentMinions < Main.maxNPCs)
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, fivePercentMinions, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, fivePercentMinions);
}
return;
@@ -830,15 +830,15 @@ namespace CalamityMod.NPCs.HiveMind
{
NPC.position.X = NPC.ai[1] * 16 - NPC.width / 2;
NPC.position.Y = NPC.ai[2] * 16 - height_Phase2 / 2;
}
for (int i = 0; i < Main.maxNPCs; i++)
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC hiveBlob = Main.npc[i];
if (hiveBlob.active && (hiveBlob.type == ModContent.NPCType<HiveBlob>() || hiveBlob.type == ModContent.NPCType<HiveBlob2>()))
{
NPC hiveBlob = Main.npc[i];
if (hiveBlob.active && (hiveBlob.type == ModContent.NPCType<HiveBlob>() || hiveBlob.type == ModContent.NPCType<HiveBlob2>()))
{
hiveBlob.position.X = NPC.position.X;
hiveBlob.position.Y = NPC.position.Y;
}
hiveBlob.position.X = NPC.position.X;
hiveBlob.position.Y = NPC.position.Y;
}
}
@@ -879,6 +879,16 @@ namespace CalamityMod.NPCs.HiveMind
NPC.velocity = Vector2.Zero;
dashStarted = false;
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC hiveBlob = Main.npc[i];
if (hiveBlob.active && (hiveBlob.type == ModContent.NPCType<HiveBlob>() || hiveBlob.type == ModContent.NPCType<HiveBlob2>()))
{
hiveBlob.position.X = NPC.position.X;
hiveBlob.position.Y = NPC.position.Y;
}
}
if (revenge && lifeRatio < 0.53f)
{
state = nextState;
@@ -914,6 +924,19 @@ namespace CalamityMod.NPCs.HiveMind
if (Main.netMode != NetmodeID.MultiplayerClient)
NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation);
if (NPC.alpha == 255 - lungeFade)
{
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC hiveBlob = Main.npc[i];
if (hiveBlob.active && (hiveBlob.type == ModContent.NPCType<HiveBlob>() || hiveBlob.type == ModContent.NPCType<HiveBlob2>()))
{
hiveBlob.position.X = NPC.position.X;
hiveBlob.position.Y = NPC.position.Y;
}
}
}
rotation += rotationIncrement * rotationDirection;
phase2timer = lungeDelay;
}
@@ -978,6 +1001,19 @@ namespace CalamityMod.NPCs.HiveMind
NPC.position.Y += teleportRadius;
}
if (NPC.alpha == 255 - (masterMode ? 10 : 5))
{
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC hiveBlob = Main.npc[i];
if (hiveBlob.active && (hiveBlob.type == ModContent.NPCType<HiveBlob>() || hiveBlob.type == ModContent.NPCType<HiveBlob2>()))
{
hiveBlob.position.X = NPC.position.X;
hiveBlob.position.Y = NPC.position.Y;
}
}
}
NPC.netUpdate = true;
NPC.netSpam = 0;
}
@@ -1051,6 +1087,19 @@ namespace CalamityMod.NPCs.HiveMind
NPC.position.X += teleportRadius * rotationDirection;
}
if (NPC.alpha == 255 - (masterMode ? 10 : 5))
{
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC hiveBlob = Main.npc[i];
if (hiveBlob.active && (hiveBlob.type == ModContent.NPCType<HiveBlob>() || hiveBlob.type == ModContent.NPCType<HiveBlob2>()))
{
hiveBlob.position.X = NPC.position.X;
hiveBlob.position.Y = NPC.position.Y;
}
}
}
NPC.netUpdate = true;
NPC.netSpam = 0;
}