1 - Astrum Aureus and Crabulon circular hitboxes.

This commit is contained in:
Andrew Marheine committed 2021-11-09 02:07:45 -06:00
1 parent f26ea60600
commit d4d2cdc56c
8 files changed
+77 -25

No files matched your search

+10 -13
View File
@@ -43,8 +43,8 @@ namespace CalamityMod.NPCs.AstrumAureus
npc.npcSlots = 15f;
npc.GetNPCDamage();
npc.Calamity().canBreakPlayerDefense = true;
npc.width = 400;
npc.height = 280;
npc.width = 426;
npc.height = 374;
npc.defense = 40;
npc.DR_NERD(0.15f);
npc.LifeMaxNERB(NPC.downedMoonlord ? 230000 : 84000, NPC.downedMoonlord ? 292500 : 107000, 740000); // 30 seconds in boss rush
@@ -423,15 +423,12 @@ namespace CalamityMod.NPCs.AstrumAureus
// Can only hit the target if within certain distance
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
/*Vector2 npcCenter = new Vector2(npc.Center.X, npc.Center.Y + 8f);
Vector2 npcCenter = npc.Center;
// NOTE: Right and left hitboxes are interchangeable, each hitbox is the same size and is located to the right or left of the center hitbox.
// Width = 83, Height = 107
Rectangle leftHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 2f)), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2);
// Width = 166, Height = 214
Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 2f)), npc.width / 2, npc.height);
// Width = 83, Height = 107
Rectangle rightHitbox = new Rectangle((int)(npcCenter.X + (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2);
Rectangle leftHitbox = new Rectangle((int)(npcCenter.X - 93f - 5f + 4f), (int)(npcCenter.Y + 33f - 5f), 10, 10);
Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 2f) + 24f), npc.width / 2, npc.height);
Rectangle rightHitbox = new Rectangle((int)(npcCenter.X + 93f - 5f - 4f), (int)(npcCenter.Y + 33f - 5f), 10, 10);
Vector2 leftHitboxCenter = new Vector2(leftHitbox.X + (leftHitbox.Width / 2), leftHitbox.Y + (leftHitbox.Height / 2));
Vector2 bodyHitboxCenter = new Vector2(bodyHitbox.X + (bodyHitbox.Width / 2), bodyHitbox.Y + (bodyHitbox.Height / 2));
@@ -452,7 +449,7 @@ namespace CalamityMod.NPCs.AstrumAureus
if (leftDist4 < minLeftDist)
minLeftDist = leftDist4;
bool insideLeftHitbox = minLeftDist <= 55f;
bool insideLeftHitbox = minLeftDist <= 120f;
float bodyDist1 = Vector2.Distance(bodyHitboxCenter, targetHitbox.TopLeft());
float bodyDist2 = Vector2.Distance(bodyHitboxCenter, targetHitbox.TopRight());
@@ -467,7 +464,7 @@ namespace CalamityMod.NPCs.AstrumAureus
if (bodyDist4 < minBodyDist)
minBodyDist = bodyDist4;
bool insideBodyHitbox = minBodyDist <= 110f;
bool insideBodyHitbox = minBodyDist <= 160f;
float rightDist1 = Vector2.Distance(rightHitboxCenter, targetHitbox.TopLeft());
float rightDist2 = Vector2.Distance(rightHitboxCenter, targetHitbox.TopRight());
@@ -482,9 +479,9 @@ namespace CalamityMod.NPCs.AstrumAureus
if (rightDist4 < minRightDist)
minRightDist = rightDist4;
bool insideRightHitbox = minRightDist <= 55f;*/
bool insideRightHitbox = minRightDist <= 120f;
return /*(insideLeftHitbox || insideBodyHitbox || insideRightHitbox) &&*/ npc.alpha == 0 && npc.ai[0] > 1f;
return (insideLeftHitbox || insideBodyHitbox || insideRightHitbox) && npc.alpha == 0 && npc.ai[0] > 1f;
}
public override void OnHitPlayer(Player player, int damage, bool crit)
-2
View File
@@ -2609,8 +2609,6 @@ namespace CalamityMod.NPCs
#region Astrum Aureus
public static void AstrumAureusAI(NPC npc, Mod mod)
{
npc.gfxOffY = -46;
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
bool postMoonLordBuff = NPC.downedMoonlord && !BossRushEvent.BossRushActive;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 16 KiB

+66 -9
View File
@@ -37,8 +37,8 @@ namespace CalamityMod.NPCs.Crabulon
npc.Calamity().canBreakPlayerDefense = true;
npc.npcSlots = 14f;
npc.GetNPCDamage();
npc.width = 280;
npc.height = 160;
npc.width = 312;
npc.height = 196;
npc.defense = 8;
npc.LifeMaxNERB(3000, 4000, 1100000);
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
@@ -74,8 +74,6 @@ namespace CalamityMod.NPCs.Crabulon
{
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
npc.gfxOffY = -16;
Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.3f, 0.7f);
bool enraged = calamityGlobalNPC.enraged > 0;
@@ -611,12 +609,71 @@ namespace CalamityMod.NPCs.Crabulon
}
}
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
return npc.ai[0] > 1f;
}
// Can only hit the target if within certain distance
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
Vector2 npcCenter = npc.Center;
public override void FindFrame(int frameHeight)
// NOTE: Right and left hitboxes are interchangeable, each hitbox is the same size and is located to the right or left of the center hitbox.
Rectangle leftHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 2f) + 6f), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2);
Rectangle bodyHitbox = new Rectangle((int)(npcCenter.X - (npc.width / 4f)), (int)(npcCenter.Y - (npc.height / 2f)), npc.width / 2, npc.height);
Rectangle rightHitbox = new Rectangle((int)(npcCenter.X + (npc.width / 4f) - 6f), (int)(npcCenter.Y - (npc.height / 4f)), npc.width / 4, npc.height / 2);
Vector2 leftHitboxCenter = new Vector2(leftHitbox.X + (leftHitbox.Width / 2), leftHitbox.Y + (leftHitbox.Height / 2));
Vector2 bodyHitboxCenter = new Vector2(bodyHitbox.X + (bodyHitbox.Width / 2), bodyHitbox.Y + (bodyHitbox.Height / 2));
Vector2 rightHitboxCenter = new Vector2(rightHitbox.X + (rightHitbox.Width / 2), rightHitbox.Y + (rightHitbox.Height / 2));
Rectangle targetHitbox = target.Hitbox;
float leftDist1 = Vector2.Distance(leftHitboxCenter, targetHitbox.TopLeft());
float leftDist2 = Vector2.Distance(leftHitboxCenter, targetHitbox.TopRight());
float leftDist3 = Vector2.Distance(leftHitboxCenter, targetHitbox.BottomLeft());
float leftDist4 = Vector2.Distance(leftHitboxCenter, targetHitbox.BottomRight());
float minLeftDist = leftDist1;
if (leftDist2 < minLeftDist)
minLeftDist = leftDist2;
if (leftDist3 < minLeftDist)
minLeftDist = leftDist3;
if (leftDist4 < minLeftDist)
minLeftDist = leftDist4;
bool insideLeftHitbox = minLeftDist <= 45f;
float bodyDist1 = Vector2.Distance(bodyHitboxCenter, targetHitbox.TopLeft());
float bodyDist2 = Vector2.Distance(bodyHitboxCenter, targetHitbox.TopRight());
float bodyDist3 = Vector2.Distance(bodyHitboxCenter, targetHitbox.BottomLeft());
float bodyDist4 = Vector2.Distance(bodyHitboxCenter, targetHitbox.BottomRight());
float minBodyDist = bodyDist1;
if (bodyDist2 < minBodyDist)
minBodyDist = bodyDist2;
if (bodyDist3 < minBodyDist)
minBodyDist = bodyDist3;
if (bodyDist4 < minBodyDist)
minBodyDist = bodyDist4;
bool insideBodyHitbox = minBodyDist <= 90f;
float rightDist1 = Vector2.Distance(rightHitboxCenter, targetHitbox.TopLeft());
float rightDist2 = Vector2.Distance(rightHitboxCenter, targetHitbox.TopRight());
float rightDist3 = Vector2.Distance(rightHitboxCenter, targetHitbox.BottomLeft());
float rightDist4 = Vector2.Distance(rightHitboxCenter, targetHitbox.BottomRight());
float minRightDist = rightDist1;
if (rightDist2 < minRightDist)
minRightDist = rightDist2;
if (rightDist3 < minRightDist)
minRightDist = rightDist3;
if (rightDist4 < minRightDist)
minRightDist = rightDist4;
bool insideRightHitbox = minRightDist <= 45f;
return (insideLeftHitbox || insideBodyHitbox || insideRightHitbox) && npc.ai[0] > 1f;
}
public override void FindFrame(int frameHeight)
{
npc.frameCounter += 0.15f;
npc.frameCounter %= Main.npcFrameCount[npc.type];
Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 16 KiB

+1 -1
View File
@@ -691,7 +691,7 @@ namespace CalamityMod.NPCs.Ravager
// Can only hit the target if within certain distance
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
Vector2 npcCenter = new Vector2(npc.Center.X, npc.Center.Y);
Vector2 npcCenter = npc.Center;
// NOTE: Right and left hitboxes are interchangeable, each hitbox is the same size and is located to the right or left of the center hitbox.
// Width = 83, Height = 107