diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index fd27e54a1d..c750ccc0f7 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4012,16 +4012,19 @@ namespace CalamityMod.CalPlayer sCalDeathCount++; } } - deathCount++; + + if (CalamityWorld.ironHeart) + { + KillPlayer(); + return false; + } + + deathCount++; if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { DeathPacket(false); } - if (CalamityWorld.ironHeart && areThereAnyDamnBosses) - { - KillPlayer(); - return false; - } + return true; } #endregion @@ -4056,6 +4059,14 @@ namespace CalamityMod.CalPlayer } #endregion + #region Get Heal Life + public override void GetHealLife(Item item, bool quickHeal, ref int healValue) + { + if (CalamityWorld.ironHeart) + healValue = 0; + } + #endregion + #region Get Weapon Damage And KB public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) { @@ -5813,7 +5824,7 @@ namespace CalamityMod.CalPlayer } else { - float amount = npc.velocity.Length() / npc.Calamity().maxVelocity; + float amount = npc.velocity.Length() / (npc.Calamity().maxVelocity * 0.4f); if (amount > 1f) amount = 1f; @@ -6949,7 +6960,6 @@ namespace CalamityMod.CalPlayer #endregion #region Frame Effects - public override void FrameEffects() { if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || @@ -7163,6 +7173,20 @@ namespace CalamityMod.CalPlayer damage = (int)newDamage; } + if (CalamityWorld.ironHeart) + { + int damageMin = player.statLifeMax2 / 4; + playSound = false; + hurtSoundTimer = 20; + if (damage < damageMin) + { + damage = damageMin; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartHurt"), (int)player.position.X, (int)player.position.Y); + } + else + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartBigHurt"), (int)player.position.X, (int)player.position.Y); + } + #region MultiplicativeReductions if (trinketOfChiBuff) { @@ -7879,7 +7903,7 @@ namespace CalamityMod.CalPlayer player.lastDeathPostion = player.Center; player.lastDeathTime = DateTime.Now; player.showLastDeath = true; - bool specialDeath = CalamityWorld.ironHeart && areThereAnyDamnBosses; + bool specialDeath = CalamityWorld.ironHeart; int coinsOwned = (int)Utils.CoinsCount(out bool flag, player.inventory, new int[0]); if (Main.myPlayer == player.whoAmI) { @@ -7893,13 +7917,7 @@ namespace CalamityMod.CalPlayer if (Main.myPlayer == player.whoAmI) { player.trashItem.SetDefaults(0, false); - if (specialDeath) - { - player.difficulty = 2; - player.DropItems(); - player.KillMeForGood(); - } - else if (player.difficulty == 0) + if (player.difficulty == 0) { for (int i = 0; i < 59; i++) { @@ -10390,6 +10408,7 @@ namespace CalamityMod.CalPlayer chatText = "Now is not the time!"; return false; } + return true; } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index ad9956bef2..5899716584 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -461,7 +461,7 @@ namespace CalamityMod.CalPlayer player.lifeRegen /= 2; } - if (modPlayer.omegaBlueChestplate || modPlayer.godSlayerCooldown || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (CalamityWorld.ironHeart || modPlayer.omegaBlueChestplate || modPlayer.godSlayerCooldown || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { if (player.lifeRegen > 0) player.lifeRegen = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 6dc3407c00..b0f053fb39 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3305,7 +3305,7 @@ namespace CalamityMod.CalPlayer } // Brimstone Elemental lore inferno potion boost - if (modPlayer.brimstoneElementalLore && player.inferno) + if ((modPlayer.brimstoneElementalLore || modPlayer.ataxiaBlaze) && player.inferno) { const int FramesPerHit = 30; @@ -3799,7 +3799,7 @@ namespace CalamityMod.CalPlayer modPlayer.critStats[0] = player.meleeCrit; modPlayer.critStats[1] = player.rangedCrit; modPlayer.critStats[2] = player.magicCrit; - modPlayer.critStats[3] = modPlayer.throwingCrit; + modPlayer.critStats[3] = player.thrownCrit + modPlayer.throwingCrit; modPlayer.ammoReductionRanged = (int)(100f * (player.ammoBox ? 0.8f : 1f) * (player.ammoPotion ? 0.8f : 1f) * diff --git a/CalamityMod.cs b/CalamityMod.cs index 0cdcda1a3b..82d5a2af85 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -132,7 +132,7 @@ namespace CalamityMod // Boss velocity scaling data structure public static SortedDictionary bossVelocityDamageScaleValues; - public const float velocityScaleMin = 0.66f; + public const float velocityScaleMin = 0.6f; public const float bitingEnemeyVelocityScale = 0.9f; // Lists diff --git a/Items/DifficultyItems/IronHeart.cs b/Items/DifficultyItems/IronHeart.cs index eb3d38a3c2..f8ffeb0442 100644 --- a/Items/DifficultyItems/IronHeart.cs +++ b/Items/DifficultyItems/IronHeart.cs @@ -2,6 +2,7 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,10 +14,10 @@ namespace CalamityMod.Items.DifficultyItems public override void SetStaticDefaults() { DisplayName.SetDefault("Iron Heart"); - Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + + Tooltip.SetDefault("Healing with potions and all life regen is disabled.\n" + + "Enemy damage scales with your max health.\n" + "Can be toggled on and off.\n" + - "Using this while a boss is alive will permanently kill you.\n" + - "Cannot be activated if any boss has been killed."); + "Using this while a boss is alive will instantly kill you and despawn the boss."); } public override void SetDefaults() @@ -32,24 +33,19 @@ namespace CalamityMod.Items.DifficultyItems item.consumable = false; } - public override bool CanUseItem(Player player) - { - return !CalamityWorld.downedBossAny; - } - public override bool UseItem(Player player) { - for (int doom = 0; doom < 200; doom++) - { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) - { - player.KillMeForGood(); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.ironHeart) + for (int doom = 0; doom < Main.npc.Length; doom++) + { + if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || + Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) + { + player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); + Main.npc[doom].active = Main.npc[doom].friendly; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.ironHeart) { CalamityWorld.ironHeart = true; string key = "Mods.CalamityMod.IronHeartText"; 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/Astral/Aries.cs b/NPCs/Astral/Aries.cs index e27be4a2be..7411eedc31 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index a2abc3311a..f3e28b000e 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -293,7 +293,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 1dd8067b76..823eeb5d01 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 81fa114674..caf087f35e 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 3ce951f053..ce8c8f0e40 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -610,7 +610,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index 5c6552fa6c..918c76f0b6 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -147,8 +147,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/EnchantedNightcrawler.cs b/NPCs/Astral/EnchantedNightcrawler.cs index 944a68c4a8..99cb60152e 100644 --- a/NPCs/Astral/EnchantedNightcrawler.cs +++ b/NPCs/Astral/EnchantedNightcrawler.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 1e7216d85b..0e724cb04e 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 2cc7eb6e38..7e5b6ccbb6 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/Hive.cs index c5566554ff..23fe7877e6 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/Hive.cs @@ -121,13 +121,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - //only 1 hive possible. - bool anyHives = NPC.CountNPCS(npc.type) > 0; - if (anyHives) - return 0f; - - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player) || NPC.AnyNPCs(npc.type)) { return 0f; } diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 6a54edbd3c..8f9f7da46d 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -64,39 +64,31 @@ namespace CalamityMod.NPCs.Astral { npc.velocity.X -= acceleration; if (npc.velocity.X > 0) - { npc.velocity.X -= acceleration; - } if (npc.velocity.X < -maxSpeed) - { npc.velocity.X = -maxSpeed; - } } else { npc.velocity.X += acceleration; if (npc.velocity.X < 0) - { npc.velocity.X += acceleration; - } if (npc.velocity.X > maxSpeed) - { npc.velocity.X = maxSpeed; - } } //if need to jump if (npc.velocity.Y == 0f && (HoleBelow() || (npc.collideX && npc.position.X == npc.oldPosition.X))) { - npc.velocity.Y = (CalamityWorld.death ? -7f : -5f); + npc.velocity.Y = CalamityWorld.death ? -7f : -5f; } //check if we can shoot at target. Vector2 vector = npc.Center - target.Center; - if (Math.Abs(vector.Y) < 64f && Math.Abs(vector.X) < 540f && Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + if (vector.Length() < 480f && Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - npc.ai[1]++; - if (npc.ai[1] > (CalamityWorld.death ? 60f : 120f)) + npc.ai[1] += 1f; + if (npc.ai[1] >= (CalamityWorld.death ? 60f : 120f)) { //fire projectile npc.ai[0] = 1f; @@ -106,24 +98,19 @@ namespace CalamityMod.NPCs.Astral } } else - { npc.ai[1] -= 0.5f; - } if (npc.justHit) - { npc.ai[1] -= 60f; - } - if (npc.ai[1] < 0f) npc.ai[1] = 0f; } else { - npc.ai[2]++; + npc.ai[2] += 1f; npc.velocity.X *= 0.95f; - if (npc.ai[2] == 25f) + if (npc.ai[2] >= 20f) { Main.PlaySound(SoundID.Item71, npc.position); Vector2 vector = Main.player[npc.target].Center - npc.Center; @@ -230,7 +217,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 2cd1f5bd17..04ab9247a6 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index b16d5068ce..e8f6cfc624 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -114,8 +114,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index f0ec674ee5..69e8bc6c7a 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index 5ab6f2a60c..1cc77dad77 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index e231efd7a1..7ce2354444 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2872,7 +2872,11 @@ namespace CalamityMod.NPCs { var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)npc2); netMessage.Write(Main.npc[npc2].Calamity().newAI[0]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[1]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[2]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[3]); netMessage.Send(); } @@ -2886,7 +2890,10 @@ namespace CalamityMod.NPCs { var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)npc3); netMessage.Write(Main.npc[npc3].Calamity().newAI[0]); + netMessage.Write(Main.npc[npc3].Calamity().newAI[1]); + netMessage.Write(Main.npc[npc3].Calamity().newAI[2]); netMessage.Write(Main.npc[npc3].Calamity().newAI[3]); netMessage.Send(); } @@ -2993,6 +3000,17 @@ 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((byte)lol); + netMessage.Write(Main.npc[lol].Calamity().newAI[0]); + netMessage.Write(Main.npc[lol].Calamity().newAI[1]); + netMessage.Write(Main.npc[lol].Calamity().newAI[2]); + 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..c6ddf6d2aa 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -1389,7 +1389,7 @@ namespace CalamityMod.NPCs float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); // Count segments remaining - float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); // 2f to 65f + float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); // Percent segments remaining, add two to total for head and tail float lifeRatio = segmentCount / (totalSegments + 2); @@ -1866,7 +1866,7 @@ namespace CalamityMod.NPCs public static int GetEaterOfWorldsSegmentsCountRevDeath() { - return CalamityWorld.death ? 80 : 75; + return (CalamityWorld.death || CalamityWorld.bossRushActive) ? 80 : 75; } #endregion @@ -2522,7 +2522,7 @@ namespace CalamityMod.NPCs public static int GetBrainOfCthuluCreepersCountRevDeath() { - return CalamityWorld.death ? 30 : 25; + return (CalamityWorld.death || CalamityWorld.bossRushActive) ? 30 : 25; } private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) @@ -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/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1f812460ae..612f2d4b7b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -90,9 +90,6 @@ namespace CalamityMod.NPCs public Dictionary flatDRReductions = new Dictionary(); public Dictionary multDRReductions = new Dictionary(); - // Iron Heart (currently unimplemented) - // private int ironHeartDamage = 0; - // Max velocity used in contact damage scaling public float maxVelocity = 0f; @@ -778,11 +775,6 @@ namespace CalamityMod.NPCs } OtherStatChanges(npc); - - if (CalamityWorld.ironHeart) - { - IronHeartChanges(npc); - } } #endregion @@ -801,7 +793,7 @@ namespace CalamityMod.NPCs npc.buffImmune[BuffID.Slow] = true; } - if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) + if (DestroyerIDs.Contains(npc.type) || (EaterofWorldsIDs.Contains(npc.type) && CalamityWorld.bossRushActive) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) { for (int k = 0; k < npc.buffImmune.Length; k++) { @@ -1225,15 +1217,6 @@ namespace CalamityMod.NPCs } #endregion - // TODO -- Change Iron Heart damage in here for Iron Heart mode - #region Iron Heart Changes - private void IronHeartChanges(NPC npc) - { - // Iron Heart damage variable will scale with npc.damage - // ironHeartDamage = 0; - } - #endregion - #region Scale Expert Multiplayer Stats public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale) { @@ -1417,14 +1400,12 @@ namespace CalamityMod.NPCs public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { // Damage reduction on spawn - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + bool destroyerResist = DestroyerIDs.Contains(npc.type) && (CalamityWorld.revenge || CalamityWorld.bossRushActive); + if (destroyerResist || AstrumDeusIDs.Contains(npc.type)) { - if (DestroyerIDs.Contains(npc.type) || AstrumDeusIDs.Contains(npc.type)) + if (newAI[1] < 480f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) { - if (newAI[1] < 480f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) - { - damage *= 0.01; - } + damage *= 0.01; } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 831c712dcc..14735a2027 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -751,7 +751,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void NPCLoot() { // Skip the sentinel phase entirely if DoG has already been killed - CalamityWorld.DoGSecondStageCountdown = CalamityWorld.downedDoG ? 600 : 21600; + CalamityWorld.DoGSecondStageCountdown = (CalamityWorld.downedDoG || CalamityWorld.downedSecondSentinels) ? 600 : 21600; if (Main.netMode == NetmodeID.Server) { diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index 5692d8a2c4..441976927f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -135,10 +135,10 @@ namespace CalamityMod.NPCs.DevourerofGods if (player.dead || CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) { npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y - 3f; + npc.velocity.Y -= 3f; if ((double)npc.position.Y < Main.topWorld + 16f) { - npc.velocity.Y = npc.velocity.Y - 3f; + npc.velocity.Y -= 3f; } if ((double)npc.position.Y < Main.topWorld + 16f) { 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/Signus.cs b/NPCs/Signus/Signus.cs index afad42a2a8..e276f62f9f 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -782,7 +782,11 @@ namespace CalamityMod.NPCs.Signus netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } - } + + // Mark DoG fight sentinels as dead + CalamityWorld.downedSecondSentinels = true; + CalamityMod.UpdateServerBoolean(); + } // Mark Signus as dead CalamityWorld.downedSentinel3 = true; 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/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index 07ff19638f..1c570f4c68 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -63,12 +63,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.localAI[0]); - } + writer.Write(npc.alpha); + } public override void ReceiveExtraAI(BinaryReader reader) { npc.localAI[0] = reader.ReadSingle(); - } + npc.alpha = reader.ReadInt32(); + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { diff --git a/NPCs/Yharon/DetonatingFlare.cs b/NPCs/Yharon/DetonatingFlare.cs index e5aed4aac6..45ff052e60 100644 --- a/NPCs/Yharon/DetonatingFlare.cs +++ b/NPCs/Yharon/DetonatingFlare.cs @@ -32,6 +32,7 @@ namespace CalamityMod.NPCs.Yharon npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; + npc.chaseable = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; npc.alpha = 255; diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs index 4c7178c56b..b36c85873e 100644 --- a/NPCs/Yharon/DetonatingFlare2.cs +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -31,7 +31,8 @@ namespace CalamityMod.NPCs.Yharon npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit52; + npc.chaseable = false; + npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; npc.alpha = 255; } 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/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index d96878a30d..96a616128f 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 20; projectile.height = 20; - projectile.hostile = true; + projectile.scale = 1.5f; + projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Lighting.AddLight(projectile.Center, 0f, 0.15f, 0f); bool flag15 = false; bool flag16 = false; if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) @@ -61,12 +62,12 @@ namespace CalamityMod.Projectiles.Boss num461 *= 0.7f; projectile.ai[0] += 4f; int num462 = 0; - while ((float)num462 < num461) + while (num462 < num461) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + float num463 = Main.rand.Next(-10, 11); + float num464 = Main.rand.Next(-10, 11); + float num465 = Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; @@ -75,9 +76,9 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index b7a4a8a5d7..9355b50714 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 10; projectile.height = 10; - projectile.hostile = true; + projectile.scale = 1.5f; + projectile.hostile = true; projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 300; @@ -28,9 +29,9 @@ namespace CalamityMod.Projectiles.Boss if (projectile.position.Y > projectile.ai[1]) projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); + int num123 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[0] += 1f; if (projectile.ai[0] < 110f && projectile.ai[0] > 30f) { @@ -61,13 +62,13 @@ namespace CalamityMod.Projectiles.Boss spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector11 = new Vector2(Main.projectileTexture[projectile.type].Width / 2, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Width, (float)(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Width, ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type]) * 1f / 2f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Color.Red); Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + null, color, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.png b/Projectiles/Boss/PlagueStingerGoliath.png index 1d5914c74b..0c8fd55607 100644 Binary files a/Projectiles/Boss/PlagueStingerGoliath.png and b/Projectiles/Boss/PlagueStingerGoliath.png differ diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 46be68fdc6..dd2f44e3bc 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 10; projectile.height = 10; + projectile.scale = 1.5f; projectile.hostile = true; projectile.penetrate = -1; projectile.extraUpdates = 2; @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.position.Y > projectile.ai[1]) projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -46,13 +47,13 @@ namespace CalamityMod.Projectiles.Boss spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector11 = new Vector2(Main.projectileTexture[projectile.type].Width / 2, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, (float)(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type]) * 1f / 2f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Color.Red); Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + null, color, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 1c692aa799..6989d1a637 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,25 @@ 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 = modPlayer.critStats[0]; + else if (projectile.ranged) + defCrit = modPlayer.critStats[1]; + else if (projectile.magic) + defCrit = modPlayer.critStats[2]; + else if (rogue) + defCrit = modPlayer.critStats[3]; + else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) + defCrit = 4; + } + + 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 +1053,23 @@ 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 critMax = 100; + int critChance = (int)MathHelper.Clamp(defCrit, 1, critMax); + crit = Main.rand.Next(1, critMax + 1) <= critChance; + + 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 diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 0927822a9d..69aacc2f67 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[projectile.owner] = 8; } } } diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index d742786f82..13a6f07c97 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) + if ((npc.CanBeChasedBy(projectile, false) || (npc.type == NPCID.DukeFishron && (!npc.dontTakeDamage || npc.ai[0] > 9f))) && npc.active) { float extraDistance = (npc.width / 2) + (npc.height / 2); diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index ccb0c8ee0b..78b91179df 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -160,7 +160,8 @@ namespace CalamityMod.World public static bool downedSentinel1 = false; // Ceaseless Void public static bool downedSentinel2 = false; // Storm Weaver public static bool downedSentinel3 = false; // Signus, Envoy of the Devourer - public static bool downedPolterghast = false; + public static bool downedSecondSentinels = false; + public static bool downedPolterghast = false; public static bool downedDoG = false; public static bool downedBumble = false; public static bool buffedEclipse = false; @@ -250,6 +251,7 @@ namespace CalamityMod.World downedGSS = false; downedBuffedMothron = false; downedBoomerDuke = false; + downedSecondSentinels = false; death = false; defiled = false; armageddon = false; @@ -298,6 +300,8 @@ namespace CalamityMod.World downed.Add("stormWeaver"); if (downedSentinel3) downed.Add("signus"); + if (downedSecondSentinels) + downed.Add("secondSentinels"); if (downedYharon) downed.Add("yharon"); if (buffedEclipse) @@ -404,6 +408,7 @@ namespace CalamityMod.World downedSentinel1 = downed.Contains("ceaselessVoid"); downedSentinel2 = downed.Contains("stormWeaver"); downedSentinel3 = downed.Contains("signus"); + downedSecondSentinels = downed.Contains("secondSentinels"); downedYharon = downed.Contains("yharon"); buffedEclipse = downed.Contains("eclipse"); downedSCal = downed.Contains("supremeCalamitas"); @@ -528,7 +533,7 @@ namespace CalamityMod.World BitsByte flags8 = reader.ReadByte(); forcedRainAlready = flags8[0]; forcedDownpourWithTear = flags8[1]; - _ = flags8[2]; + downedSecondSentinels = flags8[2]; _ = flags8[3]; _ = flags8[4]; _ = flags8[5]; @@ -619,7 +624,7 @@ namespace CalamityMod.World BitsByte flags8 = new BitsByte(); flags8[0] = forcedRainAlready; flags8[1] = forcedDownpourWithTear; - flags8[2] = false; + flags8[2] = downedSecondSentinels; flags8[3] = false; flags8[4] = false; flags8[5] = false; @@ -716,7 +721,7 @@ namespace CalamityMod.World BitsByte flags8 = reader.ReadByte(); forcedRainAlready = flags8[0]; forcedDownpourWithTear = flags8[1]; - _ = flags8[2]; + downedSecondSentinels = flags8[2]; _ = flags8[3]; _ = flags8[4]; _ = flags8[5];