diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 0b3fd7e8b2..471aa614a0 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -368,15 +368,6 @@ namespace CalamityMod.CalPlayer (modPlayer.cShard ? 50 : 0) + (modPlayer.starBeamRye ? 50 : 0); - // True melee damage bonuses - double damageAdd = (modPlayer.dodgeScarf ? 0.2 : 0) + - (modPlayer.evasionScarf ? 0.1 : 0) + - ((modPlayer.aBulwarkRare && modPlayer.aBulwarkRareMeleeBoostTimer > 0) ? 2 : 0) + - (modPlayer.DoGLore ? 0.5 : 0) + - (modPlayer.fungalSymbiote ? 0.25 : 0) + - ((player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves) ? 0.3 : 0); - modPlayer.trueMeleeDamage += damageAdd; - // Life Steal nerf // Reduces normal mode life steal recovery rate from 0.6/s to 0.5/s // Reduces expert mode life steal recovery rate from 0.5/s to 0.35/s @@ -2863,13 +2854,13 @@ namespace CalamityMod.CalPlayer player.minionKB += floatTypeBoost; player.moveSpeed += floatTypeBoost; if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 1.15); + player.wingTimeMax = (int)(player.wingTimeMax * 1.15); } if (modPlayer.ravagerLore) { if (player.wingTimeMax > 0) - player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); + player.wingTimeMax = (int)(player.wingTimeMax * 0.5); player.allDamage += 0.1f; } @@ -3086,7 +3077,7 @@ namespace CalamityMod.CalPlayer float arg = player.position.X - Main.player[myPlayer].position.X; float num3 = player.position.Y - Main.player[myPlayer].position.Y; - if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) + if ((float)Math.Sqrt(arg * arg + num3 * num3) < 800f) Main.player[myPlayer].AddBuff(43, 20, true); } } @@ -3111,7 +3102,7 @@ namespace CalamityMod.CalPlayer float arg = player.position.X - Main.player[myPlayer].position.X; float num3 = player.position.Y - Main.player[myPlayer].position.Y; - if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 800f) + if ((float)Math.Sqrt(arg * arg + num3 * num3) < 800f) Main.player[myPlayer].AddBuff(43, 20, true); } } @@ -3174,7 +3165,7 @@ namespace CalamityMod.CalPlayer modPlayer.bloodflareSummonTimer = 900; for (int I = 0; I < 3; I++) { - float ai1 = (float)(I * 120); + float ai1 = I * 120; Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(I * 120) * 550), player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, ModContent.ProjectileType(), (int)((modPlayer.auricSet ? 15000f : 5000f) * player.MinionDamage()), 1f, player.whoAmI, ai1, 0f); } @@ -3184,7 +3175,6 @@ namespace CalamityMod.CalPlayer if (modPlayer.yInsignia) { player.longInvince = true; - player.kbGlove = true; player.meleeDamage += 0.05f; player.lavaMax += 240; if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) @@ -3362,17 +3352,17 @@ namespace CalamityMod.CalPlayer player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[BuffID.Poisoned] = true; player.buffImmune[BuffID.Venom] = true; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) { player.allDamage += 0.06f; modPlayer.AllCritBoost(3); } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) { player.allDamage += 0.06f; modPlayer.AllCritBoost(3); } - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.25)) { player.allDamage += 0.06f; modPlayer.AllCritBoost(3); @@ -3386,7 +3376,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.auricSet && modPlayer.silvaMelee) { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; + double multiplier = player.statLife / (double)player.statLifeMax2; player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times } @@ -3415,6 +3405,7 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(232f * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); } } + if (modPlayer.pArtifact) { if (player.whoAmI == Main.myPlayer) @@ -3443,6 +3434,7 @@ namespace CalamityMod.CalPlayer } } } + if (modPlayer.profanedCrystalBuffs && modPlayer.gOffense && modPlayer.gDefense) { if (player.whoAmI == Main.myPlayer) @@ -3464,7 +3456,7 @@ namespace CalamityMod.CalPlayer player.moveSpeed += 0.25f; player.statDefense -= 15; if (!player.Calamity().yharonLore) - player.wingTimeMax = (int)((float)player.wingTimeMax * 1.1f); + player.wingTimeMax = (int)(player.wingTimeMax * 1.1f); player.ignoreWater = true; } else @@ -3474,7 +3466,7 @@ namespace CalamityMod.CalPlayer player.statDefense += 15; player.lifeRegen += 5; } - bool enrage = player.statLife <= (int)((double)player.statLifeMax2 * 0.5); + bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); bool notRetro = Lighting.NotRetro; if (!modPlayer.ZoneAbyss) //No abyss memes. Lighting.AddLight(player.Center, enrage ? 60 : offenseBuffs ? 50 : 10, enrage ? 12 : offenseBuffs ? 10 : 2, 0); @@ -3577,12 +3569,12 @@ namespace CalamityMod.CalPlayer Vector2 velocity = Main.MouseWorld - startPos; if (player.gravDir == -1f) { - velocity.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - startPos.Y; + velocity.Y = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - startPos.Y; } float travelDist = velocity.Length(); if ((float.IsNaN(velocity.X) && float.IsNaN(velocity.Y)) || (velocity.X == 0f && velocity.Y == 0f)) { - velocity.X = (float)player.direction; + velocity.X = player.direction; velocity.Y = 0f; travelDist = shootSpeed; } @@ -3594,11 +3586,11 @@ namespace CalamityMod.CalPlayer int laserAmt = Main.rand.Next(2); for (int index = 0; index < laserAmt; index++) { - startPos = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - startPos.X = (startPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - startPos.Y -= (float)(100 * index); - velocity.X = (float)Main.mouseX + Main.screenPosition.X - startPos.X; - velocity.Y = (float)Main.mouseY + Main.screenPosition.Y - startPos.Y; + startPos = new Vector2(player.Center.X + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + startPos.X = (startPos.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); + startPos.Y -= 100 * index; + velocity.X = Main.mouseX + Main.screenPosition.X - startPos.X; + velocity.Y = Main.mouseY + Main.screenPosition.Y - startPos.Y; if (velocity.Y < 0f) { velocity.Y *= -1f; @@ -3611,8 +3603,8 @@ namespace CalamityMod.CalPlayer travelDist = shootSpeed / travelDist; velocity.X *= travelDist; velocity.Y *= travelDist; - velocity.X += (float)Main.rand.Next(-50, 51) * 0.02f; - velocity.Y += (float)Main.rand.Next(-50, 51) * 0.02f; + velocity.X += Main.rand.Next(-50, 51) * 0.02f; + velocity.Y += Main.rand.Next(-50, 51) * 0.02f; int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, Main.rand.Next(10)); Main.projectile[laser].localNPCHitCooldown = 5; } @@ -3644,8 +3636,8 @@ namespace CalamityMod.CalPlayer new Color(255, 0, 255, 50), //Fuschia new Color(255, 0, 128, 50) //Hot Pink }); - Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2((float)player.width / 2f, (float)player.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + player.Center; + Vector2 vector6 = Vector2.Normalize(player.velocity) * new Vector2(player.width / 2f, player.height) * 0.75f; + vector6 = vector6.RotatedBy((dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + player.Center; Vector2 vector7 = vector6 - player.Center; int dusty = Dust.NewDust(vector6 + vector7, 0, 0, 267, vector7.X * 1f, vector7.Y * 1f, 100, color, 1f); Main.dust[dusty].noGravity = true; @@ -3677,6 +3669,19 @@ namespace CalamityMod.CalPlayer if (CalamityConfig.Instance.Proficiency) modPlayer.GetStatBonuses(); + + // True melee damage bonuses + double damageAdd = (modPlayer.dodgeScarf ? 0.2 : 0) + + (modPlayer.evasionScarf ? 0.1 : 0) + + ((modPlayer.aBulwarkRare && modPlayer.aBulwarkRareMeleeBoostTimer > 0) ? 1 : 0) + + (modPlayer.DoGLore ? 0.5 : 0) + + (modPlayer.fungalSymbiote ? 0.25 : 0) + + ((player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves) ? 0.3 : 0) + + (player.kbGlove ? 0.25 : 0) + + (modPlayer.eGauntlet ? 0.1 : 0) + + (modPlayer.yInsignia ? 0.1 : 0) + + (modPlayer.badgeOfBraveryRare ? 0.2 : 0); + modPlayer.trueMeleeDamage += damageAdd; } #endregion diff --git a/CalamityMod.cs b/CalamityMod.cs index 8de673ddba..b8feefedc3 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -63,6 +63,7 @@ using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; @@ -136,6 +137,7 @@ namespace CalamityMod // Lists public static IList donatorList; + public static List trueMeleeProjectileList; // DO NOT, EVER, DELETE THIS LIST, OR I WILL COME FOR YOU :D public static List rangedProjectileExceptionList; public static List projectileDestroyExceptionList; public static List projectileMinionList; @@ -361,6 +363,7 @@ namespace CalamityMod bossVelocityDamageScaleValues = null; donatorList = null; + trueMeleeProjectileList = null; rangedProjectileExceptionList = null; projectileDestroyExceptionList = null; projectileMinionList = null; @@ -615,7 +618,87 @@ namespace CalamityMod "RKMoon" }; - rangedProjectileExceptionList = new List() + trueMeleeProjectileList = new List() + { + // Vanilla shit + ProjectileID.Spear, + ProjectileID.Trident, + ProjectileID.TheRottedFork, + ProjectileID.Swordfish, + ProjectileID.Arkhalis, + ProjectileID.DarkLance, + ProjectileID.CobaltNaginata, + ProjectileID.PalladiumPike, + ProjectileID.MythrilHalberd, + ProjectileID.OrichalcumHalberd, + ProjectileID.AdamantiteGlaive, + ProjectileID.TitaniumTrident, + ProjectileID.MushroomSpear, + ProjectileID.Gungnir, + ProjectileID.ObsidianSwordfish, + ProjectileID.ChlorophytePartisan, + ProjectileID.MonkStaffT1, + ProjectileID.MonkStaffT2, + ProjectileID.MonkStaffT3, + ProjectileID.NorthPoleWeapon, + + // Tools + ProjectileID.CobaltDrill, + ProjectileID.MythrilDrill, + ProjectileID.AdamantiteDrill, + ProjectileID.PalladiumDrill, + ProjectileID.OrichalcumDrill, + ProjectileID.TitaniumDrill, + ProjectileID.ChlorophyteDrill, + ProjectileID.CobaltChainsaw, + ProjectileID.MythrilChainsaw, + ProjectileID.AdamantiteChainsaw, + ProjectileID.PalladiumChainsaw, + ProjectileID.OrichalcumChainsaw, + ProjectileID.TitaniumChainsaw, + ProjectileID.ChlorophyteChainsaw, + ProjectileID.VortexDrill, + ProjectileID.VortexChainsaw, + ProjectileID.NebulaDrill, + ProjectileID.NebulaChainsaw, + ProjectileID.SolarFlareDrill, + ProjectileID.SolarFlareChainsaw, + ProjectileID.StardustDrill, + ProjectileID.StardustChainsaw, + ProjectileID.Hamdrax, + ProjectileID.ChlorophyteJackhammer, + ProjectileID.SawtoothShark, + ProjectileID.ButchersChainsaw, + + // Calamity shit + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }; + + rangedProjectileExceptionList = new List() { ProjectileID.Phantasm, ProjectileID.VortexBeater, diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index daf2600bb2..d42ed72689 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Elemental Gauntlet"); Tooltip.SetDefault("Melee attacks and projectiles inflict most debuffs\n" + "15% increased melee speed, damage, and 5% increased melee critical strike chance\n" + + "35% increased true melee damage\n" + "Increased invincibility after taking damage\n" + "Temporary immunity to lava\n" + "Increased melee knockback\n" + diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index d382fc8b19..15c2f0e62f 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Hide of Astrum Deus"); - Tooltip.SetDefault("Taking damage drops an immense amount of astral stars from the sky and boosts true melee damage by 200% for a time\n" + + Tooltip.SetDefault("Taking damage drops an immense amount of astral stars from the sky and boosts true melee damage by 100% for a time\n" + "Boost duration is based on the amount of damage you took, the higher the damage the longer the boost\n" + "Provides immunity to the astral infection, cursed inferno, on fire, and frostburn debuffs\n" + "Enemies take damage when they hit you and are inflicted with the astral infection debuff"); diff --git a/Items/Accessories/SamuraiBadge.cs b/Items/Accessories/SamuraiBadge.cs index 94eeab7dd8..b1586154e7 100644 --- a/Items/Accessories/SamuraiBadge.cs +++ b/Items/Accessories/SamuraiBadge.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Samurai Badge"); - Tooltip.SetDefault("20% increased melee damage and speed\n" + - "Reduces max life by 25%"); + Tooltip.SetDefault("20% increased melee and true melee damage and speed\n" + + "Reduces max life by 25%"); } public override void SetDefaults() diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 0c596447c4..4965203c9f 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Yharim's Insignia"); Tooltip.SetDefault("10% increased damage when under 50% life\n" + "10% increased melee speed\n" + - "5% increased melee damage\n" + + "5% increased melee damage and 10% increased true melee damage\n" + "Melee attacks and melee projectiles inflict holy fire\n" + "Increased invincibility after taking damage\n" + "Temporary immunity to lava\n" + diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 5926b9bd74..f9f9e257c4 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1149,8 +1149,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Teleports you to the position of the mouse\n" + - "Teleportation is disabled while Chaos State is active"; + line2.text += "\nTeleportation is disabled while Chaos State is active"; } } } @@ -1160,8 +1159,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Capable of soaking up an endless amount of water\n" + - "Cannot be used in the Abyss"; + line2.text += "\nCannot be used in the Abyss"; } } } @@ -1171,8 +1169,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Defense") { - line2.text = "1 defense\n" + - "Cannot be used in the Abyss"; + line2.text += "\nCannot be used in the Abyss"; } } } @@ -1182,8 +1179,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a heart to provide light\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1193,8 +1189,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Creates a magical shadow orb\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1204,8 +1199,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a magic lantern that exposes nearby treasure\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1215,8 +1209,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Provides light under water and extra mobility on ice\n" + - "Provides a small amount of light in the abyss\n" + + line2.text += "\nProvides a small amount of light in the abyss\n" + "Moderately reduces breath loss in the abyss"; } } @@ -1227,8 +1220,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Provides light under water\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1238,8 +1230,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Provides light under water\n" + - "Provides a small amount of light in the abyss"; + line2.text += "\nProvides a small amount of light in the abyss"; } } } @@ -1249,8 +1240,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a magical fairy\n" + - "Provides a moderate amount of light in the abyss"; + line2.text += "\nProvides a moderate amount of light in the abyss"; } } } @@ -1260,8 +1250,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a pet flickerwick to provide light\n" + - "Provides a moderate amount of light in the abyss"; + line2.text += "\nProvides a moderate amount of light in the abyss"; } } } @@ -1271,8 +1260,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "BuffTime") { - line2.text = "5 minute duration\n" + - "Provides a moderate amount of light in the abyss"; + line2.text += "\nProvides a moderate amount of light in the abyss"; } } } @@ -1282,8 +1270,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Summons a Wisp to provide light\n" + - "Provides a large amount of light in the abyss"; + line2.text += "\nProvides a large amount of light in the abyss"; } } } @@ -1293,8 +1280,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "'I know what you're thinking...'\n" + - "Provides a large amount of light in the abyss"; + line2.text += "\nProvides a large amount of light in the abyss"; } } } @@ -1304,8 +1290,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "BuffTime") { - line2.text = "2 minute duration\n" + - "Greatly reduces breath loss in the abyss"; + line2.text += "\nGreatly reduces breath loss in the abyss"; } } } @@ -1315,30 +1300,17 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Greatly extends underwater breathing\n" + - "Moderately reduces breath loss in the abyss"; + line2.text += "\nModerately reduces breath loss in the abyss"; } } } - if (item.type == ItemID.NeptunesShell) + if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Transforms the holder into merfolk when entering water\n" + - "Greatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.MoonShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Turns the holder into a werewolf at night and a merfolk when entering water\n" + - "Greatly reduces breath loss in the abyss"; + line2.text += "\nGreatly reduces breath loss in the abyss"; } } } @@ -1348,8 +1320,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Minor increases to all stats\n" + - "Greatly reduces breath loss in the abyss"; + line2.text += "\nGreatly reduces breath loss in the abyss"; } } } @@ -1359,8 +1330,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Reduces damage from cold sources\n" + - "Makes you immune to the Chilled, Frozen, and Glacial State debuffs\n" + + line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs\n" + "Provides cold protection in Death Mode"; } } @@ -1455,13 +1425,44 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.FireGauntlet) + if (item.type == ItemID.TitanGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text += "\n25% increased true melee damage"; + } + } + } + if (item.type == ItemID.PowerGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\n25% increased true melee damage"; + } + } + } + if (item.type == ItemID.MechanicalGlove) + { + foreach (TooltipLine line2 in tooltips) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text += "\n25% increased true melee damage"; + } + } + } + if (item.type == ItemID.FireGauntlet) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { line2.text = "14% increased melee damage and speed\n" + + "25% increased true melee damage\n" + "Provides heat and cold protection in Death Mode"; } } @@ -1518,8 +1519,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Provides 7 seconds of immunity to lava\n" + - "Provides heat protection in Death Mode"; + line2.text += "\nProvides heat protection in Death Mode"; } } } @@ -1529,8 +1529,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Grants immunity to fire blocks and 7 seconds of immunity to lava\n" + - "Provides heat protection in Death Mode"; + line2.text += "\nProvides heat protection in Death Mode"; } } } @@ -1540,8 +1539,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Grants invisibility\n" + - "Boosts certain stats when holding certain types of rogue weapons"; + line2.text += "\nBoosts certain stats when holding certain types of rogue weapons"; } } } @@ -1562,8 +1560,8 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "Capable of mining Lihzahrd Bricks\n" + - "Also capable of mining Scoria Ore found in the Abyss"; + // I'm leaving this intentionally ambiguous so that people have to search for Scoria Ore + line2.text = "Capable of mining Lihzahrd Bricks and Scoria Ore"; } } } @@ -1717,17 +1715,6 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: 17% extra melee damage\n" + - "30% extra true melee damage"; - } - } - } if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) { if (!Main.player[Main.myPlayer].Calamity().forbiddenCirclet) @@ -1736,8 +1723,7 @@ namespace CalamityMod.Items { if (line2.mod == "Terraria" && line2.Name == "SetBonus") { - line2.text = "Set Bonus: Double tap " + (Main.ReversedUpDownArmorSetBonuses ? "UP" : "DOWN") + " to call an ancient storm to the cursor location\n" + - "Minions deal full damage while wielding magic weapons"; + line2.text += "\nMinions deal full damage while wielding magic weapons"; } } } @@ -1808,13 +1794,14 @@ namespace CalamityMod.Items } } } - if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) + if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) { foreach (TooltipLine line2 in tooltips) { if (line2.mod == "Terraria" && line2.Name == "SetBonus") { line2.text = @"Set Bonus: 17% extra melee damage +30% extra true melee damage Grants immunity to fire blocks, and temporary immunity to lava Provides heat and cold protection in Death Mode"; } diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index feeae155ec..b4158783dd 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -101,8 +101,8 @@ namespace CalamityMod.NPCs.Calamitas { if (NPC.CountNPCS(ModContent.NPCType()) < 3) { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 25)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 25)); + int x = (int)(npc.position.X + Main.rand.Next(npc.width - 25)); + int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 25)); int num663 = ModContent.NPCType(); int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); } @@ -116,7 +116,7 @@ namespace CalamityMod.NPCs.Calamitas timer = 0; } NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; - double deg = (double)npc.ai[1]; + double deg = npc.ai[1]; double rad = deg * (Math.PI / 180); double dist = 150; npc.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index d9242c463f..4919dfd7ca 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -919,7 +919,7 @@ namespace CalamityMod.NPCs float radialOffset = 0.2f; float diameter = 80f; - vectorCenter.Y -= Math.Abs(vectorCenter.X) * radialOffset; + //vectorCenter.Y -= Math.Abs(vectorCenter.X) * radialOffset; vectorCenter = Vector2.Normalize(vectorCenter) * projectileSpeed; Vector2 velocity = vectorCenter; @@ -972,19 +972,7 @@ namespace CalamityMod.NPCs Vector2 source = new Vector2(vectorCenter.X + (npc.spriteDirection > 0 ? 34f : -34f), vectorCenter.Y - 74f); Vector2 aimAt = player.Center + player.velocity * 20f; - float aimResponsiveness = 0.4f; - - switch ((int)npc.ai[2]) - { - case 0: - break; - case 1: - aimResponsiveness = 0.25f; - break; - case 2: - aimResponsiveness = 0.1f; - break; - } + float aimResponsiveness = (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; Vector2 aimVector = Vector2.Normalize(aimAt - source); if (aimVector.HasNaNs()) @@ -999,6 +987,9 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[1] = laserVelocity.X; calamityGlobalNPC.newAI[2] = laserVelocity.Y; + // Rev = 190 + 165 = 355 + // Death = 165 + npc.ai[1] += 1f; if (npc.ai[1] >= 240f) { @@ -1006,7 +997,7 @@ namespace CalamityMod.NPCs npc.ai[2] += 1f; npc.localAI[0] = 0f; npc.localAI[1] = 0f; - if (npc.ai[2] >= 3f) + if (npc.ai[2] >= (death ? 1f : 2f)) { npc.ai[0] = 3f; npc.ai[1] = 0f; @@ -1035,18 +1026,15 @@ namespace CalamityMod.NPCs } else { - float playSoundTimer = 20f; + float playSoundTimer = 30f; if (npc.ai[1] < 150f) { switch ((int)npc.ai[2]) { case 0: + npc.ai[1] += 0.5f; break; case 1: - npc.ai[1] += 0.5f; - playSoundTimer = 30f; - break; - case 2: npc.ai[1] += 1f; playSoundTimer = 40f; break; @@ -1297,6 +1285,14 @@ namespace CalamityMod.NPCs num823 += 1f; num824 += 0.02f; } + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num824 *= 0.5f; + } + if (provy) { num823 *= 1.25f; @@ -1432,6 +1428,14 @@ namespace CalamityMod.NPCs num832 += 1f; num833 += 0.02f; } + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num833 *= 0.5f; + } + if (provy) { num832 *= 1.25f; @@ -2345,8 +2349,10 @@ namespace CalamityMod.NPCs // Start up if (npc.ai[0] == 0f) { - // If hit or after two seconds start Idle phase - npc.ai[1] += 1f; + CustomGravity(); + + // If hit or after two seconds start Idle phase + npc.ai[1] += 1f; if (npc.justHit || npc.ai[1] >= 120f) { // Set AI to next phase (Idle) and reset other AI @@ -2359,8 +2365,10 @@ namespace CalamityMod.NPCs // Idle else if (npc.ai[0] == 1f) { - // Decrease defense - npc.defense = 0; + CustomGravity(); + + // Decrease defense + npc.defense = 0; // Slow down npc.velocity.X *= 0.98f; @@ -2469,7 +2477,10 @@ namespace CalamityMod.NPCs // Jump else if (npc.ai[0] == 3f) { - npc.noTileCollide = false; + CustomGravity(); + + npc.noTileCollide = false; + if (npc.velocity.Y == 0f) { // Slow down @@ -2492,8 +2503,6 @@ namespace CalamityMod.NPCs if (revenge) { - calamityGlobalNPC.newAI[0] = 0f; - if (distanceBelowTarget > 0f) calamityGlobalNPC.newAI[0] = 1f + distanceBelowTarget * 0.001f; @@ -2541,8 +2550,10 @@ namespace CalamityMod.NPCs else npc.ai[0] = 3f; - // Spawn dust for visual effect - for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) + calamityGlobalNPC.newAI[0] = 0f; + + // Spawn dust for visual effect + for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) { for (int num623 = 0; num623 < 4; num623++) { @@ -2581,10 +2592,12 @@ namespace CalamityMod.NPCs } else { - if (npc.direction < 0) - npc.velocity.X -= 0.2f; + float velocityXChange = 0.02f + Math.Abs(npc.Center.X - player.Center.X) * 0.0005f; + + if (npc.direction < 0) + npc.velocity.X -= velocityXChange; else if (npc.direction > 0) - npc.velocity.X += 0.2f; + npc.velocity.X += velocityXChange; float num626 = CalamityWorld.bossRushActive ? 12f : 9f; if (expertMode) @@ -2596,29 +2609,7 @@ namespace CalamityMod.NPCs npc.velocity.X = num626; } - // Custom gravity - float gravity = 0.3f; - float maxFallSpeed = 10f; - if (npc.wet) - { - if (npc.honeyWet) - { - gravity *= 0.33f; - maxFallSpeed *= 0.4f; - } - else - { - gravity *= 0.66f; - maxFallSpeed *= 0.7f; - } - } - - if (calamityGlobalNPC.newAI[0] > 1f) - maxFallSpeed *= calamityGlobalNPC.newAI[0]; - - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; + CustomGravity(); } } @@ -2754,6 +2745,32 @@ namespace CalamityMod.NPCs Main.dust[num244].velocity *= 0.5f; } } + + void CustomGravity() + { + float gravity = 0.3f; + float maxFallSpeed = 10f; + if (npc.wet) + { + if (npc.honeyWet) + { + gravity *= 0.33f; + maxFallSpeed *= 0.4f; + } + else + { + gravity *= 0.66f; + maxFallSpeed *= 0.7f; + } + } + + if (calamityGlobalNPC.newAI[0] > 1f) + maxFallSpeed *= calamityGlobalNPC.newAI[0]; + + npc.velocity.Y += gravity; + if (npc.velocity.Y > maxFallSpeed) + npc.velocity.Y = maxFallSpeed; + } } #endregion @@ -2846,28 +2863,7 @@ namespace CalamityMod.NPCs Main.npc[npc3].velocity = Vector2.Normalize(player.Center - Main.npc[npc3].Center) * 16f; Main.npc[npc3].timeLeft *= 20; Main.npc[npc3].netUpdate = true; - //NPC.SpawnOnPlayer(npc.FindClosestPlayer(), npc.type); - //NPC.SpawnOnPlayer(npc.FindClosestPlayer(), npc.type); } - - /*for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].Calamity().newAI[0] == 0f && Main.npc[i].type == npc.type && i != npc.whoAmI) - { - Main.npc[i].Calamity().newAI[0] = calamityGlobalNPC.newAI[0] + 1f; - - if (Main.npc[i].Calamity().newAI[0] == 2f) - Main.npc[i].Calamity().newAI[3] = 600f; - - Main.npc[i].velocity = Vector2.Normalize(player.Center - Main.npc[i].Center) * 16f; - - Main.npc[i].netUpdate = true; - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 2f) - break; - } - }*/ } for (int i = 0; i < Main.maxNPCs; i++) @@ -3040,7 +3036,7 @@ namespace CalamityMod.NPCs if (Main.player[m].active) { Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, height); - if (rectangle.Intersects(rectangle2)) + if (rectangle.Intersects(rectangle2) || revenge) { flag3 = false; break; @@ -3093,6 +3089,14 @@ namespace CalamityMod.NPCs speed *= speedMultiplier; } + if (revenge) + { + float revMultiplier = 1.1f; + speed *= revMultiplier; + turnSpeed *= revMultiplier; + fallSpeed *= revMultiplier; + } + if (CalamityWorld.bossRushActive) { speed *= 1.25f; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index d54805a424..bb8b082c92 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -2640,22 +2640,10 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - float num617 = npc.ai[1]; int num618; - do - { - num618 = Main.rand.Next(3); - switch (num618) - { - case 1: - num618 = 2; - break; - case 2: - num618 = 3; - break; - } - } - while ((float)num618 == num617); + do num618 = Main.rand.Next(4); + while (num618 == npc.ai[1] || num618 == 1); + npc.ai[0] = num618; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -2696,7 +2684,7 @@ namespace CalamityMod.NPCs if (npc.life < npc.lifeMax * 0.1 || death) speed += 2f; - speed += 8f * (float)enrageScale; + speed += 8f * enrageScale; // Line up and initiate charge if (npc.ai[1] % 2f == 0f) @@ -2704,7 +2692,7 @@ namespace CalamityMod.NPCs // Get target and initiate charge npc.TargetClosest(true); float num620 = 20f; - num620 += (float)(20 * enrageScale); + num620 += 20 * enrageScale; if (Math.Abs(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2))) < num620) { // Set AI variables and speed @@ -2751,8 +2739,8 @@ namespace CalamityMod.NPCs num602 += 2f; num603 += 0.1f; } - num602 += (float)(3 * enrageScale); - num603 += 0.5f * (float)enrageScale; + num602 += 3 * enrageScale; + num603 += 0.5f * enrageScale; // Velocity calculations if (npc.position.Y + (npc.height / 2) < Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2)) @@ -2815,7 +2803,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 1f; flag35 = true; } - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num604 * 1.5f) + if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > num604 * 1.5f) { npc.ai[2] = 1f; flag35 = true; @@ -2860,7 +2848,6 @@ namespace CalamityMod.NPCs npc.velocity *= 0.9f; num606 += 0.05f; } - if (enrageScale > 0) npc.velocity *= 0.7f; @@ -3043,8 +3030,9 @@ namespace CalamityMod.NPCs if (npc.ai[2] > 3f) { npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; } } @@ -3059,11 +3047,11 @@ namespace CalamityMod.NPCs float num623 = (float)Math.Sqrt(num621 * num621 + num622 * num622); npc.ai[1] += 1f; - int num650 = ((npc.life < npc.lifeMax * 0.25) ? 15 : ((npc.life < npc.lifeMax * 0.5) ? 20 : ((npc.life < npc.lifeMax * 0.75) ? 25 : 30))); + int num650 = (npc.life < npc.lifeMax * 0.25) ? 15 : ((npc.life < npc.lifeMax * 0.5) ? 20 : ((npc.life < npc.lifeMax * 0.75) ? 25 : 30)); num650 -= 5 * enrageScale; // Fire stingers - if (npc.ai[1] % (float)num650 == (float)(num650 - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + if (npc.ai[1] % num650 == (num650 - 1) && npc.position.Y + npc.height < Main.player[npc.target].position.Y && Collision.CanHit(vector78, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { Main.PlaySound(SoundID.Item17, npc.position); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -3071,7 +3059,7 @@ namespace CalamityMod.NPCs float num624 = CalamityWorld.bossRushActive ? 16f : 12f; if (npc.life < npc.lifeMax * 0.33 || death) num624 += 3f; - num624 += (float)(7 * enrageScale); + num624 += 7 * enrageScale; float num625 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector78.X; float num626 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector78.Y; @@ -3091,7 +3079,7 @@ namespace CalamityMod.NPCs // Movement calculations float num620 = CalamityWorld.bossRushActive ? 0.1f : 0.075f; - num620 += 0.2f * (float)enrageScale; + num620 += 0.2f * enrageScale; if (!Collision.CanHit(new Vector2(vector78.X, vector78.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { num620 = CalamityWorld.bossRushActive ? 0.125f : 0.1f; @@ -3158,9 +3146,7 @@ namespace CalamityMod.NPCs } // Go to a random phase - float num660 = 20f; - num660 -= (float)(5 * enrageScale); - if (npc.ai[1] > (float)num650 * num660) + if (npc.ai[1] > num650 * 15f) { npc.ai[0] = -1f; npc.ai[1] = 3f; @@ -4932,10 +4918,319 @@ namespace CalamityMod.NPCs return false; } - #endregion + #endregion - #region Buffed Twins AI - public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod, bool chaos) + // Only used for Normal and Expert Mode + #region True Melee Retinazer Phase 2 AI + public static bool TrueMeleeRetinazerPhase2AI(NPC npc) + { + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(); + } + bool dead2 = Main.player[npc.target].dead; + float num399 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); + float num400 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + float num401 = (float)Math.Atan2(num400, num399) + 1.57f; + if (num401 < 0f) + { + num401 += MathHelper.TwoPi; + } + else if (num401 > MathHelper.TwoPi) + { + num401 -= MathHelper.TwoPi; + } + float num402 = 0.1f; + if (npc.rotation < num401) + { + if ((double)(num401 - npc.rotation) > MathHelper.Pi) + { + npc.rotation -= num402; + } + else + { + npc.rotation += num402; + } + } + else if (npc.rotation > num401) + { + if ((double)(npc.rotation - num401) > MathHelper.Pi) + { + npc.rotation += num402; + } + else + { + npc.rotation -= num402; + } + } + if (npc.rotation > num401 - num402 && npc.rotation < num401 + num402) + { + npc.rotation = num401; + } + if (npc.rotation < 0f) + { + npc.rotation += MathHelper.TwoPi; + } + else if (npc.rotation > MathHelper.TwoPi) + { + npc.rotation -= MathHelper.TwoPi; + } + if (npc.rotation > num401 - num402 && npc.rotation < num401 + num402) + { + npc.rotation = num401; + } + if (Main.rand.Next(5) == 0) + { + int num403 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + npc.height * 0.25f), npc.width, (int)(npc.height * 0.5f), 5, npc.velocity.X, 2f); + Main.dust[num403].velocity.X *= 0.5f; + Main.dust[num403].velocity.Y *= 0.1f; + } + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) + { + for (int num381 = 0; num381 < Main.maxNPCs; num381++) + { + if (num381 != npc.whoAmI && Main.npc[num381].active && (Main.npc[num381].type == NPCID.Retinazer || Main.npc[num381].type == NPCID.Spazmatism) && Main.npc[num381].timeLeft - 1 > npc.timeLeft) + npc.timeLeft = Main.npc[num381].timeLeft - 1; + + } + } + if (Main.dayTime | Main.player[npc.target].dead) + { + npc.velocity.Y -= 0.04f; + if (npc.timeLeft > 10) + npc.timeLeft = 10; + return false; + } + if (npc.ai[0] == 3f) + { + npc.damage = (int)(npc.defDamage * 1.5); + npc.defense = npc.defDefense + 10; + npc.HitSound = SoundID.NPCHit4; + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (npc.ai[1] == 0f) + { + float num421 = 8f; + float num422 = 0.15f; + if (Main.expertMode) + { + num421 = 9.5f; + num422 = 0.175f; + } + // Reduce acceleration if target is holding a true melee weapon + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num422 *= 0.5f; + } + Vector2 vector39 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num423 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector39.X; + float num424 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector39.Y; + float num425 = (float)Math.Sqrt(num423 * num423 + num424 * num424); + num425 = num421 / num425; + num423 *= num425; + num424 *= num425; + if (npc.velocity.X < num423) + { + npc.velocity.X += num422; + if (npc.velocity.X < 0f && num423 > 0f) + { + npc.velocity.X += num422; + } + } + else if (npc.velocity.X > num423) + { + npc.velocity.X -= num422; + if (npc.velocity.X > 0f && num423 < 0f) + { + npc.velocity.X -= num422; + } + } + if (npc.velocity.Y < num424) + { + npc.velocity.Y += num422; + if (npc.velocity.Y < 0f && num424 > 0f) + { + npc.velocity.Y += num422; + } + } + else if (npc.velocity.Y > num424) + { + npc.velocity.Y -= num422; + if (npc.velocity.Y > 0f && num424 < 0f) + { + npc.velocity.Y -= num422; + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + npc.ai[1] = 1f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + vector39 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num423 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector39.X; + num424 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector39.Y; + npc.rotation = (float)Math.Atan2(num424, num423) - 1.57f; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + return false; + } + npc.localAI[1] += 1f; + if (npc.life < npc.lifeMax * 0.75) + { + npc.localAI[1] += 1f; + } + if (npc.life < npc.lifeMax * 0.5) + { + npc.localAI[1] += 1f; + } + if (npc.life < npc.lifeMax * 0.25) + { + npc.localAI[1] += 1f; + } + if (npc.life < npc.lifeMax * 0.1) + { + npc.localAI[1] += 2f; + } + if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] = 0f; + float num426 = 8.5f; + int attackDamage_ForProjectiles4 = Main.expertMode ? 23 : 25; + int num427 = 100; + if (Main.expertMode) + { + num426 = 10f; + } + num425 = (float)Math.Sqrt(num423 * num423 + num424 * num424); + num425 = num426 / num425; + num423 *= num425; + num424 *= num425; + vector39.X += num423 * 15f; + vector39.Y += num424 * 15f; + int num428 = Projectile.NewProjectile(vector39.X, vector39.Y, num423, num424, num427, attackDamage_ForProjectiles4, 0f, Main.myPlayer); + } + return false; + } + int num429 = 1; + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) + { + num429 = -1; + } + float num430 = 8f; + float num431 = 0.2f; + if (Main.expertMode) + { + num430 = 9.5f; + num431 = 0.25f; + } + // Reduce acceleration if target is holding a true melee weapon + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num431 *= 0.5f; + } + Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num432 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num429 * 340) - vector40.X; + float num433 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector40.Y; + float num434 = (float)Math.Sqrt(num432 * num432 + num433 * num433); + num434 = num430 / num434; + num432 *= num434; + num433 *= num434; + if (npc.velocity.X < num432) + { + npc.velocity.X += num431; + if (npc.velocity.X < 0f && num432 > 0f) + { + npc.velocity.X += num431; + } + } + else if (npc.velocity.X > num432) + { + npc.velocity.X -= num431; + if (npc.velocity.X > 0f && num432 < 0f) + { + npc.velocity.X -= num431; + } + } + if (npc.velocity.Y < num433) + { + npc.velocity.Y += num431; + if (npc.velocity.Y < 0f && num433 > 0f) + { + npc.velocity.Y += num431; + } + } + else if (npc.velocity.Y > num433) + { + npc.velocity.Y -= num431; + if (npc.velocity.Y > 0f && num433 < 0f) + { + npc.velocity.Y -= num431; + } + } + vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num432 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector40.X; + num433 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector40.Y; + npc.rotation = (float)Math.Atan2(num433, num432) - 1.57f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[1] += 1f; + if (npc.life < npc.lifeMax * 0.75) + { + npc.localAI[1] += 0.5f; + } + if (npc.life < npc.lifeMax * 0.5) + { + npc.localAI[1] += 0.75f; + } + if (npc.life < npc.lifeMax * 0.25) + { + npc.localAI[1] += 1f; + } + if (npc.life < npc.lifeMax * 0.1) + { + npc.localAI[1] += 1.5f; + } + if (Main.expertMode) + { + npc.localAI[1] += 1.5f; + } + if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + npc.localAI[1] = 0f; + float num435 = 9f; + int attackDamage_ForProjectiles5 = Main.expertMode ? 17 : 18; + int num436 = 100; + num434 = (float)Math.Sqrt(num432 * num432 + num433 * num433); + num434 = num435 / num434; + num432 *= num434; + num433 *= num434; + vector40.X += num432 * 15f; + vector40.Y += num433 * 15f; + int num437 = Projectile.NewProjectile(vector40.X, vector40.Y, num432, num433, num436, attackDamage_ForProjectiles5, 0f, Main.myPlayer); + } + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 180f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + + return false; + } + + return true; + } + #endregion + + #region Buffed Twins AI + public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod, bool chaos) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; @@ -5028,7 +5323,8 @@ namespace CalamityMod.NPCs { float num382 = 8.25f; float num383 = 0.115f; - if (CalamityWorld.bossRushActive) + + if (CalamityWorld.bossRushActive) { num382 *= 1.5f; num383 *= 1.5f; @@ -5250,7 +5546,15 @@ namespace CalamityMod.NPCs { float num399 = 9.5f; float num400 = 0.175f; - if (CalamityWorld.bossRushActive) + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num400 *= 0.5f; + } + + if (CalamityWorld.bossRushActive) { num399 *= 1.5f; num400 *= 1.5f; @@ -5356,7 +5660,15 @@ namespace CalamityMod.NPCs float num409 = 9.5f; float num410 = 0.25f; - if (CalamityWorld.bossRushActive) + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num410 *= 0.5f; + } + + if (CalamityWorld.bossRushActive) { num409 *= 1.5f; num410 *= 1.5f; @@ -5722,6 +6034,7 @@ namespace CalamityMod.NPCs // Velocity float num424 = 12f; float num425 = 0.4f; + if (CalamityWorld.bossRushActive) { num424 *= 1.5f; @@ -8066,9 +8379,11 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Phases based on HP + // Phases based on HP + bool phase1phase2 = lifeRatio < 0.75f; bool phase2 = lifeRatio <= 0.5f; - bool phase3 = lifeRatio < 0.25f || (death && phase2); + bool phase3 = lifeRatio < 0.33f || (death && phase2); + bool phase4 = lifeRatio < 0.25f; bool spawnMoreTentacles = lifeRatio < 0.1f; // Variables and target @@ -8309,6 +8624,21 @@ namespace CalamityMod.NPCs // Phase 1 if (!phase2) { + if (phase1phase2 && Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.localAI[0] == 1f) + { + npc.localAI[0] = 2f; + int totalTentacles = 6; + float radians = MathHelper.TwoPi / totalTentacles; + for (int i = 0; i < totalTentacles; i++) + { + Vector2 vector255 = new Vector2(0f, -320f).RotatedBy(radians * i); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, vector255.X, vector255.Y, 1f, 0f, 255); + } + } + } + // Adjust stats npc.defense = 42; npc.damage = npc.defDamage; @@ -8411,21 +8741,25 @@ namespace CalamityMod.NPCs // Spawn tentacles if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.localAI[0] == 1f) + if (npc.localAI[0] == 2f) { - npc.localAI[0] = 2f; - for (int num749 = 0; num749 < 8; num749++) + npc.localAI[0] = 3f; + int totalTentacles = 8 - NPC.CountNPCS(NPCID.PlanterasTentacle); + for (int i = 0; i < totalTentacles; i++) { - int num750 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } } - if (spawnMoreTentacles && npc.localAI[0] == 2f) + if (spawnMoreTentacles && npc.localAI[0] == 3f) { - npc.localAI[0] = 3f; - for (int num749 = 0; num749 < 8; num749++) + npc.localAI[0] = 4f; + int totalTentacles = 8; + float radians = MathHelper.TwoPi / totalTentacles; + for (int i = 0; i < totalTentacles; i++) { - int num750 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Vector2 vector255 = new Vector2(0f, -320f).RotatedBy(radians * i); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, vector255.X, vector255.Y, 2f, 0f, 255); } } } @@ -8786,18 +9120,21 @@ namespace CalamityMod.NPCs if (npc.ai[3] > 0f) num778 = (int)npc.ai[3] - 1; - // Movement variables - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] -= 1f; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = Main.rand.Next(120, 480); - npc.ai[0] = Main.rand.Next(-100, 101); - npc.ai[1] = Main.rand.Next(-100, 101); - npc.netUpdate = true; - } - } + // Movement variables + if (npc.ai[2] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] -= 1f; + if (npc.localAI[0] <= 0f) + { + npc.localAI[0] = Main.rand.Next(120, 480); + npc.ai[0] = Main.rand.Next(-100, 101); + npc.ai[1] = Main.rand.Next(-100, 101); + npc.netUpdate = true; + } + } + } // Target npc.TargetClosest(true); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c7acc6cc8d..cf28e68c6e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1827,6 +1827,10 @@ namespace CalamityMod.NPCs break; } } + else if (npc.type == NPCID.Retinazer) + { + return CalamityGlobalAI.TrueMeleeRetinazerPhase2AI(npc); + } if (CalamityWorld.death) { @@ -3571,7 +3575,7 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.5); } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.ChargedBlasterLaser) + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.InfernoFriendlyBolt || projectile.type == ProjectileID.InfernoFriendlyBlast || projectile.type == ProjectileID.RainbowFront || projectile.type == ProjectileID.RainbowBack || projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.ChargedBlasterLaser) { damage = (int)(damage * 0.75); } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index bbe25d94fc..1c89dbdf70 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -178,12 +178,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Distance from target Vector2 distFromPlayer = player.Center - vectorCenter; - // Enrage - bool aboveGroundEnrage = (player.position.Y < Main.worldSurface * 16.0 || player.position.Y > ((Main.maxTilesY - 200) * 16)) && !CalamityWorld.bossRushActive; + // Enrage + int enrageScale = 0; + if ((npc.position.Y / 16f) < Main.worldSurface || (npc.position.Y / 16f) > (Main.maxTilesY - 200)) + enrageScale++; + if (!player.ZoneJungle) + enrageScale++; - bool jungleEnrage = false; - if (!player.ZoneJungle && !CalamityWorld.bossRushActive) - jungleEnrage = true; + if (CalamityWorld.bossRushActive) + enrageScale = 0; bool diagonalDash = revenge && (lifeRatio < 0.8f || death); @@ -235,20 +238,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { if (Main.netMode != NetmodeID.MultiplayerClient) { - float num595 = npc.ai[1]; int num596; - do - { - num596 = Main.rand.Next(3); - if (MissileCountdown == 1) - num596 = 4; - else if (num596 == 1) - num596 = 2; - else if (num596 == 2) - num596 = 3; - } + do num596 = MissileCountdown == 1 ? 4 : Main.rand.Next(4); + while (num596 == npc.ai[1] || num596 == 1); - while (num596 == num595); if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) { switch (Main.rand.Next(3)) @@ -274,8 +267,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (npc.ai[0] == 0f) { float num1044 = revenge ? 28f : 26f; - if (aboveGroundEnrage) - num1044 += 6f; if (lifeRatio < 0.66f || death) num1044 += 2f; if (lifeRatio < 0.33f || death) @@ -283,7 +274,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1044 += 2f; - int num1043 = 2; + num1044 += 6f * enrageScale; + + int num1043 = 2 + enrageScale; if ((npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) { npc.ai[0] = -1f; @@ -300,7 +293,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float playerLocation = vectorCenter.X - player.Center.X; - if (Math.Abs(npc.Center.Y - (player.Center.Y - chargeDistance)) < 20f) + float num620 = 20f; + num620 += 20 * enrageScale; + + if (Math.Abs(npc.Center.Y - (player.Center.Y - chargeDistance)) < num620) { if (diagonalDash) { @@ -365,8 +361,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1048 += 2f; num1049 += 0.1f; } + num1048 += 3 * enrageScale; + num1049 += 0.5f * enrageScale; - if (vectorCenter.Y < (player.Center.Y - chargeDistance)) + if (vectorCenter.Y < (player.Center.Y - chargeDistance)) npc.velocity.Y += num1049; else npc.velocity.Y -= num1049; @@ -410,14 +408,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath int num1050 = revenge ? 525 : 550; if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1050 = 300; - else if (aboveGroundEnrage || CalamityWorld.bossRushActive) + else if (CalamityWorld.bossRushActive) num1050 = 400; else if (lifeRatio < 0.33f || death) num1050 = revenge ? 450 : 475; else if (lifeRatio < 0.66f) num1050 = revenge ? 475 : 500; + num1050 -= 100 * enrageScale; - int num1051 = 1; + int num1051 = 1; if (vectorCenter.X < player.Center.X) num1051 = -1; @@ -425,8 +424,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { npc.ai[2] = 1f; } + if (enrageScale > 0 && npc.ai[2] == 1f) + npc.velocity *= 0.5f; - if (npc.ai[2] != 1f) + if (npc.ai[2] != 1f) { charging = true; npc.frameCounter = 4; @@ -466,8 +467,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity *= 0.98f; num1052 += 0.05f; } + if (enrageScale > 0) + npc.velocity *= 0.7f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { npc.ai[2] = 0f; npc.ai[1] += 1f; @@ -502,7 +505,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } // Move closer - Movement(100f, 350f, 450f, player); + Movement(100f, 350f, 450f, player, enrageScale); } // Spawn bees @@ -526,7 +529,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 0.25f; bool flag103 = false; - if (npc.ai[1] > 40f) + if (npc.ai[1] > 40f - 12f * enrageScale) { npc.ai[1] = 0f; npc.ai[2] += 1f; @@ -545,10 +548,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else randomAmt = ModContent.NPCType(); - if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < (aboveGroundEnrage ? 4 : 2)) + if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 2) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (revenge && NPC.CountNPCS(ModContent.NPCType()) < (aboveGroundEnrage ? 2 : 1)) + if (revenge && !NPC.AnyNPCs(ModContent.NPCType())) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); if (NPC.CountNPCS(ModContent.NPCType()) < 2) @@ -557,7 +560,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Main.npc[num1062].velocity = player.Center - npc.Center; Main.npc[num1062].velocity.Normalize(); - Main.npc[num1062].velocity *= (CalamityWorld.bossRushActive ? 12f : 6f); + Main.npc[num1062].velocity *= CalamityWorld.bossRushActive ? 12f : 6f; Main.npc[num1062].localAI[0] = 60f; Main.npc[num1062].netUpdate = true; @@ -567,7 +570,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer if too far away if (num1060 > 600f) - Movement(100f, 350f, 450f, player); + Movement(100f, 350f, 450f, player, enrageScale); else npc.velocity *= 0.9f; @@ -575,11 +578,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - if (npc.ai[2] > 2f) + if (npc.ai[2] > 3f) { npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; } } @@ -604,7 +608,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (lifeRatio < 0.1f || death) npc.ai[1] += 0.25f; - if (npc.ai[1] > 40f) + if (npc.ai[1] > 40f - 12f * enrageScale) { npc.ai[1] = 0f; npc.ai[2] += 1f; @@ -617,10 +621,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode != NetmodeID.MultiplayerClient) { - if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < (aboveGroundEnrage ? 6 : 4)) + if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 3) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (revenge && NPC.CountNPCS(ModContent.NPCType()) < 1 && aboveGroundEnrage) + if (revenge && !NPC.AnyNPCs(ModContent.NPCType())) NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); float projectileSpeed = revenge ? 6f : 5f; @@ -635,7 +639,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1071 *= num1073; num1072 *= num1073; - if (NPC.CountNPCS(ModContent.NPCType()) < (aboveGroundEnrage ? 8 : 5)) + if (NPC.CountNPCS(ModContent.NPCType()) < 5) { int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1062].velocity.X = num1071; @@ -647,7 +651,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer if too far away if (num1060 > 600f) - Movement(100f, 350f, 450f, player); + Movement(100f, 350f, 450f, player, enrageScale); else npc.velocity *= 0.9f; @@ -655,11 +659,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - if (npc.ai[2] > 2f) + if (npc.ai[2] > 3f) { npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; + npc.ai[1] = 2f; + npc.ai[2] = 0f; + npc.netUpdate = true; } } @@ -667,21 +672,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (npc.ai[0] == 3f) { Vector2 vector121 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y - 40f); - vector121.X += (npc.direction * 120); + vector121.X += npc.direction * 120; npc.ai[1] += 1f; - int num650 = ((npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((lifeRatio < 0.1f || death || aboveGroundEnrage) ? 20 : ((lifeRatio < 0.5f) ? 25 : 30))); + int num650 = (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((lifeRatio < 0.1f || death) ? 20 : ((lifeRatio < 0.5f) ? 25 : 30)); + num650 -= 5 * enrageScale; - if (npc.ai[1] % (float)num650 == (float)(num650 - 1) && vectorCenter.Y < player.position.Y) + if (npc.ai[1] % num650 == (num650 - 1) && vectorCenter.Y < player.position.Y) { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileSpeed = revenge ? 6.5f : 6f; - if (jungleEnrage || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + projectileSpeed += 7 * enrageScale; + + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) projectileSpeed += 10f; - if (CalamityWorld.bossRushActive) + + if (CalamityWorld.bossRushActive) projectileSpeed *= 1.5f; float num1071 = player.position.X + player.width * 0.5f - vector121.X; @@ -717,7 +726,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - Movement(100f, 400f, 500f, player); + Movement(100f, 400f, 500f, player, enrageScale); float playerLocation = vectorCenter.X - player.Center.X; npc.direction = playerLocation < 0 ? 1 : -1; @@ -738,12 +747,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (CalamityWorld.bossRushActive) num1044 = 32f; - int num1043 = 2; + num1044 += 6f * enrageScale; + + int num1043 = 2 + enrageScale; if (npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) { MissileCountdown = 0; npc.ai[0] = -1f; - npc.ai[1] = 0f; + npc.ai[1] = -1f; npc.ai[2] = 0f; npc.netUpdate = true; return; @@ -756,7 +767,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float playerLocation = vectorCenter.X - player.Center.X; - if (Math.Abs(vectorCenter.Y - (player.Center.Y - 500f)) < 20f) + float num620 = 20f; + num620 += 20 * enrageScale; + + if (Math.Abs(vectorCenter.Y - (player.Center.Y - 500f)) < num620) { if (MissileCountdown == 1) { @@ -765,10 +779,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode != NetmodeID.MultiplayerClient) { int speed = revenge ? 6 : 5; - if (aboveGroundEnrage) - speed = 8; - if (CalamityWorld.bossRushActive) + speed += 7 * enrageScale; + + if (CalamityWorld.bossRushActive) speed = 12; + int damage = expertMode ? 48 : 60; Vector2 baseVelocity = player.Center - vectorCenter; @@ -812,7 +827,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1048 = revenge ? 16f : 14f; float num1049 = revenge ? 0.2f : 0.18f; - if (CalamityWorld.bossRushActive) + num1048 += 3 * enrageScale; + num1049 += 0.5f * enrageScale; + if (CalamityWorld.bossRushActive) { num1048 *= 1.5f; num1049 *= 1.5f; @@ -829,16 +846,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity.Y = num1048; if (Math.Abs(vectorCenter.X - player.Center.X) > 600f) - npc.velocity.X += 0.15f * npc.direction; + npc.velocity.X += num1049 * npc.direction; else if (Math.Abs(vectorCenter.X - player.Center.X) < 300f) - npc.velocity.X -= 0.15f * npc.direction; + npc.velocity.X -= num1049 * npc.direction; else npc.velocity.X *= 0.8f; - if (npc.velocity.X < -20f) - npc.velocity.X = -20f; - if (npc.velocity.X > 20f) - npc.velocity.X = 20f; + if (npc.velocity.X < -num1048) + npc.velocity.X = -num1048; + if (npc.velocity.X > num1048) + npc.velocity.X = num1048; npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; @@ -866,8 +883,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1051 = -1; if (npc.direction == num1051 && Math.Abs(vectorCenter.X - player.Center.X) > num1050) npc.ai[2] = 1f; + if (enrageScale > 0 && npc.ai[2] == 1f) + npc.velocity *= 0.5f; - if (npc.ai[2] != 1f) + if (npc.ai[2] != 1f) { charging = true; @@ -906,8 +925,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity *= 0.9f; num1052 += 0.05f; } + if (enrageScale > 0) + npc.velocity *= 0.7f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { npc.ai[2] = 0f; npc.ai[1] += 1f; @@ -927,39 +948,48 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - private void Movement(float xPos, float yPos, float yPos2, Player player) + private void Movement(float xPos, float yPos, float yPos2, Player player, int enrageScale) { - if (npc.position.Y > player.position.Y - yPos) + Vector2 acceleration = new Vector2(CalamityWorld.bossRushActive ? 0.15f : 0.1f, CalamityWorld.bossRushActive ? 0.2f : 0.15f); + Vector2 velocity = new Vector2(8f, 5f); + float deceleration = 0.98f; + + acceleration *= 0.2f * enrageScale + 1f; + velocity *= 0.2f * enrageScale + 1f; + deceleration *= 1f - enrageScale * 0.2f; + + if (npc.position.Y > player.position.Y - yPos) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y -= (CalamityWorld.bossRushActive ? 0.2f : 0.15f); - if (npc.velocity.Y > 5f) - npc.velocity.Y = 5f; + npc.velocity.Y *= deceleration; + npc.velocity.Y -= acceleration.Y; + if (npc.velocity.Y > velocity.Y) + npc.velocity.Y = velocity.Y; } else if (npc.position.Y < player.position.Y - yPos2) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y += (CalamityWorld.bossRushActive ? 0.2f : 0.15f); - if (npc.velocity.Y < -5f) - npc.velocity.Y = -5f; + npc.velocity.Y *= deceleration; + npc.velocity.Y += acceleration.Y; + if (npc.velocity.Y < -velocity.Y) + npc.velocity.Y = -velocity.Y; } + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + xPos) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; + npc.velocity.X *= deceleration; + npc.velocity.X -= acceleration.X; + if (npc.velocity.X > velocity.X) + npc.velocity.X = velocity.X; } if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - xPos) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; + npc.velocity.X *= deceleration; + npc.velocity.X += acceleration.X; + if (npc.velocity.X < -velocity.X) + npc.velocity.X = -velocity.X; } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index ff26b76c14..c557a9f079 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -408,7 +408,9 @@ namespace CalamityMod.NPCs.Ravager if (npc.ai[0] == 0f) { - npc.noTileCollide = false; + CustomGravity(); + + npc.noTileCollide = false; if (npc.velocity.Y == 0f) { @@ -448,8 +450,6 @@ namespace CalamityMod.NPCs.Ravager if (revenge) { - npc.Calamity().newAI[1] = 0f; - if (distanceBelowTarget > 0f) npc.Calamity().newAI[1] += 1f + distanceBelowTarget * 0.001f; @@ -528,6 +528,8 @@ namespace CalamityMod.NPCs.Ravager if (revenge) npc.Calamity().newAI[0] += 1f; + npc.Calamity().newAI[1] = 0f; + for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) { for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) @@ -650,32 +652,36 @@ namespace CalamityMod.NPCs.Ravager npc.velocity.X = velocityX; } - // Custom gravity - float gravity = npc.ai[0] == 2f ? 0f : 0.3f; - float maxFallSpeed = npc.ai[0] == 2f ? 24f : 10f; - if (npc.wet) - { - if (npc.honeyWet) - { - gravity *= 0.33f; - maxFallSpeed *= 0.4f; - } - else - { - gravity *= 0.66f; - maxFallSpeed *= 0.7f; - } - } - - if (npc.Calamity().newAI[1] > 1f) - maxFallSpeed *= npc.Calamity().newAI[1]; - - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; + CustomGravity(); } } + void CustomGravity() + { + float gravity = npc.ai[0] == 2f ? 0f : 0.3f; + float maxFallSpeed = npc.ai[0] == 2f ? 24f : 10f; + if (npc.wet) + { + if (npc.honeyWet) + { + gravity *= 0.33f; + maxFallSpeed *= 0.4f; + } + else + { + gravity *= 0.66f; + maxFallSpeed *= 0.7f; + } + } + + if (npc.Calamity().newAI[1] > 1f) + maxFallSpeed *= npc.Calamity().newAI[1]; + + npc.velocity.Y += gravity; + if (npc.velocity.Y > maxFallSpeed) + npc.velocity.Y = maxFallSpeed; + } + player = Main.player[npc.target]; if (npc.target <= 0 || npc.target == 255 || player.dead || !player.active) { diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 67904e0974..a8d20e07dd 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.damage = npc.defDamage; // Enrage based on large slimes - bool phase2 = false; + bool phase2 = lifeRatio < 0.4f; bool hyperMode = true; bool purpleSlimeAlive = false; bool redSlimeAlive = false; @@ -130,7 +130,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.Calamity().newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; purpleSlimeAlive = true; - phase2 = lifeRatio >= 0.5f; + phase2 = lifeRatio < 0.2f; hyperMode = false; } } @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.localAI[3] = Main.npc[CalamityGlobalNPC.slimeGodRed].Center.Y; redSlimeAlive = true; - phase2 = lifeRatio >= 0.5f; + phase2 = lifeRatio < 0.2f; hyperMode = false; } } @@ -259,7 +259,7 @@ namespace CalamityMod.NPCs.SlimeGod } // Spin and shoot orbs - if (!phase2) + if (phase2) { npc.ai[1] += 1f; if (revenge) @@ -510,7 +510,7 @@ namespace CalamityMod.NPCs.SlimeGod } float num1372 = 6f; - if (!phase2 || death) + if (phase2 || death) { num1372 = 14f; } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 6628dc44c1..76fb36b27e 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1248,6 +1248,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num823 = 12f; float num824 = 0.12f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num824 *= 0.5f; + } + Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num825 = player.position.X + (player.width / 2) - vector82.X; float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; @@ -1428,6 +1435,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num412 = 32f; float num413 = 1.2f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num413 *= 0.5f; + } + int num414 = 1; if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; @@ -1514,6 +1528,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num832 = 32f; float num833 = 1.2f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num833 *= 0.5f; + } + Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 float num835 = player.position.Y + (player.height / 2) - vector83.Y; @@ -1771,6 +1792,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num823 = 12f; float num824 = 0.12f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num824 *= 0.5f; + } + Vector2 vector82 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num825 = player.position.X + (player.width / 2) - vector82.X; float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; @@ -1947,6 +1975,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float num412 = 32f; float num413 = 1.2f; + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num413 *= 0.5f; + } + int num414 = 1; if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; @@ -2033,6 +2069,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num832 = 32f; float num833 = 1.2f; + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = player.inventory[player.selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num833 *= 0.5f; + } + Vector2 vector83 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 float num835 = player.position.Y + (player.height / 2) - vector83.Y; diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index fdb0481e5f..96afbf5f59 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -83,7 +82,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.TargetClosest(true); float num676 = 60f; float num677 = 1.5f; - float distanceX = 750f; + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num677 *= 0.5f; + } + + float distanceX = 750f; if (npc.ai[3] < 750f) { npc.ai[3] += 1f; diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index ade342568a..d895ac72bd 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -83,7 +82,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.TargetClosest(true); float num676 = 60f; float num677 = 1.5f; - float distanceX = 750f; + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + num677 *= 0.5f; + } + + float distanceX = 750f; if (npc.ai[3] < 750f) { npc.ai[3] += 1f; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index ecd910032a..54a732a52b 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -1821,7 +1821,7 @@ namespace CalamityMod.NPCs.Yharon } } - if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer - 15f) + if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer) { float newRotation = npc.DirectionTo(targetData.Center).ToRotation(); float amount = 0.04f; @@ -1841,13 +1841,14 @@ namespace CalamityMod.NPCs.Yharon npc.alpha = 255; } - if (npc.ai[1] == phaseSwitchTimer + 15f) + float timeBeforeTeleport = teleportPhaseTimer - 15f; + if (npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == phaseSwitchTimer + 15f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) { teleportLocation = Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600); - Vector2 center = targetData.Center + new Vector2(-npc.ai[2] * 450f, teleportLocation); + Vector2 center = targetData.Center + new Vector2(-npc.ai[2] * 500f, teleportLocation); npcCenter = npc.Center = center; } @@ -2282,7 +2283,7 @@ namespace CalamityMod.NPCs.Yharon } npc.ai[2] += 1f; - if (npc.ai[2] >= teleportPhaseTimer * (phase4 ? 0.5f : 1f)) + if (npc.ai[2] >= teleportPhaseTimer) { npc.ai[0] = 1f; npc.ai[1] = 0f; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 780d09bfca..321b29d5d5 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -71,59 +71,11 @@ namespace CalamityMod.Projectiles #region SetDefaults public override void SetDefaults(Projectile projectile) { + if (CalamityMod.trueMeleeProjectileList.Contains(projectile.type)) + trueMelee = true; + switch (projectile.type) { - case ProjectileID.Spear: - case ProjectileID.Trident: - case ProjectileID.TheRottedFork: - case ProjectileID.Swordfish: - case ProjectileID.Arkhalis: - case ProjectileID.DarkLance: - case ProjectileID.CobaltNaginata: - case ProjectileID.PalladiumPike: - case ProjectileID.MythrilHalberd: - case ProjectileID.OrichalcumHalberd: - case ProjectileID.AdamantiteGlaive: - case ProjectileID.TitaniumTrident: - case ProjectileID.MushroomSpear: - case ProjectileID.Gungnir: - case ProjectileID.ObsidianSwordfish: - case ProjectileID.ChlorophytePartisan: - case ProjectileID.MonkStaffT1: - case ProjectileID.MonkStaffT2: - case ProjectileID.MonkStaffT3: - case ProjectileID.NorthPoleWeapon: - - //tools - case ProjectileID.CobaltDrill: - case ProjectileID.MythrilDrill: - case ProjectileID.AdamantiteDrill: - case ProjectileID.PalladiumDrill: - case ProjectileID.OrichalcumDrill: - case ProjectileID.TitaniumDrill: - case ProjectileID.ChlorophyteDrill: - case ProjectileID.CobaltChainsaw: - case ProjectileID.MythrilChainsaw: - case ProjectileID.AdamantiteChainsaw: - case ProjectileID.PalladiumChainsaw: - case ProjectileID.OrichalcumChainsaw: - case ProjectileID.TitaniumChainsaw: - case ProjectileID.ChlorophyteChainsaw: - case ProjectileID.VortexDrill: - case ProjectileID.VortexChainsaw: - case ProjectileID.NebulaDrill: - case ProjectileID.NebulaChainsaw: - case ProjectileID.SolarFlareDrill: - case ProjectileID.SolarFlareChainsaw: - case ProjectileID.StardustDrill: - case ProjectileID.StardustChainsaw: - case ProjectileID.Hamdrax: - case ProjectileID.ChlorophyteJackhammer: - case ProjectileID.SawtoothShark: - case ProjectileID.ButchersChainsaw: - trueMelee = true; - break; - case ProjectileID.StarWrath: projectile.penetrate = projectile.maxPenetrate = 1; break; diff --git a/Projectiles/Environment/LightningMark.cs b/Projectiles/Environment/LightningMark.cs index c266a3d844..9795158a32 100644 --- a/Projectiles/Environment/LightningMark.cs +++ b/Projectiles/Environment/LightningMark.cs @@ -42,10 +42,10 @@ namespace CalamityMod.Projectiles.Environment Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)projectile.Center.X, (int)projectile.Center.Y); Vector2 ai0 = projectile.Center - fireFrom; - float ai = (float)Main.rand.Next(100); + float ai = Main.rand.Next(100); Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(0.78539818525314331)) * 7f; int proj = Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, 50, 0f, projectile.owner, ai0.ToRotation(), ai); - Main.projectile[proj].extraUpdates += 6; + Main.projectile[proj].extraUpdates += 11; Main.projectile[proj].friendly = true; Main.projectile[proj].Calamity().lineColor = 1; } diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 123ee4eb20..ee5c50df5c 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -127,15 +127,15 @@ namespace CalamityMod.Projectiles.Magic projectile.position += value37; projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy((double)num811, default); projectile.scale = 1.5f * (1.5f - num812); - projectile.damage = projectile2.damage; - double damageMult = 1.0 + (double)(projectile2.ai[0] * 0.0015f); //1 to 2.0 (1400 * x) - if (damageMult > 2.0) + + // Takes 360 frames to reach normal damage + float amount = projectile2.ai[0] / 1200f; + if (amount > 1f) + amount = 1f; + projectile.damage = (int)(projectile2.damage * MathHelper.Lerp(0.25f, 2.5f, amount)); + + if (projectile2.ai[0] >= 720f) { - damageMult = 2.0; - } - if (projectile2.ai[0] >= 720f) - { - projectile.damage = (int)((double)projectile.damage * damageMult); vector71 = new Vector2?(projectile2.Center); } if (!Collision.CanHitLine(Main.player[projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) @@ -164,8 +164,8 @@ namespace CalamityMod.Projectiles.Magic num821 += array3[num822]; } num821 /= num819; - float amount = 0.75f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount); + float amount2 = 0.75f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num821, amount2); if (Math.Abs(projectile.localAI[1] - num821) < 100f && projectile.scale > 0.15f) { //color.A = 0; diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index f00921abcb..f3123d482c 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Projectiles/Melee/MarniteObliteratorProj.cs b/Projectiles/Melee/MarniteObliteratorProj.cs index f685f7f62a..ae875ee8fc 100644 --- a/Projectiles/Melee/MarniteObliteratorProj.cs +++ b/Projectiles/Melee/MarniteObliteratorProj.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee projectile.hide = true; projectile.ownerHitCheck = true; projectile.melee = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } } } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 9792dc8e3b..51fdcb2818 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 0; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Melee/Spears/AmidiasTridentProj.cs b/Projectiles/Melee/Spears/AmidiasTridentProj.cs index 466458cc4d..e6ed3edefe 100644 --- a/Projectiles/Melee/Spears/AmidiasTridentProj.cs +++ b/Projectiles/Melee/Spears/AmidiasTridentProj.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1f; public override float ForwardSpeed => 0.75f; diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index e320763c27..3dcb01869d 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -29,8 +29,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index 2f843b5afd..0c3f58f8ac 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -29,8 +29,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 2; projectile.alpha = 255; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear; public override float TravelSpeed => 22f; public override Action EffectBeforeReelback => (proj) => diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index dffb04c169..56bf8f0efd 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -26,8 +26,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index d5cd3728fd..23764ae2ef 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -24,8 +24,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/EarthenPikeSpear.cs b/Projectiles/Melee/Spears/EarthenPikeSpear.cs index a7cd0ea890..940739a1db 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index 0b923b49cb..e98f738239 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; diff --git a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs index 6d4e771956..839d0b0979 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index e0c17d0443..1e94a744d9 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -26,9 +26,10 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } - // These numbers sure are common, huh? + + // These numbers sure are common, huh? yeah, they are public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 1774c09694..1df1536735 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -23,8 +23,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 1.1f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index e2852b4045..4fc87924f3 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs index 57e63628bd..63ecb07dfc 100644 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index 4f8192da22..6cbde975c3 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 41609031a9..61e4138a06 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -27,8 +27,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 5.5f; public override float ReelbackSpeed => 2.1f; public override float ForwardSpeed => 1.1f; diff --git a/Projectiles/Melee/Spears/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index c70e961628..cf3c3d119b 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs index bc41e8ad53..1127f9fc24 100644 --- a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs +++ b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 286651e0ac..2ffb51c4fb 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -25,8 +25,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index bc60d48bd2..b06ad17ee1 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.hide = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs index ab3ba4b3af..1c64eed847 100644 --- a/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs +++ b/Projectiles/Melee/Spears/TenebreusTidesProjectile.cs @@ -27,10 +27,11 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 15; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/TerraLanceProjectile.cs b/Projectiles/Melee/Spears/TerraLanceProjectile.cs index 19d02dd618..1353d9b72c 100644 --- a/Projectiles/Melee/Spears/TerraLanceProjectile.cs +++ b/Projectiles/Melee/Spears/TerraLanceProjectile.cs @@ -24,8 +24,9 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } + public override float InitialSpeed => 3f; public override float ReelbackSpeed => 2.4f; public override float ForwardSpeed => 0.95f; diff --git a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs index da72e359c2..0157170e2b 100644 --- a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs +++ b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/YateveoBloomSpear.cs b/Projectiles/Melee/Spears/YateveoBloomSpear.cs index 9da2f9ca74..5220848d6b 100644 --- a/Projectiles/Melee/Spears/YateveoBloomSpear.cs +++ b/Projectiles/Melee/Spears/YateveoBloomSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.ownerHitCheck = true; - projectile.Calamity().trueMelee = true; + //projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 3f;