diff --git a/Items/Weapons/Melee/CrimsonCrusherBlade.cs b/Items/Weapons/Melee/CrimsonCrusherBlade.cs index 1363d4647c..ac8381d7db 100644 --- a/Items/Weapons/Melee/CrimsonCrusherBlade.cs +++ b/Items/Weapons/Melee/CrimsonCrusherBlade.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Ichor, 120); if (target.damage > 0 && crit && !CalamityPlayer.areThereAnyDamnBosses) { - target.damage = target.defDamage - 10; + target.damage = target.defDamage - 5; if (target.damage < 1) target.damage = 1; } diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index a999aa626d..a2bd797c9e 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 26; item.damage = 120; item.melee = true; - item.useAnimation = 6; + item.useAnimation = 8; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 6; + item.useTime = 8; item.useTurn = true; item.knockBack = 7f; item.UseSound = SoundID.Item1; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index e231efd7a1..5c3048e03c 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2993,6 +2993,14 @@ namespace CalamityMod.NPCs Main.npc[lol].realLife = npc.whoAmI; Main.npc[lol].Calamity().newAI[0] = calamityGlobalNPC.newAI[0]; Main.npc[lol].Calamity().newAI[3] = calamityGlobalNPC.newAI[3]; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write(Main.npc[lol].Calamity().newAI[0]); + netMessage.Write(Main.npc[lol].Calamity().newAI[3]); + netMessage.Send(); + } Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 84e597c10b..874788ea71 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -4490,11 +4490,13 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > 80f && !flyAtTarget) { // Laser rate of fire - int shootTime = 2 + (int)Math.Ceiling(((enraged || configBossRushBoost) ? 5D : 2D) * (1f - lifeRatio)); + int shootTime = 4 + (death ? 2 : (int)Math.Ceiling(2f * (1f - lifeRatio))); if (CalamityWorld.bossRushActive) shootTime += 1; + if (enraged || configBossRushBoost) + shootTime += 2; - calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); + calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); int randomCount = death ? Main.rand.Next(1470, 27300) : Main.rand.Next(1330, 24700); if (calamityGlobalNPC.newAI[0] >= randomCount) @@ -4696,7 +4698,7 @@ namespace CalamityMod.NPCs if (flyAtTarget) { - float speedMultiplier = phase5 ? 1.5f : phase4 ? 1.3f : 1.2f; + float speedMultiplier = phase5 ? 2f : phase4 ? 1.7f : 1.5f; speed *= speedMultiplier; } @@ -12714,7 +12716,7 @@ namespace CalamityMod.NPCs if (flag86 && WorldGen.SolidTile(point5.X, point5.Y)) flag86 = false; - float num1163 = (float)Main.rand.Next(6, 19); + float num1163 = Main.rand.Next(6, 19); float num1164 = MathHelper.TwoPi / num1163; float num1165 = MathHelper.TwoPi * Main.rand.NextFloat(); float scaleFactor8 = 1f + Main.rand.NextFloat() * 2f; diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index ca2510c68a..03ef7fa9ea 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -129,9 +129,9 @@ namespace CalamityMod.NPCs.DevourerofGods bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool speedBoost = lifeRatio < 0.6 || (death && lifeRatio < 0.9); - bool speedBoost2 = lifeRatio < 0.2; - bool breathFireMore = lifeRatio < 0.15 || death; + bool speedBoost = lifeRatio < 0.75f || (death && lifeRatio < 0.9f); + bool speedBoost2 = lifeRatio < 0.3f; + bool breathFireMore = lifeRatio < 0.15f || death; // Light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); @@ -306,9 +306,8 @@ namespace CalamityMod.NPCs.DevourerofGods { calamityGlobalNPC.newAI[1] += 1f; - float speed = 10.5f; - float spawnOffsetX = 1900f; - float spawnOffsetY = 1000f; + float speed = 12f; + float spawnOffset = 1500f; float divisor = 120f; if (calamityGlobalNPC.newAI[1] % divisor == 0f) @@ -320,8 +319,8 @@ namespace CalamityMod.NPCs.DevourerofGods // Side walls for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + spawnOffsetX, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - spawnOffsetX, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[0] -= spacingVar; } @@ -329,8 +328,8 @@ namespace CalamityMod.NPCs.DevourerofGods { for (int x = 0; x < 10; x++) { - Projectile.NewProjectile(player.position.X + spawnOffsetX, targetPosY + shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - spawnOffsetX, targetPosY + shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[3] -= Main.rand.NextBool(2) ? 180 : 200; } shotSpacing[3] = 1050; @@ -340,7 +339,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Lower wall for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + spawnOffsetY, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + spawnOffset, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[1] -= spacingVar; } shotSpacing[1] = 1050; @@ -348,7 +347,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Upper wall for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - spawnOffsetY, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - spawnOffset, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[2] -= spacingVar; } shotSpacing[2] = 1050; diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 9cfdc7105a..ba6efe3381 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -577,7 +577,7 @@ namespace CalamityMod.NPCs.Ravager } } - float maxOffset = death ? 160f : 160f * (1f - lifeRatio); + float maxOffset = 160f + (death ? 160f : 160f * (1f - lifeRatio)); float offset = npc.ai[0] == 2f ? maxOffset * npc.Calamity().newAI[2] : 0f; // Set offset to 0 if the target stops moving diff --git a/NPCs/Signus/SignusBomb.cs b/NPCs/Signus/SignusBomb.cs index 7218ff3784..f05fa9d320 100644 --- a/NPCs/Signus/SignusBomb.cs +++ b/NPCs/Signus/SignusBomb.cs @@ -28,6 +28,7 @@ namespace CalamityMod.NPCs.Signus npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; + npc.dontTakeDamage = true; npc.HitSound = SoundID.NPCHit53; npc.DeathSound = SoundID.NPCDeath44; } @@ -51,50 +52,58 @@ namespace CalamityMod.NPCs.Signus return; } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.7f, 0.2f, 1.1f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.7f, 0.2f, 1.1f); + npc.rotation = npc.velocity.X * 0.04f; - if (npc.ai[1] == 0f) - { - npc.scale -= 0.02f; - npc.alpha += 30; - if (npc.alpha >= 250) - { - npc.alpha = 255; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.02f; - npc.alpha -= 30; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } + npc.TargetClosest(true); Player player = Main.player[npc.target]; - Vector2 vector = player.Center - npc.Center; - if (vector.Length() < 90f || npc.ai[3] >= 300f) + Vector2 vector = player.Center - npc.Center; + npc.ai[2] = vector.Length(); + + npc.ai[3] += 1f; + if (npc.ai[2] < 90f || npc.ai[3] >= 300f || npc.Calamity().newAI[0] > 0f) { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; + npc.Calamity().newAI[0] += 1f; + npc.velocity *= 0.98f; + npc.dontTakeDamage = false; + npc.scale = MathHelper.Lerp(1f, 3f, npc.Calamity().newAI[0] / 85f); + + if (npc.Calamity().newAI[0] >= 85f) + { + CheckDead(); + npc.life = 0; + } + + return; } - npc.ai[3] += 1f; - npc.dontTakeDamage = npc.ai[3] >= 240f ? false : true; - if (npc.ai[3] >= 180f) - { - npc.velocity *= 0.985f; - return; - } - float num1372 = 14f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + + if (npc.ai[1] == 0f) + { + npc.scale -= 0.02f; + npc.alpha += 30; + if (npc.alpha >= 250) + { + npc.alpha = 255; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.02f; + npc.alpha -= 30; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + + float num1372 = 14f; + Vector2 vector167 = new Vector2(npc.Center.X + (npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; @@ -115,6 +124,7 @@ namespace CalamityMod.NPCs.Signus } return; } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) @@ -141,7 +151,7 @@ namespace CalamityMod.NPCs.Signus spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -153,16 +163,16 @@ namespace CalamityMod.NPCs.Signus Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); color38 = npc.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -172,24 +182,24 @@ namespace CalamityMod.NPCs.Signus public override bool CheckDead() { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.damage = 300; npc.width = npc.height = 256; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } Main.dust[num622].noGravity = true; } - for (int num623 = 0; num623 < 30; num623++) + for (int num623 = 0; num623 < 20; num623++) { int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 2d2e932d33..23dbe65792 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using System.IO; using Terraria; using Terraria.ModLoader; @@ -73,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss OldVelocity = Vector2.Zero; projectile.netUpdate = true; } - projectile.rotation = projectile.velocity.ToRotation() + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } // Otherwise, be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. else if (OldVelocity == Vector2.Zero) @@ -81,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss OldVelocity = projectile.velocity; projectile.velocity = Vector2.Zero; projectile.netUpdate = true; - projectile.rotation = OldVelocity.ToRotation() + 1.57f; + projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; } TelegraphDelay++; } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 3829d127fe..678ce0689a 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -45,16 +45,6 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - float num953 = revenge ? 110f : 100f; - float scaleFactor12 = revenge ? 50f : 40f; - - if (projectile.ai[1] == 1f) - { - num953 *= 0.7f; - scaleFactor12 *= 0.7f; - } - - float num954 = 40f; if (projectile.timeLeft > 30 && projectile.alpha > 0) { projectile.alpha -= 25; @@ -68,9 +58,19 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 0; } - if (projectile.timeLeft > 120 && projectile.ai[1] == 1f) + if (projectile.timeLeft > 135 && projectile.ai[1] == 1f) return; + float num953 = revenge ? 110f : 100f; + float num954 = 40f; + float scaleFactor12 = revenge ? 50f : 40f; + + if (projectile.ai[1] == 1f) + { + num953 *= 0.7f; + scaleFactor12 *= 0.7f; + } + int num959 = (int)projectile.ai[0]; if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 1c692aa799..25b4b76068 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -52,9 +52,10 @@ namespace CalamityMod.Projectiles public float spawnedPlayerMinionDamageValue = 1f; public int spawnedPlayerMinionProjectileDamageValue = 0; public int defDamage = 0; + public int defCrit = 0; - // Rogue Stuff - public bool stealthStrike = false; //Update all existing rogue weapons with this + // Rogue Stuff + public bool stealthStrike = false; //Update all existing rogue weapons with this public bool momentumCapacitatorBoost = false; //Constant acceleration // Iron Heart @@ -76,6 +77,18 @@ namespace CalamityMod.Projectiles switch (projectile.type) { + case ProjectileID.ShadowBeamHostile: + projectile.timeLeft = 60; + break; + + case ProjectileID.LostSoulHostile: + projectile.tileCollide = true; + break; + + case ProjectileID.NebulaLaser: + projectile.extraUpdates = 1; + break; + case ProjectileID.StarWrath: projectile.penetrate = projectile.maxPenetrate = 1; break; @@ -988,7 +1001,23 @@ namespace CalamityMod.Projectiles #region PostAI public override void PostAI(Projectile projectile) { - int x = (int)(projectile.Center.X / 16f); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + // Set crit here to avoid issues with projectiles that change class types in PreAI and AI + if (defCrit == 0 && !projectile.npcProj && !projectile.trap) + { + if (projectile.melee) + defCrit = player.meleeCrit; + else if (projectile.ranged) + defCrit = player.rangedCrit; + else if (projectile.magic) + defCrit = player.magicCrit; + else if (rogue) + defCrit = modPlayer.throwingCrit; + } + + int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); for (int i = x - 1; i <= x + 1; i++) { @@ -1022,8 +1051,22 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) - crit = true; + if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) + { + int critChance = (int)MathHelper.Clamp(1, 100, 100 - defCrit); + crit = Main.rand.NextBool(critChance + 1); + + if ((uint)(projectile.type - ProjectileID.DD2LightningAuraT1) <= 2u) + { + if (player.setMonkT3) + crit = Main.rand.NextBool(4); + else if (player.setMonkT2) + crit = Main.rand.NextBool(6); + } + + if (rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) + crit = true; + } } #endregion