1 - Harpies, Salamanders, Giant Cursed Skulls, Fungi Bulbs, Giant Fungi Bulbs, Icy Mermen, Angry Nimbuses, Sand Elementals and Small Stardust Cells no longer deal contact damage.

2 - Added Math.Round to avoid rounding errors for the remainder of npc.damage and npc.defense multiplicative adjustments.
3 - Decreased Tortoise spin dash damage multiplier from 1.8 to 1.4.
4 - Fungi Bulbs now fire Fungi Spores because otherwise they'd have no way to threaten the player.
5 - Contact damage fairness for Flocko, Mimics, Big Mimics, Deadly Spheres, Nebula Headcrabs, Martian Drones, Corites, Armed Zombies, Crawdads, Granite Elementals, Granite Golems, Squids, Jellyfish, Herplings and Derplings.
6 - Big Mimics spend less time in their closed state.
7 - Decreased Giant Shelly spin dash damage multiplier from 1.35 to 1.2.
8 - Decreased Sroller spin dash damage multiplier from 1.4 to 1.2.
9 - Fixed some teleport problems with Rev+ Chaos Elementals, Renegade Warlocks and Caster AIs.
10 - Fungi Bulbs, Giant Fungi Bulbs and Clingers no longer shoot while the player is a ghost.
11 - Added some code for Corites that vanilla added at some point.
This commit is contained in:
mountaindrew10 committed 2024-03-07 04:34:12 -06:00
1 parent e233239b42
commit 760e4cca78
28 files changed
+290 -173

No files matched your search

+2 -3
View File
@@ -747,9 +747,8 @@ namespace CalamityMod.CalPlayer
if (transformer)
{
if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish ||
npc.type == NPCID.FungoFish || npc.type == NPCID.BloodJelly || npc.type == NPCID.AngryNimbus || npc.type == NPCID.GigaZapper ||
npc.type == NPCID.MartianTurret || npc.type == ModContent.NPCType<Stormlion>() || npc.type == ModContent.NPCType<GhostBell>() || npc.type == ModContent.NPCType<BoxJellyfish>())
if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || npc.type == NPCID.FungoFish ||
npc.type == NPCID.BloodJelly || npc.type == ModContent.NPCType<Stormlion>() || npc.type == ModContent.NPCType<GhostBell>() || npc.type == ModContent.NPCType<BoxJellyfish>())
contactDamageReduction += 0.5;
}
+17 -15
View File
@@ -2297,6 +2297,22 @@ namespace CalamityMod
ZeroContactDamageNPCList = new List<int>
{
NPCID.Harpy,
NPCID.Salamander,
NPCID.Salamander2,
NPCID.Salamander3,
NPCID.Salamander4,
NPCID.Salamander5,
NPCID.Salamander6,
NPCID.Salamander7,
NPCID.Salamander8,
NPCID.Salamander9,
NPCID.GiantCursedSkull,
NPCID.FungiBulb,
NPCID.GiantFungiBulb,
NPCID.IcyMerman,
NPCID.AngryNimbus,
NPCID.SandElemental,
NPCID.DarkCaster,
NPCID.FireImp,
NPCID.Tim,
@@ -2338,6 +2354,7 @@ namespace CalamityMod
NPCID.ElfArcher,
NPCID.NebulaBrain,
NPCID.NebulaSoldier,
NPCID.StardustCellSmall,
NPCID.StardustJellyfishBig,
NPCID.StardustSoldier,
NPCID.StardustSpiderBig,
@@ -2431,27 +2448,20 @@ namespace CalamityMod
NPCID.Derpling,
NPCID.Herpling,
NPCID.DiggerHead,
NPCID.DiggerBody,
NPCID.DiggerTail,
NPCID.DesertGhoul,
NPCID.DesertGhoulCorruption,
NPCID.DesertGhoulCrimson,
NPCID.DesertGhoulHallow,
NPCID.DuneSplicerHead,
NPCID.DuneSplicerBody,
NPCID.DuneSplicerTail,
NPCID.EnchantedSword,
NPCID.FloatyGross,
NPCID.GiantBat,
NPCID.GiantFlyingFox,
NPCID.GiantFungiBulb,
NPCID.FungiSpore,
NPCID.GiantTortoise,
NPCID.IceTortoise,
NPCID.HoppinJack,
NPCID.Mimic,
NPCID.IchorSticker,
NPCID.IcyMerman,
NPCID.IlluminantBat,
NPCID.IlluminantSlime,
NPCID.JungleCreeper,
@@ -2480,12 +2490,8 @@ namespace CalamityMod
NPCID.Werewolf,
NPCID.Wolf,
NPCID.SeekerHead,
NPCID.SeekerBody,
NPCID.SeekerTail,
NPCID.Wraith,
NPCID.ChatteringTeethBomb,
NPCID.Clown,
NPCID.AngryNimbus,
NPCID.IceGolem,
NPCID.RainbowSlime,
NPCID.SandShark,
@@ -2506,8 +2512,6 @@ namespace CalamityMod
NPCID.HellArmoredBonesSpikeShield,
NPCID.HellArmoredBonesSword,
NPCID.MisterStabby,
NPCID.SnowBalla,
NPCID.SnowmanGangsta,
NPCID.Butcher,
NPCID.CreatureFromTheDeep,
NPCID.DeadlySphere,
@@ -2544,8 +2548,6 @@ namespace CalamityMod
NPCID.ZombieElfBeard,
NPCID.ZombieElfGirl,
NPCID.BloodEelHead,
NPCID.BloodEelBody,
NPCID.BloodEelTail,
NPCID.GoblinShark,
NPCID.EyeballFlyingFish,
NPCID.ZombieMerman
+1 -1
View File
@@ -219,7 +219,7 @@ namespace CalamityMod.NPCs.Abyss
if (canAttack)
{
// Set damage
NPC.damage = phase3 ? (int)(NPC.defDamage * 0.5) : NPC.defDamage;
NPC.damage = phase3 ? (int)Math.Round(NPC.defDamage * 0.5) : NPC.defDamage;
if (NPC.ai[3] > 0f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
{
+1 -1
View File
@@ -345,7 +345,7 @@ namespace CalamityMod.NPCs.AstrumAureus
NPC.position.X = NPC.position.X + NPC.width / 2;
NPC.position.Y = NPC.position.Y + NPC.height / 2;
NPC.damage = (int)(NPC.defDamage * NPC.scale);
NPC.damage = (int)Math.Round(NPC.defDamage * (double)NPC.scale);
NPC.width = NPC.height = (int)(216 * NPC.scale);
NPC.position.X = NPC.position.X - NPC.width / 2;
NPC.position.Y = NPC.position.Y - NPC.height / 2;
@@ -606,12 +606,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
{
if (npc.velocity.Length() <= minimalContactDamageVelocity)
{
npc.damage = (int)(npc.defDamage * 0.5f);
npc.damage = (int)Math.Round(npc.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar);
}
}
else
@@ -923,12 +923,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
{
if (npc.velocity.Length() <= minimalContactDamageVelocity)
{
npc.damage = (int)(npc.defDamage * 0.5f);
npc.damage = (int)Math.Round(npc.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar);
}
}
else
+77 -3
View File
@@ -4388,6 +4388,9 @@ namespace CalamityMod.NPCs
}
}
if (npc.type == NPCID.FungiBulb)
return RevengeanceAndDeathAI.BuffedPlantAI(npc, Mod);
if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore)
return RevengeanceAndDeathAI.BuffedSporeAI(npc, Mod);
@@ -4750,6 +4753,77 @@ namespace CalamityMod.NPCs
// Fair contact damage
switch (npc.type)
{
case NPCID.Flocko:
npc.damage = npc.ai[0] > 0f ? npc.defDamage : 0;
break;
case NPCID.Mimic:
case NPCID.IceMimic:
case NPCID.PresentMimic:
npc.damage = (npc.ai[0] == 0f || npc.velocity.Y == 0f) ? 0 : npc.defDamage;
break;
case NPCID.BigMimicCorruption:
case NPCID.BigMimicCrimson:
case NPCID.BigMimicHallow:
case NPCID.BigMimicJungle:
npc.damage = npc.ai[0] == 3f ? 0 : npc.defDamage;
// Spend less time in closed state
if (npc.ai[0] == 3f)
npc.ai[1] += 0.5f;
break;
case NPCID.DeadlySphere:
npc.damage = npc.ai[0] == 1f ? npc.defDamage : 0;
break;
case NPCID.NebulaHeadcrab:
npc.damage = npc.ai[0] == 5f ? npc.defDamage : 0;
break;
case NPCID.MartianDrone:
case NPCID.SolarCorite:
npc.damage = (npc.ai[0] == 2f || npc.ai[0] == 3f) ? npc.defDamage : 0;
break;
case NPCID.ArmedTorchZombie:
case NPCID.ArmedZombie:
case NPCID.ArmedZombieCenx:
case NPCID.ArmedZombieEskimo:
case NPCID.ArmedZombiePincussion:
case NPCID.ArmedZombieSlimed:
case NPCID.ArmedZombieSwamp:
case NPCID.ArmedZombieTwiggy:
case NPCID.Crawdad:
case NPCID.Crawdad2:
npc.damage = npc.ai[2] == 0f ? 0 : (int)Math.Round(npc.defDamage * 1.4);
break;
case NPCID.GraniteFlyer:
npc.damage = npc.ai[0] == -1f ? 0 : npc.defDamage;
break;
case NPCID.GraniteGolem:
npc.damage = npc.ai[2] < 0f ? 0 : npc.defDamage;
break;
case NPCID.Squid:
case NPCID.BlueJellyfish:
case NPCID.GreenJellyfish:
case NPCID.PinkJellyfish:
case NPCID.BloodJelly:
case NPCID.FungoFish:
float damagingVelocity = npc.type == NPCID.GreenJellyfish ? 3.6f : 2.8f;
npc.damage = (npc.dontTakeDamage || npc.velocity.Length() > damagingVelocity) ? npc.defDamage : 0;
break;
case NPCID.Herpling:
case NPCID.Derpling:
npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage;
break;
case NPCID.BlueSlime:
case NPCID.MotherSlime:
case NPCID.LavaSlime:
@@ -4786,16 +4860,16 @@ namespace CalamityMod.NPCs
case NPCID.GiantShelly:
case NPCID.GiantShelly2:
npc.damage = npc.ai[0] == 3f ? (int)(npc.defDamage * 1.35) : 0;
npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.2) : 0;
break;
case NPCID.GiantTortoise:
case NPCID.IceTortoise:
npc.damage = npc.ai[0] == 3f ? (int)(npc.defDamage * 1.8) : 0;
npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.4) : 0;
break;
case NPCID.SolarSroller:
npc.damage = npc.ai[0] == 6f ? (int)(npc.defDamage * 1.4) : 0;
npc.damage = npc.ai[0] == 6f ? (int)Math.Round(npc.defDamage * 1.2) : 0;
break;
default:
+1 -1
View File
@@ -296,7 +296,7 @@ namespace CalamityMod.NPCs
chargeDirection = ref npc.ai[2];
flySpeedAdditive = ref npc.ai[3];
npc.damage = (int)(npc.defDamage * 1.2);
npc.damage = (int)Math.Round(npc.defDamage * 1.2);
npc.collideX = false;
npc.collideY = false;
npc.noTileCollide = true;
+2 -2
View File
@@ -365,12 +365,12 @@ namespace CalamityMod.NPCs.DesertScourge
float minimalDamageVelocity = maxChaseSpeed * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2;
+2 -2
View File
@@ -619,12 +619,12 @@ namespace CalamityMod.NPCs.DesertScourge
float minimalDamageVelocity = maxChaseSpeed * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2;
+2 -2
View File
@@ -335,12 +335,12 @@ namespace CalamityMod.NPCs.DevourerofGods
float minimalDamageVelocity = segmentVelocity * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
+2 -2
View File
@@ -2338,12 +2338,12 @@ namespace CalamityMod.NPCs.DevourerofGods
float minimalDamageVelocity = segmentVelocity * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
if (NPC.life > Main.npc[(int)NPC.ai[0]].life)
+2 -2
View File
@@ -1016,12 +1016,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
float minimalDamageVelocity = baseVelocity * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
}
+2 -2
View File
@@ -400,12 +400,12 @@ namespace CalamityMod.NPCs.NormalNPCs
float minimalDamageVelocity = maxChaseSpeed * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f;
+2 -2
View File
@@ -499,12 +499,12 @@ namespace CalamityMod.NPCs.Perforator
float minimalDamageVelocity = maxChargeSpeed * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2;
+2 -2
View File
@@ -420,12 +420,12 @@ namespace CalamityMod.NPCs.Perforator
float minimalDamageVelocity = maxChargeSpeed * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
+2 -2
View File
@@ -457,12 +457,12 @@ namespace CalamityMod.NPCs.Perforator
float minimalDamageVelocity = maxChargeSpeed * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2;
+3 -2
View File
@@ -1,4 +1,5 @@
using CalamityMod.Buffs.DamageOverTime;
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
@@ -56,7 +57,7 @@ namespace CalamityMod.NPCs.PlagueEnemies
public override void AI()
{
NPC.damage = NPC.ai[0] == 3f ? (int)(NPC.defDamage * 1.8) : 0;
NPC.damage = NPC.ai[0] == 3f ? (int)Math.Round(NPC.defDamage * 1.4) : 0;
}
public override void HitEffect(NPC.HitInfo hit)
+2 -2
View File
@@ -815,7 +815,7 @@ namespace CalamityMod.NPCs.Polterghast
if (!isInChargePhase)
NPC.damage = phase2ReducedSetDamage;
NPC.defense = (int)(NPC.defDefense * 0.8f);
NPC.defense = (int)Math.Round(NPC.defDefense * 0.8);
if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase)
{
@@ -971,7 +971,7 @@ namespace CalamityMod.NPCs.Polterghast
if (!isInChargePhase)
NPC.damage = phase3ReducedSetDamage;
NPC.defense = (int)(NPC.defDefense * 0.5f);
NPC.defense = (int)Math.Round(NPC.defDefense * 0.5);
NPC.localAI[1] += 1f;
if (NPC.localAI[1] >= (getPissed ? 200f : 280f) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
+3 -2
View File
@@ -2,6 +2,7 @@
using CalamityMod.Events;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -96,7 +97,7 @@ namespace CalamityMod.NPCs.Ravager
// Set damage
if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive)
NPC.damage = (int)(NPC.defDamage * 1.5);
NPC.damage = (int)Math.Round(NPC.defDamage * 1.5);
else
NPC.damage = NPC.defDamage;
@@ -112,7 +113,7 @@ namespace CalamityMod.NPCs.Ravager
{
// Set damage
if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive)
NPC.damage = (int)(NPC.defDamage * 1.5);
NPC.damage = (int)Math.Round(NPC.defDamage * 1.5);
else
NPC.damage = NPC.defDamage;
+2 -2
View File
@@ -771,12 +771,12 @@ namespace CalamityMod.NPCs.StormWeaver
float minimalDamageVelocity = velocity * 0.5f;
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
{
NPC.damage = (int)(NPC.defDamage * 0.5f);
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
}
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
+6 -5
View File
@@ -6,6 +6,7 @@ using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.GameContent;
using Terraria.GameContent.Bestiary;
@@ -85,26 +86,26 @@ namespace CalamityMod.NPCs.SunkenSea
}
else if (CalamityWorld.revenge)
{
NPC.damage = (int)(NPC.defDamage * 2.75);
NPC.damage = (int)Math.Round(NPC.defDamage * 2.75);
}
else if (Main.expertMode)
{
NPC.damage = (int)(NPC.defDamage * 2.5);
NPC.damage = (int)Math.Round(NPC.defDamage * 2.5);
}
else
{
NPC.damage = (int)(NPC.defDamage * 1.25);
NPC.damage = (int)Math.Round(NPC.defDamage * 1.25);
}
}
else
{
if (CalamityWorld.death)
{
NPC.damage = (int)(NPC.defDamage * 2.5);
NPC.damage = (int)Math.Round(NPC.defDamage * 2.5);
}
else if (CalamityWorld.revenge)
{
NPC.damage = (int)(NPC.defDamage * 2.25);
NPC.damage = (int)Math.Round(NPC.defDamage * 2.25);
}
else if (Main.expertMode)
{
@@ -1249,7 +1249,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
bool flag3 = false;
bool flag4 = false;
if (phase2)
npc.defense = (int)((float)npc.defDefense * 0.65f);
npc.defense = (int)Math.Round(npc.defDefense * 0.65);
if (!flag2)
{
@@ -781,12 +781,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
if (npc.velocity.Length() <= minimalContactDamageVelocity)
{
npc.damage = (int)(npc.defDamage * 0.5f);
npc.damage = (int)Math.Round(npc.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar);
}
}
else
@@ -1310,12 +1310,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
if (npc.velocity.Length() <= minimalContactDamageVelocity)
{
npc.damage = (int)(npc.defDamage * 0.5f);
npc.damage = (int)Math.Round(npc.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar);
}
}
else
@@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
else if (phase2AI)
{
setDamage = (int)Math.Round(setDamage * 1.44);
npc.defense = (int)(npc.defDefense * 0.8f);
npc.defense = (int)Math.Round(npc.defDefense * 0.8);
}
else
npc.defense = npc.defDefense;
@@ -1253,7 +1253,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
else if (flag3)
{
setDamage = (int)Math.Round(setDamage * 1.2 * damageScale);
npc.defense = (int)((float)npc.defDefense * 0.8f);
npc.defense = (int)Math.Round(npc.defDefense * 0.8);
}
else
npc.defense = npc.defDefense;
@@ -639,12 +639,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
if (npc.velocity.Length() <= minimalContactDamageVelocity)
{
npc.damage = (int)(npc.defDamage * 0.5f);
npc.damage = (int)Math.Round(npc.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar);
}
}
else
@@ -1145,12 +1145,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
{
if (npc.velocity.Length() <= minimalContactDamageVelocity)
{
npc.damage = (int)(npc.defDamage * 0.5f);
npc.damage = (int)Math.Round(npc.defDamage * 0.5);
}
else
{
float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
npc.damage = (int)MathHelper.Lerp(npc.defDamage * 0.5f, npc.defDamage, velocityDamageScalar);
npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar);
}
}
else
@@ -1261,9 +1261,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.dontTakeDamage = !takeDamage;
if (phase3)
npc.defense = (int)(npc.defDefense * 0.8f);
npc.defense = (int)Math.Round(npc.defDefense * 0.8);
else if (phase2)
npc.defense = (int)(npc.defDefense * 1.2f);
npc.defense = (int)Math.Round(npc.defDefense * 1.2);
else
npc.defense = npc.defDefense;
@@ -2313,9 +2313,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
npc.dontTakeDamage = !takeDamage;
if (phase3)
npc.defense = (int)(npc.defDefense * 0.8f);
npc.defense = (int)Math.Round(npc.defDefense * 0.8);
else if (phase2)
npc.defense = (int)((float)npc.defDefense * 1.2f);
npc.defense = (int)Math.Round(npc.defDefense * 1.2);
else
npc.defense = npc.defDefense;
@@ -403,9 +403,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
{
int activeTime = 300;
int defendTime = 120;
// Set damage
npc.damage = npc.defDamage;
npc.defense = npc.defDefense;
if (npc.ai[2] < 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.defense = npc.defDefense + 15;
npc.ai[2] += 1f;
npc.velocity.X *= 0.9f;
@@ -548,7 +556,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies
if (npc.ai[3] < 0f)
{
npc.knockBackResist = 0f;
npc.defense = (int)(npc.defDefense * 1.3);
npc.defense = (int)Math.Round(npc.defDefense * 1.3);
npc.noGravity = true;
npc.noTileCollide = true;
npc.direction = (npc.velocity.X > 0).ToDirectionInt();
@@ -1819,7 +1827,9 @@ PrepareToShoot:
{
if (npc.ai[2] == 0f)
{
npc.damage = npc.defDamage;
// Avoid cheap bullshit
npc.damage = 0;
float maxVelocity = CalamityWorld.death ? 2.5f : 1.5f;
maxVelocity *= 1f + (1f - npc.scale);
FighterRunningAI(npc, maxVelocity, 0.09f, 0.8f, true, 0.8f);
@@ -1840,7 +1850,9 @@ PrepareToShoot:
}
else
{
npc.damage = npc.defDamage * 2;
// Set damage
npc.damage = (int)Math.Round(npc.defDamage * 1.4);
npc.ai[3] = 1f;
npc.velocity.X *= 0.9f;
if (Math.Abs(npc.velocity.X) < 0.1f)
@@ -3452,46 +3464,15 @@ PrepareToShoot:
// Teleport (Chaos elementals)
if (Main.netMode != NetmodeID.MultiplayerClient && (npcType == NPCID.ChaosElemental || npcType == ModContent.NPCType<RenegadeWarlock>()) && npc.ai[3] >= (float)aiGateValue)
{
int tileCoordsX = (int)Main.player[npc.target].position.X / 16;
int tileCoordsY = (int)Main.player[npc.target].position.Y / 16;
int tileCoordsX2 = (int)npc.position.X / 16;
int tileCoordsY2 = (int)npc.position.Y / 16;
int maxDistanceX = 20;
int tryCount = 0;
bool tooFarFromPlayer = false;
if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) + Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f)
int targetTileX = (int)Main.player[npc.target].Center.X / 16;
int targetTileY = (int)Main.player[npc.target].Center.Y / 16;
Vector2 chosenTile = Vector2.Zero;
if (npc.AI_AttemptToFindTeleportSpot(ref chosenTile, targetTileX, targetTileY, 20, 9))
{
tryCount = 100;
tooFarFromPlayer = true;
}
while (!tooFarFromPlayer && tryCount < 100)
{
tryCount++;
int randX = Main.rand.Next(tileCoordsX - maxDistanceX, tileCoordsX + maxDistanceX);
for (int t = Main.rand.Next(tileCoordsY - maxDistanceX, tileCoordsY + maxDistanceX); t < tileCoordsY + maxDistanceX; t++)
{
if ((t < tileCoordsY - 4 || t > tileCoordsY + 4 || randX < tileCoordsX - 4 || randX > tileCoordsX + 4) && (t < tileCoordsY2 - 1 || t > tileCoordsY2 + 1 || randX < tileCoordsX2 - 1 || randX > tileCoordsX2 + 1) && Main.tile[randX, t].HasUnactuatedTile)
{
bool foundGoodTeleport = true;
// I don't understand why the hell this exists if it's only for Chaos Elementals, but I suppose I'll
// Leave it here
if (npcType == NPCID.DarkCaster && Main.tile[randX, t - 1].WallType == WallID.None)
{
foundGoodTeleport = false;
}
else if (Main.tile[randX, t - 1].LiquidType == LiquidID.Lava)
{
foundGoodTeleport = false;
}
if (foundGoodTeleport && Main.tileSolid[(int)Main.tile[randX, t].TileType] && !Collision.SolidTiles(randX - 1, randX + 1, t - 4, t - 1))
{
npc.position.X = (float)(randX * 16 - npc.width / 2);
npc.position.Y = (float)(t * 16 - npc.height);
npc.netUpdate = true;
npc.ai[3] = -30f;
}
}
}
npc.position.X = chosenTile.X * 16f - (float)(npc.width / 2);
npc.position.Y = chosenTile.Y * 16f - (float)npc.height;
npc.ai[3] = -30f;
npc.netUpdate = true;
}
}
return false;
@@ -4178,7 +4159,7 @@ PrepareToShoot:
}
else
{
npc.defense = (int)(npc.defDefense * 1.3);
npc.defense = (int)Math.Round(npc.defDefense * 1.3);
if (npc.ai[3] > 0f)
npc.realLife = (int)npc.ai[3];
@@ -5304,46 +5285,12 @@ PrepareToShoot:
npc.ai[0] = 2f;
int targetTileX = (int)Main.player[npc.target].position.X / 16;
int targetTileY = (int)Main.player[npc.target].position.Y / 16;
int npcTileX = (int)npc.position.X / 16;
int npcTileY = (int)npc.position.Y / 16;
int randTeleportOffset = 20;
int teleportTries = 0;
bool canTeleport = false;
if (Math.Abs(npc.position.X - Main.player[npc.target].position.X) + Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f)
Vector2 chosenTile = Vector2.Zero;
if (npc.AI_AttemptToFindTeleportSpot(ref chosenTile, targetTileX, targetTileY))
{
teleportTries = 100;
canTeleport = true;
}
while (!canTeleport && teleportTries < 100)
{
teleportTries++;
int teleportTileX = Main.rand.Next(targetTileX - randTeleportOffset, targetTileX + randTeleportOffset);
int teleportTileY = Main.rand.Next(targetTileY - randTeleportOffset, targetTileY + randTeleportOffset);
int dustIncrement;
for (int k = teleportTileY; k < targetTileY + randTeleportOffset; k = dustIncrement + 1)
{
if ((k < targetTileY - 4 || k > targetTileY + 4 || teleportTileX < targetTileX - 4 || teleportTileX > targetTileX + 4) && (k < npcTileY - 1 || k > npcTileY + 1 || teleportTileX < npcTileX - 1 || teleportTileX > npcTileX + 1) && Main.tile[teleportTileX, k].HasUnactuatedTile)
{
bool validTeleportSpot = true;
if ((npc.type == NPCID.DarkCaster || (npc.type >= NPCID.RaggedCaster && npc.type <= NPCID.DiabolistWhite)) && !Main.wallDungeon[(int)Main.tile[teleportTileX, k - 1].WallType])
{
validTeleportSpot = false;
}
else if (Main.tile[teleportTileX, k - 1].LiquidType == LiquidID.Lava)
{
validTeleportSpot = false;
}
if (validTeleportSpot && Main.tileSolid[(int)Main.tile[teleportTileX, k].TileType] && !Collision.SolidTiles(teleportTileX - 1, teleportTileX + 1, k - 4, k - 1))
{
npc.ai[1] = 20f;
npc.ai[2] = (float)teleportTileX;
npc.ai[3] = (float)k;
canTeleport = true;
break;
}
}
dustIncrement = k;
}
npc.ai[1] = 20f;
npc.ai[2] = chosenTile.X;
npc.ai[3] = chosenTile.Y;
}
npc.netUpdate = true;
}
@@ -5618,7 +5565,7 @@ PrepareToShoot:
minDistance = 225f;
break;
case NPCID.FungiBulb:
minDistance = 200f;
minDistance = !CalamityWorld.revenge ? 100f : 200f;
break;
case NPCID.AngryTrapper:
acceleration = 0.05f;
@@ -5733,7 +5680,7 @@ PrepareToShoot:
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (npc.type == NPCID.Clinger && !Main.player[npc.target].dead)
if (npc.type == NPCID.Clinger && !Main.player[npc.target].DeadOrGhost)
{
if (npc.justHit)
npc.localAI[0] = 0f;
@@ -5757,17 +5704,19 @@ PrepareToShoot:
}
}
}
if (npc.type == NPCID.GiantFungiBulb && !Main.player[npc.target].dead)
if ((npc.type == NPCID.GiantFungiBulb || npc.type == NPCID.FungiBulb) && !Main.player[npc.target].DeadOrGhost)
{
if (npc.justHit)
npc.localAI[0] = 0f;
npc.localAI[0] += 1f;
if (npc.localAI[0] >= 120f)
float sporeSpawnGateValue = npc.type == NPCID.GiantFungiBulb ? 120f : 240f;
if (npc.localAI[0] >= sporeSpawnGateValue)
{
if (!Collision.SolidCollision(npc.position, npc.width, npc.height))
{
float speed = 16f;
float speed = npc.type == NPCID.GiantFungiBulb ? 16f : 8f;
distanceVector.X = Main.player[npc.target].Center.X - npc.Center.X;
float absoluteYDistance = Math.Abs(distanceVector.X * 0.1f);
if (Main.player[npc.target].Center.Y - npc.Center.Y > 0f)
@@ -5777,7 +5726,7 @@ PrepareToShoot:
Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance, -Vector2.UnitY) * speed;
int idx = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore, 0, 0f, 0f, 0f, 0f, 255);
int idx = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore);
Main.npc[idx].velocity = velocity;
Main.npc[idx].netUpdate = true;
npc.localAI[0] = 0f;
@@ -6332,6 +6281,10 @@ PrepareToShoot:
#region Jellyfish AI
public static bool BuffedJellyfishAI(NPC npc, Mod mod)
{
// Avoid cheap bullshit
float damagingVelocity = npc.type == NPCID.GreenJellyfish ? 7.2f : 5.6f;
npc.damage = (npc.dontTakeDamage || npc.velocity.Length() > damagingVelocity) ? npc.defDamage : 0;
// Stop moving because we're emitting electricity and don't take damage
bool endEarly = false;
if (npc.wet && npc.ai[1] == 1f)
@@ -7500,6 +7453,9 @@ PrepareToShoot:
// Sitting around, waiting for a potential player
if (npc.ai[0] == 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
if (!isLostHoppingPresent)
{
npc.TargetClosest(true);
@@ -7525,6 +7481,9 @@ PrepareToShoot:
}
else if (npc.velocity.Y == 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.ai[2] += 1f;
int timeSpentStopping = 20;
@@ -7569,6 +7528,9 @@ PrepareToShoot:
}
else
{
// Set damage
npc.damage = npc.defDamage;
if (npc.direction == 1 && npc.velocity.X < 1f)
{
npc.velocity.X += 0.1f;
@@ -8364,11 +8326,11 @@ PrepareToShoot:
if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2)
{
npc.damage = (int)(npc.defDamage * 1.35);
npc.damage = (int)Math.Round(npc.defDamage * 1.2);
}
else
{
npc.damage = (int)(npc.defDamage * 1.8);
npc.damage = (int)Math.Round(npc.defDamage * 1.4);
}
npc.defense = npc.defDefense * 2;
@@ -8489,7 +8451,7 @@ PrepareToShoot:
{
if (npc.ai[0] == 6f)
{
npc.damage = (int)(npc.defDamage * 1.4);
npc.damage = (int)Math.Round(npc.defDamage * 1.2);
npc.defense = npc.defDefense * 2;
npc.knockBackResist = 0f;
@@ -8945,6 +8907,9 @@ PrepareToShoot:
}
}
// Avoid cheap bullshit
npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage;
if (npc.velocity.Y == 0f)
{
if (npc.ai[3] == npc.position.X)
@@ -9716,6 +9681,9 @@ PrepareToShoot:
// Move upward.
if (npc.ai[0] == 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.knockBackResist = npcKBResist;
Vector2 playerDistanceNorm = Main.player[npc.target].Center - npc.Center;
Vector2 upwardVelocity = playerDistanceNorm - Vector2.UnitY * idealUpwardDelta;
@@ -9766,18 +9734,36 @@ PrepareToShoot:
// Slow down and prepare for charge.
else if (npc.ai[0] == 1f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.knockBackResist = 0f;
npc.velocity *= chargeWaitSlowdownMult;
bool decelerate = true;
if (npc.type == NPCID.SolarCorite)
{
decelerate = npc.velocity.Length() > 2f;
if (!decelerate && npc.target >= 0 && !Main.player[npc.target].DeadOrGhost)
{
Vector2 maxVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.Zero) * 0.1f;
npc.velocity = Vector2.Lerp(npc.velocity, maxVelocity, 0.25f);
}
}
if (decelerate)
npc.velocity *= chargeWaitSlowdownMult;
npc.ai[1] += 1f;
// If enough time has passed, charge.
if (npc.ai[1] >= chargePhaseWait)
{
// Set damage
npc.damage = npc.defDamage;
npc.ai[0] = 2f;
npc.ai[1] = 0f;
npc.netUpdate = true;
Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) +
new Vector2(Main.rand.Next(-chargeRandomness, chargeRandomness + 1), Main.rand.Next(-chargeRandomness, chargeRandomness + 1)) * 0.04f;
Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]) + new Vector2(Main.rand.Next(-chargeRandomness, chargeRandomness + 1), Main.rand.Next(-chargeRandomness, chargeRandomness + 1)) * 0.04f;
velocity.Normalize();
velocity *= chargeSpeed;
npc.velocity = velocity;
@@ -9795,6 +9781,9 @@ PrepareToShoot:
}
else if (npc.ai[0] == 2f)
{
// Set damage
npc.damage = npc.defDamage;
npc.knockBackResist = 0f;
npc.ai[1] += 1f;
@@ -9802,6 +9791,9 @@ PrepareToShoot:
// If time is up and the player is (relatively) far, or the velocity is (relatively) low, reset.
if ((npc.ai[1] >= maximumChargeTime & aboveAndFar) || npc.velocity.Length() < minimumChargeSpeed)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
@@ -9838,6 +9830,9 @@ PrepareToShoot:
}
else if (npc.ai[0] == 4f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.ai[1] -= 3f;
if (npc.ai[1] <= 0f)
{
@@ -9858,17 +9853,18 @@ PrepareToShoot:
npc.netUpdate = true;
}
// Dust
// Explode
if (npc.ai[0] == 3f)
{
// Set damage
npc.damage = npc.defDamage;
npc.position = npc.Center;
npc.width = npc.height = CalamityWorld.death ? 360 : 240;
npc.position -= npc.Size;
npc.velocity = Vector2.Zero;
npc.damage = 160;
npc.alpha = 255;
Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0.2f, 0.7f, 1.1f);
@@ -10045,7 +10041,7 @@ PrepareToShoot:
if ((int)npc.ai[1] == NPCID.Mothron)
{
npc.defense = (int)(npc.defDefense * 1.5);
npc.defense = (int)Math.Round(npc.defDefense * 1.5);
npc.scale *= 2f;
npc.width = npc.height = (int)(34f * npc.scale);
npc.netUpdate = true;
@@ -10099,7 +10095,12 @@ PrepareToShoot:
{
npc.noGravity = true;
npc.noTileCollide = false;
// Set damage
npc.damage = npc.defDamage;
npc.defense = npc.defDefense;
if (npc.justHit && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10))
{
npc.netUpdate = true;
@@ -10108,7 +10109,11 @@ PrepareToShoot:
}
if (npc.ai[0] == -1f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.defense = npc.defDefense + 10;
npc.noGravity = false;
npc.velocity.X *= 0.98f;
npc.ai[1] += 1f;
@@ -10288,6 +10293,10 @@ PrepareToShoot:
npc.noTileCollide = false;
if (npc.ai[0] == 0f)
{
// Avoid cheap bullshit
if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab)
npc.damage = 0;
npc.TargetClosest();
if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1))
{
@@ -10347,6 +10356,12 @@ PrepareToShoot:
}
else if (npc.ai[0] == 1f)
{
// Set damage or avoid cheap bullshit
if (npc.type == NPCID.DeadlySphere)
npc.damage = npc.defDamage;
else if (npc.type == NPCID.NebulaHeadcrab)
npc.damage = 0;
npc.rotation += npc.direction * 0.3f;
Vector2 attacktargetDirection = Main.player[npc.target].Center - npc.Center;
if (npc.type == NPCID.NebulaHeadcrab)
@@ -10390,6 +10405,10 @@ PrepareToShoot:
}
else if (npc.ai[0] == 2f)
{
// Avoid cheap bullshit
if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab)
npc.damage = 0;
npc.rotation = npc.velocity.X * 0.1f;
npc.noTileCollide = true;
Vector2 idleTargetDirection = Main.player[npc.target].Center - npc.Center;
@@ -10404,6 +10423,10 @@ PrepareToShoot:
}
else if (npc.ai[0] == 3f)
{
// Avoid cheap bullshit
if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab)
npc.damage = 0;
npc.rotation = npc.velocity.X * 0.1f;
Vector2 blockedCellCenter = new Vector2(npc.ai[1], npc.ai[2]);
Vector2 blockedCellDirection = blockedCellCenter - npc.Center;
@@ -10424,6 +10447,10 @@ PrepareToShoot:
}
else if (npc.ai[0] == 4f)
{
// Avoid cheap bullshit
if (npc.type == NPCID.DeadlySphere || npc.type == NPCID.NebulaHeadcrab)
npc.damage = 0;
npc.rotation = npc.velocity.X * 0.1f;
if (npc.collideX)
npc.velocity.X *= -0.8f;
@@ -10486,12 +10513,18 @@ PrepareToShoot:
Player player8 = Main.player[npc.target];
if (!player8.active || player8.dead)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.netUpdate = true;
}
else
{
// Set damage
npc.damage = npc.defDamage;
npc.Center = ((player8.gravDir == 1f) ? player8.Top : player8.Bottom) + new Vector2(player8.direction * 4, 0f);
npc.gfxOffY = player8.gfxOffY;
npc.velocity = Vector2.Zero;
@@ -10813,6 +10846,9 @@ PrepareToShoot:
#region Big Mimic AI
public static bool BuffedBigMimicAI(NPC npc, Mod mod)
{
// Set damage
npc.damage = npc.defDamage;
npc.knockBackResist = 0.2f * Main.GameModeInfo.KnockbackToEnemiesMultiplier;
npc.dontTakeDamage = false;
npc.noTileCollide = false;
@@ -10934,10 +10970,13 @@ PrepareToShoot:
}
else if (npc.ai[0] == 3f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.velocity.X *= 0.85f;
npc.dontTakeDamage = true;
npc.ai[1] += 1f;
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (CalamityWorld.death ? 60f : 120f))
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= (CalamityWorld.death ? 60f : 90f))
{
npc.ai[0] = 2f;
npc.ai[1] = 0f;