Merge branch '1.4.4' into MegalodonLine

This commit is contained in:
sunny-raindrops committed 2026-02-13 18:02:19 -08:00
commit 53bd8f0ca5
29 files changed
+242 -161

No files matched your search

+17 -20
View File
@@ -1860,7 +1860,7 @@ namespace CalamityMod.CalPlayer
if (sSpiritAmulet)
{
int spawnTime = 65; // Time between energy spawns
int spawnTime = 75; // Time between energy spawns
int energyCap = 8; // Max number of energies that can be alive at a time
Projectile projectile = null;
@@ -1877,7 +1877,7 @@ namespace CalamityMod.CalPlayer
}
}
if (energyCount > 0)
sSpiritAmuletTimer = -spawnTime; // The spawn cooldown after launching energies is twice as long
sSpiritAmuletTimer = -spawnTime * 3; // The spawn cooldown after launching energies is much longer
}
int numOfEnergy = 0;
for (int x = 0; x < Main.maxProjectiles; x++) // Get a count of energies in idle mode
@@ -2073,29 +2073,26 @@ namespace CalamityMod.CalPlayer
zapActivity += 1;
if (zapActivity <= 300 && zapActivity % 30 == 0)
{
for (int arcProjCount = 0; arcProjCount < 3; arcProjCount++)
float maxDistance = 300f;
int target = -1;
foreach (NPC npc in Main.ActiveNPCs)
{
float maxDistance = 300f;
int target = -1;
foreach (NPC npc in Main.ActiveNPCs)
float targetDist = Vector2.Distance(npc.Center, Player.Center);
if (targetDist < maxDistance && npc.Calamity().arcZapCooldown == 0 && npc.CanBeChasedBy())
{
float targetDist = Vector2.Distance(npc.Center, Player.Center);
if (targetDist < maxDistance && npc.Calamity().arcZapCooldown == 0 && npc.CanBeChasedBy())
{
maxDistance = targetDist;
target = npc.whoAmI;
}
maxDistance = targetDist;
target = npc.whoAmI;
}
}
if (target > 0)
{
unstableSelectedTarget = Main.npc[target];
unstableSelectedTarget.Calamity().arcZapCooldown = 18;
int damage = (int)Player.GetBestClassDamage().ApplyTo(18);
if (target > 0)
{
unstableSelectedTarget = Main.npc[target];
unstableSelectedTarget.Calamity().arcZapCooldown = 25;
int damage = (int)Player.GetBestClassDamage().ApplyTo(15);
Projectile.NewProjectile(Player.GetSource_FromThis(), new Vector2(Player.Center.X, Player.Center.Y - 20f), new Vector2(0f, -2f), ModContent.ProjectileType<ArcZap>(), damage, 0f, Player.whoAmI, target, 3f);
target = -1;
}
Projectile.NewProjectile(Player.GetSource_FromThis(), new Vector2(Player.Center.X, Player.Center.Y - 20f), new Vector2(0f, -2f), ModContent.ProjectileType<ArcZap>(), damage, 0f, Player.whoAmI, target, 5f);
target = -1;
}
}
else if (zapActivity > 600)
@@ -78,6 +78,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"PokerFace",
"Raesh",
"Sagittariod",
"sixtydegrees",
"StipulateVenus",
"Sunny",
"_tofu",
+1 -1
View File
@@ -8,7 +8,7 @@ namespace CalamityMod.Items.Weapons.Melee
public class Bonebreaker : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public const int BaseDamage = 45;
public const int BaseDamage = 55;
public override void SetDefaults()
{
+2 -1
View File
@@ -106,7 +106,8 @@ namespace CalamityMod.Items.Weapons.Melee
}
if (completion >= 0.65f && spawnProj)
{
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f);
if (!player.Calamity().bladeArmEnchant) // Manually remove projectiles when Tainted
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f);
Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.6f, clr, new Vector2(1f, 1f), true, false, 0, false, false);
GeneralParticleHandler.SpawnParticle(swipe);
+27 -18
View File
@@ -29,11 +29,12 @@ namespace CalamityMod.Items.Weapons.Melee
public bool canHit => (completion >= 0.35f && completion <= 0.8f);
public int swingCount = 0;
public bool spawnProj = true;
public bool spawnTrueMeleeProj = true;
public bool playSound = true;
public override void SetDefaults()
{
Item.width = Item.height = 112;
Item.damage = 840;
Item.damage = 800;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = Item.useTime = 16;
Item.useStyle = ItemUseStyleID.Swing;
@@ -72,6 +73,7 @@ namespace CalamityMod.Items.Weapons.Melee
bladeHitboxPos = player.Center;
bladeRotation = 0;
spawnProj = true;
spawnTrueMeleeProj = true;
playSound = true;
int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X);
float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1);
@@ -106,13 +108,16 @@ namespace CalamityMod.Items.Weapons.Melee
}
if (completion >= 0.65f && spawnProj)
{
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f);
for (int i = 0; i < 4; i++)
if (!player.Calamity().bladeArmEnchant) // Manually remove projectiles when Tainted
{
float rot = Main.rand.NextFloat(0.5f, 0.65f) * (Main.rand.NextBool() ? 1 : -1);
Vector2 vel = (shootDir * 2.5f).RotatedByRandom(0.6f);
Projectile.NewProjectile(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType<StarofOrder>(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1);
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f);
for (int i = 0; i < 4; i++)
{
float rot = Main.rand.NextFloat(0.5f, 0.65f) * (Main.rand.NextBool() ? 1 : -1);
Vector2 vel = (shootDir * 2.5f).RotatedByRandom(0.6f);
Projectile.NewProjectile(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType<StarofOrder>(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1);
}
}
Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false);
@@ -140,19 +145,23 @@ namespace CalamityMod.Items.Weapons.Melee
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
int beamDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage * 0.4f);
Vector2 mouseClamped = player.ClampedMouseWorld();
SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f)}, player.Center);
for (int i = 0; i < 2; i++)
if (spawnTrueMeleeProj)
{
Vector2 targetPos = Main.MouseWorld;
NPC target2 = Main.MouseWorld.ClosestNPCAt(650);
if (target2 != null)
targetPos = target2.Center;
int beamDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage * 0.35f);
Vector2 mouseClamped = player.ClampedMouseWorld();
SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center);
for (int i = 0; i < 2; i++)
{
Vector2 targetPos = Main.MouseWorld;
NPC target2 = Main.MouseWorld.ClosestNPCAt(650);
if (target2 != null)
targetPos = target2.Center;
Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900);
Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10;
Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType<OrderbringerBeam>(), beamDamage, 0, player.whoAmI);
Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900);
Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10;
Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType<OrderbringerBeam>(), beamDamage, 0, player.whoAmI);
}
spawnTrueMeleeProj = false;
}
}
public override void ModifyTooltips(List<TooltipLine> list)
+1 -1
View File
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue
{
Item.width = 109;
Item.height = 128;
Item.damage = 192;
Item.damage = 222;
Item.noMelee = true;
Item.noUseGraphic = true;
// Due to the amazing sound engine, having multiple crosses embedded in enemies cuts off the sound
+3 -4
View File
@@ -15,12 +15,11 @@ namespace CalamityMod.Items.Weapons.Rogue
{
Item.width = 48;
Item.height = 48;
Item.damage = 144;
Item.damage = 111;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.useAnimation = 17;
Item.useTime = Item.useAnimation = 17;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 17;
Item.knockBack = 8f;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
@@ -31,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.DamageType = RogueDamageClass.Instance;
}
public override float StealthDamageMultiplier => 0.65f;
public override float StealthDamageMultiplier => 0.7f;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
+3 -1
View File
@@ -250,6 +250,9 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
}
// Copy the damage state of the head
NPC.damage = Main.npc[(int)NPC.ai[2]].damage == 0 ? 0 : NPC.defDamage;
NPC aheadSegment = Main.npc[(int)NPC.ai[1]];
Vector2 directionToNextSegment = aheadSegment.Center - NPC.Center;
if (aheadSegment.rotation != NPC.rotation)
@@ -345,7 +348,6 @@ namespace CalamityMod.NPCs.DevourerofGods
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
if (Main.npc[(int)NPC.ai[2]].dontTakeDamage)
return false;
cooldownSlot = ImmunityCooldownID.Bosses;
@@ -798,6 +798,8 @@ namespace CalamityMod.NPCs.DevourerofGods
if (NPC.Opacity >= 1f)
{
// Don't do contact damage while flying away after laser walls
NPC.damage = 0;
NPC.Opacity = 1f;
laserWallPhase = (int)LaserWallPhase.SetUp;
@@ -2299,6 +2301,7 @@ namespace CalamityMod.NPCs.DevourerofGods
AwaitingPhase2Teleport = false;
NPC.Opacity = 1f - (postTeleportTimer / 255f);
NPC.velocity = Vector2.Normalize(AdjustedPlayerCenter(10) - NPC.Center) * chargeVelocity;
NPC.damage = NPC.defDamage;
NPC.ForceNetUpdate(false);
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
foreach (NPC n in Main.ActiveNPCs)
+3 -1
View File
@@ -152,7 +152,6 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.life = Main.npc[(int)NPC.ai[2]].life;
NPC.lifeMax = Main.npc[(int)NPC.ai[2]].lifeMax;
// Percent life remaining
float lifeRatio = Main.npc[(int)NPC.ai[2]].life / (float)Main.npc[(int)NPC.ai[2]].lifeMax;
@@ -249,6 +248,9 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
}
// Copy the damage state of the head
NPC.damage = Main.npc[(int)NPC.ai[2]].damage == 0 ? 0 : NPC.defDamage;
Vector2 segmentDirection = NPC.Center;
float playerXDist = player.position.X + (player.width / 2);
float playerYDist = player.position.Y + (player.height / 2);
+6
View File
@@ -171,6 +171,9 @@ namespace CalamityMod.NPCs.Polterghast
acceleration += revenge ? 0.035f : 0.025f;
}
// Reset contact damage every frame
NPC.damage = NPC.defDamage;
// Predictiveness
Vector2 lookAt = player.Center;
Vector2 rotationVector = lookAt - vector;
@@ -337,6 +340,9 @@ namespace CalamityMod.NPCs.Polterghast
}
else
{
// Do not deal damage during movement to avoid cheap bullshit
NPC.damage = 0;
// Random location choice
if (NPC.ai[0] == 0f)
{
@@ -151,7 +151,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
#region Bloodletting
internal static int BloodlettingDuration => 675;
internal static Vector2 HoverDistance => new (420f, 270f);
internal static Vector2 HoverDistance => new (420f, 300f);
internal static float HoverEndHeight => 300f;
internal static int IchorRate => CalamityWorld.death ? 9 : 10;
internal static float IchorSpread => 1.5f;
@@ -355,10 +355,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
else
NPC.defense = (int)(NPC.defDefense * Phase1DefenseMultiplier);
if (AIState <= BrainAIState.SurfaceSpawnAnimation)
NPC.damage = 0;
else
NPC.damage = NPC.defDamage;
NPC.extraValue = 0;
#region Targeting
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
@@ -559,6 +556,11 @@ public class BrainOfCthulhuAI : VanillaAIOverride
private void SpawnAnimation()
{
NPC.damage = 0;
foreach (Player p in Main.ActivePlayers)
p.Calamity().adrenaline = 0;
if (SpawnTime != 0) //BoC should begin appearing
{
float d = Main.LocalPlayer.DistanceSQ(NPC.Center);
@@ -638,6 +640,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
BrainOfCthulhuSystem.ScreenBlurStrength = 0f;
BoCDrawOffset = Vector2.Zero;
AIState = BrainAIState.Phase1Idle;
NPC.damage = NPC.defDamage;
ResetAttackValues();
Time = -1;
SpawnTime = -1;
@@ -1041,6 +1044,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
BrainOfCthulhuSystem.ScreenBlurStrength = 0f;
NPC.dontTakeDamage = false;
NPC.damage = 0;
if (Time <= 15)
{
@@ -1108,6 +1112,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
OnSecondCreeperPhase = true;
AIState = BrainAIState.Phase1Idle;
Time = -1;
NPC.damage = NPC.defDamage;
}
else if (AttackCounter > -1 && wrappedCounter == 0)
{
@@ -1304,7 +1309,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
NPC.velocity = NPC.DirectionTo(goalPos).SafeNormalize(Vector2.UnitX * -Target.direction) * 8f;
#endregion
float delay = OnSecondCreeperPhase ? StrongSwipeDelay : LightSwipeDelay;
int delay = OnSecondCreeperPhase ? StrongSwipeDelay : LightSwipeDelay;
if (Time == 0)
AttackList.Clear();
@@ -1325,9 +1330,9 @@ public class BrainOfCthulhuAI : VanillaAIOverride
crushCount = StrongSwipeAmount;
attackDelay = StrongSwipeDuration;
}
int attackDur = attackDelay * crushCount;
int attackDur = delay + ((attackDelay + 1) * crushCount);
if (Time < delay + attackDur && Time % attackDelay == 0)
if (Time < attackDur && Time % attackDelay == 0)
{
List<NPC> creepers = Main.npc.Where(n => n.active && n.type == NPCID.Creeper && n.AIOverride<CreeperAI>().Time == -1 && !AttackList.Contains((byte)n.whoAmI)).ToList();
if (creepers.Count > 1 && Main.netMode != NetmodeID.MultiplayerClient)
@@ -1369,7 +1374,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
}
}
if (Time > delay + attackDur + attackDelay)
if (Time > attackDur + attackDelay)
{
Time = 0;
NPC.damage = NPC.defDamage;
@@ -1395,6 +1400,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
{
AttackSign = Main.rand.NextBool() ? -1 : 1;
AttackPosition = Target.Center;
AttackList.Clear();
NPC.netUpdate = true;
NPC.damage = 0;
@@ -1555,6 +1561,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
NPC.dontTakeDamage = true;
NPC.rotation *= 0.9f;
TeleportTime = 0;
NPC.damage = 0;
float animCounter = Time - 60;
if (animCounter >= 0)
@@ -1620,6 +1627,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
ResetAttackValues();
AIState = BrainAIState.Phase2Idle;
NPC.dontTakeDamage = false;
NPC.damage = NPC.defDamage;
}
}
else
@@ -1707,6 +1715,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
else if (Time == ChaseTime + (TeleportDuration / 2f) && !AttackFlag)
{
NPC.Center = endPoint;
NPC.damage = NPC.defDamage;
DisableMultiplayerSmoothing = true;
AttackFlag = true;
NPC.netUpdate = true;
@@ -1854,7 +1863,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
else if (endTime < DashPrepTime)
{
if (endTime == 0)
NPC.velocity = Vector2.UnitX * AttackSign * 8f;
NPC.velocity = Vector2.UnitX * AttackSign * 10f;
else
{
Vector2 goalPos = Target.Center - Vector2.UnitY * HoverEndHeight;
@@ -2465,24 +2474,24 @@ public class BrainOfCthulhuAI : VanillaAIOverride
NPC.Opacity = 1 - (TeleportTime / (TeleportDuration / 2f));
}
else if (startTime < 90 + IllusionDashSpinDuration + 30 + IllusionDashFakeoutTeleportDuration + 30)
else if (startTime <= 150 + IllusionDashSpinDuration + 30 + IllusionDashFakeoutTeleportDuration + 30)
{
NPC.velocity *= 0.9f;
if (startTime % 15 == 0 && startTime > 45 + IllusionDashSpinDuration + 30 + IllusionDashFakeoutTeleportDuration)
if (startTime % 15 == 5 && startTime > 60 + IllusionDashSpinDuration + 30 + IllusionDashFakeoutTeleportDuration)
{
for (int i = 0; i < 2; i++)
for (int i = 0; i < (CalamityWorld.death ? 2 : 1); i++)
{
Vector2 dir = NPC.DirectionTo(Target.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Vector2 initialDir = dir.RotatedBy(Main.rand.NextFloat(-MathHelper.Pi / 4f, MathHelper.Pi / 4f));
Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, initialDir * Main.rand.NextFloat(10f, 25f), ProjectileID.BloodNautilusShot, BloodShotDamage, 0.5f, ai0: dir.ToRotation() + MathHelper.TwoPi, ai1: initialDir.ToRotation());
Vector2 initialDir = dir.RotatedBy(MathHelper.Pi + Main.rand.NextFloat(-0.01f, 0.01f));
Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center + Main.rand.NextVector2Circular(NPC.width, NPC.width), initialDir * Main.rand.NextFloat(6f, 8f), ProjectileID.BloodNautilusShot, BloodShotDamage, 0.5f, ai0: dir.ToRotation() + MathHelper.TwoPi, ai1: initialDir.ToRotation());
}
NPC.velocity -= dir * 2f;
NPC.velocity -= dir;
}
}
}
else if (startTime >= 135 + IllusionDashSpinDuration + 30 + IllusionDashFakeoutTeleportDuration + 30)
else if (startTime >= 180 + IllusionDashSpinDuration + 30 + IllusionDashFakeoutTeleportDuration + 30)
{
foreach (NPC n in Main.ActiveNPCs)
if (n.type == ModContent.NPCType<BrainIllusion>())
@@ -2569,20 +2578,20 @@ public class BrainOfCthulhuAI : VanillaAIOverride
}
NPC.damage = 0;
NPC.dontTakeDamage = false;
if (AttackFlag)
{
if (AttackCounter == 0)
{
NPC.ShowNameOnHover = true;
NPC.velocity = NPC.DirectionFrom(Target.Center) * 8f;
NPC.velocity = NPC.DirectionFrom(Target.Center) * 4f;
}
else
NPC.velocity *= 0.95f;
if (AttackCounter >= IllusionTrickStunDuration)
{
NPC.damage = NPC.defDamage;
SetupForNextAttack();
NPC.Opacity = 1f;
TeleportTime = 0;
@@ -2607,6 +2616,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
continue;
n.ModNPC<FalseBrain>().BeenHit = true;
n.netUpdate = true;
}
for (int i = 1; i <= 3; i++)
@@ -2628,7 +2638,7 @@ public class BrainOfCthulhuAI : VanillaAIOverride
if (AttackList.Count > 0)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<TelekineticBlast>(), 0, 0f, -1, AttackList[0], 2f);
Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<TelekineticBlast>(), 0, 0f, -1, AttackList[0], 0, NPC.whoAmI);
AttackList.RemoveAt(0);
}
@@ -2636,12 +2646,12 @@ public class BrainOfCthulhuAI : VanillaAIOverride
{
Vector2 direction = Target.velocity.SafeNormalize(Vector2.UnitX * Target.direction).RotatedBy(Main.rand.NextFloat(-MathHelper.Pi / 3f, MathHelper.Pi / 3f));
float distance = DefaultTeleportDistance;
NPC.damage = NPC.defDamage;
AttackPosition = Target.Center + (direction * distance);
BoCAfterImages = [];
NPC.Opacity = 1f;
TeleportTime = 0;
Time = ChaseTime - 1;
NPC.damage = NPC.defDamage;
NPC.netUpdate = true;
ResetAttackValues();
@@ -2697,6 +2707,8 @@ public class BrainOfCthulhuAI : VanillaAIOverride
{
NPC.Opacity = 0f;
BoCAfterImages = [];
NPC.damage = 0;
NPC.dontTakeDamage = true;
}
if (Time >= 180)
@@ -525,6 +525,7 @@ public class CreeperAI : VanillaAIOverride
CachedValue1 = MathHelper.TwoPi / creeperCount * localCreeperID;
AttackPosition = NPC.Center;
AttackAngle = 0;
Time = -1;
NPC.netUpdate = true;
}
}
@@ -1,10 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Packets;
using CalamityMod.Packets.Entities;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Boss.BrainOfCthulhu;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -13,6 +18,7 @@ using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses.BrainOfCthulhu;
@@ -47,15 +53,15 @@ public class FalseBrain : ModNPC, ILocalizedModType
Music = MusicID.Boss3;
SceneEffectPriority = (SceneEffectPriority)(-1);
NPC.localAI[0] = Main.rand.Next(6);
NPC.localAI[0] = Main.rand.Next(Main.getGoodWorld ? 7 : 6);
NPC.localAI[1] = 1 + Main.rand.NextFloat(-0.25f, 0.25f);
}
private int Variant => (int)NPC.localAI[0];
private float Angle => NPC.ai[0];
private ref float Time => ref NPC.ai[1];
int AttackTime { get => (int)NPC.ai[2]; set => NPC.ai[2] = value; }
internal bool BeenHit = false;
int AttackTime = 0;
int SpawnTime = 60;
internal static float TimeDivisor => 360f;
@@ -80,10 +86,8 @@ public class FalseBrain : ModNPC, ILocalizedModType
{
NPC.dontTakeDamage = true;
if (AttackTime == 60)
if (AttackTime++ >= 60)
NPC.active = false;
AttackTime++;
}
else
{
@@ -100,61 +104,47 @@ public class FalseBrain : ModNPC, ILocalizedModType
}
if (SpawnTime > 0)
SpawnTime--;
else if (SpawnTime >= -30)
{
if (--SpawnTime == 0)
Time += --SpawnTime / -30f;
if(SpawnTime <= -30)
NPC.dontTakeDamage = false;
}
else if (SpawnTime > -30)
Time += --SpawnTime / -30f;
else
Time++;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(BeenHit);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
BeenHit = reader.ReadBoolean();
}
public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone)
{
SmiteFool(player);
if (!BeenHit)
{
if (Main.netMode == NetmodeID.SinglePlayer)
Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<TelekineticBlast>(), 50, 0.5f, -1, player.whoAmI, 8, NPC.whoAmI);
else
BrainIllusionHitPacket.Send(NPC.whoAmI, player.whoAmI);
NPC.dontTakeDamage = true;
}
}
public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone)
{
if (!projectile.Calamity().IgnoreBoCIllusions && projectile.owner != -1)
SmiteFool(Main.player[projectile.owner]);
}
private void SmiteFool(Player fool)
{
if (!BeenHit)
if (!BeenHit && !projectile.Calamity().IgnoreBoCIllusions && projectile.owner != -1)
{
for (int i = 0; i < 6; i++)
{
Vector2 dir = fool.Center - NPC.Center;
int lifeTime = 24;
dir /= lifeTime / 2f * 5f;
dir *= i;
DirectionalPulseRing pulse = new(NPC.Center, dir, i % 2 == 0 ? Color.Red : Color.Orange, new Vector2(0.5f, 1), dir.ToRotation(), 0f, i / 5f, lifeTime + 8);
GeneralParticleHandler.SpawnParticle(pulse);
}
BeenHit = true;
SoundEngine.PlaySound(BrainOfCthulhuAI.Laugh, NPC.Center);
fool.AddBuff(BuffID.Darkness, 900);
fool.AddBuff(BuffID.Bleeding, 900);
fool.AddBuff(BuffID.Confused, 60);
int timeToAdd = 300;
int bbIndex = fool.buffType.ToList().IndexOf(ModContent.BuffType<BurningBlood>());
if (bbIndex != -1)
{
timeToAdd /= 2;
timeToAdd += fool.buffTime[bbIndex];
}
if (timeToAdd > 3600)
timeToAdd = 3600;
fool.AddBuff(ModContent.BuffType<BurningBlood>(), timeToAdd);
fool.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainIllusion" + Main.rand.Next(1, 3 + 1)).ToNetworkText(fool.name)), 50, NPC.Center.X > fool.Center.X ? -1 : 1, cooldownCounter: 0, dodgeable: false, scalingArmorPenetration: 1f);
if(Main.netMode == NetmodeID.SinglePlayer)
Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<TelekineticBlast>(), 50, 0.5f, -1, projectile.owner, 8, NPC.whoAmI);
else
BrainIllusionHitPacket.Send(NPC.whoAmI, projectile.owner);
NPC.dontTakeDamage = true;
}
}
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CalamityMod.Projectiles.Boss.BrainOfCthulhu;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace CalamityMod.Packets.Entities;
internal class BrainIllusionHitPacket : CalamityPacket
{
public static BrainIllusionHitPacket Instance { get; private set; }
public static void Send(int illusionIndex, int foolIndex)
{
// Only Client should send to Server
if (Main.dedServ)
return;
var packet = Instance.CreateBasePacket();
packet.Write((byte)illusionIndex);
packet.Write((byte)foolIndex);
packet.Send();
}
public override void HandlePacket(BinaryReader packet, int sender)
{
var bytes = packet.ReadBytes(2);
NPC illusion = Main.npc[(int)bytes[0]];
Player fool = Main.player[(int)bytes[1]];
if(Main.dedServ)
Projectile.NewProjectile(illusion.GetSource_FromThis(), illusion.Center, Vector2.Zero, ModContent.ProjectileType<TelekineticBlast>(), 50, 0.5f, -1, fool.whoAmI, 8, illusion.whoAmI);
illusion.dontTakeDamage = true;
illusion.netUpdate = true;
}
}
+8 -13
View File
@@ -97,22 +97,17 @@ public class BloodScythe : ModProjectile, ILocalizedModType
if (!ChildSafety.Disabled)
drawColor = Main.DiscoColor;
if (CalamityClientConfig.Instance.Afterimages)
for (int i = 0; i < (CalamityClientConfig.Instance.Afterimages ? Projectile.oldPos.Length : 1); ++i)
{
for (int i = 0; i < Projectile.oldPos.Length; ++i)
{
float afterimageRot = Projectile.oldRot[i];
drawPos = Projectile.oldPos[i] + (Projectile.Size / 2f) - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
if (i != 0)
drawColor *= 0.9f;
float afterimageRot = Projectile.oldRot[i];
drawPos = Projectile.oldPos[i] + (Projectile.Size / 2f) - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
if (i != 0)
drawColor *= 0.9f;
// DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES.
float interpolant = ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length);
Main.spriteBatch.Draw(tex, drawPos, null, drawColor, afterimageRot, tex.Size() * 0.5f, Projectile.scale * interpolant, SpriteEffects.None, 0f);
}
// DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES.
float interpolant = ((float)(Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length);
Main.spriteBatch.Draw(tex, drawPos, null, drawColor, afterimageRot, tex.Size() * 0.5f, Projectile.scale * interpolant, SpriteEffects.None, 0f);
}
//else
// Main.EntitySpriteDraw(tex, drawPos, tex.Frame(), drawColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0);
Main.spriteBatch.SetBlendState(BlendState.AlphaBlend);
@@ -27,17 +27,40 @@ public class TelekineticBlast : ModProjectile, ILocalizedModType
Projectile.penetrate = -1;
Projectile.Opacity = 1f;
Projectile.tileCollide = false;
Projectile.timeLeft = 1;
Projectile.timeLeft = 10;
Projectile.damage = 0;
Projectile.scale = 1;
Projectile.hostile = true;
Projectile.netImportant = true;
}
Player target => Main.player[(int)Projectile.ai[0]];
float debuffMultiplier => Projectile.ai[1];
float debuffMultiplier => Main.npc[NPCSource].type == NPCID.BrainofCthulhu ? 2f : 1f;
int delay { get => (int)Projectile.ai[1]; set => Projectile.ai[1] = value; }
int NPCSource => (int)Projectile.ai[2];
public override void OnSpawn(IEntitySource source)
{
Projectile.netUpdate = true;
}
public override void AI()
{
if (Main.npc[NPC.crimsonBoss].AIOverride<BrainOfCthulhuAI>().AttackFlag || Main.npc[NPC.crimsonBoss].AIOverride<BrainOfCthulhuAI>().AIState == BrainOfCthulhuAI.BrainAIState.DeathAnimation)
{
Projectile.active = false;
return;
}
if (--delay > 0)
return;
if (Main.npc[NPCSource].ModNPC is FalseBrain illusion)
{
illusion.BeenHit = true;
Main.npc[NPCSource].netUpdate = true;
}
for (int i = 0; i < 6; i++)
{
Vector2 dir = target.Center - Projectile.Center;
+3
View File
@@ -368,6 +368,9 @@ namespace CalamityMod.Projectiles
grapeBeer = true;
}
if (parent.Calamity().IgnoreBoCIllusions)
IgnoreBoCIllusions = true;
// Nerf Crystal bullet shard damage by 45%
// Vanilla crystal shards deal 50% of the bullet's damage which is absurd, this nerfs them to 27.5%
if (parent.type == ProjectileID.CrystalBullet && projectile.type == ProjectileID.CrystalShard)
+3 -3
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue
public bool jitter = false;
public Vector2 portalSpot;
public Vector2 shadowPlacement;
public int clones = 9; // This is just a counter for the clones, it will not change how many spawn
public int clones = 6; // This is the number of clones spawned by the stealth strike
NPC closestTarget;
public override void SetDefaults()
{
@@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Rogue
if (closestTarget == null)
closestTarget = Projectile.Center.ClosestNPCAt(2000);
if (Projectile.Calamity().stealthStrike && time % 20 == 0)
if (Projectile.Calamity().stealthStrike && time % 20 == 0 && clones > 0)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2CircularEdge(450, 450) * Main.rand.NextFloat(0.7f, 1.3f), Vector2.Zero, ModContent.ProjectileType<AntumbraShardProjectile>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1, 5);
clones--;
@@ -260,7 +260,7 @@ namespace CalamityMod.Projectiles.Rogue
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.83f);
Projectile.damage = (int)(Projectile.damage * 0.8f);
if (Projectile.damage < 1)
Projectile.damage = 1;
+13 -8
View File
@@ -168,12 +168,11 @@ namespace CalamityMod.Projectiles.Rogue
if (Projectile.velocity.Length() < storedStealthVel.Length())
Projectile.velocity += Utils.DirectionTo(Projectile.Center, Owner.Center) * 0.1f;
Projectile.velocity *= 0.99f;
// CIT 26JUN2025: Removing its ability to deal damage again because it's overpowered
/*if (time == 180)
if (time == 180) // Allow it to hit on the return trip
{
for (int i = 0; i < Main.maxNPCs; i++)
Projectile.localNPCImmunity[i] = 0;
}*/
}
if (Projectile.timeLeft <= 240)
{
impaleDist = Vector2.One; // This is so the projectile stops dealing damage
@@ -308,7 +307,7 @@ namespace CalamityMod.Projectiles.Rogue
float minMult = 0.35f;
int hitsToMinMult = 10;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
modifiers.SourceDamage *= damageMult / 2;
}
else if (!falling || Projectile.numHits != 0)
modifiers.SourceDamage *= 0.1f;
@@ -344,11 +343,17 @@ namespace CalamityMod.Projectiles.Rogue
{
if (Main.zenithWorld)
{
// All is cleansed by The Lord
for (int index = 0; index < Main.npc.Length; index++)
{
NPC searchedTarget = Main.npc[index];
searchedTarget.active = false;
}
{ NPC searchedTarget = Main.npc[index]; searchedTarget.active = false; }
for (int x = 0; x < Main.maxProjectiles; x++)
{ Projectile projectile = Main.projectile[x]; if (projectile.active && projectile.type != ModContent.ProjectileType<ExorcismShockwave>() && projectile.type != ModContent.ProjectileType<ExorcismProj>()) { projectile.active = false; } }
for (int x = 0; x < Main.maxItems; x++)
{ Item item = Main.item[x]; if (item.active) { item.active = false; } }
for (int x = 0; x < Main.maxDust; x++)
{ Dust dust = Main.dust[x]; if (dust.active) { dust.active = false; } }
for (int x = 0; x < Main.maxGore; x++)
{ Gore gore = Main.gore[x]; if (gore.active) { gore.active = false; } }
SoundStyle gong = new("CalamityMod/Sounds/Custom/GFB/Jesus");
for (int i = 0; i < 2; i++)
@@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Summon
float shootSpeed = 15f;
Vector2 source = Projectile.Center;
var velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, target, shootSpeed, 2);
Projectile beam = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, ModContent.ProjectileType<VengefulSunBeam>(), (int)(Projectile.damage * (0.75f + Projectile.minionSlots * 0.25f)), Projectile.knockBack, Projectile.owner, ai1: (Projectile.minionSlots - 1) / 9f);
Projectile beam = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center - velocity, velocity, ModContent.ProjectileType<VengefulSunBeam>(), (int)(Projectile.damage * (0.75f + Projectile.minionSlots * 0.25f)), Projectile.knockBack, Projectile.owner, ai1: (Projectile.minionSlots - 1) / 6f);
beam.DamageType = DamageClass.Summon;
Projectile.ai[1] += 60f / (0.75f + Projectile.minionSlots * 0.25f);
}
+4 -20
View File
@@ -28,8 +28,6 @@ namespace CalamityMod.Projectiles.Typeless
public ref float energyNumber => ref Projectile.ai[1]; // The number assigned to this energy, ranging from 1 to the max number of energies
public bool idle => Projectile.ai[2] == 0; // Floating around the player
public bool healing = false; // If the energies should heal the player. If false they will attack
public int soundCooldown = 0; // A cooldown after making a sound. Also used for some of the visuals when a sound is made
public SlotId soundSlot;
public NPC targeted;
public override void SetStaticDefaults()
{
@@ -51,12 +49,11 @@ namespace CalamityMod.Projectiles.Typeless
public override void AI()
{
bool spoke = (soundCooldown >= 250 * Projectile.MaxUpdates);
int startTime = 100; // Time after launch when it will begin attacking/healing
int endTime = 300; // Time after launch when it's movement code reaches it's cap on strength
// Color is in blues if idle or healing, but becomes orange breifley if they speak or constantly if they are attacking
float colorShift = spoke ? Utils.GetLerpValue(250 * Projectile.MaxUpdates, 300 * Projectile.MaxUpdates, soundCooldown) : (idle || healing ? 0 : Utils.GetLerpValue(0, startTime, time));
// Color is in blues if idle or healing, but becomes orange if they are attacking
float colorShift = (idle || healing ? 0 : Utils.GetLerpValue(0, startTime, time));
float rate = Main.GlobalTimeWrappedHourly * 5;
List<Color> eColors = new List<Color>()
{
@@ -86,9 +83,6 @@ namespace CalamityMod.Projectiles.Typeless
// Emit some light
Lighting.AddLight(Projectile.Center, bColor.ToVector3() * 0.65f);
if (SoundEngine.TryGetActiveSound(soundSlot, out var sound) && sound.IsPlaying)
sound.Position = Projectile.Center;
if (idle) // Following Ai
{
if (time == 0 && visuals) // On spawn fx
@@ -124,22 +118,12 @@ namespace CalamityMod.Projectiles.Typeless
Projectile.velocity *= 0.985f;
if (!outOfRange)
Projectile.velocity = Projectile.velocity.RotatedBy(0.0065f * (energyNumber % 2 == 0 ? -1 : 1)) * 1.004f;
if (soundCooldown == 0 && Main.rand.NextBool(4500 * Projectile.MaxUpdates) && visuals && time > 18000 * Projectile.MaxUpdates && !Main.dedServ) // Sounds are an easter egg that only plays if they've been alive for over 5 minutes
{
SoundStyle certainlyNotADeadChild = new("CalamityMod/Sounds/Item/AmuletVox", 6);
soundSlot = SoundEngine.PlaySound(certainlyNotADeadChild with { Volume = 0.3f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, Projectile.Center);
soundCooldown = 800 * Projectile.MaxUpdates;
}
if (soundCooldown > 0)
soundCooldown--;
}
else
Projectile.velocity *= 0.99f;
}
else // Attack/Healing Ai
{
soundCooldown = 0;
if (Projectile.ai[2] == 5) // Effects for the moment they stop being idle
{
Projectile.netUpdate = true;
@@ -209,13 +193,13 @@ namespace CalamityMod.Projectiles.Typeless
GeneralParticleHandler.SpawnParticle(fadeInfx);
}
Projectile.scale = MathHelper.Lerp(Projectile.scale, spoke ? 0.9f : 0.5f, 0.1f);
Projectile.scale = MathHelper.Lerp(Projectile.scale, 0.5f, 0.1f);
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
time++;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 420);
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 540);
Projectile.netUpdate = true;
}
public override void OnKill(int timeLeft)
+5
View File
@@ -64,6 +64,11 @@ namespace CalamityMod.Projectiles.Typeless
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
Player Owner = Main.player[Projectile.owner];
bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Owner.GetBestClass());
if (crit)
modifiers.SetCrit();
float minMult = 0.4f;
int hitsToMinMult = 6;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.