diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 0c4fe27886..dfd865b68b 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -52,6 +52,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using Terraria.ModLoader.Config; namespace CalamityMod.CalPlayer { @@ -82,6 +83,7 @@ namespace CalamityMod.CalPlayer #region No Category public static bool areThereAnyDamnBosses = false; + public static bool areThereAnyDamnEvents = false; public bool drawBossHPBar = true; public bool shouldDrawSmallText = true; private const int saveVersion = 0; @@ -93,10 +95,12 @@ namespace CalamityMod.CalPlayer public int actualMaxLife = 0; public int deathModeUnderworldTime = 0; public int deathModeBlizzardTime = 0; - public static int chaosStateDuration = 600; + public static int chaosStateDuration = 360; + public static int chaosStateDurationBoss = 600; public bool killSpikyBalls = false; public Projectile lastProjectileHit; public double acidRoundMultiplier = 1D; + public int waterLeechTarget = -1; #endregion #region External variables -- Only set by Mod.Call @@ -191,6 +195,7 @@ namespace CalamityMod.CalPlayer public int profanedSoulWeaponType = 0; public int hurtSoundTimer = 0; public int danceOfLightCharge = 0; + public int shadowPotCooldown = 0; #endregion #region Sound @@ -1898,6 +1903,7 @@ namespace CalamityMod.CalPlayer planarSpeedBoost = 0; galileoCooldown = 0; soundCooldown = 0; + shadowPotCooldown = 0; rage = 0; adrenaline = 0; raiderStack = 0; @@ -2350,6 +2356,10 @@ namespace CalamityMod.CalPlayer ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; + //Overriding 1.4's ass req boosts + if (Main.snowTiles > 300) + player.ZoneSnow = true; + Mod fargos = ModLoader.GetMod("Fargowiltas"); if (fargos != null) { @@ -2513,12 +2523,14 @@ namespace CalamityMod.CalPlayer player.Teleport(teleportLocation, 4, 0); NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); + int duration = chaosStateDuration; + if (areThereAnyDamnBosses || areThereAnyDamnEvents) + duration = chaosStateDurationBoss; if (eScarfCooldown) - player.AddBuff(BuffID.ChaosState, (int)(chaosStateDuration * 1.5), true); - else if (scarfCooldown) - player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); - else - player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); + duration = (int)(chaosStateDuration * 1.5); + else if (scarfCooldown) + duration = chaosStateDuration * 2; + player.AddBuff(BuffID.ChaosState, duration, true); } } } @@ -2566,12 +2578,14 @@ namespace CalamityMod.CalPlayer player.Teleport(teleportLocation, 1, 0); NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); - if (eScarfCooldown) - player.AddBuff(BuffID.ChaosState, (int)(chaosStateDuration * 1.5), true); - else if (scarfCooldown) - player.AddBuff(BuffID.ChaosState, chaosStateDuration * 2, true); - else - player.AddBuff(BuffID.ChaosState, chaosStateDuration, true); + int duration = chaosStateDuration; + if (areThereAnyDamnBosses || areThereAnyDamnEvents) + duration = chaosStateDurationBoss; + if (eScarfCooldown) + duration = (int)(chaosStateDuration * 1.5); + else if (scarfCooldown) + duration = chaosStateDuration * 2; + player.AddBuff(BuffID.ChaosState, duration, true); int numDust = 40; Vector2 step = playerToTeleport / numDust; @@ -4012,9 +4026,9 @@ namespace CalamityMod.CalPlayer acidRoundMultiplier = 1D; } //Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me - if (desertProwler && (item.ranged/* || item.type == ModContent.ItemType()*/)) + if (desertProwler && (item.ranged || item.type == ModContent.ItemType())) { - flat += 2f; + flat += 1f; } } @@ -7768,7 +7782,7 @@ namespace CalamityMod.CalPlayer float dashDistance; if (dashMod == 1) //Counter and Evasion Scarf { - dashDistance = evasionScarf ? 16.9f : 14.5f; + dashDistance = evasionScarf ? 16.3f : 14.5f; int direction = 0; bool justDashed = false; if (dashTimeMod > 0) @@ -8277,7 +8291,7 @@ namespace CalamityMod.CalPlayer { if (evasionScarf) { - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(6f)); + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(9f)); player.AddBuff(ModContent.BuffType(), player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f)); } else @@ -8822,8 +8836,8 @@ namespace CalamityMod.CalPlayer } public override void PreUpdate() - { - tailFrameUp++; + { + tailFrameUp++; if (tailFrameUp == 8) { tailFrame++; @@ -11122,6 +11136,7 @@ namespace CalamityMod.CalPlayer int frame = HandlePSCAnimationFrames(animType); player.legFrame.Y = player.legFrame.Height * frame; } + waterLeechTarget = -1; } #endregion diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index a14cc532c1..858dfdd1b3 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -56,6 +56,9 @@ namespace CalamityMod.CalPlayer // Bool for any existing bosses, true if any boss NPC is active CalamityPlayer.areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); + // Bool for any existing events, true if any event is active + CalamityPlayer.areThereAnyDamnEvents = CalamityGlobalNPC.AnyEvents(player); + // If any boss NPC is active, apply Zen to the player to reduce spawn rate if (CalamityPlayer.areThereAnyDamnBosses) { @@ -894,6 +897,8 @@ namespace CalamityMod.CalPlayer modPlayer.galileoCooldown--; if (modPlayer.soundCooldown > 0) modPlayer.soundCooldown--; + if (modPlayer.shadowPotCooldown > 0) + modPlayer.shadowPotCooldown--; if (modPlayer.raiderCooldown > 0) modPlayer.raiderCooldown--; if (modPlayer.gSabatonCooldown > 0) @@ -3549,7 +3554,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.prismaticLasers > 1800 && player.whoAmI == Main.myPlayer) { float shootSpeed = 18f; - int dmg = (int)(150 * player.MagicDamage()); + int dmg = (int)(50 * player.MagicDamage()); Vector2 startPos = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 velocity = Main.MouseWorld - startPos; if (player.gravDir == -1f) @@ -3568,7 +3573,7 @@ namespace CalamityMod.CalPlayer travelDist = shootSpeed / travelDist; } - int laserAmt = 2; + 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); @@ -3590,7 +3595,8 @@ namespace CalamityMod.CalPlayer velocity.Y *= travelDist; velocity.X += (float)Main.rand.Next(-50, 51) * 0.02f; velocity.Y += (float)Main.rand.Next(-50, 51) * 0.02f; - Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, (float)Main.rand.Next(10)); + int laser = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), dmg, 4f, player.whoAmI, 0f, Main.rand.Next(10)); + Main.projectile[laser].localNPCHitCooldown = 5; } Main.PlaySound(SoundID.Item12, player.position); } diff --git a/CalamityMod.cs b/CalamityMod.cs index 2b71071fef..5ef3fbafb4 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1303,7 +1303,9 @@ namespace CalamityMod ItemID.WaspGun, ItemID.Keybrand, ItemID.PulseBow, - ItemID.PaladinsHammer + ItemID.PaladinsHammer, + ItemID.SolarEruption, + ItemID.DayBreak }; thirtyThreeDamageBuffList = new List() @@ -1382,7 +1384,8 @@ namespace CalamityMod ItemID.DD2BetsyBow, ItemID.InfluxWaver, ItemID.Xenopopper, - ItemID.ElectrosphereLauncher + ItemID.ElectrosphereLauncher, + ItemID.OpticStaff //Note: got local i frames so it should be better }; pumpkinMoonBuffList = new List() diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 287a2f66f5..0b32c27cb6 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) } + { ModContent.NPCType(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) } }; public static Dictionary PossibleEnemiesPolter = new Dictionary() @@ -71,7 +71,7 @@ namespace CalamityMod.Events { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }, - { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) }, + { ModContent.NPCType(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) }, { ModContent.NPCType(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) } }; @@ -132,9 +132,9 @@ namespace CalamityMod.Events } } if (CalamityWorld.downedPolterghast) - return (int)(180 * Math.Log(playerCount + Math.E - 1)); + return (int)(140 * Math.Log(playerCount + Math.E - 1)); else if (CalamityWorld.downedAquaticScourge) - return (int)(125 * Math.Log(playerCount + Math.E - 1)); + return (int)(115 * Math.Log(playerCount + Math.E - 1)); else return (int)(90 * Math.Log(playerCount + Math.E - 1)); } diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index c00b5ede3c..3a71ce5fdb 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Asgard's Valor"); Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + - "Immune to most debuffs including Brimstone Flames, Holy Flames, and Glacial State\n" + + "Immune to most debuffs including Brimstone Flames, and Glacial State\n" + "10% damage reduction while submerged in liquid\n" + "+20 max life\n" + "Grants a holy dash which can be used to ram enemies\n" + @@ -51,7 +51,6 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Cursed] = true; player.buffImmune[BuffID.Darkness] = true; player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.statLifeMax2 += 20; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index 62234a3e5b..ef5c92d3de 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(HowlDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(HowlDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 1f); } if (player.ownedProjectileCounts[ProjectileType()] < 1) { diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 7338190ab6..a30da8596a 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -97,6 +97,10 @@ namespace CalamityMod.Items.Accessories { WaterBonuses = true; } + else if (!player.IsUnderwater()) + { + WaterBonuses = false; + } } } if (WaterBonuses || player.IsUnderwater()) diff --git a/Items/Armor/DesertProwlerHat.cs b/Items/Armor/DesertProwlerHat.cs index 69a9033f3f..4436351718 100644 --- a/Items/Armor/DesertProwlerHat.cs +++ b/Items/Armor/DesertProwlerHat.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Ranged attacks deal an extra 2 flat damage\n" + + player.setBonus = "Ranged attacks deal an extra 1 flat damage\n" + "Ranged crits can rarely whip up a sandstorm"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.desertProwler = true; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 9e3931424b..97b52f456c 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -966,12 +966,14 @@ namespace CalamityMod.Items { if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) { + int duration = CalamityPlayer.chaosStateDuration; + if (CalamityPlayer.areThereAnyDamnBosses || CalamityPlayer.areThereAnyDamnEvents) + duration = CalamityPlayer.chaosStateDurationBoss; if (modPlayer.eScarfCooldown) - player.AddBuff(BuffID.ChaosState, (int)(CalamityPlayer.chaosStateDuration * 1.5), true); + duration = (int)(CalamityPlayer.chaosStateDuration * 1.5); else if (modPlayer.scarfCooldown) - player.AddBuff(BuffID.ChaosState, CalamityPlayer.chaosStateDuration * 2, true); - else - player.AddBuff(BuffID.ChaosState, CalamityPlayer.chaosStateDuration, true); + duration = CalamityPlayer.chaosStateDuration * 2; + player.AddBuff(BuffID.ChaosState, duration, true); } } } @@ -2816,7 +2818,7 @@ Provides heat and cold protection in Death Mode"; // Plantera case ItemID.PlanteraBossBag: - DropHelper.DropItem(player, ModContent.ItemType(), 8, 11); + DropHelper.DropItem(player, ModContent.ItemType(), 16, 22); float bFluxChance = DropHelper.LegendaryDropRateFloat; DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, bFluxChance); DropHelper.DropItemChance(player, ItemID.JungleKey, 5); diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 4688312ba9..53c08f1100 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -41,10 +41,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.useStyle = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { @@ -65,7 +62,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches } // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Fishing/AstralCatches/PolarisParrotfish.cs b/Items/Fishing/AstralCatches/PolarisParrotfish.cs index 01c7dea67c..e44f282be1 100644 --- a/Items/Fishing/AstralCatches/PolarisParrotfish.cs +++ b/Items/Fishing/AstralCatches/PolarisParrotfish.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - item.damage = 60; + item.damage = 55; item.ranged = true; item.width = 38; item.height = 34; diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 44cf91737b..d98e589ed8 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -31,10 +31,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.useStyle = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index ee7d0da02a..1dc1c6e2cf 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -4,6 +4,11 @@ using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables; using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Potions; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Tiles.Abyss; using CalamityMod.World; using Terraria; @@ -36,10 +41,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches item.useStyle = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { @@ -76,8 +78,25 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 10); } + // Weapons + DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType()); + + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType()); + // Equipment - DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.25f, + DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs index 027f00b0db..62f806f072 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs @@ -40,10 +40,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.useStyle = 1; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void RightClick(Player player) { @@ -61,7 +58,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches } // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs index 9cdc2a3399..e720b01f24 100644 --- a/Items/Mounts/BUMBLEDOGE.cs +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Mounts mountData.fatigueMax = 0; mountData.fallDamage = 0f; mountData.runSpeed = 12f; - mountData.dashSpeed = 12f; mountData.heightBoost = 44; mountData.acceleration = 0.2f; mountData.jumpHeight = 10; @@ -56,7 +55,7 @@ namespace CalamityMod.Items.Mounts mountData.swimFrameDelay = mountData.inAirFrameDelay; mountData.swimFrameStart = mountData.inAirFrameStart; - mountData.dashSpeed = 25f; + mountData.dashSpeed = 18.5f; mountData.dashingFrameCount = mountData.flyingFrameCount; mountData.dashingFrameDelay = 5; mountData.dashingFrameStart = mountData.flyingFrameStart; diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs index 7171a5d8f5..aec0a954a0 100644 --- a/Items/Potions/ShadowPotion.cs +++ b/Items/Potions/ShadowPotion.cs @@ -40,8 +40,7 @@ namespace CalamityMod.Items.Potions ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.InvisibilityPotion); - recipe.AddIngredient(ItemID.AlchemyTable); - recipe.AddTile(TileID.Bottles); + recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this, 2); recipe.AddRecipe(); recipe = new ModRecipe(mod); diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index 06f05113fb..3f71dc6333 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.TreasureBags // Materials DropHelper.DropItem(player, ModContent.ItemType(), 25, 35); - DropHelper.DropItem(player, ModContent.ItemType(), 15, 25); + DropHelper.DropItem(player, ModContent.ItemType(), 20, 30); // Weapons DropHelper.DropItemChance(player, ModContent.ItemType(), 3); diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index fe5f528c33..98216b996f 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 60; + item.damage = 99; item.magic = true; - item.mana = 12; + item.mana = 8; item.width = 52; item.height = 52; item.useTime = 17; diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index 12c8980faf..734002411f 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { item.width = 98; - item.damage = 45; + item.damage = 55; item.magic = true; - item.mana = 14; + item.mana = 12; item.useAnimation = 7; item.useTime = 7; item.useStyle = 5; diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 147a521634..632d5a9574 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 36; + item.damage = 40; item.magic = true; item.mana = 17; item.width = 56; diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index 3d65397d61..d42e2eeb90 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 6; item.width = 28; item.height = 30; - item.useTime = 18; - item.useAnimation = 18; + item.useTime = 20; + item.useAnimation = 20; item.useStyle = 5; item.noMelee = true; item.knockBack = 3.5f; diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index c4b2c93fcf..317a2ae5cd 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 20; + item.damage = 15; item.magic = true; item.mana = 7; item.width = 34; @@ -31,64 +31,60 @@ namespace CalamityMod.Items.Weapons.Magic item.rare = 2; item.UseSound = SoundID.Item8; item.autoReuse = true; - item.shoot = 590; + item.shoot = ProjectileID.TruffleSpore; item.shootSpeed = 1f; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld + vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + float speed = item.shootSpeed; + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + float xDist = (float)Main.mouseX + Main.screenPosition.X + source.X; + float yDist = (float)Main.mouseY + Main.screenPosition.Y + source.Y; + Vector2 spawnVec = new Vector2(xDist, yDist); if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + spawnVec.Y = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + source.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + float distance = spawnVec.Length(); + if ((float.IsNaN(spawnVec.X) && float.IsNaN(spawnVec.Y)) || (spawnVec.X == 0f && spawnVec.Y == 0f)) { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; + spawnVec.X = (float)player.direction; + spawnVec.Y = 0f; + distance = speed; } else { - num80 = num72 / num80; + distance = speed / distance; } - int num107 = 3; - for (int num108 = 0; num108 < num107; num108++) + int projAmt = 3; + for (int projIndex = 0; projIndex < projAmt; projIndex++) { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-100, 101); - vector2.Y -= (float)(50 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) + source = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + source.X = (source.X + player.Center.X) / 2f + (float)Main.rand.Next(-100, 101); + source.Y -= (float)(50 * projIndex); + spawnVec.X = (float)Main.mouseX + Main.screenPosition.X - source.X; + spawnVec.Y = (float)Main.mouseY + Main.screenPosition.Y - source.Y; + if (spawnVec.Y < 0f) { - num79 *= -1f; + spawnVec.Y *= -1f; } - if (num79 < 20f) + if (spawnVec.Y < 20f) { - num79 = 20f; + spawnVec.Y = 20f; } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-180, 181) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); + distance = spawnVec.Length(); + distance = speed / distance; + spawnVec.X *= distance; + spawnVec.Y *= distance; + spawnVec.X += (float)Main.rand.Next(-180, 181) * 0.02f; + spawnVec.Y += (float)Main.rand.Next(-180, 181) * 0.02f; + int proj = Projectile.NewProjectile(source, spawnVec, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3)); Main.projectile[proj].Calamity().forceMagic = true; + Main.projectile[proj].timeLeft = CalamityUtils.SecondsToFrames(8f); } return false; } diff --git a/Items/Weapons/Magic/WulfrumStaff.cs b/Items/Weapons/Magic/WulfrumStaff.cs index c81ccd8c55..27bf657e3f 100644 --- a/Items/Weapons/Magic/WulfrumStaff.cs +++ b/Items/Weapons/Magic/WulfrumStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 10; + item.damage = 12; item.magic = true; item.mana = 4; item.width = 44; diff --git a/Items/Weapons/Melee/AccretionDiskMelee.cs b/Items/Weapons/Melee/AccretionDiskMelee.cs index 1eadd4f954..2b4c772c7c 100644 --- a/Items/Weapons/Melee/AccretionDiskMelee.cs +++ b/Items/Weapons/Melee/AccretionDiskMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,13 +35,6 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/BloodyEdge.cs b/Items/Weapons/Melee/BloodyEdge.cs index 8ad4ccc251..9337375fff 100644 --- a/Items/Weapons/Melee/BloodyEdge.cs +++ b/Items/Weapons/Melee/BloodyEdge.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { int healAmount = Main.rand.Next(3) + 1; - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(2) && !player.moonLeech) { player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/BurntSienna.cs b/Items/Weapons/Melee/BurntSienna.cs index f861213e2d..fcf21be439 100644 --- a/Items/Weapons/Melee/BurntSienna.cs +++ b/Items/Weapons/Melee/BurntSienna.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.life <= 0) + if (target.life <= 0 && !player.moonLeech) { float randomSpeedX = (float)Main.rand.Next(3); float randomSpeedY = (float)Main.rand.Next(3, 5); @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (target.statLife <= 0) + if (target.statLife <= 0 && !player.moonLeech) { float randomSpeedX = (float)Main.rand.Next(3); float randomSpeedY = (float)Main.rand.Next(3, 5); diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index 6ac343fad0..408059b77f 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 44; item.height = 44; - item.damage = 800; + item.damage = 666; item.melee = true; item.knockBack = 9f; diff --git a/Items/Weapons/Melee/DraedonsExoblade.cs b/Items/Weapons/Melee/DraedonsExoblade.cs index b09f0ceb06..444032cbb8 100644 --- a/Items/Weapons/Melee/DraedonsExoblade.cs +++ b/Items/Weapons/Melee/DraedonsExoblade.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, ai1); } } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -134,6 +134,8 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, ai1); } } + if (player.moonLeech) + return; int healAmount = Main.rand.Next(5) + 5; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 38858f734f..cac0c123a2 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -86,14 +86,14 @@ namespace CalamityMod.Items.Weapons.Melee float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, (float)Main.rand.Next(10)); } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { - return; - } if (Main.rand.NextBool(2)) { target.defense -= 50; } + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) + { + return; + } int heal = Main.rand.Next(1, 69); player.statLife += heal; player.HealEffect(heal); @@ -145,6 +145,8 @@ namespace CalamityMod.Items.Weapons.Melee float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); } + if (player.moonLeech) + return; int heal = Main.rand.Next(1, 69); player.statLife += heal; player.HealEffect(heal); diff --git a/Items/Weapons/Melee/ElementalExcalibur.cs b/Items/Weapons/Melee/ElementalExcalibur.cs index 3ef670429d..ae217ee9be 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -63,10 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee return false; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { @@ -157,7 +154,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(BuffID.OnFire, 240); target.AddBuff(BuffID.Ichor, 240); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -177,6 +174,8 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(BuffID.OnFire, 240); target.AddBuff(BuffID.Ichor, 240); + if (player.moonLeech) + return; int healAmount = Main.rand.Next(10) + 10; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/EradicatorMelee.cs b/Items/Weapons/Melee/EradicatorMelee.cs index 31f6afb425..7f827c609a 100644 --- a/Items/Weapons/Melee/EradicatorMelee.cs +++ b/Items/Weapons/Melee/EradicatorMelee.cs @@ -36,13 +36,6 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Vector2 origin = new Vector2(31f, 29f); diff --git a/Items/Weapons/Melee/FlameScytheMelee.cs b/Items/Weapons/Melee/FlameScytheMelee.cs index 5ded2dbf1f..feca9aa52a 100644 --- a/Items/Weapons/Melee/FlameScytheMelee.cs +++ b/Items/Weapons/Melee/FlameScytheMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,13 +34,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 16f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index 7aef9f9409..d60c5e37b6 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.defense -= 15; } - if (target.defense <= 0 && target.canGhostHeal) + if (target.defense <= 0 && target.canGhostHeal && !player.moonLeech) { player.statLife += 4; player.HealEffect(4); @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), knockback, player.whoAmI); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)((float)item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), knockback, player.whoAmI); } - if (target.life <= 0) + if (target.life <= 0 && !player.moonLeech) { float randomSpeedX = (float)Main.rand.Next(9); float randomSpeedY = (float)Main.rand.Next(6, 15); @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), item.knockBack, player.whoAmI); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)((float)item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), item.knockBack, player.whoAmI); } - if (target.statLife <= 0) + if (target.statLife <= 0 && !player.moonLeech) { float randomSpeedX = (float)Main.rand.Next(9); float randomSpeedY = (float)Main.rand.Next(6, 15); diff --git a/Items/Weapons/Melee/LifefruitScythe.cs b/Items/Weapons/Melee/LifefruitScythe.cs index 4bd35bc74d..d450027649 100644 --- a/Items/Weapons/Melee/LifefruitScythe.cs +++ b/Items/Weapons/Melee/LifefruitScythe.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -64,6 +64,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { + if (player.moonLeech) + return; player.statLife += 5; player.HealEffect(5); } diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index 3e25680803..b47f22b9f3 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee target.defense -= 10; // Healing effect does not trigger versus dummies - if (target.type == NPCID.TargetDummy) + if (target.type == NPCID.TargetDummy || player.moonLeech) return; if (target.defense <= 0 && target.canGhostHeal) diff --git a/Items/Weapons/Melee/MangroveChakramMelee.cs b/Items/Weapons/Melee/MangroveChakramMelee.cs index b2c51b0be1..765e0701bc 100644 --- a/Items/Weapons/Melee/MangroveChakramMelee.cs +++ b/Items/Weapons/Melee/MangroveChakramMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,13 +33,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 16f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index 978f6640e9..dda4ce7f5d 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class Nadir : ModItem { - public static int BaseDamage = 800; + public static int BaseDamage = 700; public static float ShootSpeed = 12f; public override void SetStaticDefaults() diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 63586c1f30..fb0ec5f0da 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -53,11 +53,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 400; + item.damage = 1200; item.crit += 8; - item.useAnimation = 15; item.useStyle = 1; - item.useTime = 15; + item.useTime = item.useAnimation = 15; item.useTurn = true; item.melee = true; item.knockBack = 7f; @@ -91,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage * 2, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1), knockBack, player.whoAmI, 0f, 0f); } else { diff --git a/Items/Weapons/Melee/PwnagehammerMelee.cs b/Items/Weapons/Melee/PwnagehammerMelee.cs index 60f28b067f..9315eac593 100644 --- a/Items/Weapons/Melee/PwnagehammerMelee.cs +++ b/Items/Weapons/Melee/PwnagehammerMelee.cs @@ -1,5 +1,4 @@ using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,13 +33,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 12f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index c5112d6e8a..c7ac6cd59e 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 18; - item.damage = 1550; + item.damage = 1300; item.melee = true; item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/SeashellBoomerangMelee.cs b/Items/Weapons/Melee/SeashellBoomerangMelee.cs index 79febc672a..841ad4267e 100644 --- a/Items/Weapons/Melee/SeashellBoomerangMelee.cs +++ b/Items/Weapons/Melee/SeashellBoomerangMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,13 +32,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 11.5f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index 4aa3fc0331..d4b147c54b 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -20,10 +20,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 75; + item.damage = 80; item.knockBack = 4.5f; item.melee = true; - item.useAnimation = item.useTime = 15; + item.useAnimation = item.useTime = 14; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/TerraEdge.cs b/Items/Weapons/Melee/TerraEdge.cs index b37082e869..30cf8b013d 100644 --- a/Items/Weapons/Melee/TerraEdge.cs +++ b/Items/Weapons/Melee/TerraEdge.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -80,6 +80,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { + if (player.moonLeech) + return; int healAmount = Main.rand.Next(2) + 2; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 9fab60c74f..b910782777 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Frostburn, 600); target.AddBuff(BuffID.OnFire, 600); target.AddBuff(BuffID.Ichor, 300); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) { return; } @@ -110,6 +110,8 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Frostburn, 600); target.AddBuff(BuffID.OnFire, 600); target.AddBuff(BuffID.Ichor, 300); + if (player.moonLeech) + return; int healAmount = Main.rand.Next(3) + 2; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs index ba5e4479cd..849065bc52 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,13 +36,6 @@ namespace CalamityMod.Items.Weapons.Melee item.Calamity().customRarity = CalamityRarity.Developer; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/TrueBloodyEdge.cs b/Items/Weapons/Melee/TrueBloodyEdge.cs index 8f745cb00a..d11303391d 100644 --- a/Items/Weapons/Melee/TrueBloodyEdge.cs +++ b/Items/Weapons/Melee/TrueBloodyEdge.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) + if (target.type == NPCID.TargetDummy || player.moonLeech) { return; } @@ -67,6 +67,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { + if (player.moonLeech) + return; int healAmount = Main.rand.Next(6) + 1; if (Main.rand.NextBool(2)) { diff --git a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs index 63838e1415..56e70e350b 100644 --- a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 14; - item.damage = 81; + item.damage = 87; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -35,13 +34,6 @@ namespace CalamityMod.Items.Weapons.Melee item.shootSpeed = 14f; } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index b7b1700ff7..759dfef726 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 300; + item.damage = 130; item.melee = true; item.rare = 8; item.width = 72; diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index 3364382d01..6d6583af85 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 101; + item.damage = 49; item.ranged = true; - item.useTime = 15; - item.useAnimation = 15; + item.useTime = 18; + item.useAnimation = 18; item.knockBack = 2f; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index 041ddc9c07..c014be74a2 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 32; + item.damage = 27; item.ranged = true; item.width = 64; item.height = 30; diff --git a/Items/Weapons/Ranged/GreatbowofTurmoil.cs b/Items/Weapons/Ranged/GreatbowofTurmoil.cs index 6ed6729314..ad58129904 100644 --- a/Items/Weapons/Ranged/GreatbowofTurmoil.cs +++ b/Items/Weapons/Ranged/GreatbowofTurmoil.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 27; + item.damage = 31; item.ranged = true; item.width = 18; item.height = 36; @@ -38,26 +38,26 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 3; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + float piOverTen = MathHelper.Pi * 0.1f; + int arrowAmt = 3; + Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); + velocity *= 40f; + bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); + for (int projIndex = 0; projIndex < arrowAmt; projIndex++) { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) + float num120 = (float)projIndex - ((float)arrowAmt - 1f) / 2f; + Vector2 offset = velocity.RotatedBy((double)(piOverTen * num120), default); + if (!canHit) { - value9 -= vector7; + offset -= velocity; } if (type == ProjectileID.WoodenArrowFriendly) { type = ProjectileID.FireArrow; } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[num121].noDropItem = true; } for (int i = 0; i < 2; i++) @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Ranged default: break; } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.5f), knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockBack, player.whoAmI, 0f, 0f); Main.projectile[index].noDropItem = true; Main.projectile[index].usesLocalNPCImmunity = true; Main.projectile[index].localNPCHitCooldown = 10; diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index 15b6356c1a..673a3e4fe1 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 32; + item.damage = 27; item.ranged = true; item.crit += 20; item.width = 36; diff --git a/Items/Weapons/Ranged/Needler.cs b/Items/Weapons/Ranged/Needler.cs index 385aea044d..1ab60c3910 100644 --- a/Items/Weapons/Ranged/Needler.cs +++ b/Items/Weapons/Ranged/Needler.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 38; + item.damage = 45; item.ranged = true; item.width = 44; item.height = 26; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shootSpeed = 9f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 53a30951e9..1d286f5b93 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 210; + item.damage = 200; item.ranged = true; item.width = 84; item.height = 34; - item.useTime = 8; - item.useAnimation = 8; + item.useTime = 9; + item.useAnimation = 9; item.useStyle = 5; item.noMelee = true; item.knockBack = 4.5f; @@ -48,11 +48,12 @@ namespace CalamityMod.Items.Weapons.Ranged { // Fire the Onyx Shard that is characteristic of the Onyx Blaster // The shard deals triple damage and double knockback - int shardDamage = 3 * damage; + int shardDamage = (int)(2.5 * damage); float shardKB = 2f * knockBack; float shardVelocityX = (speedX + (float)Main.rand.Next(-25, 26) * 0.05f) * 0.9f; float shardVelocityY = (speedY + (float)Main.rand.Next(-25, 26) * 0.05f) * 0.9f; - Projectile.NewProjectile(position.X, position.Y, shardVelocityX, shardVelocityY, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + int onyx = Projectile.NewProjectile(position.X, position.Y, shardVelocityX, shardVelocityY, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + Main.projectile[onyx].timeLeft -= 20; // Fire three symmetric pairs of bullets alongside it Vector2 baseVelocity = new Vector2(speedX, speedY); diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index b2750d1247..31636ef2d9 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 76; item.height = 32; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 22; + item.useAnimation = 22; item.useStyle = 5; item.noMelee = true; item.knockBack = 4f; @@ -31,17 +31,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shootSpeed = 30f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int index = 0; index < 5; ++index) + for (int index = 0; index < Main.rand.Next(3,5); ++index) //3 to 4 bullets { float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index e444d39168..9a41a5dd4e 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 5600; + item.damage = 2601; item.ranged = true; item.crit += 40; item.knockBack = 10f; diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index 60b6c0023b..68117e29b6 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -1,3 +1,4 @@ +using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,10 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = 931; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool ConsumeAmmo(Player player) { @@ -57,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged Main.projectile[projectile].timeLeft = 200; Main.projectile[projectile].Calamity().forceRanged = true; } - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.LostSoulFriendly, damage, knockBack, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[proj].timeLeft = 600; Main.projectile[proj].Calamity().forceRanged = true; return false; diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 501414bdd9..fa56707ae3 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 4000; + item.damage = 4200; item.crit += 35; item.knockBack = 9.5f; item.ranged = true; @@ -57,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/Rogue/AccretionDisk.cs b/Items/Weapons/Rogue/AccretionDisk.cs index 32da2c5c22..39fbd1f72d 100644 --- a/Items/Weapons/Rogue/AccretionDisk.cs +++ b/Items/Weapons/Rogue/AccretionDisk.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,6 +36,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 776dfbb294..11507f71d8 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 100; + item.damage = 108; item.shootSpeed = 15f; item.shoot = ModContent.ProjectileType(); item.width = 66; diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 74e7573bc9..3475a96cd1 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -46,7 +46,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int dagger = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[dagger].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index fa34c83b75..ddea0f89fc 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 50; item.height = 50; - item.damage = 140; + item.damage = 120; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index ebfb1e7d4c..db54600b47 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 44; - item.damage = 18; + item.damage = 16; item.crit += 4; item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs index f114c903d6..878d9b34c2 100644 --- a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs +++ b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs @@ -94,7 +94,8 @@ namespace CalamityMod.Items.Weapons.Rogue num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 1f); + int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); } return false; } diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 21d7a99cbc..0951af189d 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -36,6 +36,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.PureGreen; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Vector2 origin = new Vector2(31f, 29f); diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index 55d7aa87c8..4120edfc13 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -34,6 +35,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/GalaxySmasherRogue.cs b/Items/Weapons/Rogue/GalaxySmasherRogue.cs index f5bbadb4c6..a59b0e4d53 100644 --- a/Items/Weapons/Rogue/GalaxySmasherRogue.cs +++ b/Items/Weapons/Rogue/GalaxySmasherRogue.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 8e3b212583..ff7aa0d399 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -48,44 +48,28 @@ Right click to delete all existing spiky balls"); } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - if (player.ownedProjectileCounts[item.shoot] > 0) - { - return true; - } - else - { - return false; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } else { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 5f; int UseMax = item.stack; - - if (player.ownedProjectileCounts[item.shoot] >= UseMax) - { - return false; - } - else - { - return true; - } + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; - if (player.altFunctionUse == 2) - { - modPlayer.killSpikyBalls = true; - return false; - } - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -96,6 +80,8 @@ Right click to delete all existing spiky balls"); public override bool AltFunctionUse(Player player) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index d6e73f5fea..38c01c5cd8 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -46,47 +46,30 @@ namespace CalamityMod.Items.Weapons.Rogue item.shootSpeed = 5f; item.shoot = ModContent.ProjectileType(); - } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - if (player.ownedProjectileCounts[item.shoot] > 0) - { - return true; - } - else - { - return false; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } else { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 5f; int UseMax = item.stack; - - if (player.ownedProjectileCounts[item.shoot] >= UseMax) - { - return false; - } - else - { - return true; - } + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; - if (player.altFunctionUse == 2) - { - modPlayer.killSpikyBalls = true; - return false; - } - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * SdamageMult), knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -99,6 +82,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index 57302003c7..50814bfec6 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 40; - item.damage = 8; + item.damage = 7; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = false; item.height = 36; item.maxStack = 999; - item.value = 1000; + item.value = Item.buyPrice(0, 0, 1, 0); item.rare = 0; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index f8dad5bc9b..7f4b6e90a1 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -43,7 +43,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index 414d6034d9..2d4e6fc3e6 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 40; - item.damage = 8; + item.damage = 7; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = false; item.height = 36; item.maxStack = 999; - item.value = 1000; + item.value = Item.buyPrice(0, 0, 1, 0); item.rare = 0; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index 5a0d797ec6..96d7874b26 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,6 +34,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index c2ea74d77f..7f0d949771 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Weapons.Rogue { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index 2f7048ba92..f2d29b7758 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { - for (int j = 0; j < item.stack - player.ownedProjectileCounts[item.shoot]; j++) + for (int j = 0; j < item.stack - player.ownedProjectileCounts[ModContent.ProjectileType()]; j++) { float spread = 2; int pIndex = Projectile.NewProjectile(position.X, position.Y, speedX + Main.rand.NextFloat(-spread, spread), speedY + Main.rand.NextFloat(-spread, spread), type, damage, knockBack, player.whoAmI, 0f, 1f); @@ -79,10 +79,22 @@ namespace CalamityMod.Items.Weapons.Rogue return false; } - public override bool CanUseItem(Player player) - { - return player.ownedProjectileCounts[item.shoot] < item.stack && player.altFunctionUse != 2; - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } + else + { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 6f; + int UseMax = item.stack; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + } + } public override void AddRecipes() { diff --git a/Items/Weapons/Rogue/PhantomLance.cs b/Items/Weapons/Rogue/PhantomLance.cs index bb4ca73c94..7265574da8 100644 --- a/Items/Weapons/Rogue/PhantomLance.cs +++ b/Items/Weapons/Rogue/PhantomLance.cs @@ -20,7 +20,7 @@ Stealth strikes don't slow down and souls always deal full damage"); public override void SafeSetDefaults() { - item.damage = 60; + item.damage = 70; item.knockBack = 5f; item.width = 62; diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs index 07e2541d12..e26e270cd5 100644 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ b/Items/Weapons/Rogue/PoisonPack.cs @@ -42,47 +42,30 @@ namespace CalamityMod.Items.Weapons.Rogue item.shootSpeed = 7f; item.shoot = ModContent.ProjectileType(); - } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - if (player.ownedProjectileCounts[item.shoot] > 0) - { - return true; - } - else - { - return false; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } else { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7f; int UseMax = item.stack; - - if (player.ownedProjectileCounts[item.shoot] >= UseMax) - { - return false; - } - else - { - return true; - } + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; - if (player.altFunctionUse == 2) - { - modPlayer.killSpikyBalls = true; - return false; - } - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -93,6 +76,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/Pwnagehammer.cs b/Items/Weapons/Rogue/Pwnagehammer.cs index 22c306977d..efc33c2c13 100644 --- a/Items/Weapons/Rogue/Pwnagehammer.cs +++ b/Items/Weapons/Rogue/Pwnagehammer.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,6 +34,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/RoyalKnives.cs b/Items/Weapons/Rogue/RoyalKnives.cs index 2814bc4c33..4d5499fe89 100644 --- a/Items/Weapons/Rogue/RoyalKnives.cs +++ b/Items/Weapons/Rogue/RoyalKnives.cs @@ -93,7 +93,8 @@ namespace CalamityMod.Items.Weapons.Rogue num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); + int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); } return false; } diff --git a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs index 9be81be0ae..93641079e8 100644 --- a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs +++ b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs @@ -39,7 +39,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 3574841393..d56a78eca5 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 47; + item.damage = 169; item.knockBack = 5f; item.useAnimation = item.useTime = 25; item.useStyle = 1; diff --git a/Items/Weapons/Rogue/SeashellBoomerang.cs b/Items/Weapons/Rogue/SeashellBoomerang.cs index cd9eb3a0c4..9424e5d6ea 100644 --- a/Items/Weapons/Rogue/SeashellBoomerang.cs +++ b/Items/Weapons/Rogue/SeashellBoomerang.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,6 +33,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index 1c58dc7cd6..bf1ae74ec7 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -42,47 +42,30 @@ namespace CalamityMod.Items.Weapons.Rogue item.shootSpeed = 2f; item.shoot = ModContent.ProjectileType(); - } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - if (player.ownedProjectileCounts[item.shoot] > 0) - { - return true; - } - else - { - return false; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.shoot = 0; + item.shootSpeed = 0f; + return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + } else { + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 2f; int UseMax = item.stack; - - if (player.ownedProjectileCounts[item.shoot] >= UseMax) - { - return false; - } - else - { - return true; - } + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; } - } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.killSpikyBalls = false; - if (player.altFunctionUse == 2) - { - modPlayer.killSpikyBalls = true; - return false; - } - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -93,6 +76,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/StellarContemptRogue.cs b/Items/Weapons/Rogue/StellarContemptRogue.cs index 307f59266f..f3b4207cc6 100644 --- a/Items/Weapons/Rogue/StellarContemptRogue.cs +++ b/Items/Weapons/Rogue/StellarContemptRogue.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Items.Weapons.Rogue { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/TerraDisk.cs b/Items/Weapons/Rogue/TerraDisk.cs index 84124fafee..80ab448d5c 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/TerraDisk.cs @@ -58,6 +58,7 @@ A max of three disks can be active at a time"); { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index 2e7c0109e6..0ddae8e36a 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Toxicant Twister"); - Tooltip.SetDefault("Throws a speedy boomerang\n" + + Tooltip.SetDefault("Throws a speedy, homing boomerang\n" + "Stealth strikes fire two boomerangs that go much faster and release sand rapidly"); } @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 42; item.height = 46; - item.damage = 950; + item.damage = 650; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = item.useTime = 20; @@ -30,45 +30,34 @@ namespace CalamityMod.Items.Weapons.Rogue item.value = Item.buyPrice(1, 40, 0, 0); item.Calamity().postMoonLordRarity = 13; item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; item.Calamity().rogue = true; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int projType = item.shoot; - if (Main.rand.NextBool(2)) - { - projType = ModContent.ProjectileType(); - } - if (player.Calamity().StealthStrikeAvailable()) { float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].velocity *= 1.5f; + Main.projectile[stealth].timeLeft = 420; + Main.projectile[stealth].penetrate = -1; + Main.projectile[stealth].localNPCHitCooldown = 6; + float SpeedX2 = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY2 = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - Main.projectile[stealth2].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - if (Main.projectile[stealth].Calamity().stealthStrike) - { - Main.projectile[stealth].velocity *= 1.5f; - Main.projectile[stealth].timeLeft = 420; - Main.projectile[stealth].penetrate = -1; - Main.projectile[stealth].localNPCHitCooldown = 6; - } - if (Main.projectile[stealth2].Calamity().stealthStrike) - { - Main.projectile[stealth2].penetrate += 2; - Main.projectile[stealth2].localNPCHitCooldown = 8; - } + int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, type, (int)(damage * 0.6f), knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth2].Calamity().stealthStrike = true; + Main.projectile[stealth2].penetrate += 2; + Main.projectile[stealth2].localNPCHitCooldown = 8; } else { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), projType, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs b/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs index cc7d1d8545..b6f1371380 100644 --- a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs +++ b/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,6 +37,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().customRarity = CalamityRarity.Developer; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/TruePaladinsHammer.cs b/Items/Weapons/Rogue/TruePaladinsHammer.cs index eeaee61fc5..bc8087f295 100644 --- a/Items/Weapons/Rogue/TruePaladinsHammer.cs +++ b/Items/Weapons/Rogue/TruePaladinsHammer.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Hybrid; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 14; - item.damage = 81; + item.damage = 87; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -34,6 +35,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 86ef24f4aa..ada0d3eabd 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 22; - item.damage = 8; + item.damage = 11; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 38; item.maxStack = 999; - item.value = 100; + item.value = Item.buyPrice(0, 0, 1, 0); item.rare = 1; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 273e2ac851..638fdc8a8d 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 12; + item.damage = 10; item.mana = 10; item.width = 34; item.height = 24; diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index b1b38912a1..54ee78dbdc 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Prototype Andromecha Ring"); - Tooltip.SetDefault("Summons an colossal controllable mech\n" + + Tooltip.SetDefault("Summons a colossal controllable mech\n" + "Right click to display the mech's control panel\n" + "The panel has 3 possible configurations, that you can choose using the brackets on the UI\n" + "Each bracket powers 2 out of 3 functions, represented by icons on the UI.\n" + diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 435ca73151..f6d79f82f3 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -357,7 +357,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("AstrumAureus", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HallowedKey, ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] at Night in the Astral Biome"; string despawn = CalamityUtils.ColorMessage("Astrum Aureus’ program has been executed. Initiate recall.", new Color(0xFF, 0xD7, 0x00)); @@ -370,7 +370,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("PlaguebringerGoliath", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.Stinger, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("HOSTILE SPECIMENS TERMINATED. INITIATE RECALL TO HOME BASE.", new Color(0x00, 0xFF, 0x00)); @@ -396,7 +396,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("AstrumDeus", out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemID.FallenStar, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FragmentSolar, ItemID.FragmentVortex, ItemID.FragmentNebula, ItemID.FragmentStardust, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Defeat 3 empowered astral titans or use a [i:{summon}] at Night"; string despawn = CalamityUtils.ColorMessage("The infected deity retreats to the heavens.", new Color(0xFF, 0xD7, 0x00)); @@ -536,7 +536,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("SupremeCalamitas", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); @@ -551,7 +551,7 @@ namespace CalamityMod InvasionDifficulty.TryGetValue("Acid Rain Initial", out float order); List enemies = AcidRainEvent.PossibleEnemiesPreHM.Select(enemy => enemy.Key).ToList(); int summon = ItemType(); - List loot = new List() { ItemType() }; + List loot = new List() { ItemType(), ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{summon}] or wait for the invasion to occur naturally after the Eye of Cthulhu is defeated."; string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the ocean.", new Color(146, 183, 116)); @@ -566,7 +566,7 @@ namespace CalamityMod enemies.Add(ModContent.NPCType()); enemies.AddRange(AcidRainEvent.PossibleMinibossesAS.Select(miniboss => miniboss.Key)); List summons = new List() { ItemType(), ItemType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{ItemType()}] or [i:{ItemType()}] or wait for the invasion to occur naturally after the Aquatic Scourge is defeated"; string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the deep ocean.", new Color(146, 183, 116)); @@ -580,7 +580,7 @@ namespace CalamityMod List enemies = AcidRainEvent.PossibleEnemiesPolter.Select(enemy => enemy.Key).ToList(); enemies.AddRange(AcidRainEvent.PossibleMinibossesPolter.Select(miniboss => miniboss.Key)); List summons = new List() { ItemType(), ItemType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ModContent.ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ModContent.ItemType() }; List collection = new List() { ItemType() }; string instructions = $"Use a [i:{ItemType()}] or [i:{ItemType()}] or wait for the invasion to occur naturally after the Polterghast is defeated"; string despawn = CalamityUtils.ColorMessage("The mysterious creatures of the sulphuric sea descended back into the deep ocean.", new Color(146, 183, 116)); @@ -618,7 +618,7 @@ namespace CalamityMod // Queen Bee AddLoot(bossChecklist, "QueenBee", - new List() { ItemType() }, + new List() { ItemType(), ItemID.Stinger }, new List() { ItemType() } ); diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 2b1074f059..fa9b875671 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -14,9 +14,10 @@ namespace CalamityMod.NPCs.AcidRain { public class NuclearTerror : ModNPC { - public bool Walking = false; public int AttackIndex = 0; public int DelayTime = 0; + public bool Dying = false; + public bool Walking = false; public float JumpTimer = 0f; public Vector2 ShootPosition; public static readonly int[] PhaseArray = new int[] @@ -61,6 +62,7 @@ namespace CalamityMod.NPCs.AcidRain public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); + writer.Write(Dying); writer.Write(Walking); writer.Write(AttackIndex); writer.Write(DelayTime); @@ -70,6 +72,7 @@ namespace CalamityMod.NPCs.AcidRain public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); + Dying = reader.ReadBoolean(); Walking = reader.ReadBoolean(); AttackIndex = reader.ReadInt32(); DelayTime = reader.ReadInt32(); @@ -78,8 +81,8 @@ namespace CalamityMod.NPCs.AcidRain } public override void AI() { - Lighting.AddLight(npc.Center, (npc.dontTakeDamage ? Color.Lime.ToVector3() : Color.White.ToVector3()) * 2f); - if (npc.dontTakeDamage) + Lighting.AddLight(npc.Center, (Dying ? Color.Lime.ToVector3() : Color.White.ToVector3()) * 2f); + if (Dying) return; bool phase2 = npc.life / (float)npc.lifeMax < 0.5f; if (DelayTime > 0) @@ -103,7 +106,7 @@ namespace CalamityMod.NPCs.AcidRain } Player player = Main.player[npc.target]; npc.defDamage = 170; - npc.damage = npc.dontTakeDamage ? 0 : npc.defDamage; + npc.damage = Dying ? 0 : npc.defDamage; TeleportCheck(player); npc.ai[0]++; Walking = false; @@ -347,7 +350,7 @@ namespace CalamityMod.NPCs.AcidRain public override void FindFrame(int frameHeight) { npc.frameCounter++; - int framesNeeded = npc.dontTakeDamage ? 7 : 6; + int framesNeeded = Dying ? 7 : 6; if (Walking) { framesNeeded = 8 - (int)Math.Ceiling(Math.Abs(npc.velocity.X) / 5f); // Walk faster the faster we're moving @@ -357,7 +360,7 @@ namespace CalamityMod.NPCs.AcidRain npc.frame.Y += frameHeight; npc.frameCounter = 0; } - if (npc.dontTakeDamage) + if (Dying) { if (npc.frame.Y < frameHeight * 8) { @@ -402,16 +405,17 @@ namespace CalamityMod.NPCs.AcidRain } public override bool CheckDead() { - if (!npc.dontTakeDamage) + if (!Dying) { npc.active = true; npc.life = 1; npc.dontTakeDamage = true; + Dying = true; npc.velocity = Vector2.Zero; npc.netUpdate = true; return false; } - return true; + return Dying; } public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 946524a1b0..2b0665d63e 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -86,7 +86,16 @@ namespace CalamityMod.NPCs.AcidRain { if (npc.ai[0] % 55f == 54f) { - npc.velocity = Vector2.UnitX * (player.Center.X - npc.Center.X > 0).ToDirectionInt() * 27f; + float horizontalSchoolingSpeed = 9f; + if (CalamityWorld.downedAquaticScourge) + { + horizontalSchoolingSpeed = 15f; + } + if (CalamityWorld.downedPolterghast) + { + horizontalSchoolingSpeed = 24f; + } + npc.velocity = Vector2.UnitX * (player.Center.X - npc.Center.X > 0).ToDirectionInt() * horizontalSchoolingSpeed; } if ((Math.Abs(player.Center.Y - npc.Center.Y) > 50f && player.wet) || (!player.wet && npc.ai[1] <= 0f)) { diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index db02795914..d11b3cd218 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -71,7 +71,33 @@ namespace CalamityMod.NPCs.AcidRain npc.TargetClosest(false); npc.localAI[0] = 1f; } + + // Anti-sticky movement and player targeting detection (only one leech and attack the player at once) Player player = Main.player[npc.target]; + bool playerAlreadyTargeted = false; + float antiStickyAcceleration = 0.25f; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].type == npc.type && + Main.npc[i].whoAmI != npc.whoAmI && + Main.npc[i].active) + { + if (Main.npc[i].target == npc.target && !playerAlreadyTargeted) + { + playerAlreadyTargeted = true; + } + if (Main.npc[i].Hitbox.Intersects(npc.Hitbox)) + { + npc.velocity += npc.DirectionFrom(Main.npc[i].Center) * antiStickyAcceleration; + } + } + } + + if (!playerAlreadyTargeted || player.Calamity().waterLeechTarget == -1) + { + player.Calamity().waterLeechTarget = npc.whoAmI; + } + // Latch onto player if (npc.ai[0] == 1f) { @@ -114,14 +140,14 @@ namespace CalamityMod.NPCs.AcidRain npc.netUpdate = true; } } - else if (player.wet) + else if (player.wet && player.Calamity().waterLeechTarget == npc.whoAmI) { - float speed = player.wet ? 23f : 15f; + float speed = player.wet ? 23f : 17f; float swimIntertia = 24f; if (CalamityWorld.downedPolterghast) { speed *= 1.6f; - swimIntertia = 13f; + swimIntertia = 17f; } npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.DirectionTo(player.Center) * speed) / swimIntertia; } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6f6a616e52..cfc12251b7 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -63,6 +63,7 @@ using System; using System.Collections.Generic; using System.Linq; using Terraria; +using Terraria.GameContent.Events; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -3530,6 +3531,10 @@ namespace CalamityMod.NPCs { damage = (int)(damage * 0.1); } + else if (projectile.type == ProjectileType()) + { + damage = (int)(damage * 0.2); + } else if (projectile.type == ProjectileID.Wasp || projectile.type == player.beeType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.DD2BetsyArrow) { damage = (int)(damage * 0.4); @@ -5306,6 +5311,11 @@ namespace CalamityMod.NPCs chat = "I happen to have several Angel Statues at the moment, a truely rare commodity. Want one?"; } + if (Main.rand.NextBool(7) && CalamityWorld.death) + { + chat = "The caverns have become increasingly dark as of late, so I stocked up on some special torches if you have the funds."; + } + break; case NPCID.Mechanic: @@ -5555,6 +5565,7 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.BallOHurt : ItemID.TheRottedFork, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedBoss3); SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(NPCType()) != -1, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.UltrabrightTorch, CalamityWorld.death); } // Because of the defiled condition, the dye trader does not receive an alert icon when hardmode starts. @@ -5818,6 +5829,23 @@ namespace CalamityMod.NPCs } #endregion + #region Any Events + public static bool AnyEvents(Player player) + { + if (Main.invasionType > 0) + return true; + if (player.PillarZone()) + return true; + if (DD2Event.Ongoing) + return true; + if ((player.ZoneOverworldHeight || player.ZoneSkyHeight) && (Main.eclipse || Main.bloodMoon || Main.pumpkinMoon || Main.snowMoon)) + return true; + if (CalamityWorld.rainingAcid && player.InSulphur()) + return true; + return false; + } + #endregion + #region Get Downed Boss Variable public static bool GetDownedBossVariable(int type) { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 721657255b..3b773eccd8 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1689,7 +1689,7 @@ namespace CalamityMod.NPCs break; case NPCID.Plantera: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 6, 9); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 12, 18); break; case NPCID.SolarSpearman: //Drakanian diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 26d9f78b5a..f5558ebedb 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.height = 198; npc.defense = 40; npc.Calamity().RevPlusDR(0.25f); - npc.LifeMaxNERB(58500, 77275, 3700000); + npc.LifeMaxNERB(64350, 85002, 3700000); double HPBoost = (double)CalamityMod.CalamityConfig.BossHealthPercentageBoost * 0.01; npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 4981529049..c9a6c11447 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1307,7 +1307,7 @@ namespace CalamityMod.NPCs.Providence { // Materials DropHelper.DropItemSpray(npc, ModContent.ItemType(), 20, 30); - DropHelper.DropItemSpray(npc, ModContent.ItemType(), 10, 15); + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 15, 20); // Weapons DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 0164ce02a1..f1a3579ccd 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -123,9 +123,17 @@ namespace CalamityMod.Projectiles case ProjectileID.ButchersChainsaw: trueMelee = true; break; + case ProjectileID.StarWrath: projectile.penetrate = projectile.maxPenetrate = 1; break; + + case ProjectileID.Spazmamini: + case ProjectileID.Retanimini: + case ProjectileID.MiniRetinaLaser: + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + break; default: break; } @@ -1139,7 +1147,7 @@ namespace CalamityMod.Projectiles } } - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType()) + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType() && !player.moonLeech) { // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (player.ghostHeal) @@ -1485,13 +1493,14 @@ namespace CalamityMod.Projectiles target.AddBuff(BuffID.Venom, 240); } - if (modPlayer.shadow) + if (modPlayer.shadow && modPlayer.shadowPotCooldown <= 0) { if (CalamityMod.javelinProjList.Contains(projectile.type)) { int randrot = Main.rand.Next(-30, 391); Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.1, 60), 3f, projectile.owner, 0f, 0f); + modPlayer.shadowPotCooldown = 30; } if (CalamityMod.spikyBallProjList.Contains(projectile.type)) { @@ -1499,6 +1508,7 @@ namespace CalamityMod.Projectiles Main.projectile[scythe].usesLocalNPCImmunity = true; Main.projectile[scythe].localNPCHitCooldown = 10; Main.projectile[scythe].penetrate = 2; + modPlayer.shadowPotCooldown = 30; } if (CalamityMod.daggerProjList.Contains(projectile.type)) { @@ -1507,6 +1517,7 @@ namespace CalamityMod.Projectiles shardVelocity *= 5f; int shard = Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 60), 0f, projectile.owner); Main.projectile[shard].timeLeft = 150; + modPlayer.shadowPotCooldown = 30; } if (CalamityMod.boomerangProjList.Contains(projectile.type)) { @@ -1547,11 +1558,13 @@ namespace CalamityMod.Projectiles int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0f, projectile.owner, (float)num3, 0f); Main.projectile[ghost].Calamity().forceRogue = true; Main.projectile[ghost].penetrate = 1; + modPlayer.shadowPotCooldown = 30; } if (CalamityMod.flaskBombProjList.Contains(projectile.type)) { int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f); Main.projectile[blackhole].Center = projectile.Center; + modPlayer.shadowPotCooldown = 30; } } } @@ -1621,8 +1634,8 @@ namespace CalamityMod.Projectiles { if (Main.rand.NextBool(4)) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 100), projectile.knockBack * 0.25f, projectile.owner); - modPlayer.jellyDmg = 20f; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 90), projectile.knockBack * 0.25f, projectile.owner); + modPlayer.jellyDmg = 25f; } } else if (modPlayer.starbusterCore) @@ -1915,6 +1928,8 @@ namespace CalamityMod.Projectiles public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier) { + if (Main.player[Main.myPlayer].moonLeech) + return; Main.player[Main.myPlayer].lifeSteal -= healAmount * cooldownMultiplier; float num13 = 0f; int num14 = projectile.owner; @@ -2133,6 +2148,231 @@ namespace CalamityMod.Projectiles } } + public static void ChargingMinionAI(Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging) + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + //Anti sticky movement to prevent stacking + float antiStickMvt = 0.05f; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + bool typeCheck = proj.type == projectile.type; + if (projIndex != projectile.whoAmI && proj.active && proj.owner == projectile.owner && typeCheck && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width) + { + if (projectile.position.X < proj.position.X) + { + projectile.velocity.X -= antiStickMvt; + } + else + { + projectile.velocity.X += antiStickMvt; + } + if (projectile.position.Y < proj.position.Y) + { + projectile.velocity.Y -= antiStickMvt; + } + else + { + projectile.velocity.Y += antiStickMvt; + } + } + } + + //Breather time between charges as like a reset + bool chargeDelay = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = initialUpdates + (projectile.type == ModContent.ProjectileType() ? 2 : 1); + if (projectile.ai[1] > chargeDelayTime) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = initialUpdates; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + chargeDelay = true; + } + } + if (chargeDelay) + { + return; + } + + //Find a target + float maxDist = range; + Vector2 targetVec = projectile.position; + bool foundTarget = false; + Vector2 half = new Vector2(0.5f); + //Prioritize the targeted enemy if possible + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + //Check the size of the target to make it easier to hit fat targets like Levi + Vector2 sizeCheck = npc.position + npc.Size * half; + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + //Some minions will ignore tiles when choosing a target like Ice Claspers, others will not + bool canHit = true; + if (!tileVision) + canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + if (!foundTarget && targetDist < maxDist && canHit) + { + maxDist = targetDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + //If no npc is specifically targetted, check through the entire array + else + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 sizeCheck = npc.position + npc.Size * half; + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + bool canHit = true; + if (!tileVision) + canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + if (!foundTarget && targetDist < maxDist && canHit) + { + maxDist = targetDist; + targetVec = sizeCheck; + foundTarget = true; + } + } + } + } + + //If the player is too far, return to the player. Range is increased while attacking something. + float distBeforeForcedReturn = maxPlayerDist; + if (foundTarget) + { + distBeforeForcedReturn = extraMaxPlayerDist; + } + if (Vector2.Distance(player.Center, projectile.Center) > distBeforeForcedReturn) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + + //Go to the target if you found one + if (foundTarget && projectile.ai[0] == 0f) + { + //Some minions don't ignore tiles while charging like brittle stars + projectile.tileCollide = !ignoreTilesWhenCharging; + Vector2 targetSpot = targetVec - projectile.Center; + float targetDist = targetSpot.Length(); + targetSpot.Normalize(); + //Tries to get the minion in the sweet spot of 200 pixels away but the minion also charges so idk what good it does + if (targetDist > 200f) + { + float speed = goToSpeed; //8 + targetSpot *= speed; + projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; + } + else + { + float speed = -goBackSpeed; //-4 + targetSpot *= speed; + projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; //41 + } + } + + //Movement for idle or returning to the player + else + { + //Ignore tiles so they don't get stuck everywhere like Optic Staff + projectile.tileCollide = false; + + bool returningToPlayer = false; + if (!returningToPlayer) + { + returningToPlayer = projectile.ai[0] == 1f; + } + + //Player distance calculations + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -60f); + float playerDist = playerVec.Length(); + + //If the minion is actively returning, move faster + float playerHomeSpeed = 6f; + if (returningToPlayer) + { + playerHomeSpeed = 15f; + } + //Move somewhat faster if the player is kinda far~ish + if (playerDist > 200f && playerHomeSpeed < 8f) + { + playerHomeSpeed = 8f; + } + //Return to normal if close enough to the player + if (playerDist < safeDist && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + //Teleport to the player if abnormally far + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + //If more than 70 pixels away, move toward the player + if (playerDist > 70f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + } + //Minions never stay still + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + + //Increment attack counter randomly + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + //If high enough, prepare to attack + if (projectile.ai[1] > chargeCounterMax) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + //Charge at an enemy if not on cooldown + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && foundTarget && maxDist < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 targetPos = targetVec - projectile.Center; + targetPos.Normalize(); + projectile.velocity = targetPos * chargeSpeed; //8 + projectile.netUpdate = true; + } + } + } + } + public static void FloatingPetAI(Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false) { Player player = Main.player[projectile.owner]; diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index 6c2ed80366..c9a3d5e548 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing projectile.velocity.X *= 0.95f; projectile.velocity.Y *= 0.95f; - CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f, false); + CalamityGlobalProjectile.HealingProjectile(projectile, 3, (int)projectile.ai[0], 6f, 15f, false); int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dusty]; dust.noGravity = true; diff --git a/Projectiles/Healing/TerracottaProj.cs b/Projectiles/Healing/TerracottaProj.cs index 14ae4bc480..d6c26b2ae1 100644 --- a/Projectiles/Healing/TerracottaProj.cs +++ b/Projectiles/Healing/TerracottaProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing projectile.velocity.X *= 0.95f; projectile.velocity.Y *= 0.95f; - CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f, false, 300); + CalamityGlobalProjectile.HealingProjectile(projectile, 9, (int)projectile.ai[0], 8f, 15f, false, 300); float num498 = projectile.velocity.X * 0.2f; float num499 = -(projectile.velocity.Y * 0.2f); int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f); diff --git a/Projectiles/Hybrid/AccretionDiskProj.cs b/Projectiles/Hybrid/AccretionDiskProj.cs index 0cc68e105f..5c91e8fadb 100644 --- a/Projectiles/Hybrid/AccretionDiskProj.cs +++ b/Projectiles/Hybrid/AccretionDiskProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 400; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Hybrid/EradicatorProjectile.cs b/Projectiles/Hybrid/EradicatorProjectile.cs index 458f86a7a3..c5d6093ea1 100644 --- a/Projectiles/Hybrid/EradicatorProjectile.cs +++ b/Projectiles/Hybrid/EradicatorProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Hybrid aiType = ProjectileID.WoodenBoomerang; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Hybrid/FlameScytheProjectile.cs b/Projectiles/Hybrid/FlameScytheProjectile.cs index 57e8b9a374..5faaa6cf46 100644 --- a/Projectiles/Hybrid/FlameScytheProjectile.cs +++ b/Projectiles/Hybrid/FlameScytheProjectile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.timeLeft = 600; projectile.alpha = 55; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() @@ -57,7 +57,10 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; + if (projectile.melee) + Main.projectile[proj].Calamity().forceMelee = true; + else + Main.projectile[proj].Calamity().forceRogue = true; } } @@ -67,7 +70,10 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; + if (projectile.melee) + Main.projectile[proj].Calamity().forceMelee = true; + else + Main.projectile[proj].Calamity().forceRogue = true; } } } diff --git a/Projectiles/Hybrid/GalaxySmasherHammer.cs b/Projectiles/Hybrid/GalaxySmasherHammer.cs index 16010c3265..39f836e272 100644 --- a/Projectiles/Hybrid/GalaxySmasherHammer.cs +++ b/Projectiles/Hybrid/GalaxySmasherHammer.cs @@ -183,7 +183,6 @@ namespace CalamityMod.Projectiles.Hybrid float laserSpeed = Main.rand.NextFloat(15f, 18f); Vector2 velocity = startDir * (-laserSpeed); - // NebulaShot projectile adjusts its own damage type based on ai[0] if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner); diff --git a/Projectiles/Hybrid/MangroveChakramProjectile.cs b/Projectiles/Hybrid/MangroveChakramProjectile.cs index 0c32453a85..a1e11f2486 100644 --- a/Projectiles/Hybrid/MangroveChakramProjectile.cs +++ b/Projectiles/Hybrid/MangroveChakramProjectile.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 600; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Hybrid/OPHammer.cs b/Projectiles/Hybrid/OPHammer.cs index 0278d3d2db..8cd41f666b 100644 --- a/Projectiles/Hybrid/OPHammer.cs +++ b/Projectiles/Hybrid/OPHammer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.tileCollide = false; projectile.penetrate = -1; projectile.extraUpdates = 2; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() @@ -118,7 +118,10 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; + if (projectile.melee) + Main.projectile[proj].Calamity().forceMelee = true; + else + Main.projectile[proj].Calamity().forceRogue = true; } } @@ -128,7 +131,10 @@ namespace CalamityMod.Projectiles.Hybrid if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].Calamity().forceRogue = true; + if (projectile.melee) + Main.projectile[proj].Calamity().forceMelee = true; + else + Main.projectile[proj].Calamity().forceRogue = true; } } diff --git a/Projectiles/Hybrid/PwnagehammerProj.cs b/Projectiles/Hybrid/PwnagehammerProj.cs index b84082b42c..a973c87a60 100644 --- a/Projectiles/Hybrid/PwnagehammerProj.cs +++ b/Projectiles/Hybrid/PwnagehammerProj.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.timeLeft = 120; projectile.extraUpdates = 3; aiType = ProjectileID.PaladinsHammerFriendly; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Hybrid/SeashellBoomerangProjectile.cs b/Projectiles/Hybrid/SeashellBoomerangProjectile.cs index d7209de0a7..f6f6a7c8aa 100644 --- a/Projectiles/Hybrid/SeashellBoomerangProjectile.cs +++ b/Projectiles/Hybrid/SeashellBoomerangProjectile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 240; aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; + projectile.melee = true; } } } diff --git a/Projectiles/Hybrid/TriactisOPHammer.cs b/Projectiles/Hybrid/TriactisOPHammer.cs index 1c4ddffd63..4a59c7ab85 100644 --- a/Projectiles/Hybrid/TriactisOPHammer.cs +++ b/Projectiles/Hybrid/TriactisOPHammer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Hybrid projectile.tileCollide = false; projectile.penetrate = -1; projectile.extraUpdates = 3; - projectile.Calamity().rogue = true; + projectile.melee = true; } public override void AI() diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs index cfacbdbd4a..718b82efce 100644 --- a/Projectiles/Magic/MagnusBeam.cs +++ b/Projectiles/Magic/MagnusBeam.cs @@ -203,7 +203,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index fa9fb3df1d..1559d3ffb0 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.velocity.X *= 0.975f; projectile.velocity.Y *= 0.975f; - if (Main.rand.NextBool(2)) + if (projectile.timeLeft % 4 == 0) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 15, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index db5781dd73..66162cb947 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; projectile.velocity.X *= 0.975f; projectile.velocity.Y *= 0.975f; - if (Main.rand.NextBool(2)) + if (projectile.timeLeft % 4 == 0) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 9f58a84dfc..ced7da82de 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,7 +23,6 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 60; projectile.alpha = 255; projectile.friendly = true; - projectile.aiStyle = 71; projectile.magic = true; projectile.penetrate = -1; projectile.timeLeft = 600; @@ -31,6 +31,96 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; } + public override void AI() + { + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 10f && Main.rand.NextBool(3)) + { + int num = 6; + for (int index1 = 0; index1 < num; ++index1) + { + Vector2 vector2_1 = (Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width, (float)projectile.height) / 2f).RotatedBy((double)(index1 - (num / 2 - 1)) * Math.PI / (double)num, new Vector2()) + projectile.Center; + Vector2 vector2_2 = ((Main.rand.NextFloat() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int index2 = Dust.NewDust(vector2_1 + vector2_2, 0, 0, 217, vector2_2.X * 2f, vector2_2.Y * 2f, 100, new Color(), 1.4f); + Dust dust = Main.dust[index2]; + dust.noGravity = true; + dust.noLight = true; + dust.velocity /= 4f; + dust.velocity -= projectile.velocity; + } + projectile.alpha -= 5; + if (projectile.alpha < 50) + projectile.alpha = 50; + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[1] / 3f) % 3; + Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0.1f, 0.4f, 0.6f); + } + int num1 = -1; + Vector2 vector2 = projectile.Center; + float num2 = 500f; + Vector2 value = new Vector2(0.5f); + if (projectile.localAI[0] > 0f) + { + projectile.localAI[0] -= 1f; + } + if (projectile.ai[0] == 0f && projectile.localAI[0] == 0f) + { + for (int index = 0; index < Main.maxNPCs; ++index) + { + NPC npc = Main.npc[index]; + if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (index + 1f))) + { + Vector2 center = npc.position + npc.Size * value; + float num3 = Vector2.Distance(center, vector2); + if (num3 < num2 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num2 = num3; + vector2 = center; + num1 = index; + } + } + } + if (num1 >= 0) + { + projectile.ai[0] = num1 + 1f; + projectile.netUpdate = true; + } + } + if (projectile.localAI[0] == 0f && projectile.ai[0] == 0f) + projectile.localAI[0] = 30f; + bool flag = false; + if (projectile.ai[0] != 0f) + { + int index = (int)(projectile.ai[0] - 1); + if (Main.npc[index].active && !Main.npc[index].dontTakeDamage && Main.npc[index].immune[projectile.owner] == 0) + { + if ((Math.Abs(projectile.Center.X - Main.npc[index].Center.X) + Math.Abs(projectile.Center.Y - Main.npc[index].Center.Y)) < 1000f) + { + flag = true; + vector2 = Main.npc[index].Center; + } + } + else + { + projectile.ai[0] = 0f; + flag = false; + projectile.netUpdate = true; + } + } + if (flag) + { + double num3 = (double)(vector2 - projectile.Center).ToRotation() - (double)projectile.velocity.ToRotation(); + if (num3 > Math.PI) + num3 -= 2.0 * Math.PI; + if (num3 < -1.0 * Math.PI) + num3 += 2.0 * Math.PI; + projectile.velocity = projectile.velocity.RotatedBy(num3 * 0.1, new Vector2()); + } + float num4 = projectile.velocity.Length(); + projectile.velocity.Normalize(); + projectile.velocity = projectile.velocity * (num4 + 1f / 400f); + } + public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 12d74eaff4..3ed0304e57 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -88,14 +88,14 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + target.AddBuff(ModContent.BuffType(), 120); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } Player player = Main.player[projectile.owner]; player.statLife += 1; player.HealEffect(1); - target.AddBuff(ModContent.BuffType(), 120); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Magic/VisceraBeam.cs b/Projectiles/Magic/VisceraBeam.cs index 894d789415..e695566dc5 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index c092e1101d..ce6818f4bd 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - CalamityUtils.ModifyHitNPCSticky(projectile, 4, false); + CalamityUtils.ModifyHitNPCSticky(projectile, 3, false); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index b160e1f524..663a68b5f1 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -40,6 +40,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Player player = Main.player[projectile.owner]; + if (player.moonLeech) + return; player.statLife += 5; player.HealEffect(5); } diff --git a/Projectiles/Melee/Leech.cs b/Projectiles/Melee/Leech.cs index 805c041da9..325f29c3f6 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -47,6 +47,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + if (Main.player[projectile.owner].moonLeech) + return; Player player = Main.player[projectile.owner]; player.statLife += 5; player.HealEffect(5); diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index a9e3c93132..30895a8a21 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; Player player = Main.player[projectile.owner]; diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 1d16adb747..7b1063d648 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ignoreWater = true; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 4; projectile.Calamity().trueMelee = true; } public override float InitialSpeed => 5.5f; @@ -34,8 +34,8 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 1.1f; public override Action EffectBeforeReelback => (proj) => { - int damage = Nadir.BaseDamage / 5; - float kb = 5.5f; + int damage = projectile.damage / 4; + float kb = projectile.knockBack * 0.5f; Vector2 projPos = projectile.Center + projectile.velocity; Vector2 projVel = projectile.velocity * 0.75f; if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index c8d3d72553..aedeb96684 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -193,8 +193,8 @@ namespace CalamityMod.Projectiles.Melee private void SpawnTentacle(Vector2 tentacleVelocity) { - int damage = Nadir.BaseDamage; - float kb = 7f; + int damage = projectile.damage; + float kb = projectile.knockBack; // Randomize tentacle behavior variables float ai0 = Main.rand.NextFloat(0.01f, 0.08f); diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index c9972ca647..60e5346fbf 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; Player player = Main.player[projectile.owner]; if (Main.rand.NextBool(5)) diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index aae7dae614..aa189fdafe 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 3; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 5c0f7837e8..37724b66e1 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.myPlayer == projectile.owner) if (projectile.Hitbox.Intersects(player.Hitbox)) { - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(3) && !Main.player[projectile.owner].moonLeech) { player.statLife += 1; player.HealEffect(1); @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 360); target.AddBuff(ModContent.BuffType(), 360); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index a3066f1645..9792dfcd11 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -80,7 +80,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + target.AddBuff(ModContent.BuffType(), 360); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } @@ -90,7 +91,6 @@ namespace CalamityMod.Projectiles.Ranged player.statLife += 1; player.HealEffect(1); } - target.AddBuff(ModContent.BuffType(), 360); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/BloodfireBullet.cs b/Projectiles/Ranged/BloodfireBullet.cs index bd200a4560..e7c2b5542b 100644 --- a/Projectiles/Ranged/BloodfireBullet.cs +++ b/Projectiles/Ranged/BloodfireBullet.cs @@ -52,7 +52,8 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + target.AddBuff(ModContent.BuffType(), 360); + if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) { return; } @@ -62,7 +63,6 @@ namespace CalamityMod.Projectiles.Ranged player.statLife += 1; player.HealEffect(1); } - target.AddBuff(ModContent.BuffType(), 360); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index f5e40a58fb..a52885e739 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -27,120 +27,112 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } projectile.ai[0] += 1f; - int num39 = 0; + int incrementAmt = 0; float spreadMult = 0.15f; if (projectile.ai[0] >= 90f) { - num39++; + incrementAmt++; spreadMult = 0.13f; } if (projectile.ai[0] >= 180f) { - num39++; + incrementAmt++; spreadMult = 0.11f; } if (projectile.ai[0] >= 270f) { - num39++; + incrementAmt++; spreadMult = 0.09f; } if (projectile.ai[0] >= 360f) { - num39++; + incrementAmt++; spreadMult = 0.07f; } if (projectile.ai[0] >= 450f) { - num39++; spreadMult = 0.05f; } if (projectile.ai[0] >= 540f) { - num39++; + incrementAmt++; spreadMult = 0.04f; } if (projectile.ai[0] >= 630f) { - num39++; spreadMult = 0.03f; } if (projectile.ai[0] >= 720f) //8 { - num39++; + incrementAmt++; spreadMult = 0.02f; } - int num40 = 40; - int num41 = 3; + int shootDelayBase = 40; + int incrementMult = 3; projectile.ai[1] -= 1f; - bool flag15 = false; + bool willShoot = false; if (projectile.ai[1] <= 0f) { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; + projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt); + willShoot = true; } - bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; + bool canShoot = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; } - if (projectile.soundDelay <= 0 && flag16) + if (projectile.soundDelay <= 0 && canShoot) { - projectile.soundDelay = num40 - num41 * num39; + projectile.soundDelay = shootDelayBase - incrementMult * incrementAmt; if (projectile.ai[0] != 1f) { Main.PlaySound(SoundID.Item38, projectile.position); } projectile.localAI[0] = 12f; } - if (flag15 && Main.myPlayer == projectile.owner) + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + if (willShoot && Main.myPlayer == projectile.owner) { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - float weaponKnockback2 = player.ActiveItem().knockBack; - if (flag16) + int projType = ProjectileID.Bullet; + float speedMult = 14f; + int damage = player.GetWeaponDamage(player.ActiveItem()); + float kback = player.ActiveItem().knockBack; + if (canShoot) { - player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); - float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback, false); + kback = player.GetWeaponKnockback(player.ActiveItem(), kback); + float speed = player.ActiveItem().shootSpeed * projectile.scale; + Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source; if (player.gravDir == -1f) { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + targetPos.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - source.Y; } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + Vector2 velMult = Vector2.Normalize(targetPos); + if (float.IsNaN(velMult.X) || float.IsNaN(velMult.Y)) { - value19 = -Vector2.UnitY; + velMult = -Vector2.UnitY; } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + velMult *= speed; + if (velMult.X != projectile.velocity.X || velMult.Y != projectile.velocity.Y) { projectile.netUpdate = true; } - projectile.velocity = value19 * 0.55f; - int randomBulletCount = Main.rand.Next(3, 5); - for (int num43 = 0; num43 < randomBulletCount; num43++) + projectile.velocity = velMult * 0.55f; + int randomBulletCount = Main.rand.Next(3, 5); //3 to 4 bullets + for (int projIndex = 0; projIndex < randomBulletCount; projIndex++) { - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * spreadMult); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + Vector2 bulletVel = Vector2.Normalize(projectile.velocity) * speedMult * (0.6f + Main.rand.NextFloat() * spreadMult); + if (float.IsNaN(bulletVel.X) || float.IsNaN(bulletVel.Y)) { - vector20 = -Vector2.UnitY; + bulletVel = -Vector2.UnitY; } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -5f, 5f); - vector20.X += (float)Main.rand.Next(-15, 16) * spreadMult; - vector20.Y += (float)Main.rand.Next(-15, 16) * spreadMult; - int num44 = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); + source += Utils.RandomVector2(Main.rand, -5f, 5f); + bulletVel.X += (float)Main.rand.Next(-15, 16) * spreadMult; + bulletVel.Y += (float)Main.rand.Next(-15, 16) * spreadMult; + int num44 = Projectile.NewProjectile(source, bulletVel, projType, damage, kback, projectile.owner, 0f, 0f); Main.projectile[num44].noDropItem = true; - Main.projectile[num44].extraUpdates += num39 / 2; //0 to 4 + Main.projectile[num44].extraUpdates += incrementAmt / 2; //0 to 4 } } else @@ -149,7 +141,12 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; + float rotationAmt = 0f; + if (projectile.spriteDirection == -1) + { + rotationAmt = MathHelper.Pi; + } + projectile.rotation = projectile.velocity.ToRotation() + rotationAmt; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index f023af6d53..c6bbcce245 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -60,11 +60,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 360); - if (target.type == NPCID.TargetDummy) + Player player = Main.player[projectile.owner]; + if (target.type == NPCID.TargetDummy || player.moonLeech) { return; } - Player player = Main.player[projectile.owner]; player.statLife += 1; player.HealEffect(1); } diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index aeb75bfddd..e93fc94851 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.45), 0f, projectile.owner, 0f, 0f); } } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 118); diff --git a/Projectiles/Ranged/NeedlerProj.cs b/Projectiles/Ranged/NeedlerProj.cs index 6ad53995fa..d9d9fa4779 100644 --- a/Projectiles/Ranged/NeedlerProj.cs +++ b/Projectiles/Ranged/NeedlerProj.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -22,7 +23,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.extraUpdates = 2; projectile.aiStyle = 93; - aiType = 514; + aiType = ProjectileID.NailFriendly; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 1; } public override void AI() @@ -44,11 +47,6 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 1; - } - public override void Kill(int timeLeft) { projectile.position = projectile.Center; diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index d5d419f1e6..b91cefe529 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -58,39 +58,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) - { - float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); - float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); - float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 18f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 18f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index 9120c2ec8c..b6ba258d6d 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -20,7 +21,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ignoreWater = true; projectile.aiStyle = 1; - aiType = 242; + aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 90; } @@ -49,6 +50,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; projectile.Damage(); } } diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index fd7f0cefa0..ff994af960 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); } - if (target.type == NPCID.TargetDummy) + if (target.type == NPCID.TargetDummy || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index 7ee1c48c78..badefae78c 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue for (float i = 0; i < 5; i++) { float angle = MathHelper.TwoPi / 5f * i; - int star = Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + int star = Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.87), projectile.knockBack, projectile.owner, 0f, 0f); Main.projectile[star].Calamity().stealthStrike = projectile.Calamity().stealthStrike; } projectile.position = projectile.Center; diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 24d20904ab..802f3d0811 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue int stealth = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[stealth].Calamity().forceRogue = true; } - if (!target.canGhostHeal) //canGhostHeal be like lol + if (!target.canGhostHeal || player.moonLeech) //canGhostHeal be like lol { return; } diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index 638cd3ffbd..f78d5f5f79 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -93,8 +93,9 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < Main.maxPlayers; i++) { + Player owner = Main.player[projectile.owner]; Player player = Main.player[i]; - if ((Main.player[projectile.owner].team != player.team || player.team == 0) && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(projectile.Center, player.Center) <= radius) + if ((owner.team != player.team || player.team == 0) && player.hostile && owner.hostile && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(projectile.Center, player.Center) <= radius) { if (player.FindBuffIndex(buffType) == -1) player.AddBuff(buffType, 180, false); diff --git a/Projectiles/Rogue/LeonidStar.cs b/Projectiles/Rogue/LeonidStar.cs index a601774acf..bf86eb0194 100644 --- a/Projectiles/Rogue/LeonidStar.cs +++ b/Projectiles/Rogue/LeonidStar.cs @@ -40,8 +40,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0]++; if (projectile.ai[0] > 120f) { - projectile.alpha -= 15; - if (projectile.alpha <= 0) + projectile.scale *= 0.98f; + projectile.position = projectile.Center; + projectile.width = (int)(projectile.width * projectile.scale); + projectile.height = (int)(projectile.height * projectile.scale); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + if (projectile.scale <= 0.05f) projectile.Kill(); } projectile.rotation += projectile.direction * 0.05f; diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 069cf54644..3014bd7ff8 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -25,12 +25,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.timeLeft = 240; projectile.Calamity().rogue = true; + projectile.extraUpdates = 1; + projectile.alpha = 150; } public override void AI() { projectile.frameCounter++; - if (projectile.frameCounter > 4) + if (projectile.frameCounter > 8) { projectile.frame++; projectile.frameCounter = 0; @@ -47,13 +49,14 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 43); for (int j = 0; j <= 10; j++) { Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1f); } } + public override Color? GetAlpha(Color lightColor) => new Color(150, 150, 150, 150); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 104c5466d0..41a38ffd9a 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.0075), 0f, projectile.owner, 0f, 0f); - if (target.type == NPCID.TargetDummy || !projectile.Calamity().stealthStrike) + if (target.type == NPCID.TargetDummy || !projectile.Calamity().stealthStrike || Main.player[projectile.owner].moonLeech) { return; } diff --git a/Projectiles/Rogue/SealedSingularityGore.cs b/Projectiles/Rogue/SealedSingularityGore.cs index 1dad8cd775..5b1f906bc4 100644 --- a/Projectiles/Rogue/SealedSingularityGore.cs +++ b/Projectiles/Rogue/SealedSingularityGore.cs @@ -14,21 +14,20 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { projectile.friendly = true; - projectile.width = 25; - projectile.height = 25; + projectile.width = projectile.height = 25; projectile.Calamity().rogue = true; + projectile.timeLeft = 300; } public override void AI() { //Rotation and gravity projectile.rotation += 0.6f * projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.27f; + projectile.velocity.Y += 0.27f; if (projectile.velocity.Y > 16f) { projectile.velocity.Y = 16f; } - } public override void Kill(int timeLeft) @@ -48,10 +47,9 @@ namespace CalamityMod.Projectiles.Rogue Texture2D texture; switch (projectile.ai[0]) { - - case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore2"); + case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore2"); break; - case 3f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore3"); + case 2f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SealedSingularityGore3"); break; default: texture = Main.projectileTexture[projectile.type]; break; diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs index 1de61c3dd4..59bf1b0f2c 100644 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs @@ -58,52 +58,50 @@ namespace CalamityMod.Projectiles.Rogue Main.PlaySound(SoundID.Item7, projectile.position); } - // Returns after some number of frames in the air - if (projectile.timeLeft < lifeTime - 180) + // Returns after 2.5 seconds in the air + if (projectile.timeLeft < lifeTime - 150) projectile.ai[0] = 1f; if (projectile.ai[0] != 0f) { - float returnSpeed = 18f * 1.6f; + float returnSpeed = 30f; float acceleration = 1.4f; Player owner = Main.player[projectile.owner]; // Delete the projectile if it's excessively far away. - Vector2 playerCenter = owner.Center; - float xDist = playerCenter.X - projectile.Center.X; - float yDist = playerCenter.Y - projectile.Center.Y; - float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + Vector2 projVector = owner.Center - projectile.Center; + float dist = projVector.Length(); if (dist > 3000f) projectile.Kill(); dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; + projVector.X *= dist; + projVector.Y *= dist; // Home back in on the player. - if (projectile.velocity.X < xDist) + if (projectile.velocity.X < projVector.X) { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + if (projectile.velocity.X < 0f && projVector.X > 0f) projectile.velocity.X += acceleration; } - else if (projectile.velocity.X > xDist) + else if (projectile.velocity.X > projVector.X) { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + if (projectile.velocity.X > 0f && projVector.X < 0f) projectile.velocity.X -= acceleration; } - if (projectile.velocity.Y < yDist) + if (projectile.velocity.Y < projVector.Y) { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + if (projectile.velocity.Y < 0f && projVector.Y > 0f) projectile.velocity.Y += acceleration; } - else if (projectile.velocity.Y > yDist) + else if (projectile.velocity.Y > projVector.Y) { - projectile.velocity.Y = projectile.velocity.Y - acceleration; - if (projectile.velocity.Y > 0f && yDist < 0f) + projectile.velocity.Y -= acceleration; + if (projectile.velocity.Y > 0f && projVector.Y < 0f) projectile.velocity.Y -= acceleration; } @@ -120,6 +118,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + if (projectile.penetrate < 3) + projectile.ai[0] = 1f; target.AddBuff(ModContent.BuffType(), 180); Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int k = 0; k < 10; k++) @@ -132,6 +132,8 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { + if (projectile.penetrate < 3) + projectile.ai[0] = 1f; target.AddBuff(ModContent.BuffType(), 180); Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); for (int k = 0; k < 10; k++) diff --git a/Projectiles/Summon/ApparatusExplosion.cs b/Projectiles/Summon/ApparatusExplosion.cs index 1f5ffacb1d..58143b81b8 100644 --- a/Projectiles/Summon/ApparatusExplosion.cs +++ b/Projectiles/Summon/ApparatusExplosion.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 012c839454..67f2fb93cc 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -64,185 +64,8 @@ namespace CalamityMod.Projectiles.Summon } } projectile.rotation += projectile.velocity.X * 0.04f; - float num633 = 700f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - float SAIMovement = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X -= SAIMovement; - } - else - { - projectile.velocity.X += SAIMovement; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y -= SAIMovement; - } - else - { - projectile.velocity.Y += SAIMovement; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - projectile.tileCollide = true; - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 - } - } - else - { - projectile.tileCollide = false; - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; //8 - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, false); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 3478ec1a8c..85162b0476 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -216,11 +216,11 @@ namespace CalamityMod.Projectiles.Summon } if (flag25) { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; } if (projectile.ai[1] > 0f) { diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index d59bdd29a8..c8c761d021 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -64,185 +64,8 @@ namespace CalamityMod.Projectiles.Summon } } projectile.rotation += projectile.velocity.X * 0.04f; - float num633 = 700f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633 && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - projectile.tileCollide = true; - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 - } - } - else - { - projectile.tileCollide = false; - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; //8 - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, false); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 8ee9315bf7..85b12794b5 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -117,15 +117,17 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } + Vector2 value = new Vector2(0.5f); if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { + Vector2 vector2 = npc.position + npc.Size * value; float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - vector46 = npc.Center; + vector46 = vector2; flag25 = true; } } @@ -134,14 +136,15 @@ namespace CalamityMod.Projectiles.Summon { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + Vector2 vector2 = npc.position + npc.Size * value; + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = vector2; flag25 = true; } } diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index b8372875eb..a4f7b2adbc 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -116,11 +116,13 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } + Vector2 value = new Vector2(0.5f); if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { + Vector2 vector2 = npc.position + npc.Size * value; float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { @@ -133,14 +135,15 @@ namespace CalamityMod.Projectiles.Summon { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + Vector2 vector2 = npc.position + npc.Size * value; + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = vector2; flag25 = true; } } diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 86a4b27f9e..b7036d438e 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -61,10 +61,6 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - float num633 = 700f; - float num634 = 1100f; - float num635 = 2400f; - float num636 = 150f; bool flag64 = projectile.type == ModContent.ProjectileType(); if (flag64) { @@ -77,178 +73,10 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; - projectile.frameCounter++; - if (projectile.frameCounter > 1) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 2) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; projectile.frameCounter++; - if (projectile.frameCounter > 3) + if (projectile.frameCounter > (projectile.ai[0] == 2f ? 1 : 3)) { projectile.frame++; projectile.frameCounter = 0; @@ -257,30 +85,8 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 1100f, 2400f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 027ceff01d..872b7f681e 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -82,210 +82,26 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } - float num633 = 500f; //700 - float num634 = 800f; - float num635 = 1200f; - float num636 = 400f; //150 - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0.25f * num, 0.55f * num, 0.75f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 100f) //200 - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; //6 - if (flag26) - { - num650 = 15f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(500f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) //200 and 8 - { - num650 = 8f; //8 - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 7) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(projectile.Center, 0.25f * lightScalar, 0.55f * lightScalar, 0.75f * lightScalar); + + projectile.frameCounter++; + if (projectile.frameCounter > 16) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 7) + { + projectile.frame = 0; + } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 500f, 800f, 1200f, 400f, 0, 30f, 8f, -4f, 40f, 8f, false, true); } } } diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 54747653c6..c409c0ac5d 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -222,7 +222,7 @@ namespace CalamityMod.Projectiles.Summon } if (foundTarget) { - projectile.rotation = (targetVec - projectile.Center).ToRotation() + MathHelper.Pi; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f); } else { diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/ElementalAxeMinion.cs index 3899f354c9..43daf58f0f 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/ElementalAxeMinion.cs @@ -69,183 +69,8 @@ namespace CalamityMod.Projectiles.Summon } } projectile.rotation += 0.075f; - float num633 = 1600f; //range - float num634 = 1800f; - float num635 = 2500f; - float num636 = 400f; - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 24f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 12f; //4 - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; //41 - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 16f; //8 - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 1600f, 1800f, 2500f, 400f, 1, 30f, 24f, -12f, 30f, 16f, true, true); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index 04f6c10f2b..864318f7b2 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -124,9 +124,11 @@ namespace CalamityMod.Projectiles.Summon //If summoned by Amalgam, trail poisonous seawater if (Math.Abs(projectile.velocity.X) > 0.1f || Math.Abs(projectile.velocity.Y) > 0.1f) { - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer && amalgam) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 1f, 0f); + int water = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 1f, 0f); + Main.projectile[water].usesIDStaticNPCImmunity = true; + Main.projectile[water].usesLocalNPCImmunity = false; } } @@ -139,35 +141,45 @@ namespace CalamityMod.Projectiles.Summon returnToPlayer = true; //Find an npc to target, or if minion targetting is used, choose that npc - Vector2 center = projectile.Center; + Vector2 targetVec = projectile.Center; float range = 900f; bool npcFound = false; + Vector2 half = new Vector2(0.5f); if (!returnToPlayer) { - projectile.tileCollide = true; - NPC target = projectile.OwnerMinionAttackTargetNPC; - if (target != null && target.CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) { - float extraDistance = (target.width / 2) + (target.height / 2); - - if (Vector2.Distance(target.Center, projectile.Center) < (range + extraDistance) && Collision.CanHit(projectile.position, projectile.width, projectile.height, target.position, target.width, target.height)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - center = target.Center; - npcFound = true; + //Check the size of the target to make it easier to hit fat targets like Levi + Vector2 sizeCheck = npc.position + npc.Size * half; + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + //Some minions will ignore tiles when choosing a target like Ice Claspers, others will not + bool canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + if (!npcFound && targetDist < range && canHit) + { + range = targetDist; + targetVec = sizeCheck; + npcFound = true; + } } } - if (!npcFound) + //If no npc is specifically targetted, check through the entire array + else { - for (int index = 0; index < Main.maxNPCs; ++index) + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) { - NPC npc = Main.npc[index]; + NPC npc = Main.npc[npcIndex]; if (npc.CanBeChasedBy(projectile, false)) { - float extraDistance = (npc.width / 2) + (npc.height / 2); - - if (Vector2.Distance(npc.Center, projectile.Center) < (range + extraDistance) && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + Vector2 sizeCheck = npc.position + npc.Size * half; + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + bool canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height); + if (!npcFound && targetDist < range && canHit) { - center = npc.Center; + range = targetDist; + targetVec = sizeCheck; npcFound = true; } } @@ -185,35 +197,33 @@ namespace CalamityMod.Projectiles.Summon float turnSpeed = 20f; if (returnToPlayer) //move faster if returning to the player homingSpeed = amalgam ? 30f : 12f; - Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); - float xDist = player.Center.X - projPos.X; - float yDist = player.Center.Y - projPos.Y - 60f; - Vector2 playerVector = new Vector2(xDist, yDist); + Vector2 playerVector = player.Center - projectile.Center; + playerVector.Y -= 60f; float playerDist = playerVector.Length(); - if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - projectile.ai[0] = 0f; + if (playerDist < 100f && returnToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + returnToPlayer = false; if (playerDist > 2000f) { projectile.position.X = player.Center.X - projectile.width / 2; projectile.position.Y = player.Center.Y - projectile.width / 2; } - if (playerDist > 70f) - { - Vector2 homeInVector = projectile.DirectionTo(playerVector); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * turnSpeed + homeInVector * homingSpeed) / (turnSpeed + 1f); - } - else - { + //If more than 70 pixels away, move toward the player + if (playerDist > 70f) + { + playerVector.Normalize(); + playerVector *= homingSpeed; + projectile.velocity = (projectile.velocity * turnSpeed + playerVector) / (turnSpeed + 1f); + } + //Minions never stay still + else + { if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } projectile.velocity *= 1.01f; - } + } projectile.friendly = false; projectile.rotation = projectile.velocity.X * 0.05f; if (Math.Abs(projectile.velocity.X) <= 0f) @@ -233,19 +243,18 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; float minionSpeed = amalgam ? 20f : 8f; float turnSpeed = 14f; - Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y); - float xDist = center.X - projPos.X; - float yDist = center.Y - projPos.Y - 60f; - Vector2 targetVector = new Vector2(xDist, yDist); - float targetDist = targetVector.Length(); + Vector2 targetLocation = targetVec - projectile.Center; + float targetDist = targetLocation.Length(); if (targetDist < 100f) minionSpeed = amalgam ? 25f : 10f; - Vector2 homeInVector = projectile.DirectionTo(targetVector); + Vector2 homeInVector = projectile.DirectionTo(targetLocation); if (homeInVector.HasNaNs()) homeInVector = Vector2.UnitY; - projectile.velocity = (projectile.velocity * turnSpeed + homeInVector * minionSpeed) / (turnSpeed + 1f); + targetLocation.Normalize(); + targetLocation *= minionSpeed; + projectile.velocity = (projectile.velocity * turnSpeed + targetLocation) / (turnSpeed + 1f); } else { @@ -277,5 +286,7 @@ namespace CalamityMod.Projectiles.Summon } CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 6ce24ae4d3..cc014a1faa 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = projectile.direction; } @@ -78,10 +78,7 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - float num633 = 600f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; + bool flag64 = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -95,180 +92,8 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && - flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 7f; //8 - projectile.netUpdate = true; - } - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 7f, false, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index 1c063c2e31..b4c7fe8aa2 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon projectile.height = 54; projectile.netImportant = true; projectile.friendly = true; - projectile.minionSlots = 1f; + projectile.minionSlots = 0f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.timeLeft *= 5; diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index 3d20d0f0be..50d81e9ade 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -75,10 +75,6 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.05f, 0.15f, 0.2f); - float num633 = 700f; - float num634 = 1000f; - float num635 = 2200f; - float num636 = 150f; bool flag64 = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -92,182 +88,10 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && - flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() - 1.57f; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 9f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 1000f, 2200f, 150f, 0, 40f, 9f, -4f, 40f, 9f, true, true); + projectile.rotation = projectile.velocity.ToRotation() - 1.57f; - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 9f; //8 - projectile.netUpdate = true; - } - } - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index dbbf55d8b7..b40fc8ced3 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -84,10 +84,7 @@ namespace CalamityMod.Projectiles.Summon projectile.localAI[0] = 0f; } } - float num633 = 700f; - float num634 = 1000f; - float num635 = 2200f; - float num636 = 150f; + bool flag64 = projectile.type == ModContent.ProjectileType(); if (flag64) { @@ -96,182 +93,10 @@ namespace CalamityMod.Projectiles.Summon projectile.Kill(); } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && - flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.rotation = projectile.velocity.ToRotation() + 1.57f; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 9f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 1000f, 2200f, 150f, 0, 40f, 9f, -4f, 40f, 9f, true, true); + projectile.rotation = projectile.velocity.ToRotation() + 1.57f; - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 9f; //8 - projectile.netUpdate = true; - } - } - } } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 42c0e72143..47bdf7321f 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -187,8 +187,8 @@ namespace CalamityMod.Projectiles.Summon } if (num651 > 2000f) { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); projectile.netUpdate = true; } if (num651 > 70f) @@ -205,11 +205,11 @@ namespace CalamityMod.Projectiles.Summon } if (flag25) { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; } if (projectile.ai[1] > 0f) { diff --git a/Projectiles/Summon/PlantSummon.cs b/Projectiles/Summon/PlantSummon.cs index e54d51b734..55f9d2f5d0 100644 --- a/Projectiles/Summon/PlantSummon.cs +++ b/Projectiles/Summon/PlantSummon.cs @@ -152,16 +152,18 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] = 0f; Vector2 vector46 = projectile.position; bool flag25 = false; + Vector2 value = new Vector2(0.5f); if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { + Vector2 vector2 = npc.position + npc.Size * value; float num646 = Vector2.Distance(npc.Center, projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; - vector46 = npc.Center; + vector46 = vector2; flag25 = true; } } @@ -170,14 +172,15 @@ namespace CalamityMod.Projectiles.Summon { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + Vector2 vector2 = npc.position + npc.Size * value; + float num646 = Vector2.Distance(npc.Center, projectile.Center); if (!flag25 && num646 < num633) { num633 = num646; - vector46 = nPC2.Center; + vector46 = vector2; flag25 = true; } } @@ -255,11 +258,11 @@ namespace CalamityMod.Projectiles.Summon } if (flag25) { - projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f; + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; } if (projectile.ai[1] > 0f) { @@ -273,14 +276,14 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[0] == 0f) { float scaleFactor3 = 6f; - int num658 = (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()); + int projType = (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()); int projDmg = (int)(projectile.damage * 0.7f); float speedMult = 1f; if (Main.rand.NextBool(4)) { - num658 = ModContent.ProjectileType(); + projType = ModContent.ProjectileType(); } - if (num658 == ModContent.ProjectileType()) + if (projType == ModContent.ProjectileType()) { speedMult = 2f; projDmg = (int)(projectile.damage * 1.2f); @@ -294,7 +297,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X * speedMult, value19.Y * speedMult, num658, projDmg, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X * speedMult, value19.Y * speedMult, projType, projDmg, 0f, projectile.owner, 0f, 0f); projectile.netUpdate = true; } } @@ -326,16 +329,18 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; + Vector2 value = new Vector2(0.5f); if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy(projectile, false)) { + Vector2 vector2 = npc.position + npc.Size * value; float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = npc.Center; + vector46 = vector2; flag25 = true; } } @@ -344,14 +349,15 @@ namespace CalamityMod.Projectiles.Summon { for (int num645 = 0; num645 < Main.maxNPCs; num645++) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[num645]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + Vector2 vector2 = npc.position + npc.Size * value; + float num646 = Vector2.Distance(npc.Center, projectile.Center); if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = nPC2.Center; + vector46 = vector2; flag25 = true; } } diff --git a/Projectiles/Summon/SonOfYharon.cs b/Projectiles/Summon/SonOfYharon.cs index 361eac8190..ed48037b59 100644 --- a/Projectiles/Summon/SonOfYharon.cs +++ b/Projectiles/Summon/SonOfYharon.cs @@ -60,20 +60,16 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } - float num633 = 1000f; - float num634 = 2000f; - float num635 = 3000f; - float num636 = 500f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 1.2f * num, 0.8f * num, 0f * num); - bool flag64 = projectile.type == ModContent.ProjectileType(); + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(projectile.Center, 1.2f * lightScalar, 0.8f * lightScalar, 0f * lightScalar); + bool correctMinion = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (correctMinion) { if (player.dead) { @@ -84,35 +80,8 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; if (projectile.ai[0] == 2f) { - projectile.ai[1] += 1f; - projectile.extraUpdates = 2; projectile.frameCounter++; if (projectile.frameCounter > 3) { @@ -123,160 +92,22 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - if (projectile.ai[1] > 30f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 1; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25 && num646 < num633) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 1000f, 2000f, 3000f, 500f, 1, 30f, 8f, -4f, 40f, 8f, true, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 746ecdfc04..83cd9fc2d0 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.valkyrie) @@ -45,7 +44,8 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } - if (flag64) + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (correctMinion) { if (player.dead) { @@ -76,175 +76,21 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + + //Adjust sprite direction so it faces correctly + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } - float num633 = 700f; - float num634 = 800f; - float num635 = 1200f; - float num636 = 150f; - float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; - Lighting.AddLight(projectile.Center, 0f * num, 0.2f * num, 0.45f * num); - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } - bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) - { - num633 = num646; - vector46 = npc.Center; - flag25 = true; - } - } - } - else - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if ((!flag25 && num646 < num633) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } - } - float num647 = num634; - if (flag25) - { - num647 = num635; - } - if (Vector2.Distance(player.Center, projectile.Center) > num647) - { - projectile.ai[0] = 1f; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - if (flag25 && projectile.ai[0] == 0f) - { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - } - else - { - bool flag26 = false; - if (!flag26) - { - flag26 = projectile.ai[0] == 1f; - } - float num650 = 6f; - if (flag26) - { - num650 = 15f; - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 8f) - { - num650 = 8f; - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } + + CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, true); + + //Give off some light + float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; + lightScalar *= Main.essScale; + Lighting.AddLight(projectile.Center, 0f * lightScalar, 0.2f * lightScalar, 0.45f * lightScalar); + + //Frames projectile.frameCounter++; if (projectile.frameCounter > 7) { @@ -255,30 +101,6 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 value20 = vector46 - projectile.Center; - value20.Normalize(); - projectile.velocity = value20 * 8f; - projectile.netUpdate = true; - } - } - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 029e62f3b8..c855387dae 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ai[0] = 10 + Main.rand.Next(10); float maxDistance = hentai ? 900f : 600f; int target = -1; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; if (npc.CanBeChasedBy(projectile)) @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && target.type != NPCID.TargetDummy) + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && target.type != NPCID.TargetDummy && !Main.player[projectile.owner].moonLeech) { int healAmount = 10 * damage / projectile.damage; //should always be around max, less if enemy has defense/DR if (healAmount > 0) @@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitPvp(Player target, int damage, bool crit) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f) + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && !Main.player[projectile.owner].moonLeech) { int healAmount = 10 * damage / projectile.damage; //should always be around max, less if enemy has defense/DR if (healAmount > 0) diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 619dcb6611..4951f8fa4a 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.timeLeft = 6; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Sounds/Custom/MicrowaveBeep.cs b/Sounds/Custom/MicrowaveBeep.cs new file mode 100644 index 0000000000..4e13043f45 --- /dev/null +++ b/Sounds/Custom/MicrowaveBeep.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class MicrowaveBeep : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/MicrowaveBeep.ogg b/Sounds/Custom/MicrowaveBeep.ogg new file mode 100644 index 0000000000..30e6018102 Binary files /dev/null and b/Sounds/Custom/MicrowaveBeep.ogg differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 65b1349c2e..d8285b60a6 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -220,7 +220,8 @@ namespace CalamityMod ItemID.SonarPotion, ItemID.GenderChangePotion, ItemID.LovePotion, - ItemID.StinkPotion + ItemID.StinkPotion, + ItemID.RecallPotion }; ModRecipe r; diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 5b7748ec10..0241a79a34 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1919,7 +1919,7 @@ namespace CalamityMod.World } } - if (!downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient) + if (!downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient && !Main.hardMode) CalamityUtils.StopSandstorm(); if (Main.netMode != NetmodeID.MultiplayerClient)